泛域名泛域名證書又名通配符證書是SSL證書中的其中一種形式,一般會以通配符的形式(如:*.domain.com)來指定證書所要保護的域名。OV證書和DV證書都會有通配符的域名形式提供,而EV證書一般沒有通配符的證書形式。1.配置靈活方便由於采用瞭通配符的形式對域名進行配置,那麼對於擁有多個二級域名的網站是一件非常便利的事情。隻要申請一張通配符證書,就能用於所有的二級域名網站中。而且如果以後需要繼續增加二級域名,也不需要再去申請購買證書,隻需繼續使用原有的證書就可以,對於網站管理者來說確實是非常的方便。2.性價比高一般而言,通配符證書是會比單域名證書會貴上不少,但是假如按每個二級域名的證書價格攤分下來,那其實證書單價是及其的低。當然這要看你的二級域名數量總數有多少而定。但如今互聯網時代,很多公司企業他們都會用戶多個二級域名。對於這些企業而言,通配符證書無疑是一種高性價比的SSL證書。安裝所需環境root@cby:~# apt-get install socat -y
root@cby:~# curl https://get.acme.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
100 937 0 937 0 0 788 0 –:–:– 0:00:01 –:–:– 789
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 210k 100 210k 0 0 131k 0 0:00:01 0:00:01 –:–:– 131k
[Fri 15 Apr 2022 11:54:09 AM CST] Installing from online archive.
[Fri 15 Apr 2022 11:54:09 AM CST] Downloading https://github.com/acmesh-official/acme.sh/archive/master.tar.gz
[Fri 15 Apr 2022 11:54:11 AM CST] Extracting master.tar.gz
[Fri 15 Apr 2022 11:54:11 AM CST] Installing to /root/.acme.sh
[Fri 15 Apr 2022 11:54:11 AM CST] Installed to /root/.acme.sh/acme.sh
[Fri 15 Apr 2022 11:54:11 AM CST] Installing alias to '/root/.bashrc'
[Fri 15 Apr 2022 11:54:11 AM CST] OK, Close and reopen your terminal to start using acme.sh
[Fri 15 Apr 2022 11:54:11 AM CST] Installing cron job
49 0 * * * "/root/.acme.sh"/acme.sh –cron –home "/root/.acme.sh" > /dev/null
[Fri 15 Apr 2022 11:54:11 AM CST] Good, bash is found, so change the shebang to use bash as preferred.
[Fri 15 Apr 2022 11:54:12 AM CST] OK
[Fri 15 Apr 2022 11:54:12 AM CST] Install success!
root@cby:~#
進入導入環境變量並提出申請root@cby:~# cd .acme.sh/
root@cby:~/.acme.sh# export DP_Id="abcd"
root@cby:~/.acme.sh# export DP_Key="xxxxxxxxxx"
root@cby:~/.acme.sh# ./acme.sh –issue –dns dns_dp -d *.oiox.cn -d oiox.cn
[Fri 15 Apr 2022 12:05:13 PM CST] Using CA: https://acme.zerossl.com/v2/DV90
[Fri 15 Apr 2022 12:05:13 PM CST] Multi domain='DNS:*.oiox.cn,DNS:oiox.cn'
[Fri 15 Apr 2022 12:05:13 PM CST] Getting domain auth token for each domain
[Fri 15 Apr 2022 12:05:38 PM CST] Getting webroot for domain='*.oiox.cn'
[Fri 15 Apr 2022 12:05:38 PM CST] Getting webroot for domain='oiox.cn'
[Fri 15 Apr 2022 12:05:39 PM CST] Adding txt value: DDuc5hd3b1RIoa5BefBkA53EpEtbAY0Fk8jOVVJcL6E for domain: _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:05:39 PM CST] Adding record
[Fri 15 Apr 2022 12:05:39 PM CST] The txt record is added: Success.
[Fri 15 Apr 2022 12:05:40 PM CST] Adding txt value: 43GHnhiHjyxCxsdHSDRDP_A4YqP8dDjc_9YgnkFNk5I for domain: _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:05:40 PM CST] Adding record
[Fri 15 Apr 2022 12:05:40 PM CST] The txt record is added: Success.
[Fri 15 Apr 2022 12:05:40 PM CST] Let's check each DNS record now. Sleep 20 seconds first.
[Fri 15 Apr 2022 12:06:01 PM CST] You can use '–dnssleep' to disable public dns checks.
[Fri 15 Apr 2022 12:06:01 PM CST] See: https://github.com/acmesh-official/acme.sh/wiki/dnscheck
[Fri 15 Apr 2022 12:06:02 PM CST] Checking oiox.cn for _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:06:04 PM CST] Domain oiox.cn '_acme-challenge.oiox.cn' success.
[Fri 15 Apr 2022 12:06:04 PM CST] Checking oiox.cn for _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:06:05 PM CST] Domain oiox.cn '_acme-challenge.oiox.cn' success.
[Fri 15 Apr 2022 12:06:05 PM CST] All success, let's return
[Fri 15 Apr 2022 12:06:05 PM CST] Verifying: *.oiox.cn
[Fri 15 Apr 2022 12:06:17 PM CST] Processing, The CA is processing your order, please just wait. (1/30)
[Fri 15 Apr 2022 12:06:24 PM CST] Success
[Fri 15 Apr 2022 12:06:24 PM CST] Verifying: oiox.cn
[Fri 15 Apr 2022 12:06:31 PM CST] Processing, The CA is processing your order, please just wait. (1/30)
[Fri 15 Apr 2022 12:06:34 PM CST] Success
[Fri 15 Apr 2022 12:06:34 PM CST] Removing DNS records.
[Fri 15 Apr 2022 12:06:34 PM CST] Removing txt: DDuc5hd3b1RIoa5BefBkA53EpEtbAY0Fk8jOVVJcL6E for domain: _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:06:35 PM CST] Removed: Success
[Fri 15 Apr 2022 12:06:35 PM CST] Removing txt: 43GHnhiHjyxCxsdHSDRDP_A4YqP8dDjc_9YgnkFNk5I for domain: _acme-challenge.oiox.cn
[Fri 15 Apr 2022 12:06:36 PM CST] Removed: Success
[Fri 15 Apr 2022 12:06:36 PM CST] Verify finished, start to sign.
[Fri 15 Apr 2022 12:06:36 PM CST] Lets finalize the order.
[Fri 15 Apr 2022 12:06:36 PM CST] Le_OrderFinalize='https://acme.zerossl.com/v2/DV90/order/G4Sy37Y-eHjHX1wLMAh5nA/finalize'
[Fri 15 Apr 2022 12:06:44 PM CST] Order status is processing, lets sleep and retry.
[Fri 15 Apr 2022 12:06:44 PM CST] Retry after: 15
[Fri 15 Apr 2022 12:07:00 PM CST] Polling order status: https://acme.zerossl.com/v2/DV90/order/G4Sy37Y-eHjHX1wLMAh5nA
[Fri 15 Apr 2022 12:07:03 PM CST] Down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o
3ehnUoyRkggmoD+SX8AAJLPuxkHFB/L68CL7knwWXzYcBYfj0yv+0T5HPhOofHud
Fwv/h5loRN/1jeVwIblo9B+3KnNNDAxd5NTf1l80oZJgKqS6zoFJwKbE0X11Ved7
m35ZEcj4UwrgSFLE7Y9+to66In2N/QpvFPFclE9Xfwdd03YAmxS/biIul2xrkzBf
E9Q19NWLnTA2YU52
—–END CERTIFICATE—–
[Fri 15 Apr 2022 12:07:10 PM CST] Your cert is in: /root/.acme.sh/*.oiox.cn/*.oiox.cn.cer
[Fri 15 Apr 2022 12:07:10 PM CST] Your cert key is in: /root/.acme.sh/*.oiox.cn/*.oiox.cn.key
[Fri 15 Apr 2022 12:07:10 PM CST] The intermediate CA cert is in: /root/.acme.sh/*.oiox.cn/ca.cer
[Fri 15 Apr 2022 12:07:10 PM CST] And the full chain certs is there: /root/.acme.sh/*.oiox.cn/fullchain.cer
查看已申請出來證書root@cby:~/.acme.sh# cd \*.oiox.cn
root@cby:~/.acme.sh/*.oiox.cn# ll
total 44
drwxr-xr-x 2 root root 4096 Apr 15 12:07 ./
drwx—— 8 root root 4096 Apr 15 11:55 ../
-rw-r–r– 1 root root 4399 Apr 15 12:07 ca.cer
-rw-r–r– 1 root root 6680 Apr 15 12:07 fullchain.cer
-rw-r–r– 1 root root 2281 Apr 15 12:07 '*.oiox.cn.cer'
-rw-r–r– 1 root root 563 Apr 15 12:07 '*.oiox.cn.conf'
-rw-r–r– 1 root root 956 Apr 15 12:05 '*.oiox.cn.csr'
-rw-r–r– 1 root root 156 Apr 15 12:05 '*.oiox.cn.csr.conf'
-rw——- 1 root root 1675 Apr 15 11:55 '*.oiox.cn.key'
root@cby:~/.acme.sh/*.oiox.cn#Nginx部署證書示例:
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443;
ssl_certificate /ssl/fullchain.cer;
ssl_certificate_key /ssl/*.oiox.cn.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
server_name dns.oiox.cn;
root /var/www/dns;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}附錄 上面使用DNSPOD進行動態解析申請證書
阿裡雲DNS申請
export Ali_Key="abcd"
export Ali_Secret="xxxxxxxxxx"
# RSA 證書
acme.sh –issue –dns dns_ali -d blog.exsvc.cn -d *.exsvc.cn
# ECC 證書
acme.sh –issue –dns dns_ali -d blog.exsvc.cn -d *.exsvc.cn –keylength ec-256
騰訊雲DNS申請
root@cby:~/.acme.sh# export DP_Id="abcd"
root@cby:~/.acme.sh# export DP_Key="xxxxxxxxxx"
root@cby:~/.acme.sh# ./acme.sh –issue –dns dns_dp -d *.oiox.cn -d oiox.cn
更多申請方式見:https://github.com/acmesh-official/acme.sh/wiki/dnsapi
https://www.oiox.cn/https://www.chenby.cn/https://cby-chen.github.io/https://weibo.com/u/5982474121https://blog.csdn.net/qq_33921750https://my.oschina.net/u/3981543https://www.zhihu.com/people/chen-bu-yun-2https://segmentfault.com/u/hppyvyv6/articleshttps://juejin.cn/user/3315782802482007https://space.bilibili.com/352476552/articlehttps://cloud.tencent.com/developer/column/93230https://www.jianshu.com/u/0f894314ae2chttps://www.toutiao.com/c/user/token/MS4wLjABAAAAeqOrhjsoRZSj7iBJbjLJyMwYT5D0mLOgCoo4pEmpr4A/CSDN、GitHub、知乎、開源中國、思否、掘金、簡書、騰訊雲、嗶哩嗶哩、今日頭條、新浪微博、個人博客、全網可搜《小陳運維》