2018年7月1日

Let’sEncryptの自動更新が出来なかった時の対処法

Let’s Encrypt をインストールして3ヶ月弱。自動更新の設定も対応済みなので何も気にせず運用していると、ある日こんな件名のメールが。

Let's Encrypt certificate expiration notice for domain "example.com" (and 1 more)

※「example.com」は Let’s Encrypt を設定したドメイン

自動更新設定が動作していない

英語のメールですが、要するに「証明書の期限が近付いてるから更新しなよ」という内容。自動更新設定していたはずなのに?と思い、cronの実行結果を確認してみるとこんな内容。

# /インストール先/letsencrypt/letsencrypt-auto renew --force-renew && /etc/init.d/httpd restart
Saving debug log to /var/log/letsencrypt/letsencrypt.log

-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/example.com.conf
-------------------------------------------------------------------------------
Cert is due for renewal, auto-renewing...
Plugins selected: Authenticator standalone, Installer None
Renewing an existing certificate
Performing the following challenges:
tls-sni-01 challenge for example.com
Cleaning up challenges
Attempting to renew cert (example.com) from /etc/letsencrypt/renewal/example.com.conf produced an unexpected error: Problem binding to port 443: Could not bind to IPv4 or IPv6.. Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/example.com/fullchain.pem (failure)

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

All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/example.com/fullchain.pem (failure)
-------------------------------------------------------------------------------

Apacheが起動していたことが原因

443ポートを使用しているサーバーを停止する必要がある様子。性質的にそりゃそうか、という事で、「Apache停止→Let’s Encrypt更新→Apache起動」という手順に変更。

/etc/init.d/httpd stop && /インストール先/letsencrypt/letsencrypt-auto renew --force-renew && /etc/init.d/httpd start

これにて無事に更新されました。
以上、LetsEncryptの自動更新が出来なかった時の対処法でした。

, ,

コメントを残す

メールアドレスが公開されることはありません。