Amazon Lightsailで証明書の期限切れが発生したので自動更新に変更した

AWS

Lightsailに移行後放置していたらいつの間にか証明書の期限が切れていた。

期限切れのメールはこちら

Hello,

Your certificate (or certificates) for the names listed below will expire in 18 days (on 22 Jul 22 23:00 +0000). Please make sure to renew your certificate before then, or visitors to your web site will encounter errors.

We recommend renewing certificates automatically when they have a third of their total lifetime left. For Let's Encrypt's current 90-day certificates, that means renewing 30 days before expiration. See https://letsencrypt.org/docs/integration-guide/ for details.

murablog.net

For any questions or support, please visit: https://community.letsencrypt.org/ Unfortunately, we can't provide support by email.

For details about when we send these emails, please visit: https://letsencrypt.org/docs/expiration-emails/ In particular, note that this reminder email is still sent if you've obtained a slightly different certificate by adding or removing names. If you've replaced this certificate with a newer one that covers more or fewer names than the list above, you may be able to ignore this message.

If you are receiving this email in error, unsubscribe at:

You've been unsubscribed
Please note that this would also unsubscribe you from other Let's Encrypt service notices, including expiration reminders for any other certificates. Regards, The Let's Encrypt Team

どうやら証明書は3ヶ月間のみ有効だったらしい。

証明書の更新方法

更新方法は2つあり、ELBを利用して証明書を適用する方法と、無料の証明書(Let’s Encrypt)を利用する方法。

ELBはそれなりに料金がかかるので、今回はLet’s Encryptを採用。

調べたところ、LightsailのWordPressをHTTPS化する方法はいくつかあり、

・Certbotコマンドを利用

・Bitnami HTTPS 設定ツール(bncert)を利用

の2種類があるBitnamiは自動更新も可能なのでこちらでやっていきます。

参考サイト

Lightsailで証明書を自動更新する方法 - Qiita
LightsailのWordPressをHTTPS化する方法Certbotコマンドを利用する方法…

https://takake-blog.com/lightsail-bncert/](https://takake-blog.com/lightsail-bncert/

証明書の更新

bitnami@ip-XXX-XX-XX-XXX:~$ sudo /opt/bitnami/bncert-tool --perform_public_ip_validation 0 --perform_dns_validation 0
----------------------------------------------------------------------------
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 []: murablog.net

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:
Warning: No www domains (e.g. www.example.com) or non-www domains (e.g.
www.example.com) have been provided, so the following redirections will be
disabled: non-www to www, www to non-www.
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


----------------------------------------------------------------------------
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/murablog.net.crt
3. Configure a cron job to automatically renew the certificate each month
4. Configure web server name to: murablog.net
5. Enable HTTP to HTTPS redirection (example: redirect http://murablog.net to

https://murablog.net)
6. 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: murablog.net Server name: murablog.net E-mail address []: XXXXXXXX@gmail.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.202209182308 * /opt/bitnami/apache/conf/bitnami/bitnami.conf.back.202209182308 * /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf.back.202209182308 * /opt/bitnami/apache/conf/vhosts/wordpress-https-vhost.conf.back.202209182308 * /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf.back.202209182308 Find more details in the log file: /tmp/bncert-202209182308.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: bitnami@ip-XXX-XX-XX-XXX:~$

証明書が適用されました!

コメント

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