Let’s Encryptの自動更新の設定

Date 2017-2-1 13:13:57 | Topic: Let's Encryptを試す

Let's Encryptの有効期限は90日しかないので、自動更新を設定します。
初めにテスト
# ./certbot-auto renew --dry-run
すると
/root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6
is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support
for Python 2.6
  DeprecationWarning
Saving debug log to /var/log/letsencrypt/letsencrypt.log
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.kinryokai.net.conf
-------------------------------------------------------------------------------
Cert not due for renewal, but simulating renewal for dry run
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for www.kinryokai.net
Waiting for verification...
Cleaning up challenges
Generating key (2048 bits): /etc/letsencrypt/keys/0001_key-certbot.pem
Creating CSR: /etc/letsencrypt/csr/0001_csr-certbot.pem
** DRY RUN: simulating 'certbot renew' close to cert expiry **
         (The test certificates below have not been saved.)
Congratulations, all renewals succeeded. The following certs have been renewed:
 /etc/letsencrypt/live/www.kinryokai.net/fullchain.pem (success)
** DRY RUN: simulating 'certbot renew' close to cert expiry **
         (The test certificates above have not been saved.)
後略

と成功したので、更新するコマンドを1日2回(失敗することがあるので2回の実行が推奨されているそうな)実行するようcrotabで設定します
# crontab -u root -e
空白の設定ファイルが開くので(以前に何か設定していたら、それが表示されるので最後に追記する) a を押し挿入モードにしてから
MAILTO=""
15 6 * * * /root/certbot-auto renew --quiet
15 7 * * * /root/certbot-auto renew --quiet

として保存しておく(esc : w q) 尚、このファイルは /var/spool/cron/root に保存される。6時15分と7時15分に設定したのは午前4時に全サブホストのバックアップが始まるから少しずらした。


This article comes from 錦稜会 KINRYOKAI
https://www.kinryokai.net

The URL for this story is:
https://www.kinryokai.net/article.php?storyid=322