shtools/docs/certbot_use_dns_check.md
2025-01-03 14:05:10 +08:00

47 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 使用dns检查发放lets encrypt的证书
## 依赖软件
* [certbot](https://certbot.eff.org)
* [acme-dns-certbot](https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py)
## 域名控制权
所使用的域名能增加域名解析
## 安装软件
### 安装certbot
以nginx pip为例
```
apt update
apt install python3 python3-venv libaugeas0
python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install certbot certbot-nginx
ln -s /opt/certbot/bin/certbot /usr/bin/certbot
```
### 安装acme-dns-certbot
```
wget https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py
chmod +x acme-dns-auth.py
vi acme-dns-auth.py
####CHANGE FIRST LINE TO
#!/usr/bin/env python3
####END
mkdir mv /etc/letsencrypt/
mv acme-dns-auth.py /etc/letsencrypt/
```
## 申请证书
```
sudo certbot certonly --manual --manual-auth-hook /etc/letsencrypt/acme-dns-auth.py --preferred-challenges dns --debug-challenges -d \*.your-domain -d your-domain
```
按照程序输出中的内容类似这样_acme-challenge.psaqc.com CNAME 052a7281-14b4-42eb-8691-ca97618cc7ae.auth.acme-dns.io. )添加到你的域名的解析中。
解析生效后回车让程序执行完成,即完成了证书的申请
## 使用证书
生成的证书在/etc/letsencrypt/下寻找找到好可以将证书放在nginx可以找到的地方既可以使用了