事象
Let’s Encryptの証明書更新失敗は過去に記事も書いたが、それとは別の原因。
crontab でLet’s Encryptの証明書更新をしかけてるサーバがある。
しかし更新に失敗している。
原因
Basic認証をかけてるせい。
以下、ログ抜粋。
Detail: あいぴーあどれす: Invalid response from https://どめいん/.well-known/acme-challenge/乱数: 401
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.
.well-known/acme-challenge/ 配下に一時的にファイルを作るっぽいけど、Basic認証かけてるせいで、httpステータス401でアクセスできねーぞと。
対処
一時対処
Basic認証一時的に解除しちゃって、
Let’s Encryptの証明書更新コマンドを実施する。
/usr/bin/certbot renew --post-hook "systemctl restart httpd.service"
恒久対処
.htaccess を設置する
ディレクトリ作っておく。
mkdir -p .well-known/acme-challenge
↓
以下実施。
手っ取り早く .well-known/acme-challenge/.htaccess でBasic認証解除の
設定を書いておきましょう。
Satisfy any
order allow,deny
allow from all
401 Authorization Required
しかしながらチームで運用している場合、↑共有が必要。メンドーなので↓
apacheのconfで設定する
<Directory /.well-known/acme-challenge/>
ディレクティブの中に上記と同じようなこと書けばいけるかと思って試してみたが、できんかった。
もうすぐ潰れるサーバなので深追いしないが、延命が決まったらこれでやろうと思う。
コメント