LoginSignup
0
0

More than 3 years have passed since last update.

certbotで使い捨てSSL証明書を発行する

Last updated at Posted at 2019-08-05

参考: https://qiita.com/ysogabe/items/1ffc1d381b5770ab57a8

$ docker run -it --rm --entrypoint /bin/sh certbot/certbot:v0.23.0
$ certbot certonly \
  --manual \
  --preferred-challenges dns \
  -d *.<証明書を取得したいドメイン> \
  --server https://acme-v02.api.letsencrypt.org/directory \
  --register-unsafely-without-email
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Registering without email!
Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org

-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: A
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for <証明書を取得したいドメイン>

-------------------------------------------------------------------------------
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
-------------------------------------------------------------------------------
(Y)es/(N)o: Y

-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.<証明書を取得したいドメイン> with the following value:

z6dhYCEe2KD6e0bK5IhdF9aT7ReKMOagCiD8oVBkM2c

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue

ここまで表示されたら Enter を押さずに書いてある通りに DNS のTXTレコードの設定を行う
設定したら Enter を押すと以下の様にSSL証明書が発行される

Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/<証明書を取得したいドメイン>/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/<証明書を取得したいドメイン>/privkey.pem
   Your cert will expire on 2019-11-03. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

これで完了
生成された証明書は IMPORTANT NOTES: の項目にあるように

証明書: /etc/letsencrypt/live/<証明書を取得したいドメイン>/fullchain.pem
秘密鍵: /etc/letsencrypt/live/<証明書を取得したいドメイン>/privkey.pem

に生成されるのでそれを保存する

今回は使い捨てで更新の予定がなかったので --register-unsafely-without-email オプションをつけたが、このオプションを外せば email を質問されるので更新のメールが送られるようになるらしい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0