SSL証明書 Let’s Encryptを使用する。

セキュリティ

一般的には、認証局(ジオトラストやグローバルサインなど)が発行する有料の証明書を購入してサーバーにインストールします。
無料のSSL証明書発行サービスであるLet’s Encryptの正式サービスが2016年4月に開始され無料でSSL証明書を手に入れることができるようになりました。

テストサイトなどでは、Let’s Encryptを使用してWebサイトをSSL化します。

 

Let’s Encrypt(レッツ・エンクリプト)は、2016年4月に正式に開始された認証局

SSL証明書の有効期限は3ヶ月

 

◆ApacheのSSLモジュールmod_sslの確認
#httpd -M
proxy_wstunnel_module (shared)
ssl_module (shared)
systemd_module (shared)

◆Let’s Encryptのインストール
# yum install certbot python2-certbot-apache
◆証明書をインストール
# certbot --apache -d ***.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): (EMAILアドレスを入力。Let's Encryptからのお知らせを受け取るアドレス。)

Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org

-------------------------------------------------------------------------------
Please read the Terms of Service at

404 Page not found - Let's Encrypt
Let's Encrypt is a free, automated, and open certificate authority brought to you by the nonprofit Internet Security Res...
You must agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
------------------------------------------------------------------------------- (A)gree/(C)ancel:A (規約に同意) ------------------------------------------------------------------------------- Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about EFF and our work to encrypt the web, protect its users and defend digital rights. ------------------------------------------------------------------------------- (Y)es/(N)o: Y (Let's EncryptパートナーにEmailを公開します。公開しない場合はN。) Starting new HTTPS connection (1): supporters.eff.org Obtaining a new certificate Performing the following challenges: tls-sni-01 challenge for xxxxxxx.com We were unable to find a vhost with a ServerName or Address of example.com. Which virtual host would you like to choose? (note: conf files with multiple vhosts are not yet supported) ------------------------------------------------------------------------------- 1: ssl.conf | | HTTPS | Enabled ------------------------------------------------------------------------------- Press 1 [enter] to confirm the selection (press 'c' to cancel):1 (ssl.confを選択) Deploying Certificate for example.com to VirtualHost /etc/httpd/conf.d/ssl.conf Please choose whether HTTPS access is required or optional. ------------------------------------------------------------------------------- 1: Easy - Allow both HTTP and HTTPS access to these sites 2: Secure - Make all requests redirect to secure HTTPS access ------------------------------------------------------------------------------- Select the appropriate number [1-2] then [enter] (press 'c' to cancel):2 (httpアクセスをhttpsにリダイレクト) Created redirect file: le-redirect-example.com.conf Rollback checkpoint is empty (no changes made?) ------------------------------------------------------------------------------- Congratulations! You have successfully enabled https://example.com You should test your configuration at:
SSL Server Test (Powered by Qualys SSL Labs)
A comprehensive free SSL test for your public web servers.
------------------------------------------------------------------------------- IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-09-18. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le

3か月に一回更新が必要なので更新作業&自動更新設定をします。

 

◆証明書の有効期限を確認
#certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
Certificate Name: ***.example.com
Serial Number: 4e73490ef94defe030c0d023be2d0ba1aa6
Domains: ***.example.com
Expiry Date: 2020-09-14 07:46:43+00:00 (VALID: 89 days)
Certificate Path: /etc/letsencrypt/live/***.example.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/***.example.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

◆証明書の更新(テスト)
#certbot renew --dry-run
◆証明書の更新
#certbot renew
◆証明書の更新(有効期限が30日未満)
#certbot renew
◆証明書の更新(有効期限に関係なく実行)
#certbot renew --force-renew
◆証明書の自動更新(cronで毎月1日AM3時に自動更新)
#0 3 1 * * /usr/bin/certbot renew
※–force-renewalオプションはLet's Encryptの使用量制限にかかる可能性があるのでつけない

 

 

 

 

 

タイトルとURLをコピーしました