LoginSignup
151
150

More than 5 years have passed since last update.

Let's Encrypt (certbot) でワイルドカード証明書できた!

Last updated at Posted at 2018-03-13

はじめに

先日、

という記事を書きまして、Qiitaでの初投稿であったにも関わらず5000以上のアクセス、100いいねを頂きました。
投稿時点ではちゃんとワイルドカード証明書が発行できたと思っていたのですが、実際はまだステージングの段階で無効な証明書しか発行されないというツッコミを頂きまして、ドキュメントの読み込み不足・検証不足を痛感し記事に追記したところであります。

ところがやっと、

「ACME v2エンドポイントがProductionEnvironmentとして利用可能になった」というアナウンスがあり、

対応クライアント一覧にcertbotが入っていたので、もう一度検証してみることにしました。

結論

  • 警告が出ない、ちゃんとしたワイルドカード証明書が発行される←NEW
  • yumで入るcertbotはまだ古い(2018/03/14 04:30 JSTごろ)
  • ↑yumでインストールできる最新版0.23.0でワイルドカード証明書発行できました(2018/05/13現在)
  • ACME v2 のエンドポイントは明示的な指定が必要

Let's Encryptでワイルドカード証明書を取得するまで

検証環境

  • CentOS7.4

yumでcertbot入れて試してみた

epelが必要だった気がする

[root@wildcard ~]# yum -y install certbot --enablerepo=epel

普通にDNS認証でやってみる→失敗

[root@wildcard certbot]# certbot certonly --manual \
-d *.charakoba.com -m <メールアドレス> --agree-tos --manual-public-ip-logging-ok \
--preferred-challenges dns-01
Wildcard domains are not supported: *.charakoba.com

嫌な予感がする

[root@wildcard ~]# yum list installed | grep certbot
certbot.noarch                          0.21.1-1.el7                    @epel   
python2-certbot.noarch                  0.21.1-1.el7                    @epel 

バージョンが古かった

yumでインストールできる最新版0.23.0でワイルドカード証明書発行できました。gitでの操作は必要ありません。(2018/05/13追記)

gitで落としてくる

Release 0.22.0 ってコミットメッセージが入ってます。しかも6日前。
スクリーンショット 2018-03-14 5.18.15.png

クローンする

[root@wildcard ~]# yum install git
[root@wildcard ~]# git clone https://github.com/certbot/certbot.git
[root@wildcard ~]# cd certbot/

前回の記事のコマンドから不要な部分を削って実行してみます

[root@wildcard certbot]# ./certbot-auto certonly --manual \
-d *.charakoba.com -m <メールアドレス> --agree-tos --manual-public-ip-logging-ok \
--preferred-challenges dns-01

APIサーバのエンドポイントのデフォルトは古いままのようです。

Obtaining a new certificate
The currently selected ACME CA endpoint does not support issuing wildcard certificates.

ACMEv2本番用であるhttps://acme-v02.api.letsencrypt.org/directory をエンドポイントに指定して再度実行します。

[root@wildcard certbot]# ./certbot-auto certonly --manual \
-d *.charakoba.com -m <メールアドレス> --agree-tos --manual-public-ip-logging-ok \
--preferred-challenges dns-01 \
--server https://acme-v02.api.letsencrypt.org/directory

ちゃんとTXTレコードが表示されました。

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

abCePnd_c652hTidebzC_UOtX-lkV2AjtG4YD8Xzp5k

Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------

これをDNSサーバに登録して、何かキーを押すと、証明書が発行されます。

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/charakoba.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/charakoba.com/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

検証

nginxで適当にWEBサーバを建てて、証明書の検証をしてみました。

スクリーンショット 2018-03-14 4.57.45.png

特に警告が出ることもなく、緑色の鍵が表示されています。

スクリーンショット 2018-03-14 4.58.04.png

発行者の名称の部分も、ステージングAPIでは Fake LE Intermediate X1 となっていましたが、ちゃんと正規の Let's Encrypt Authority X3 となっています。

さいごに

ねむいです。著書買ってくださると励みになります。

イラスト図解でよくわかる ITインフラの基礎知識

151
150
1

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