0.0.2 • Published 2 years ago
@planet-matrix/huaweiyun-certbot-dns-hook v0.0.2
@planet-matrix/huaweiyun-certbot-dns-hook
方便的对运行在 华为云 上的域名进行 certbot-dns 挑战.
安装
npm i -g @planet-matrix/huaweiyun-certbot-dns-hook使用
首先您需要保证您的 dns 解析记录里存在您设置的子域名解析.
例如, 如果您的域名是aaa.com., 您想为bbb.aaa.com.这个子域设置 ssl 证书, 您就必须先手动设置好bbb.aaa.com.的解析记录.
接下来安装 certbot.
接下来创建两个文件, windows 和 linux 略有不同.
- 文件后缀名不同, windows 是
.cmd或.bat, linux 是.sh. - 设置环境变量的写法不同, windows 是
set, linux 是export.
下面的示例使用 windows 的写法:
auth.cmd:
set AK=xxx
set SK=xxx
set ENDPOINT=xxx
set PROJECT_ID=xxx
set ZONE_ID=xxx
planet-matrix-huaweiyun-certbot-dns-hook-authcleanup.cmd:
set AK=xxx
set SK=xxx
set ENDPOINT=xxx
set PROJECT_ID=xxx
set ZONE_ID=xxx
planet-matrix-huaweiyun-certbot-dns-hook-cleanup最后执行命令:
certbot certonly --manual --non-interactive --preferred-challenges=dns --manual-auth-hook <auth文件路径> --manual-cleanup-hook <cleanup文件路径> --agree-tos -m <邮箱> -d <完整子域名>- 执行后会卡住很久, 是正常的, 因为要等待 dns 传播. 现在设置的是等待一分钟.
- 续期时重新执行以上命令即可.