Certbot DNS 阿里云 ESA 插件
通过阿里云边缘安全加速(ESA)API 自动创建 TXT 记录,完成 Certbot DNS-01 验证,申请及续期普通域名和泛域名证书。
本插件适用于 NS 接入 ESA 的域名,且 NS 委派须已生效;CNAME 接入仍需使用原 DNS 服务商的 Certbot 插件。参见 ESA DNS 接入方式。
功能特性
- 自动分页查询站点,按 DNS 标签边界选择最长匹配项,无需手动填写站点 ID
- 支持普通域名、子域名、泛域名及国际化域名
- 支持多个挑战共用记录名,仅清理本次创建的记录,保留已有 TXT 记录
- 支持 AccessKey 和 STS 临时凭证
- 支持 Certbot 3、4、5 和 Python 3.9–3.15
Python 3.9 支持 Certbot 3/4,Python 3.10–3.13 支持 Certbot 3/4/5,Python 3.14–3.15 支持 Certbot 4/5。使用 Certbot 3 时需额外安装 pyopenssl<25。
安装
在实际运行 Certbot 的 Python 环境中,从源码安装:
pip install .
certbot plugins --text
输出应包含 dns-esa。使用 Certbot 3 时执行 pip install 'pyopenssl<25'。
配置文件
保存为 ~/esa.ini:
dns_esa_access_key_id = YOUR_ACCESS_KEY_ID
dns_esa_access_key_secret = YOUR_ACCESS_KEY_SECRET
# 可选,默认 cn-hangzhou;国际站可使用 ap-southeast-1
dns_esa_region_id = cn-hangzhou
# 可选,仅使用 STS 临时凭证时填写
# dns_esa_security_token = YOUR_SECURITY_TOKEN
region_id 应与站点所在的 API 地域一致。插件只查询所选地域,不会跨地域猜测。支持的公网接入点为杭州和新加坡,参见 ESA 服务接入点。使用 STS 时,续期前需确保凭证仍有效。
限制凭证文件权限:
chmod 600 ~/esa.ini
Windows 用户请通过系统文件权限限制访问。
运行
certbot certonly \
--authenticator dns-esa \
--dns-esa-credentials ~/esa.ini \
--dns-esa-propagation-seconds 30 \
-d '*.example.com' \
-d example.com
DNS 传播等待默认 30 秒,可根据实际情况增加。TXT TTL 默认 600 秒,可通过 --dns-esa-ttl 调整;1 表示 ESA 自动 TTL,其余允许值取决于服务限制。创建记录超时后插件不会自动重试写入,以避免重复创建。
后续使用 certbot renew 自动续期。可先使用 certbot renew --dry-run 检查续期配置。
阿里云权限配置
AccessKey 需具备 AliyunESAFullAccess,或包含以下操作的自定义 RAM 权限:
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"esa:ListSites",
"esa:ListRecords",
"esa:CreateRecord",
"esa:DeleteRecord"
],
"Resource": "*"
}
]
}
ListSites 和 DeleteRecord 需要 Resource: "*";ListRecords 和 CreateRecord 可进一步限制到指定站点。参见 ListSites、ListRecords、CreateRecord、DeleteRecord。
自动部署
本项目只负责 Certbot DNS 验证;申请后的自动部署可配合 AutoCert。
实现参考 certbot-dns-aliyun-next。
Metadata
Release files for certbot-dns-esa 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| certbot_dns_esa-1.0.0.tar.gz | 281.7 kB | With provenance | Details for certbot_dns_esa-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| certbot_dns_esa-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for certbot_dns_esa-1.0.0-py3-none-any.whl |
Total release size: 291.8 kB
Release files / certbot_dns_esa-1.0.0.tar.gz
| Download URL | certbot_dns_esa-1.0.0.tar.gz |
|---|---|
| Size | 281.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d0a9cf53d42d01a4fdadbc44c0ba73049bfde39065e77d39b134b07622a3f97
|
|
BLAKE2b-256 checksum How to use checksums |
ac527b1e7a02d30b6f90e37964212555819c7bc1fbd5853e0bdaa604db878df6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / certbot_dns_esa-1.0.0-py3-none-any.whl
| Download URL | certbot_dns_esa-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7474536591772b09869f4672918d8bbffd261cfbee9e35b7706296714a44b53a
|
|
BLAKE2b-256 checksum How to use checksums |
4d005f176402f567c9cde4b7c4dd105ee02cb65c746be7092cf30cb6785cb509
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for certbot-dns-esa 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for certbot_dns_esa-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.