定期的にLeT’s Encryptで生成している鍵を更新しないといけない。
その方法というか手順を忘れがちなのでメモ代わりに残す。
Cerbotで鍵更新
普段はアクセスを禁止しているhttpポートを開いて実効する。
httpポートを開く理由は、Let’s Encrypt側から、こちら側が本当に生きてるIPアドレスかどうかを確認するから。
|
1 2 3 4 |
# firewall-cmd --zone=public --add-service=http # firewall-cmd --list-all # certbot-auto certonly --webroot -w /usr/share/nginx/html -d starseeker.podzone.org -d wp.sta rseeker.podzone.org -d git.starseeker.podzone.org --agree-tos --force-renewal |
更新はしばしば失敗する。
理由は結構様々だけど、何かしらのアップデートの度に失敗するようになるというのが感想。
2022/4/9の失敗の原因は、
CentOS8のサポート期限切れ後にrepository変更してまとめてdnf updateした後に、
ddclient.serviceが起動失敗していたため、
外部から自宅サーバにアクセスできなくなっていたのが原因。
正常終了して鍵が更新されるのを確認したらhttpポートを閉じる。
|
1 2 |
# firewall-cmd --zone=public --remove-service=http # firewall-cmd --list-all |
各種サービス再起動
鍵を更新しただけでは、サービス側は古い鍵で動き続けるので、
サービス側も再起動してやる必要がある。
自分の環境ではpostfix, dovecot, nginxを再起動する。
|
1 2 3 4 5 6 |
# systemctrl restart nginx # systemctrl restart postfix # systemctrl restart dovecot # systemctrl status nginx -l # systemctrl status postfix -l # systemctrl status dovecot -l |