LetsEncrypt TLS証明書の更新

AWS

はじめに

AWSのLightsail にて構築したWordPressサイトにおける Let’s Encrypt のTLS証明書が期限切れになったので、更新作業をおこなうものなり。

メールで注意報が届いていたがスルーしていた。メール件名: Let’s Encrypt certificate expiration notice for domain “additengineer.info” (and 1 more)

自動更新されるはずなのだが、なぜか自動更新されず、証明書が切れていた。それはちょっと納得いかないが。ブラウザでサイトにアクセスすると怒られる。

結論

bncert-tool コマンドで楽に処理できた。

処理の流れ

AWS Lishtsail コンソールから該当インスタンスのコマンドプロンプトに入る。

現状の証明書のバックアップ

念の為現状のcertificatesのバックアップをとっておく。

~$ cd /opt/bitnami/letsencrypt/
/opt/bitnami/letsencrypt$ ls -l
/opt/bitnami/letsencrypt$ ls /tmp
/opt/bitnami/letsencrypt$ cp -r certificates /tmp/certificates2022
/opt/bitnami/letsencrypt$ ls /tmp

ツールの起動

bncert-toolコマンドを実行する。最初はツール自体の updateがあることが告げられるのでYで答える。以下手動部分を●で示す。

~$ sudo /opt/bitnami/bncert-tool ●
An updated version is available. Would you like to download it? You would need to run it manually later. [Y/n]: Y ●

The tool will exit now. To run the updated version run the following command:

/opt/bitnami/bncert-tool

~$ sudo /opt/bitnami/bncert-tool ●
----------------------------------------------------------------------------
Welcome to the Bitnami HTTPS Configuration tool.

----------------------------------------------------------------------------
Domains

Please provide a valid space-separated list of domains for which you wish to
configure your web server.

Domain list []: additengineer.info ●

Warning: A certificate for the list of domains you entered already exists. It
will be used instead of generating a new one.
Press [Enter] to continue: ●
----------------------------------------------------------------------------
Enable/disable redirections

Please select the redirections you wish to enable or disable on your Bitnami
installation.


Enable HTTP to HTTPS redirection [Y/n]: Y ●


Enable non-www to www redirection [Y/n]: Y ●


Enable www to non-www redirection [y/N]: N ●

----------------------------------------------------------------------------
Changes to perform

The following changes will be performed to your Bitnami installation:

1. Stop web server
2. Configure web server to use an existing Let's Encrypt certificate and renew:
/opt/bitnami/letsencrypt/certificates/additengineer.info.crt
3. Configure a cron job to automatically renew the certificate each month
4. Configure web server name to: www.additengineer.info
5. Enable HTTP to HTTPS redirection (example: redirect http://additengineer.info
to https://additengineer.info)
6. Enable non-www to www redirection (example: redirect additengineer.info to
www.additengineer.info)
7. Start web server once all changes have been performed


Do you agree to these changes? [Y/n]: Y ●

----------------------------------------------------------------------------
Create a free HTTPS certificate with Let's Encrypt

Please provide a valid e-mail address for which to associate your Let's Encrypt
certificate.

Domain list: additengineer.info www.additengineer.info

Server name: www.additengineer.info

E-mail address []: hoo@example.com ●

The Let's Encrypt Subscriber Agreement can be found at:

https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf

Do you agree to the Let's Encrypt Subscriber Agreement? [Y/n]: Y ●

----------------------------------------------------------------------------
Performing changes to your installation

The Bitnami HTTPS Configuration Tool will perform any necessary actions to your
Bitnami installation. This may take some time, please be patient.

----------------------------------------------------------------------------
Success

The Bitnami HTTPS Configuration Tool succeeded in modifying your installation.

The configuration report is shown below.

Backup files:
* /opt/bitnami/apache/conf/httpd.conf.back.202207180435
* /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202207180435
* /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202207180435
* /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202207180435
* /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202207180435

Find more details in the log file:

/tmp/bncert-202207180435.log

If you find any issues, please check Bitnami Support forums at:

GitHub - bitnami/vms: Bitnami VMs
Bitnami VMs. Contribute to bitnami/vms development by creating an account on GitHub.
Press [Enter] to continue: ●

最後に

bncert-toolツールでの作業自体は楽だった。なにしろ初期にも作業した通りなので。Lightsailインスタンスの再起動は不要だった。

それにしても、繰り返しになるが今回自動更新されなかったのは謎。

これで自動更新されるはずだが。90日後が心配だ。

スポンサーリンク

コメント

タイトルとURLをコピーしました