good-arrow’s blog

https://good-arrow.net/

snap の certbot インストールと利用手順(証明書のみ版)

古い certbot を削除

sudo apt-get remove certbot

snap の更新

sudo snap install core; sudo snap refresh core

snap で certbot をインストール

sudo snap install --classic certbot

マルチドメイン時(サブドメイン

sudo certbot certonly --standalone -d www.example1.com -d mail.example1.com -d example1.com -m info@example1.com

複数ドメイン

sudo certbot certonly --standalone -d mail.example1.com -m info@example1.com
sudo certbot certonly --standalone -d mail.example2.com -m info@example2.com

証明書の場所

/etc/letsencrypt/live/example1.com/
/etc/letsencrypt/live/example2.com/

基本的に使用するのは fullchain.pemprivkey.pem

証明書の自動更新の確認

インストール時に設定されているので確認のみ。

systemctl list-timers

snap.certbot.renew.timer を確認

タイマーの実行時刻を確認

sudo cat /etc/systemd/system/snap.certbot.renew.timer

証明書更新のタイミング

既定値は「30日前」となっている。
変更したい時は、renew_before_expiry = 30 daysコメントアウトを外す。
Let’s Encrypt の証明書の有効期限は「90日」のため、最大 90 以下となる。

[/etc/letsencrypt/renewal/example1.com.conf]

# renew_before_expiry = 30 days    << 日数変更
version = 1.22.0
archive_dir = /etc/letsencrypt/archive/example1.com
cert = /etc/letsencrypt/live/example1.com/cert.pem
privkey = /etc/letsencrypt/live/example1.com/privkey.pem
chain = /etc/letsencrypt/live/example1.com/chain.pem
fullchain = /etc/letsencrypt/live/example1.com/fullchain.pem

# Options used in the renewal process
[renewalparams]
account = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
authenticator = standalone
server = https://acme-v02.api.letsencrypt.org/directory

Let's Encrypt の制限について

公式サイト
https://letsencrypt.org/docs/rate-limits/