-->

SSL証明書自動更新の失敗時の対応

SSL証明書自動更新の失敗時の対応

Let's EncryptのSSL証明書自動更新の失敗時の対応。webroot_pathの修正。

関連ページ 参考URL
Let's EncryptのSSL証明書は3ヵ月で有効期限が切れるものの、最近のLet's Encryptは初期設定で自動更新が有効になっています。
しかしなぜか更新が失敗してしまっていました。よく見てみると自動更新の設定が間違っていました。

webroot_pathの修正

Let's Encryptは自動更新機能があるので完全に安心していましたが、英語勉強サイトの方で下のような警告メールが送られてきました。
Hello,

Your certificate (or certificates) for the names listed below will expire in 19 days (on 2023-12-08). 
Please make sure to renew your certificate before then, or visitors to your web site will encounter errors.

We recommend renewing certificates automatically when they have a third of their total lifetime left. 
For Let's Encrypt's current 90-day certificates, that means renewing 30 days before expiration. 
See https://letsencrypt.org/docs/integration-guide/ for details.

english-everyday.top

そんな馬鹿なと思い、サーバにアクセスして下の手動更新コマンドを打ち込んでみました。
sudo certbot renew
結果は下の通り。
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/
[confファイル名]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator webroot, Installer None
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for english-everyday.top
Using the webroot path 
[tomcatのディレクトリ]
/webapps/ROOT for all unmatched domains.
Waiting for verification...
Challenge failed for domain english-everyday.top
http-01 challenge for english-everyday.top
Cleaning up challenges
Attempting to renew cert (english-everyday.top) from /etc/letsencrypt/renewal/
[confファイル名]

produced an unexpected error: Some challenges have failed.. Skipping.
SSL更新時のエラー表示

確かにエラーっぽい赤い文字が表示されています。
英語なんでパッと内容が入ってこないですが、よく見ると
Using the webroot path 
[tomcatのディレクトリ]
/webapps/ROOT for all unmatched domains.
とはっきりエラー理由が書いてありました。

指定通り、
 /etc/letsencrypt/renewal/ 
の下にあるenglish-everyday.topのconfファイルにアクセスしてみました。
webroot_path = 
[tomcatのディレクトリ]
/webapps/ROOT,
たしかにpathの最後がROOTになっていて間違っていました。
昔は英語勉強サイトしか運営してなかったのと、リバースプロキシによるサイトURLの短縮方法を知らなかったので、ROOTディレクトリにファイルを突っ込んでいました。 今はROOTディレクトリは使っていないのでここを修正。

再び手動更新コマンドを打ち込んでみました。結果は下の通り。
Congratulations, all renewals succeeded. The following certs have been renewed:

これで一安心。
ただここからもちろん、keystoreを再更新する必要があります。
0
0