47 lines
1.3 KiB
Markdown
47 lines
1.3 KiB
Markdown
|
# 使用dns检查发放let‘s 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可以找到的地方,既可以使用了
|
|||
|
|