Certbot-Dockerhub
https://hub.docker.com/r/certbot/certbot/
Dockerコンテナによる運用
https://certbot.eff.org/docs/install.html#running-with-docker
スタンドアローンモード(オプション)
ウェブサーバ以外の用途で認証を取得する場合のオプションです。
認証取得には、ポート:80をオープンにする必要があるため、ウェブサーバ等は停止してから実行すること。
https://certbot.eff.org/docs/using.html#standalone
certonly:単に指定ドメインの認証を取得したいだけの場合
$ sudo docker run -it --rm --name certbot \
-v "$PWD/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-p 80:80 \
certbot/certbot certonly --standalone -d stun.example.com
コンテナ内の /etc/letsencrypt/live ディレクトリに証明書が作成されるため、-vオプションによりホスト側のアプリ指定のディレクトリと共有させます。
certbotコマンドオプション
https://certbot.eff.org/docs/using.html#certbot-command-line-options
マニュアルモード(standalone + preferred-challenges)
https://certbot.eff.org/docs/using.html#manual
サーバ以外での用途にSSL認証を取得したい時に利用します。
ポート80を開放して以下コマンドを実行します。
$ sudo certbot certonly --standalone --preferred-challenges http -d test.example.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for test.example.com
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/test.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/test.example.com/privkey.pem
Your cert will expire on 2021-07-27. 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
/etc/letsencrypt/live/test.example.com
に認証ファイルが作成されます。
$ sudo ls /etc/letsencrypt/live/test.example.com
README cert.pem chain.pem fullchain.pem privkey.pem