2018年3月15日

Let's encrypt 支援Wildcard SSL

也許是太多奧客客訴了,現在acme.sh 指令後面要加上 --yes-I-know-dns-manual-mode-enough-go-ahead-please

Let's encrypt已經在3/13號開始支援wildcard ssl了,不過Wildcard SSL只能用dns-01做驗證,並且必須使用ACME 2.0。以下就記錄一下設定過程:

1.安裝acme.sh

專案網址為 https://github.com/Neilpang/acme.sh,可以在linux主機上安裝支援Bash, dash和sh的shell script
目前certbot還不支援wildcard ssl,所以先用這個吧

curl https://get.acme.sh | sh

等他跑完就完成了,他會安裝在/.acme.sh/ 目錄底下,並協助設定環境變數。
重新登出後或使用source .bashrc 指令更新一下環境變數就可以直接使用了

2.取得驗證用的dns紀錄和生成需求(以*.example.com為例):


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

接下來let's encrypt會請你設定一個名為 _acme-challenge.example.com 的DNS TXT Record,確定設定好之後再執行下面的指令。
PS. 記住要確定設定好了再做(先用nslookup或dig 好好確認一下),不然他會再生出一組新的需求,並重新產生一個新的TXT內容,然後你就要再設定一次DNS。 

3.再來就是要產生cert和key了

如果成功會告訴你他把key和cert都放在/root/.acme.sh/*.example.com 底下。

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

 

4.重新把你需要的cert和key發布到其他目錄:

其實要自己搬過去也是可以啦

acme.sh  --installcert  -d  *.example.com   \
        --cert-file /etc/nginx/ssl/example.com.cert \
        --key-file   /etc/nginx/ssl/example.com.private.key
 

5.設定nginx 來支援ssl:

    
ssl_certificate /etc/nginx/ssl/example.com.cert;
ssl_certificate_key /etc/nginx/ssl/example.com.private.key;

6.重啟nginx:

    
service nginx restart

1 則留言:

舊油燈裡的巨人 提到...

補充 certbot也是一個滿不錯的工具
https://certbot.eff.org/lets-encrypt/centosrhel7-nginx

張貼留言

精選文章

利用Selenium IDE進行UI測試

安裝與執行 Selenium IDE是Firefox的一個plugin,用來做UI的自動測試:下載網址為http://docs.seleniumhq.org/download/ 安裝後,點一下firefox 的工具 -> Selenium IDE ,就會...