tmytのらくがき

個人の日記レベルです

Let's EncryptがWildcard証明書に対応したから発行してみた

Let's Encryptが2018年1月末頃にはWildcard証明書を発行する予定!と言っていたのがやっとリリースされました!(わーぱちぱち)

せっかくなので発行してみました。いまのところ、コマンドラインから--serverとv02エンドポイントを明示する必要があるそうです。

途中さらっと流してますが、Wildcard証明書はDNS-01でドメインを検証しないといけないので、Certbotの指示に従ってDNSのTXTレコードを設定しています。 このドメインはConoHaでホストされているのでAPIで設定することもできますが、今回はWebから手動で変更しました。

**@onsen-tech:~/certbot$ ./certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d *.onsen.tech --manual --preferred-challenges dns-01 certonly
Requesting to rerun ./certbot-auto with root privileges...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): **@**.com

-------------------------------------------------------------------------------
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

-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: y
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for onsen.tech

-------------------------------------------------------------------------------
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.onsen.tech with the following value:

********

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/onsen.tech-0001/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/onsen.tech-0001/privkey.pem
   Your cert will expire on 2018-06-11. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto 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

**@onsen-tech:~/certbot$

これをNginxに設定して…ってアクセスするとサブドメイン付きのドメインしか指定されてないのでサブドメインのついてないところにアクセスするとエラー。なのでSANで作り直しました。

**@onsen-tech:~/certbot$ ./certbot-auto --server https://acme-v02.api.letsencrypt.org/directory -d onsen.tech -d *.onsen.tech --manual --preferred-challenges dns-01 certonly
Requesting to rerun ./certbot-auto with root privileges...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None

-------------------------------------------------------------------------------
You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/onsen.tech-0001.conf)

It contains these names: *.onsen.tech

You requested these names for the new certificate: onsen.tech, *.onsen.tech.

Do you want to expand and replace this existing certificate with the new
certificate?
-------------------------------------------------------------------------------
(E)xpand/(C)ancel: e
Renewing an existing certificate
Performing the following challenges:
dns-01 challenge for onsen.tech
dns-01 challenge for onsen.tech

-------------------------------------------------------------------------------
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.onsen.tech with the following value:

*******

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

-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.onsen.tech with the following value:

********

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/onsen.tech-0001/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/onsen.tech-0001/privkey.pem
   Your cert will expire on 2018-06-11. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again. To non-interactively renew *all* of your certificates, run
   "certbot-auto 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

**@onsen-tech:~/certbot$

無事発行できました。

f:id:tmyt:20180314082906p:plain