tekitoumemo’s diary

思ったことを書くだけ。長文版Twitter

Let’s EncryptでワイルドカードSSL化に挑戦(成功編)

よっしゃ!ワイルドカードSSLが取れた!

これでドメインが使えるので、やり方を紹介します。
作れないと困っている人がいたら以下のURLを確認してみて下さい。
tekitoumemo.hatenablog.com

やり方は前回書いたので、今回実施したことを記載します。

TXTタイプでDNSレコードを登録したら以下のコマンドを実行します。

dig -t txt _acme-challenge.xxxx.com

digコマンドはネームサーバーから情報を引き出すツールです。そうすると以下のような表示がされます。

saito@saito-Aspire-one-1-131:~$ dig -t txt _acme-challenge.xxxx.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> -t txt _acme-challenge.xxxx.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 11446
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;_acme-challenge.xxxx.com.	IN	TXT

;; AUTHORITY SECTION:
.xxxx.com.		300	IN	SOA	dns.jp. xxxx.dns.jp. 0000..

;; Query time: 9 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Apr 11 20:02:07 JST 2018
;; MSG SIZE  rcvd: 113

これはまだ登録されていないので以下の質問に答えちゃだめ(Enter押しちゃだめ)です。

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

xxxxxxxxxxxxxxxxxxxxxxxxxxxx

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

しばらく経ってからdigコマンドを打つと以下のように表示されます。

saito@saito-Aspire-one-1-131:~$ dig -t txt _acme-challenge.xxxx.com

; <<>> DiG 9.10.3-P4-Ubuntu <<>> -t txt _acme-challenge.xxxx.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47846
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 5

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;_acme-challenge.xxxx.com.	IN	TXT

;; ANSWER SECTION:
_acme-challenge.xxxx.com. 3600 IN	TXT	"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"

;; AUTHORITY SECTION:
以下略...

以下の表記がされていればDNSレコードが登録されています。

;; ANSWER SECTION:
_acme-challenge.xxxx.com. 3600 IN	TXT	"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"

こちらが確認出来たら「Press Enter to Continue 」の指示通りEnterを押してやります。

Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/xxxxxx.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/xxxxxx.com/privkey.pem
   Your cert will expire on 2018-07-10. 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

Congratulations!

証明書は「/etc/letsencrypt/live/xxxxxx.com/fullchain.pem」に置いてやったぜ!って書いてあるのでそこを参照して下さい。

追記:1日20回失敗するとアクセスできなくなります(笑)以下の記事に書いてありました。
Rate Limits - Let's Encrypt - Free SSL/TLS Certificates