Let's Encryptの"certbot renew"で「Connection refused. Skipping.」が出たときの対処法
4064 ワード
環境
- Conoha VPS(1GB)
- CentOS 7.6
- Certbot 0.31.0-2.el7 (yumで入れた記憶...)
- Apache 2.4.6
事象
certbot renewコマンドを実行すると、証明書の更新に失敗する。
Console
$ sudo certbot renew
...(略)...
Attempting to renew cert ([ドメイン名]) from /etc/letsencrypt/renewal/[ドメイン名].conf produced an unexpected error: Failed authorization procedure. [ドメイン名] (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://[ドメイン名]/.well-known/acme-challenge/[乱数]: Connection refused. Skipping.
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)
原因
- Apacheで「mod_writeを使い、HTTPで来たすべての接続をHTTPSへリダイレクトする」設定をしていた。
- Let's Encryptのドメイン所有者確認は「http://[ドメイン名]/.well-known/acme-challenge/*」が対象となっているが、全て「https」へリダイレクトされてしまった。
- よってLet's Encrypt的にはドメイン所有者確認ができず、更新に失敗した。
対応
「/.well-known/acme-challenge/*」へのアクセスはHTTPSへリダレクトしない設定とした。
httpd.conf(対応前)
...(略)...
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName [ドメイン名]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>
</VirtualHost>
...(略)...
追加設定
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/*
httpd.conf(対応後)
...(略)...
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName [ドメイン名]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/*
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</IfModule>
</VirtualHost>
...(略)...
Author And Source
この問題について(Let's Encryptの"certbot renew"で「Connection refused. Skipping.」が出たときの対処法), 我々は、より多くの情報をここで見つけました https://qiita.com/ackyv7/items/a1c498a849791bb9a23d著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .