Skip to main content

Certbot DNS 阿里云插件

这是一个用于 Certbot 的阿里云 DNS 插件,支持通过阿里云 DNS API 进行 DNS-01 验证来获取 SSL 证书。支持泛域名。

功能特性

  • 支持通过阿里云 DNS API 自动管理 DNS 记录
  • 支持普通域名、子域名和泛域名
  • 支持 Certbot 3 和 5
  • 兼容 Python 3.9–3.14
  • 支持 DNS-01 验证方式
  • 自动清理本次创建的临时 DNS 记录,保留已有记录
  • 支持 STS 临时凭证
  • 完善的错误处理和日志记录

Python 3.9 使用 Certbot 3,Python 3.10–3.13 支持 Certbot 3 和 5,Python 3.14 使用 Certbot 5。

安装

从 PyPI 安装

pip3 install certbot-dns-aliyun-next

插件需安装在实际运行的 Certbot 所在的 Python 环境中。

配置文件

dns_aliyun_next_access_key_id = YOUR_ACCESS_KEY_ID
dns_aliyun_next_access_key_secret = YOUR_ACCESS_KEY_SECRET
# 可选,默认 cn-hangzhou
dns_aliyun_next_region_id = cn-hangzhou
# 可选,STS 临时凭证
dns_aliyun_next_security_token = YOUR_SECURITY_TOKEN

使用 AccessKey 长期凭证时无需配置 security_token。使用 STS 临时凭证时,续期前需确保凭证仍有效。

插件自动查询并匹配阿里云托管域名,无需手动配置。

修改配置文件权限(假如文件是 ~/aliyun.ini):

chmod 600 ~/aliyun.ini

Windows 用户请通过系统文件权限限制凭证文件的访问。

运行

certbot certonly \
  --authenticator dns-aliyun-next \
  --dns-aliyun-next-credentials ~/aliyun.ini \
  --dns-aliyun-next-propagation-seconds 30 \
  -d "*.example.com" \
  -d "example.com"

DNS 传播等待默认 30 秒,可根据实际情况调整。TXT 记录 TTL 默认 600 秒,可通过 --dns-aliyun-next-ttl 设置,实际允许值取决于阿里云套餐。

后续使用 certbot renew 自动续期。

阿里云权限配置

确保您的阿里云 AccessKey 具有 AliyunDNSFullAccess,或自定义权限策略包含:

  • alidns:AddDomainRecord
  • alidns:DeleteDomainRecord
  • alidns:DescribeDomainRecords
  • alidns:DescribeDomains

从 1.x 升级时可继续使用原来的认证器名称、命令行参数和 AccessKey 配置。使用自定义权限策略时,请新增 DescribeDomains 权限。

自动部署

此程序只是 Certbot 的 DNS 验证插件,如果需要自动运行申请部署,可以使用 AutoCert。

Metadata

Release files for certbot-dns-aliyun-next 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for certbot-dns-aliyun-next 2.0.0
File Size Uploaded
certbot_dns_aliyun_next-2.0.0.tar.gz 247.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for certbot-dns-aliyun-next 2.0.0
File Interpreter ABI Platform
certbot_dns_aliyun_next-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 256.9 kB

Release files / certbot_dns_aliyun_next-2.0.0.tar.gz

Download URL certbot_dns_aliyun_next-2.0.0.tar.gz
Size 247.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1c7e2f1f99b4c485a481f1e3533a02e05a30dc60fab24b6897a40e3e16052f26
BLAKE2b-256 checksum
How to use checksums
73e3ccef052afcf24ef544ae1ba666572764ada9ec309f3f43867c74d27e4c08
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 7, 2026.

Transparency log

Release files / certbot_dns_aliyun_next-2.0.0-py3-none-any.whl

Download URL certbot_dns_aliyun_next-2.0.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcde3431c5e1791d05093f824d2a4f51ede1614c049f70f4bc70323226e60688
BLAKE2b-256 checksum
How to use checksums
9a47473a8dacb6da5b4af1518629096d958605f538193db22101c5a1dcc73af2
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 7, 2026.

Transparency log

Release history Release notifications | RSS feed

2.0.2

2 release files

2.0.1

2 release files

This release

2.0.0 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page