letsencryptで証明書を発行する(ワイルドカード込み)メモ
ここ最近証明書の発行作業などほとんどやってなくワイルドカード対応以降でまだ触っておらずやり方を忘れていたので復習も兼ねてメモ
1.まずはCertbotをインストール
2.以下のコマンドで証明書を発行
sudo certbot certonly --manual \ --server https://acme-v02.api.letsencrypt.org/directory \ --preferred-challenges dns \ -d sjisjis.com -d *.sjisjis.com \ -m mail@mail \ --agree-tos \ --manual-public-ip-logging-ok # --manual: 対話的、その他、DNSのTXTレコードによる方法。 # --server ACMEサーバを指定します。本番サーバとステージングサーバを切り替えることができます。 # --preferred-challenges dns で認証方法を選択 # -d sjisjis.com -d *.sjisjis.com ルートドメインとサブドメインすべてを指定 # -m mail@mail 更新期限通知先 # --agree-tos ACME 利用規約に同意 # --manual-public-ip-logging-ok グローバルIPアドレスのロギングが自動的に許可
3.DNSの設定を求められるので設定する
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please deploy a DNS TXT record under the name _acme-challenge.sjisjis.com with the following value: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Before continuing, verify the record is deployed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Press Enter to Continue
4.DNSが浸透したらEnterを押して完了
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/sjisjis.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/sjisjis.com/privkey.pem Your cert will expire on 2019-07-13. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - 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
5.あとは/etc/letsencrypt/live/
配下に生成された秘密鍵や証明書を各サーバに設定すればOK
自動更新はcronにセットしたりdockerでもvolumeにマウントすれば結構簡単に設定できるっぽい。