Certbot SSL 更新に問題があります。/etc/nginx/sites-available/ の下に複数のサイトがあります。
.well-known ディレクトリには次のロケーションブロックがあります。
location ~ /\\.well-known {
auth_basic off;
root /etc/letsencrypt;
allow all;
}
および /etc/letsencrypt/renewal ディレクトリの下に各サイトの更新設定があります。
これはそのうちの 1 つの例です。
#renew_before_expiry = 30 days
version = 2.7.4
archive_dir = /etc/letsencrypt/archive/redacted.com
cert = /etc/letsencrypt/live/redacted.com/cert.pem
privkey = /etc/letsencrypt/live/redacted.com/privkey.pem
chain = /etc/letsencrypt/live/redacted.com/chain.pem
fullchain = /etc/letsencrypt/live/redacted.com/fullchain.pem
#Options used in the renewal process
[renewalparams]
allow_subset_of_names = True
account = 670273d7a9a89f2d3494cf6e38739b1c
rsa_key_size = 4096
post_hook = /bin/systemctl reload nginx
authenticator = webroot
webroot_path = /etc/letsencrypt,
server = https://acme-v02.api.letsencrypt.org/directory
key_type = rsa
[[webroot_map]]
redacted.com = /etc/letsencrypt
Certbot のバージョンは 2.7.4 で、1.32.0 からアップグレードしましたが、機能しませんでした。
問題は ip6tables に関連していることはわかっていますが、ポート 443 と 80 の ACCEPT ルールはすでに設定されています。
certbot renew --dry-run の実行中に acme-challenge ファイルにアクセスしようとすると、ファイルに正常にアクセスできます。したがって、ポート 80 と 443 は問題ないはずです。
ip6tables の INPUT フィルターを DROP から ACCEPT に変更すると、すべてのサイトが更新できますが、INPUT DROP フィルターを使用すると、ほとんどのサイトがこのエラーで更新に失敗します。
> Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems:
> Domain: redacted.com
> Type: connection
> Detail: xxx.xxx.xxx.xxx: Fetching https://redacted.com/.well-known/acme-challenge/EIJFF3UFqtZJCZtG_Kv9Ca7BGA5LiuBdb9JIWxXIhVg: Timeout during connect (likely firewall problem)
最小限のルールセットで試しましたが、INPUT チェーンの一番上にポート 80 と 443 の ACCEPT ルールを追加しようとしましたが、うまくいきませんでした。そのため、ここで立ち往生しています。
Nginx の設定例を以下に示します。
server {
listen [::]:80;
server_name .redacted.com;
return 301 https://redacted.com$request_uri;
}
server {
listen [::]:443 ssl http2;
server_name redacted.com;
access_log /var/www/log/access/redacted.access.log main buffer=32k;
error_log /var/www/log/error/redacted.com.error.log notice;
limit_conn gulag 200;
root /var/www/web/redacted.com/web;
index index.php;
ssl_certificate /etc/letsencrypt/live/redacted.com/fullchain.pem;
ssl_trusted_certificate /etc/letsencrypt/live/redacted.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/redacted.com/privkey.pem;
include ssl_params;
## Standard site protection
include snippets/standard.conf;
location ~ /\\.well-known {
auth_basic off;
root /etc/letsencrypt;
allow all;
}
## Deny illegal Host headers
if ($host !~* ^(redacted.com|redacted.com)$ ) {
return 444;
break;
}
## Drupal configuration
include snippets/drupal7-php7.4.conf;
## php handling
include snippets/php7.4.conf;
}
ちなみに、Certbot の更新中に Nginx のログで acme ファイルの HTTP 200 コードを確認できます。