SSL証明書の更新がされない

過去に書いた記事
SSL証明書が期限切れ…
SSL証明書の更新
その後、様子を見ていた続きです。

cronに自動更新スクリプトを設定していたのだが、うまく動いていなかったようで、期限の20日前と10日前にそれぞれ「有効期限が切れるので更新してね」の内容のメールが届いていました。

ログを確認しようとしたのですが、ログにも吐き出されていなかったため追跡調査ができませんでした。

とりあえず、手動で更新しました。

# certbot certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Apache Web Server plugin (apache)
2: Spin up a temporary webserver (standalone)
3: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-3] then [enter] (press 'c' to cancel): 3
Plugins selected: Authenticator webroot, Installer None
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
Please enter in your domain name(s) (comma and/or space separated) (Enter 'c'
to cancel): www.maruweb.jp.net
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for www.maruweb.jp.net
Input the webroot for www.maruweb.jp.net: (Enter 'c' to cancel): /var/www/html/
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/www.maruweb.jp.net/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/www.maruweb.jp.net/privkey.pem
Your cert will expire on 2019-10-04. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- 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

1行目:対話形式で実行
10行目:「3」を選択
19行目:ドキュメントルートの「/var/www/html/」を入力
24行目:「Congratulations!」更新がうまくできたようです
28行目:次回の有効期限の表示

# systemctl reload httpd.service

SSL有効期限チェッカーで確認
更新されていました。

次にcronの設定です。
が、その前にcronに設定するためのコマンドでもう一度、更新してみます。

# certbot-auto renew --force-renewal && systemctl reload httpd
Saving debug log to /var/log/letsencrypt/letsencrypt.log


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/www.maruweb.jp.net.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new certificate deployed without reload, fullchain is
/etc/letsencrypt/live/www.maruweb.jp.net/fullchain.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Congratulations, all renewals succeeded. The following certs have been renewed:
  /etc/letsencrypt/live/www.maruweb.jp.net/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# vi /etc/cron.d/letsencrypt
5 0 1 * * root /usr/bin/certbot-auto renew --force-renewal && /usr/bin/systemctl reload httpd.service

毎月1日0時5分に更新が強制的に実行されるように、「–force-renewal」オプションを付けます。
更新後、httpdの設定をリロード

# ll /etc/letsencrypt/live/
drwxr-xr-x 2 root root 4096  7月  6 21:39 www.maruweb.jp.net

更新日時が、変わっています。

最後に、前回設定したcronの自動更新スクリプトは、「chmod -x」で実行しないように設定変更しました。

いいね! & シェア お願いします。

コメントは受け付けていません。