Let's Encryptで無料SSLライフ送りたい。
ワイルドカードの証明書がほしい。
環境
# cat /etc/redhat-release
CentOS release 6.5 (Final)
証明書取得
certbot-auto(証明書の作成・更新を自動化するスクリプト)取ってくる
# curl https://dl.eff.org/certbot-auto -o /usr/bin/certbot-auto
# chmod 700 /usr/bin/certbot-auto
実行
# /usr/bin/certbot-auto certonly --manual \
-d *.example.jp \
--preferred-challenges dns-01 \
--server https://acme-v02.api.letsencrypt.org/directory
実行後、必要なパッケージをyumでインストールしていいか確認が出るのでyes
(略)
Install 11 Package(s)
Upgrade 13 Package(s)
Total download size: 41 M
Is this ok [y/N]: y
緊急時やセキュリティ関連の連絡を受け取るメールアドレスを登録
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):hoge@example.jp
利用規約のPDF読んで同意するならA
-------------------------------------------------------------------------------
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 our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
-------------------------------------------------------------------------------
(Y)es/(N)o:どっちでも
あなたのIP記録するよ?
-------------------------------------------------------------------------------
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
example.jpのDNSにTXTレコードにXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX追加してEnterって言われる。ここですぐEnter押すとエラーになるのでDNSに設定して浸透するまで待たないといけない。長い…
-------------------------------------------------------------------------------
Please deploy a DNS TXT record under the name
_acme-challenge.example.jp with the following value:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Before continuing, verify the record is deployed.
-------------------------------------------------------------------------------
Press Enter to Continue
うちはvalue domainのDNS使ってるのでバリュードメインにログインしてtxtレコードを追加
txt _acme-challenge XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
DNSが反映されたかはコマンドで確認する
host -t txt _acme-challenge.example.jp
反映されたら、やっとEnter
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/example.jp/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/example.jp/privkey.pem
Your cert will expire on 2018-09-21. 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
無事成功。以下に証明書が作られる
# ls /etc/letsencrypt/live/example.jp/
README cert.pem chain.pem fullchain.pem privkey.pem
この証明書をnginxなりapacheなりに設定すればとりあえずOK
注意
とりあえず発行まで。
証明書の期限は90日で切れるのでcronで自動更新するように設定するのが定番ぽい