certbot-dns-esa 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,253 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # Local AI development instructions, configuration, sessions and caches
223
+ AGENTS.md
224
+ AGENTS.override.md
225
+ CLAUDE*.md
226
+ GEMINI*.md
227
+ CODEX*.md
228
+ .ai/
229
+ .codex/
230
+ .claude/
231
+ .cursor/
232
+ .cursorrules
233
+ .cursorignore
234
+ .cursorindexingignore
235
+ .gemini/
236
+ .aider*
237
+ .continue/
238
+ .windsurf/
239
+ .windsurfrules
240
+ .cline/
241
+ .clinerules
242
+ .roo/
243
+ .roorules
244
+ .opencode/
245
+ .copilot/
246
+ .agents/
247
+ .agent/
248
+ .skills/
249
+ /.github/copilot-instructions.md
250
+ /.github/instructions/
251
+ /.github/prompts/
252
+ /.github/agents/
253
+ /.github/skills/
@@ -0,0 +1,8 @@
1
+ # 更新日志
2
+
3
+ ## 1.0.0
4
+
5
+ - 基于官方 ESA 2024-09-10 SDK 实现 Certbot DNS-01 验证。
6
+ - 自动发现 NS 托管站点,支持国际化域名和最长站点匹配。
7
+ - 支持多挑战、TXT 记录所有权追踪、已有记录保护和清理重试。
8
+ - 提供 Certbot 3/4/5 的 wheel 安装验证、兼容测试与 CI/CD。
@@ -0,0 +1,29 @@
1
+ # 开发与验证
2
+
3
+ 使用 uv 管理依赖,`pyproject.toml` 为版本、依赖、入口和构建配置的唯一来源。
4
+
5
+ ```bash
6
+ uv sync --locked --python 3.13
7
+ uv run --no-sync ruff check .
8
+ uv run --no-sync ruff format --check .
9
+ uv run --no-sync pytest --cov=certbot_dns_esa --cov-report=term-missing
10
+ ```
11
+
12
+ 测试模拟外部 API,不修改真实 DNS,也不向 ACME 服务申请证书。SDK 请求和响应使用真实 DTO;另通过模拟 HTTP 传输验证 SDK 不会重试写入。
13
+
14
+ 兼容矩阵使用 tox-uv 构建并安装 wheel,从源码目录之外运行测试,校验实际宿主版本、插件入口、导入路径及 `certbot plugins --text`:
15
+
16
+ ```bash
17
+ uv python install 3.9 3.10 3.11 3.12 3.13 3.14 3.15
18
+ uv run --no-sync tox run-parallel -p 4
19
+ uv build
20
+ uv run --no-sync twine check --strict dist/*
21
+ ```
22
+
23
+ 矩阵共 18 组:Python 3.9–3.13 × Certbot 3、Python 3.9–3.15 × Certbot 4、Python 3.10–3.15 × Certbot 5。Certbot 3 测试固定最低版本 3.0.0,并限制 `pyopenssl<25`;该限制不能加入插件运行依赖,否则会与 Certbot 4/5 冲突。Python 3.14 及以后不支持旧 josepy 1.x,限定使用 Certbot 4/5。
24
+
25
+ 修改依赖后执行 `uv lock`;修改认证行为或兼容边界后运行单元测试及完整矩阵;修改发行配置后构建并校验 wheel/sdist。
26
+
27
+ 认证器复用 Certbot 公共生命周期。站点必须通过完整分页发现并按 DNS 标签边界匹配,查询失败不得猜测站点。仅删除本次创建且保存了 ID 的记录;已有记录不得更新或删除。SDK 超时和重试策略应同时通过实际传输层测试验证。
28
+
29
+ GitHub Actions 对 push/PR 执行检查。发布工作流在 release 发布时复用完整 CI,检查标签为 `v{项目版本}`;预发布版本只验证,正式版本验证成功后使用 PyPI Trusted Publishing 发布。需在仓库配置 `pypi` environment 及 PyPI 的可信发布者。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 TiyeeJiang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: certbot-dns-esa
3
+ Version: 1.0.0
4
+ Summary: 阿里云边缘安全加速 ESA DNS 插件,用于 Certbot 的 DNS-01 验证
5
+ Project-URL: Homepage, https://github.com/tiyee/certbot-dns-esa
6
+ Project-URL: Repository, https://github.com/tiyee/certbot-dns-esa
7
+ Project-URL: Issues, https://github.com/tiyee/certbot-dns-esa/issues
8
+ Author-email: tiyee <tiyee@live.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: acme,aliyun,certbot,dns-01,esa
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Plugins
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Programming Language :: Python :: 3.15
24
+ Classifier: Topic :: Security
25
+ Requires-Python: >=3.9
26
+ Requires-Dist: acme<6,>=3
27
+ Requires-Dist: alibabacloud-esa20240910<4,>=3.16
28
+ Requires-Dist: alibabacloud-tea-openapi<1,>=0.4.5
29
+ Requires-Dist: certbot<5,>=3; python_version < '3.10'
30
+ Requires-Dist: certbot<6,>=3; python_version >= '3.10' and python_version < '3.14'
31
+ Requires-Dist: certbot<6,>=4; python_version >= '3.14'
32
+ Requires-Dist: darabonba-core<2,>=1.0.8
33
+ Requires-Dist: importlib-metadata<9,>=4.6; python_version < '3.10'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Certbot DNS 阿里云 ESA 插件
37
+
38
+ 通过阿里云边缘安全加速(ESA)API 自动创建 TXT 记录,完成 Certbot DNS-01 验证,申请及续期普通域名和泛域名证书。
39
+
40
+ 本插件适用于 **NS 接入 ESA** 的域名,且 NS 委派须已生效;CNAME 接入仍需使用原 DNS 服务商的 Certbot 插件。参见 [ESA DNS 接入方式](https://help.aliyun.com/zh/edge-security-acceleration/esa/user-guide/dns-overview/)。
41
+
42
+ ## 功能特性
43
+
44
+ - 自动分页查询站点,按 DNS 标签边界选择最长匹配项,无需手动填写站点 ID
45
+ - 支持普通域名、子域名、泛域名及国际化域名
46
+ - 支持多个挑战共用记录名,仅清理本次创建的记录,保留已有 TXT 记录
47
+ - 支持 AccessKey 和 STS 临时凭证
48
+ - 支持 Certbot 3、4、5 和 Python 3.9–3.15
49
+
50
+ 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`。
51
+
52
+ ## 安装
53
+
54
+ 在实际运行 Certbot 的 Python 环境中,从源码安装:
55
+
56
+ ```bash
57
+ pip install .
58
+ certbot plugins --text
59
+ ```
60
+
61
+ 输出应包含 `dns-esa`。使用 Certbot 3 时执行 `pip install 'pyopenssl<25'`。
62
+
63
+ ## 配置文件
64
+
65
+ 保存为 `~/esa.ini`:
66
+
67
+ ```ini
68
+ dns_esa_access_key_id = YOUR_ACCESS_KEY_ID
69
+ dns_esa_access_key_secret = YOUR_ACCESS_KEY_SECRET
70
+ # 可选,默认 cn-hangzhou;国际站可使用 ap-southeast-1
71
+ dns_esa_region_id = cn-hangzhou
72
+ # 可选,仅使用 STS 临时凭证时填写
73
+ # dns_esa_security_token = YOUR_SECURITY_TOKEN
74
+ ```
75
+
76
+ `region_id` 应与站点所在的 API 地域一致。插件只查询所选地域,不会跨地域猜测。支持的公网接入点为杭州和新加坡,参见 [ESA 服务接入点](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint)。使用 STS 时,续期前需确保凭证仍有效。
77
+
78
+ 限制凭证文件权限:
79
+
80
+ ```bash
81
+ chmod 600 ~/esa.ini
82
+ ```
83
+
84
+ Windows 用户请通过系统文件权限限制访问。
85
+
86
+ ## 运行
87
+
88
+ ```bash
89
+ certbot certonly \
90
+ --authenticator dns-esa \
91
+ --dns-esa-credentials ~/esa.ini \
92
+ --dns-esa-propagation-seconds 30 \
93
+ -d '*.example.com' \
94
+ -d example.com
95
+ ```
96
+
97
+ DNS 传播等待默认 30 秒,可根据实际情况增加。TXT TTL 默认 600 秒,可通过 `--dns-esa-ttl` 调整;`1` 表示 ESA 自动 TTL,其余允许值取决于服务限制。创建记录超时后插件不会自动重试写入,以避免重复创建。
98
+
99
+ 后续使用 `certbot renew` 自动续期。可先使用 `certbot renew --dry-run` 检查续期配置。
100
+
101
+ ## 阿里云权限配置
102
+
103
+ AccessKey 需具备 `AliyunESAFullAccess`,或包含以下操作的自定义 RAM 权限:
104
+
105
+ ```json
106
+ {
107
+ "Version": "1",
108
+ "Statement": [
109
+ {
110
+ "Effect": "Allow",
111
+ "Action": [
112
+ "esa:ListSites",
113
+ "esa:ListRecords",
114
+ "esa:CreateRecord",
115
+ "esa:DeleteRecord"
116
+ ],
117
+ "Resource": "*"
118
+ }
119
+ ]
120
+ }
121
+ ```
122
+
123
+ `ListSites` 和 `DeleteRecord` 需要 `Resource: "*"`;`ListRecords` 和 `CreateRecord` 可进一步限制到指定站点。参见 [ListSites](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-listsites)、[ListRecords](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-listrecords)、[CreateRecord](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-createrecord)、[DeleteRecord](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-deleterecord)。
124
+
125
+ ## 自动部署
126
+
127
+ 本项目只负责 Certbot DNS 验证;申请后的自动部署可配合 [AutoCert](https://github.com/tiyee/AutoCert)。
128
+
129
+ 实现参考 [certbot-dns-aliyun-next](https://github.com/tiyee/certbot-dns-aliyun-next)。
@@ -0,0 +1,94 @@
1
+ # Certbot DNS 阿里云 ESA 插件
2
+
3
+ 通过阿里云边缘安全加速(ESA)API 自动创建 TXT 记录,完成 Certbot DNS-01 验证,申请及续期普通域名和泛域名证书。
4
+
5
+ 本插件适用于 **NS 接入 ESA** 的域名,且 NS 委派须已生效;CNAME 接入仍需使用原 DNS 服务商的 Certbot 插件。参见 [ESA DNS 接入方式](https://help.aliyun.com/zh/edge-security-acceleration/esa/user-guide/dns-overview/)。
6
+
7
+ ## 功能特性
8
+
9
+ - 自动分页查询站点,按 DNS 标签边界选择最长匹配项,无需手动填写站点 ID
10
+ - 支持普通域名、子域名、泛域名及国际化域名
11
+ - 支持多个挑战共用记录名,仅清理本次创建的记录,保留已有 TXT 记录
12
+ - 支持 AccessKey 和 STS 临时凭证
13
+ - 支持 Certbot 3、4、5 和 Python 3.9–3.15
14
+
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`。
16
+
17
+ ## 安装
18
+
19
+ 在实际运行 Certbot 的 Python 环境中,从源码安装:
20
+
21
+ ```bash
22
+ pip install .
23
+ certbot plugins --text
24
+ ```
25
+
26
+ 输出应包含 `dns-esa`。使用 Certbot 3 时执行 `pip install 'pyopenssl<25'`。
27
+
28
+ ## 配置文件
29
+
30
+ 保存为 `~/esa.ini`:
31
+
32
+ ```ini
33
+ dns_esa_access_key_id = YOUR_ACCESS_KEY_ID
34
+ dns_esa_access_key_secret = YOUR_ACCESS_KEY_SECRET
35
+ # 可选,默认 cn-hangzhou;国际站可使用 ap-southeast-1
36
+ dns_esa_region_id = cn-hangzhou
37
+ # 可选,仅使用 STS 临时凭证时填写
38
+ # dns_esa_security_token = YOUR_SECURITY_TOKEN
39
+ ```
40
+
41
+ `region_id` 应与站点所在的 API 地域一致。插件只查询所选地域,不会跨地域猜测。支持的公网接入点为杭州和新加坡,参见 [ESA 服务接入点](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-endpoint)。使用 STS 时,续期前需确保凭证仍有效。
42
+
43
+ 限制凭证文件权限:
44
+
45
+ ```bash
46
+ chmod 600 ~/esa.ini
47
+ ```
48
+
49
+ Windows 用户请通过系统文件权限限制访问。
50
+
51
+ ## 运行
52
+
53
+ ```bash
54
+ certbot certonly \
55
+ --authenticator dns-esa \
56
+ --dns-esa-credentials ~/esa.ini \
57
+ --dns-esa-propagation-seconds 30 \
58
+ -d '*.example.com' \
59
+ -d example.com
60
+ ```
61
+
62
+ DNS 传播等待默认 30 秒,可根据实际情况增加。TXT TTL 默认 600 秒,可通过 `--dns-esa-ttl` 调整;`1` 表示 ESA 自动 TTL,其余允许值取决于服务限制。创建记录超时后插件不会自动重试写入,以避免重复创建。
63
+
64
+ 后续使用 `certbot renew` 自动续期。可先使用 `certbot renew --dry-run` 检查续期配置。
65
+
66
+ ## 阿里云权限配置
67
+
68
+ AccessKey 需具备 `AliyunESAFullAccess`,或包含以下操作的自定义 RAM 权限:
69
+
70
+ ```json
71
+ {
72
+ "Version": "1",
73
+ "Statement": [
74
+ {
75
+ "Effect": "Allow",
76
+ "Action": [
77
+ "esa:ListSites",
78
+ "esa:ListRecords",
79
+ "esa:CreateRecord",
80
+ "esa:DeleteRecord"
81
+ ],
82
+ "Resource": "*"
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ `ListSites` 和 `DeleteRecord` 需要 `Resource: "*"`;`ListRecords` 和 `CreateRecord` 可进一步限制到指定站点。参见 [ListSites](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-listsites)、[ListRecords](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-listrecords)、[CreateRecord](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-createrecord)、[DeleteRecord](https://help.aliyun.com/zh/edge-security-acceleration/esa/api-esa-2024-09-10-deleterecord)。
89
+
90
+ ## 自动部署
91
+
92
+ 本项目只负责 Certbot DNS 验证;申请后的自动部署可配合 [AutoCert](https://github.com/tiyee/AutoCert)。
93
+
94
+ 实现参考 [certbot-dns-aliyun-next](https://github.com/tiyee/certbot-dns-aliyun-next)。
@@ -0,0 +1,5 @@
1
+ """Alibaba Cloud ESA DNS-01 authenticator for Certbot."""
2
+
3
+ from certbot_dns_esa.compat import metadata
4
+
5
+ __version__ = metadata.version("certbot-dns-esa")
@@ -0,0 +1,24 @@
1
+ """Keep host compatibility in one place, using Certbot's public APIs.
2
+
3
+ DNSAuthenticator already handles the annotated-challenge API changes between
4
+ Certbot 3, 4 and 5. Inherit its public lifecycle instead of copying it or applying
5
+ the obsolete zope.interface decorators (removed from Certbot's dependencies).
6
+ """
7
+
8
+ import sys
9
+
10
+ from certbot.plugins.dns_common import DNSAuthenticator
11
+
12
+ if sys.version_info < (3, 10):
13
+ # Python 3.9's stdlib entry_points() does not support the group keyword.
14
+ import importlib_metadata as metadata
15
+ else:
16
+ from importlib import metadata
17
+
18
+
19
+ def certbot_major_version() -> int:
20
+ """Return the actual installed host version, not a resolver assumption."""
21
+ return int(metadata.version("certbot").split(".", 1)[0])
22
+
23
+
24
+ __all__ = ["DNSAuthenticator", "certbot_major_version", "metadata"]