CertBot搭配DNSPod

cliouo / 2024-08-12 / 原文

CertBot搭配DNSPod

summary: cetbot搭配dnspod实现自动注册ssl证书和自动续期

😀 Certbot: Certbot 是一个免费的开源软件工具,用于自动使用 Let's Encrypt 服务获取、安装和更新 SSL/TLS 证书,以便在网站上启用 HTTPS。它主要通过自动化流程简化了证书的部署和维护,支持多种操作系统和Web服务器。

1.安装pip、venv、新建certbot虚拟环境并激活

apt install python3-pip
apt install python3.11-venv
python3 -m venv certbot-env
source certbot-env/bin/activate

2. pip安装certbot

  • 虚拟环境内安装certbot,pip安装的优点为版本是最新的,(使用豆瓣源)
pip3 install certbot -i https://pypi.doubanio.com/simple/

3.安装DNSPod扩展

https://github.com/tengattack/certbot-dns-dnspod

pip install git+https://github.com/tengattack/certbot-dns-dnspod.git
  • (optional)如若提示缺失zope
pip install zope.interface -i https://pypi.doubanio.com/simple/

4.certbot-dns-dnspod 配置文件

编辑dnspod的配置ini文件

dns_dnspod_api_id = 12345
dns_dnspod_api_token = 1234567890abcdef1234567890abcdef

5.certbot搭配插件使用

certbot certonly -a dns-dnspod \
  --dns-dnspod-credentials /etc/letsencrypt/dnspod.ini \
  -d example.com \
  -d *.example.com

6.Certbot 常用管理命令

  • 查看certbot当前管理的证书
certbot certificates 
  • 续期
certbot renew