CentOS6でLet's Encryptのワイルドカード証明書を取得


前提

Certbotのインストール

# yum install epel-release
# wget https://dl.eff.org/certbot-auto
# mv certbot-auto /usr/local/bin/certbot-auto
# chmod 0755 /usr/local/bin/certbot-auto

Apahceの設定を変えずに証明書の取得だけ実行するコマンドを実行する
初回は SCL repository やら python やらが必要なので指示通りインストールする

# /usr/local/bin/certbot-auto certonly --apache
Complete!
Creating virtual environment...
Installing Python packages...
Installation succeeded.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel):

一度キャンセルする

ワイルドカード証明書の取得

-d はSANs のDNS Name
-m は連絡先メールアドレス

# /usr/local/bin/certbot-auto certonly --manual
 --server https://acme-v02.api.letsencrypt.org/directory
 --preferred-challenges dns
 --agree-tos
 --manual-public-ip-logging-ok
 -d *.example.com -d example.com
 -m [email protected]

チャレンジが表示されるので自身のDNSにTXTレコードを登録する

  • エントリ: _acme-challenge.example.com
  • タイプ: TXT
  • 値: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Please deploy a DNS TXT record under the name
_acme-challenge.example.com with the following value:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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

登録した後、DNSレコードが反映されるまで(10分程度)待ってからEnterを実行する
成功すると以下が表示される

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem

Let's Encrypt に寄付する