diff --git a/docs/certbot_use_dns_check.md b/docs/certbot_use_dns_check.md new file mode 100644 index 0000000..c1d9887 --- /dev/null +++ b/docs/certbot_use_dns_check.md @@ -0,0 +1,46 @@ +# 使用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可以找到的地方,既可以使用了 + diff --git a/makeenv b/makeenv index 424a84d..e8ae7bf 100755 --- a/makeenv +++ b/makeenv @@ -112,6 +112,8 @@ sudo systemctl enable {name}.service sudo systemctl start {name} """) +od.system('chmod +x script/*.sh') + with codecs.open(f'./conf/config.json', 'w', 'utf-8') as f: f.write(config_str) @@ -137,7 +139,7 @@ with codecs.open(f'{home}/bin/{venv}py', 'w', 'utf-8') as f: with codecs.open(f'{home}/bin/{venv}pip', 'w', 'utf-8') as f: f.write(f"""#!/usr/bin/bash -~/ve/ms/bin/pip $* +~/ve/{venv}/bin/pip $* """) os.system(f'chmod +x {home}/bin/{venv}*')