#author("2022-09-24T13:11:46+09:00","","")
#contents();
*** kgb.hmuna.com のサーバー証明書の更新 [#c58d521a]
- 実は(後で気付いたのだが)元々使っていた namecheap の証明書は5年分購入していて、今回は無償で2年分追加の証明書を入手できたのだが
-- &ref(Your SSL will pause in 30 days - Namecheap support (support@namecheap.com) - 2022-09-07 0009.eml);
- 今回無償で利用できる Let's Encrypt への移行を行った (20220924)
*** [[Let's encrypt:https://letsencrypt.org/ja/getting-started/]] のガイダンスに従った [#z3c09511]
- [[certbot:https://certbot.eff.org/]] を利用して自動更新が出来るようにした。
- kgb.hmuna.com は Ubuntu 18.04 上で稼働中
[KGB] munakata:/etc/apache2/sites-available$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
- snap の確認
[KGB] munakata:/etc/apache2/sites-available$ sudo snap install core; sudo snap refresh core
snap "core" is already installed, see 'snap help refresh'
snap "core" has no updates available
- 稼働中の chertbot を削除し、Let's Encrypt のバージョンをインストール
[KGB] munakata:/etc/apache2/sites-available$ sudo apt-get remove certbot
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
以下のパッケージが自動でインストールされましたが、もう必要とされていません:
python3-acme python3-augeas python3-certbot python3-configargparse python3-configobj python3-future python3-icu python3-josepy python3-mock
python3-ndg-httpsclient python3-parsedatetime python3-pbr python3-pyasn1 python3-requests-toolbelt python3-zope.component python3- zope.event python3-zope.hookable
これを削除するには 'sudo apt autoremove' を利用してください。
以下のパッケージは「削除」されます:
certbot python-certbot-apache python3-certbot-apache
アップグレード: 0 個、新規インストール: 0 個、削除: 3 個、保留: 0 個。
1 個のパッケージが完全にインストールまたは削除されていません。
この操作後に 461 kB のディスク容量が解放されます。
続行しますか? [Y/n]
(データベースを読み込んでいます ... 現在 417562 個のファイルとディレクトリがインストールされています。)
python-certbot-apache (0.31.0-1+ubuntu18.04.1+certbot+1) を削除しています ...
python3-certbot-apache (0.31.0-1+ubuntu18.04.1+certbot+1) を削除しています ...
certbot (0.31.0-2~deb10u1+ubuntu18.04.1+certbot+3) を削除しています ...
rsyslog (8.32.0-1ubuntu4.2) を設定しています ...
ユーザー `syslog' はすでにグループ `adm' のメンバーです。
Unsafe symlinks encountered in /var/log/auth.log, refusing.
Unsafe symlinks encountered in /var/log/mail.log, refusing.
Unsafe symlinks encountered in /var/log/kern.log, refusing.
Unsafe symlinks encountered in /var/log/syslog, refusing.
dpkg: パッケージ rsyslog の処理中にエラーが発生しました (--configure):
installed rsyslog package post-installation script subprocess returned error exit status 1
man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...
処理中にエラーが発生しました:
rsyslog
E: Sub-process /usr/bin/dpkg returned an error code (1)
- charbot の自動インストールスクリプトを利用して Let's Encrypt の証明書のインストール、既存の証明書の無効化、
[KGB] munakata:/etc/apache2/sites-available$ sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: kgb.hmuna.com
2: svr.hmuna.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for kgb.hmuna.com
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/kgb.hmuna.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/kgb.hmuna.com/privkey.pem
This certificate expires on 2022-12-23.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
Deploying certificate
Successfully deployed certificate for kgb.hmuna.com to /etc/apache2/sites-enabled/kgb.hmuna.com.conf
Congratulations! You have successfully enabled HTTPS on https://kgb.hmuna.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 自動更新のテスト実行を実施
[KGB] munakata:/etc/apache2/sites-available$ sudo certbot renew --dry-run
Saving debug log to /var/log/letsencrypt/letsencrypt.log
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/kgb.hmuna.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for kgb.hmuna.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/svr.hmuna.com.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for svr.hmuna.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded:
/etc/letsencrypt/live/kgb.hmuna.com/fullchain.pem (success)
/etc/letsencrypt/live/svr.hmuna.com/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- 証明書の指定部分を確認 (/etc/apache2/sites-available/ kgb.hmuna.com.conf)
[KGB] munakata:/etc/apache2/sites-available$
SSLCertificateFile /etc/letsencrypt/live/kgb.hmuna.com/fullchain.pem?
SSLCertificateKeyFile /etc/letsencrypt/live/kgb.hmuna.com/privkey.pem?
Include /etc/letsencrypt/options-ssl-apache.conf?