原创

[ssl]腾讯云使用Let's Encrypt 做泛域名解析

前言

今天想申请一个ssl证书,给新域名做解析,现在将过程记录下来,方便后来的人可以参考,主要是记录处理的过程,以及遇到的两点大问题

处理过程

按照网上的介绍其实过程很简单

下载脚本

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

如果下载有问题的,建议检查网络是否能够连接raw.githubusercontent.com

获取APi

因为我域名解析放在腾讯云,走的DNSpod,所以我直接在DNSPOD上面获取API,方便以后自动续期。

企业微信截图_16351436904803.png

记录获取到的IDToken

脚本运行

重新开一个shell窗口,(或者刷新下环境变量,否则下面的脚本无法执行)

将记录的IDToken替换到下面的脚本中

千万注意大小写,来自Let'sEncrypt 免费通配符/泛域名SSL证书添加使用教程的提醒

export DP_Id='id'
export DP_Key="token"

acme.sh --set-default-ca  --server letsencrypt
acme.sh --issue --dns dns_dp -d *.djc8.cn -d djc8.cn

这样,等待一会即可申请成功,申请成功后会看到提示:

root#:Your cert is in: /root/.acme.sh/*.djc8.cn/*.djc8.cn.cer
root#:Your cert key is in: /root/.acme.sh/*.djc8.cn/*.djc8.cn.key
root#: The intermediate CA cert is in: /root/.acme.sh/*.djc8.cn/ca.cer
root#: And the full chain certs is there: /root/.acme.sh/*.djc8.cn/fullchain.cer

这些文件就是你要用的了。

踩坑

  1. export DP_Key ,没有注意大小写,导致提示:
You don't specify dnspod api key and key id yet.
Please create you key and try again.
Error add txt for domain:_acme-challenge.djc8.cn
Please add '--debug' or '--log' to check more details.
See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
  1. djc8.cn:Timeout

应该使用“Let's encrypt”,才对所以我在脚本中增加了

acme.sh --set-default-ca  --server letsencrypt

github解决方案见verifying or processing CA timeout is too short, exists after 30 times

自动续期

通过crontab -e可以看到已经将自动任务加入到cron计划中

其他有用的脚本

#升级
~/.acme.sh/acme.sh --upgrade
#自动升级
~/.acme.sh/acme.sh --upgrade --auto-upgrade
#关闭自动升级
~/.acme.sh/acme.sh --upgrade --auto-upgrade 0

其他参考

  1. 解决 acme.sh 自动签发 Let's Encrypt 证书失效
  2. 采用DNSPOD解析API快速验证域名快速安装免费Let's Encrypt证书
  3. 申请Let's Encrypt通配符HTTPS证书

本文来自:[ssl]腾讯云使用Let's Encrypt 做泛域名解析-小码农,转载请保留本条链接,感谢!

温馨提示:
本文最后更新于 2022年03月15日,已超过 864 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我
正文到此结束
本文目录