Let's Encryptの自動更新で失敗したときの対応方法


Let's Encryptの自動更新で失敗したときの対応方法

更新期限ぎりぎりで更新したからなのか、パッケージを色々とアップデートしてしまったからなのか
Let's EncryptでSSL証明書の更新を行おうとしたらエラーがでたのでその対応方法のメモです。

エラー内容

certbot renew で更新かけた際に下記のエラーが出ました。

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/【ドメイン名】.cnf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cert is due for renewal, auto-renewing...
Could not choose appropriate plugin: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',)
Attempting to renew cert (【ドメイン名】) from /etc/letsencrypt/renewal/【ドメイン名】.cnf produced an unexpected error: The manual plugin is not working; there may be problems with your existing configuration.
The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping.
All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/【ドメイン名】/fullchain.pem (failure)

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

All renewal attempts failed. The following certs could not be renewed:
  /etc/letsencrypt/live/【ドメイン名】/fullchain.pem (failure)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1 renew failure(s), 0 parse failure(s)

対応方法

仕方ないので、ググった結果、証明書の初回作成時と同様に certbot certonly を実行するしかないみたいでした。

certbot certonly --manual -d 【ドメイン名】

ググると 証明書の更新は cron で仕掛けて自動化とかの記事を読み見ますが
個人的に cron って運用に向いてないので、ansible のプレイリスト作って、
AWXとかで自動化したいなと思ってます。