https://certbot.eff.org/
客户在申请 Let’s Encrypt 证书的时候,需要校验域名的所有权,证明操作者有权利为该域名申请证书,目前支持三种验证方式:
dns-01:给域名添加一个 DNS TXT 记录。
http-01:在域名对应的 Web 服务器下放置一个 HTTP well-known URL 资源文件。
tls-sni-01:在域名对应的 Web 服务器下放置一个 HTTPS well-known URL 资源文件。
使用 Certbot 客户端申请证书方法非常的简单,只需如下一行命令就搞定了。
文件名 内容
cert.pem 服务端证书
chain.pem 浏览器需要的所有证书但不包括服务端证书,比如根证书和中间证书
fullchain.pem 包括了cert.pem和chain.pem的内容
privkey.pem 证书的私钥
一般情况下 fullchain.pem 和 privkey.pem 就够用了
1、申请通配符证书,只能使用 dns-01 的方式。
安装 certbot-dns-dnspod
https://github.com/tengattack/certbot-dns-dnspod
pip install certbot-dns-dnspod
certbot certonly -a certbot-dns-dnspod:dns-dnspod --certbot-dns-dnspod:dns-dnspod-credentials /etc/letsencrypt/credentials.ini -d xinling114.cn -d "*.xinling114.cn" --server https://acme-v02.api.letsencrypt.org/directory
# -a:指定使用的插件 # --certbot-dns-dnspod:指定dnspod使用的token文件 # -d:指定要生成证书的域名 # --server:指定ACME的版本
2、申请单域名证书
同上
3、免费证书默认有效期为 90 天,到期后如果要续期可以执行
certbot renew --dry-run