・Let’s Encrypt(certbot)の証明書更新がエラー「The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot」になるときの対処方法を知りたい。
・具体的な手順を教えてほしい。
こういった疑問に答えます。
本記事の内容
- Let’s Encrypt(certbot)の証明書更新がエラー「The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot」になるときの対処方法
この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
こういった私が、解説していきます。
私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。
Let’s Encrypt(certbot)の証明書更新がエラー「The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot」になるときの対処方法
発生事象
cronで定期的に証明書更新を実施していたのですが、ある日から突然、エラーが起きるようになりました。
エラーメッセージ
certbot renew --dry-run
[root@SV-ALTAIR ~]# certbot renew --dry-run Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/test01.sv-altair.●●●●●●●●●●●.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Simulating renewal of an existing certificate for test01.sv-altair.●●●●●●●●●●● and www.test01.sv-altair.●●●●●●●●●●● Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems: Domain: test01.sv-altair.●●●●●●●●●●● Type: connection Detail: XXX.XXX.XXX.XXX: Fetching http://test01.sv-altair.●●●●●●●●●●●/.well-known/acme-challenge/ZZZZZZZZZZZZZZZZZZZZZZZZZ: Error getting validation data Domain: www.test01.sv-altair.●●●●●●●●●●● Type: connection Detail: XXX.XXX.XXX.XXX: Fetching http://www.test01.sv-altair.●●●●●●●●●●●/.well-known/acme-challenge/ZZZZZZZZZZZZZZZZZZZZZZZZZ: Error getting validation data Hint: The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot. Ensure that the listed domains point to this Apache server and that it is accessible from the internet. Failed to renew certificate test01.sv-altair.●●●●●●●●●●● with error: Some challenges have failed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - All simulated renewals failed. The following certificates could not be renewed: /etc/letsencrypt/live/test01.sv-altair.●●●●●●●●●●●/fullchain.pem (failure) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 renew failure(s), 0 parse failure(s) Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
証明書更新のときに、
「/.well-known/acme-challenge/ZZZZZZZZZZZZZZZZZZZZZZZZZ」に
一時ファイルを作ろうとするがアクセスできずにエラーになっているようです。
The Certificate Authority failed to verify the temporary Apache configuration changes made by Certbot. Ensure that the listed domains point to this Apache server and that it is accessible from the internet.
原因の推測
該当のWEBサーバーは、ファイアウォールで日本国内からのアクセスしか許可しておらず、
これが原因かと推測し、一時的に、ファイアウォールでpublicゾーンにhttpサービスの許可を追加して、
エラーが解消するかを確認します。
[root@SV-ALTAIR ~]# firewall-cmd --zone=public --add-service=http success
[root@SV-ALTAIR ~]# certbot renew --dry-run Saving debug log to /var/log/letsencrypt/letsencrypt.log - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Processing /etc/letsencrypt/renewal/test01.sv-altair.●●●●●●●●●●●.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Simulating renewal of an existing certificate for test01.sv-altair.●●●●●●●●●●● and www.test01.sv-altair.●●●●●●●●●●● - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The following simulated renewals succeeded: /etc/letsencrypt/live/test01.sv-altair.●●●●●●●●●●●/fullchain.pem (success) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ファイアウォールで許可を追加したら「success」になりました!
根本対応
常時、publicゾーンでhttpサービスを許可したくはないので、
ファイアウォールにcertbot用のゾーンを用意しています。
そこに、certbotの接続元IPアドレスを追加します。
[root@SV-ALTAIR ~]# firewall-cmd --zone=certbot --add-source=34.220.116.34/32 --permanent success [root@SV-ALTAIR ~]# firewall-cmd --reload success
certbot (active) target: ACCEPT icmp-block-inversion: no interfaces: sources: 23.178.112.202/32 23.178.112.204/32 34.222.79.253/32 52.13.142.142/32 3.15.188.211/32 18.189.13.130/32 23.178.112.106/32 23.178.112.107/32 34.220.116.34/32 18.191.28.4/32 66.133.109.36/32 services: http ports: protocols: forward: no masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
certbotの接続元IPアドレス
/var/log/httpd/test01.sv-altair.●●●●●●●●●●●-access_log
23.178.112.202 - - [07/Jan/2024:05:17:10 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 18.191.28.4 - - [07/Jan/2024:09:58:09 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 66.133.109.36 - - [07/Jan/2024:09:58:09 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 66.133.109.36 - - [07/Jan/2024:09:58:10 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 18.191.28.4 - - [07/Jan/2024:09:58:19 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 34.220.116.34 - - [07/Jan/2024:09:58:19 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 34.220.116.34 - - [07/Jan/2024:09:58:19 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 66.133.109.36 - - [07/Jan/2024:10:13:20 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 34.220.116.34 - - [07/Jan/2024:10:13:20 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 18.191.28.4 - - [07/Jan/2024:10:13:20 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 66.133.109.36 - - [07/Jan/2024:10:13:20 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 18.191.28.4 - - [07/Jan/2024:10:13:29 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)" 34.220.116.34 - - [07/Jan/2024:10:13:30 +0900] "GET /.well-known/acme-challenge/ZZZZZZZZZZZZZZZ HTTP/1.1" 200 87 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"
もともと2023年までに設定していたIPアドレス
23.178.112.202 23.178.112.204 34.222.79.253 52.13.142.142 3.15.188.211 18.189.13.130 23.178.112.106 23.178.112.107
2024年1月に追加したIPアドレス
34.220.116.34 18.191.28.4 66.133.109.36
関連記事
certbotによる更新がずっこけてて、基本的にHTTPなどメジャーなポートは塞いであるために更新できてないっぽい。Let's Enctyptが使用するIPアドレスは公開されていないから、一旦HTTPを開放しないといけない。ぐぬぬ。
— m6u (@michieru) 2021年3月29日
インフラエンジニアになるための勉強のやり方
私は、某SIerに勤務しながら、WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
現在の会社で直接担当している業務の中では、決まった技術しか触れないけれど、
「他にも将来役に立ちそうなインフラ技術を勉強したい」「働きながらでもできる効率的なインフラエンジニアの勉強方法を知りたい」と考えている方のために、
①おすすめの書籍と、②おススメのオンライン学習サイトを紹介します。
働きながら勉強するための、おススメの書籍と、オンラインで学習できるサイトの紹介です。
インフラエンジニアの勉強ができるおススメ書籍
朝の通勤時や帰宅時の電車の中や、社外打合せへの移動中などに勉強するなら、やはり書籍が一番だと思います。
インフラエンジニアの教科書
LINE社に創業時から在籍しているインフラエンジニア・プロマネの「佐野裕」さんの本です。 Tweets by sanonosa twitter.com
膨大なトラフィックをさばくLINE社にて構築・保守を行っている現役エンジニアが記すITインフラの必須知識と経験の数々! サーバ、OS、ネットワーク機器、データセンター、購買と商談、障害対応、大規模インフラ、成長するために必要なスキルなど、基礎知識から実践まで言及。 ITインフラの世界が理解できる珠玉の1冊!
インフラエンジニアの教科書 (C&R研究所) 佐野裕 |
1週間でLPICの基礎が学べる本
Linuxの資格「LPIC」の試験対策を初心者向けに書いた入門書です。
Linuxの資格として広く知られているLPICですが、あまり知識の無いまま試験対策を始める人も多いのではないでしょうか。しかし、試験対策書は試験範囲についてのみ解説しているものが多く、初心者が理解するのは困難です。本書は、初心者がスムーズに試験対策を行えるよう、事前に基礎固めを行うLinux入門書です。試験情報や模擬問題も掲載しているので、資格取得を視野に入れた効率的な基礎学習が行えます。
1週間でLPICの基礎が学べる本 第3版 徹底攻略シリーズ (インプレス) 中島能和 |
インフラエンジニアの勉強ができるオンライン学習サイト
Udemy (オンライン動画学習サイト)
Udemy(ユーデミー)は、オンラインで動画で学習できるサービスです。
ITエンジニア系の講座もたくさん公開されています。
Udemyの特徴
- ユーザー登録すれば、第1回の講座は無料で視聴できる
- 無料のコンテンツもある
- 過去に受講した人の人数や、受講した人の評価も表示されるので選びやすい
以上、読んでいただきありがとうございました。