今回参考にさせていただいたのは、
Webセキュリティの小部屋さんです。ありがとうございます。
一部新しいものや当サイトの環境等に合わせ編集してあります。
letsencrypt は certbot にリニューアルされているようなので、certbot のインストールと設定
サイト名は hogehoge.com と www.hogehoge.com でアクセスでき、ルートは /var/www/html にあるものとします。
# cd /usr/local/src # git clone https://github.com/certbot/certbot # cd certbot # ./certbot-auto --help # ./certbot-auto certonly --webroot -w /var/www/html/ -d hogehoge.com -d www.hogehoge.com # vi /etc/httpd/conf/SSL設定ファイル名
SSL の項目を以下のように書き換える(バーチャルホストを用いている場合はバーチャルホストの設定ファイル)
SSLCertificateFile /etc/letsencrypt/live/hogehoge.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/hogehoge.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/hogehoge.com/chain.pem
バーチャルホストを使用してる場合は、大元の ssl.conf ファイルに、使用していない場合は、上記ファイルに、
SSLProtocol all -SSLv2 -SSLv3SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES:!RC4:!DH SSLHonorCipherOrder On
を書き加える。
さらに ssl.conf の最後に
Header set Strict-Transport-Security "max-age=315360000;"
を書き加える。(バーチャルホストを使用している場合は、バーチャルホストの設定ファイルに入れない)
# cd /usr/local/bin # mv /usr/local/src/certbot ./ # touch /etc/cron.daily/certbot_renew # chmod 755 /etc/cron.daily/certbot_renew # mkdir /var/log/certbot # vi /etc/cron.daily/certbot_renew
更新ファイル用の /etc/cron.daily/certbot_renew ファイルの中身
#!/bin/bash PATH=/usr/bin:/bin:/usr/sbin if ! /usr/local/bin/certbot/certbot-auto renew --non-interactive > /var/log/certbot/renew.log 2>&1 ; then exit 1 else /etc/rc.d/init.d/httpd reload exit 0 fi