0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

キャッシュが原因で Let's encrypt の証明書自動取得に失敗してしまう

Posted at

Let's encrypt の証明書を自動取得するために、certbot を使っています。
ところが、
certbot renew --agree-tos --webroot -w /srv/http
などとしても

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/<certfile>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Certificate not due for renewal, but simulating renewal for dry run
Plugins selected: Authenticator webroot, Installer None
Simulating renewal of an existing certificate for <certfile>
Performing the following challenges:
http-01 challenge for <domain>
Using the webroot path /srv/http for all unmatched domains.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Challenges loaded. Press continue to submit to CA. Pass "-v" for more info about
challenges.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Waiting for verification...
Challenge failed for domain <domain>
http-01 challenge for <domain>

Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
  Domain: <domain>
  Type:   unauthorized
  Detail: During secondary validation: The key authorization file from the server did not match this challenge "RdXMpaPW3jLwb0EAb46oGCQliihEMX1ybNP6PxNQWbU.u1DtLliaSTpmmHj9n-vEt4zNg8VW8ZyvHMw1lC0Cb40" != ""

Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet.

Cleaning up challenges
Failed to renew certificate <domain> with error: Some challenges have failed.

のようなエラーになってしまい、うまく更新できません。
チャレンジトークンをきちんとファイルに書いているにもかかわらず、認証サーバ側には空白に読めてしまっているようです。
ところが、--debug-challeng オプションを付加して「ゆっくり」実行するとうまく行きます。証明書の自動取得は不可でも、温もりの手動取得ならOKというわけです。

結論から言うと、キャッシュが原因でした。
Webサーバ側でファイルの内容変更に追従できずにキャッシュを返してしまっていて、それが空白の応答が帰る原因になってしまっているようです。
キャッシュを切ることで解決しました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?