使用 acme.sh 來製作 Let's Encrypt Wildcard 憑證

  • 1216
  • 0
  • 2019-03-27

 Let's Encrypt 終於開放 wildcard 的憑證申請了

這裡記下申請的步驟,環境是 Ubuntu subsystem on Windows 10

因為 Certbot 0.22 版本才支援 wildcard,但是 apt 好像還沒有 0.22 版,看到 Let's Encrypt 論壇中有人推薦使用 acme.sh,用起來還蠻簡單的~

首先:

curl https://get.acme.sh | sh
cd .acme.sh
chmod +x acme.sh
./acme.sh --issue --dns -d *.example.com --yes-I-know-dns-manual-mode-enough-go-ahead-please

輸出:

[Tue Mar 20 20:34:54 DST 2018] Creating domain key
[Tue Mar 20 20:34:54 DST 2018] The domain key is here: /home/joe/.acme.sh/*.example.com/*.example.com.key
[Tue Mar 20 20:34:54 DST 2018] Single domain='*.example.com'
[Tue Mar 20 20:34:55 DST 2018] Getting domain auth token for each domain
[Tue Mar 20 20:34:59 DST 2018] Getting webroot for domain='*.example.com'
[Tue Mar 20 20:35:00 DST 2018] Add the following TXT record:
[Tue Mar 20 20:35:00 DST 2018] Domain: '_acme-challenge.example.com'
[Tue Mar 20 20:35:00 DST 2018] TXT value: 'S5vimKPlkIGWZgNazMjYdpqwwvxSQjmDq4F6iBQosNs'
[Tue Mar 20 20:35:00 DST 2018] Please be aware that you prepend _acme-challenge. before your domain
[Tue Mar 20 20:35:00 DST 2018] so the resulting subdomain will be: _acme-challenge.example.com
[Tue Mar 20 20:35:00 DST 2018] Please add the TXT records to the domains, and re-run with --renew.
[Tue Mar 20 20:35:00 DST 2018] Please add '--debug' or '--log' to check more details.
[Tue Mar 20 20:35:00 DST 2018] See: https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh

接著去 DNS 設定 TXT 類型的資料:

Domain 輸入上面輸出給的 Domain => 範例中的 _acme-challenge.example.com

值給 TXT value 裡面的文字就好了 => 範例中的 S5vimKPlkIGWZgNazMjYdpqwwvxSQjmDq4F6iBQosNs

最後,剛剛原本的指令再加上 --renew

./acme.sh --issue --dns -d *.example.com --renew --yes-I-know-dns-manual-mode-enough-go-ahead-please

成功的話 wildcard 憑證就會出現在 *.example.com 的資料夾中了