在X上看到@geekbb推荐的免费二级域名,注册了试试。 然后发现虽然不能改成CF解析,但是他家的API功能还是很全的,包括DDNS和SSL。
注册成功后,可以在 “Settings” 里点击 “DNS API Key” 新建一个API key,之后就能在linux里设置各种自动化部署了,对我主要是自动免费SSL证书申请和部署。
首先在 "DOMAINS" 菜单里点击 "Free SSL Certificates" 启用新注册的域名的SSL,然后在vps里新建三个json文件用于自动化更新和下载证书,例如建立在/etc
。
renew.json
{ "apikey": "api key", "domain": "xx.work.gd", "action": "renew", "verbose": "true" }
cert.json
{ "apikey": "api key", "domain": "xx.work.gd", "action": "download", "file": "cert" }
key.json
{ "apikey": "api key", "domain": "xx.work.gd", "action": "download", "file": "privatekey" }
最后通过bash命令进行更新,并下载到文件,可以在cron中设置每月定期运行。 其中/etc/xxx.json
需改成自己的路径。
# 更新证书
curl -H "Content-Type: application/json" --data @/etc/renew.json https://api.dnsexit.com/dns/lse.jsp
# 下载证书和key并存储到指定路径,如nginx
curl -H "Content-Type: application/json" --data @/etc/cert.json https://api.dnsexit.com/dns/lse.jsp > /nginx/cert.crt
curl -H "Content-Type: application/json" --data @/etc/key.json https://api.dnsexit.com/dns/lse.jsp > /nginx/key.key