基于 acme.sh脚本 DNS别名功能 分批申请证书

一、写本外壳背景

  1. acme.sh 使用 DNS alias mode 功能 申请 Let's Encrypt 证书,如果申请DNS域大约超过8个以上就会遇到 Incorrect TXT record错误。本人大致看了acme.sh脚本alias mode功能暂时没有发现脚本中间有bug,后本人没有办法就在acme.sh脚本外面套一层外壳,具体使用方法见下面内容。

二、使用本外壳前准备环境

  1. acme.sh 脚本安装
  2. 设置DNS CNAME 记录
  3. 安装Python3环境
  4. 下载 letsencrypt-dns-alias.py

三、本外壳使用注意

  1. 只支持DNS alias mode 功能
  2. 只支持--challenge-alias参数,不支持--domain-alias参数。
  3. 不能往外壳传入--domain -d --domain-alias --challenge-alias --dns --log-level --log参数。
  4. 每次向Let's Encrypt申请5个域名,依次累加,申请通过的域名在一断时间内不需要再次验证。
  5. 开启记录日志模式,日志级别为 2
  6. 申请证书失败时,支持重试2次,每次等待20秒。
  7. acme.sh脚本一定要安装在/root/.acme.sh目录下

四、使用方法

  1. 第一次使用下面命令
$ letsencrypt-dns-alias.py --command="--issue" --challenge-alias="alias domain" --dns="dns_ali" --key-name="Ali_Key" --secret-name="Ali_Secret" --key="***" --secret="***" --domain="*.a.com,*.b.com"
  1. 如果acme.sh脚本已记录DNS厂商AK值,可以使用下面命令。
$ letsencrypt-dns-alias.py --command="--issue" --challenge-alias="alias domain" --dns="dns_ali" --domain="*.a.com,*.b.com"
  1. 上面命令中--key-name="Ali_Key" --secret-name="Ali_Secret" 是DNS厂商api名称,具体api支持见How to use DNS API

关注我

欢迎大家关注交流,定期分享自动化运维、DevOps、Kubernetes、Service Mesh和Cloud Native

image

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容