certbot-dns-dnspod-109 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.
- certbot_dns_dnspod_109-1.0.0/LICENSE.txt +190 -0
- certbot_dns_dnspod_109-1.0.0/PKG-INFO +207 -0
- certbot_dns_dnspod_109-1.0.0/Readme.md +191 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109/__init__.py +91 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109/_internal/__init__.py +1 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109/_internal/dns_dnspod.py +151 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109/_internal/tests/__init__.py +1 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109/_internal/tests/dns_dnspod_test.py +201 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109.egg-info/PKG-INFO +207 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109.egg-info/SOURCES.txt +14 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109.egg-info/dependency_links.txt +1 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109.egg-info/entry_points.txt +2 -0
- certbot_dns_dnspod_109-1.0.0/certbot_dns_dnspod_109.egg-info/top_level.txt +1 -0
- certbot_dns_dnspod_109-1.0.0/pyproject.toml +18 -0
- certbot_dns_dnspod_109-1.0.0/setup.cfg +4 -0
- certbot_dns_dnspod_109-1.0.0/setup.py +64 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Copyright 2015 Electronic Frontier Foundation and others
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
Apache License
|
|
16
|
+
Version 2.0, January 2004
|
|
17
|
+
http://www.apache.org/licenses/
|
|
18
|
+
|
|
19
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
20
|
+
|
|
21
|
+
1. Definitions.
|
|
22
|
+
|
|
23
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
24
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
25
|
+
|
|
26
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
27
|
+
the copyright owner that is granting the License.
|
|
28
|
+
|
|
29
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
30
|
+
other entities that control, are controlled by, or are under common
|
|
31
|
+
control with that entity. For the purposes of this definition,
|
|
32
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
33
|
+
direction or management of such entity, whether by contract or
|
|
34
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
35
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
36
|
+
|
|
37
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
38
|
+
exercising permissions granted by this License.
|
|
39
|
+
|
|
40
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
41
|
+
including but not limited to software source code, documentation
|
|
42
|
+
source, and configuration files.
|
|
43
|
+
|
|
44
|
+
"Object" form shall mean any form resulting from mechanical
|
|
45
|
+
transformation or translation of a Source form, including but
|
|
46
|
+
not limited to compiled object code, generated documentation,
|
|
47
|
+
and conversions to other media types.
|
|
48
|
+
|
|
49
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
50
|
+
Object form, made available under the License, as indicated by a
|
|
51
|
+
copyright notice that is included in or attached to the work
|
|
52
|
+
(an example is provided in the Appendix below).
|
|
53
|
+
|
|
54
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
55
|
+
form, that is based on (or derived from) the Work and for which the
|
|
56
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
57
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
58
|
+
of this License, Derivative Works shall not include works that remain
|
|
59
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
60
|
+
the Work and Derivative Works thereof.
|
|
61
|
+
|
|
62
|
+
"Contribution" shall mean any work of authorship, including
|
|
63
|
+
the original version of the Work and any modifications or additions
|
|
64
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
65
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
66
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
67
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
68
|
+
means any form of electronic, verbal, or written communication sent
|
|
69
|
+
to the Licensor or its representatives, including but not limited to
|
|
70
|
+
communication on electronic mailing lists, source code control systems,
|
|
71
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
72
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
73
|
+
excluding communication that is conspicuously marked or otherwise
|
|
74
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
75
|
+
|
|
76
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
77
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
78
|
+
subsequently incorporated within the Work.
|
|
79
|
+
|
|
80
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
81
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
82
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
83
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
84
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
85
|
+
Work and such Derivative Works in Source or Object form.
|
|
86
|
+
|
|
87
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
88
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
89
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
90
|
+
(except as stated in this section) patent license to make, have made,
|
|
91
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
92
|
+
where such license applies only to those patent claims licensable
|
|
93
|
+
by such Contributor that are necessarily infringed by their
|
|
94
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
95
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
96
|
+
institute patent litigation against any entity (including a
|
|
97
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
98
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
99
|
+
or contributory patent infringement, then any patent licenses
|
|
100
|
+
granted to You under this License for that Work shall terminate
|
|
101
|
+
as of the date such litigation is filed.
|
|
102
|
+
|
|
103
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
104
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
105
|
+
modifications, and in Source or Object form, provided that You
|
|
106
|
+
meet the following conditions:
|
|
107
|
+
|
|
108
|
+
(a) You must give any other recipients of the Work or
|
|
109
|
+
Derivative Works a copy of this License; and
|
|
110
|
+
|
|
111
|
+
(b) You must cause any modified files to carry prominent notices
|
|
112
|
+
stating that You changed the files; and
|
|
113
|
+
|
|
114
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
115
|
+
that You distribute, all copyright, patent, trademark, and
|
|
116
|
+
attribution notices from the Source form of the Work,
|
|
117
|
+
excluding those notices that do not pertain to any part of
|
|
118
|
+
the Derivative Works; and
|
|
119
|
+
|
|
120
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
121
|
+
distribution, then any Derivative Works that You distribute must
|
|
122
|
+
include a readable copy of the attribution notices contained
|
|
123
|
+
within such NOTICE file, excluding those notices that do not
|
|
124
|
+
pertain to any part of the Derivative Works, in at least one
|
|
125
|
+
of the following places: within a NOTICE text file distributed
|
|
126
|
+
as part of the Derivative Works; within the Source form or
|
|
127
|
+
documentation, if provided along with the Derivative Works; or,
|
|
128
|
+
within a display generated by the Derivative Works, if and
|
|
129
|
+
wherever such third-party notices normally appear. The contents
|
|
130
|
+
of the NOTICE file are for informational purposes only and
|
|
131
|
+
do not modify the License. You may add Your own attribution
|
|
132
|
+
notices within Derivative Works that You distribute, alongside
|
|
133
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
134
|
+
that such additional attribution notices cannot be construed
|
|
135
|
+
as modifying the License.
|
|
136
|
+
|
|
137
|
+
You may add Your own copyright statement to Your modifications and
|
|
138
|
+
may provide additional or different license terms and conditions
|
|
139
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
140
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
141
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
142
|
+
the conditions stated in this License.
|
|
143
|
+
|
|
144
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
145
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
146
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
147
|
+
this License, without any additional terms or conditions.
|
|
148
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
149
|
+
the terms of any separate license agreement you may have executed
|
|
150
|
+
with Licensor regarding such Contributions.
|
|
151
|
+
|
|
152
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
153
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
154
|
+
except as required for reasonable and customary use in describing the
|
|
155
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
156
|
+
|
|
157
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
158
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
159
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
160
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
161
|
+
implied, including, without limitation, any warranties or conditions
|
|
162
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
163
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
164
|
+
appropriateness of using or redistributing the Work and assume any
|
|
165
|
+
risks associated with Your exercise of permissions under this License.
|
|
166
|
+
|
|
167
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
168
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
169
|
+
unless required by applicable law (such as deliberate and grossly
|
|
170
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
171
|
+
liable to You for damages, including any direct, indirect, special,
|
|
172
|
+
incidental, or consequential damages of any character arising as a
|
|
173
|
+
result of this License or out of the use or inability to use the
|
|
174
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
175
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
176
|
+
other commercial damages or losses), even if such Contributor
|
|
177
|
+
has been advised of the possibility of such damages.
|
|
178
|
+
|
|
179
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
180
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
181
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
182
|
+
or other liability obligations and/or rights consistent with this
|
|
183
|
+
License. However, in accepting such obligations, You may act only
|
|
184
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
185
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
186
|
+
defend, and hold each Contributor harmless for any liability
|
|
187
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
188
|
+
of your accepting any such warranty or additional liability.
|
|
189
|
+
|
|
190
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: certbot-dns-dnspod-109
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The `certbot-dns-dnspod-109` plugin automates the process of completing a `dns-01` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the Dnspod API (Tencent Cloud API 3.0).
|
|
5
|
+
Home-page: https://github.com/10935336/certbot-dns-dnspod-109
|
|
6
|
+
Author: 10935336
|
|
7
|
+
Author-email: 10935336 <109@pha.pub>
|
|
8
|
+
Project-URL: Homepage, https://github.com/10935336/certbot-dns-dnspod-109
|
|
9
|
+
Project-URL: Issues, https://github.com/10935336/certbot-dns-dnspod-109/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE.txt
|
|
16
|
+
|
|
17
|
+
[English](#english) | [简体中文](#%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# English
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Just Another DNSPod DNS Authenticator plugin for Certbot
|
|
24
|
+
The `certbot-dns-dnspod-109` plugin automates the process of
|
|
25
|
+
completing a `dns-01` challenge (`~acme.challenges.DNS01`)
|
|
26
|
+
by creating, and subsequently removing, TXT records using the
|
|
27
|
+
Dnspod API (Tencent Cloud API 3.0).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### 1. Install
|
|
32
|
+
|
|
33
|
+
#### pip:
|
|
34
|
+
```bash
|
|
35
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
36
|
+
```
|
|
37
|
+
or
|
|
38
|
+
```bash
|
|
39
|
+
pip install certbot-dns-dnspod-109
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#### snap:
|
|
44
|
+
```bash
|
|
45
|
+
snap install certbot-dns-dnspod-109
|
|
46
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
if root snap:
|
|
50
|
+
```bash
|
|
51
|
+
snap install certbot-dns-dnspod-109
|
|
52
|
+
snap set certbot trust-plugin-with-root=ok
|
|
53
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Obtain SecretId and SecretKey
|
|
57
|
+
1. Visit https://console.cloud.tencent.com/cam to create a sub-user
|
|
58
|
+
2. Select "Programmatic access" for the sub-user access method
|
|
59
|
+
3. Grant the sub-user QcloudDNSPodFullAccess (Cloud DNS full read and write access rights) permission
|
|
60
|
+
4. Record SecretId and SecretKey
|
|
61
|
+
|
|
62
|
+
### 3. Prepare Credentials File
|
|
63
|
+
|
|
64
|
+
foobar.ini:
|
|
65
|
+
```ini
|
|
66
|
+
dns_dnspod_109_secret_id=foo
|
|
67
|
+
dns_dnspod_109_secret_key=bar
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Ready to go
|
|
71
|
+
|
|
72
|
+
#### Usage Examples
|
|
73
|
+
|
|
74
|
+
To acquire a certificate for `example.com`
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
certbot certonly \
|
|
78
|
+
-a dns-dnspod-109 \
|
|
79
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
80
|
+
-d example.com
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
To acquire a single certificate for both example.com and www.example.com
|
|
84
|
+
```bash
|
|
85
|
+
certbot certonly \
|
|
86
|
+
-a dns-dnspod-109 \
|
|
87
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
88
|
+
-d example.com \
|
|
89
|
+
-d www.example.com
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To acquire a certificate for example.com, waiting 60 seconds for DNS propagation
|
|
93
|
+
```bash
|
|
94
|
+
certbot certonly \
|
|
95
|
+
-a dns-dnspod-109 \
|
|
96
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
97
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
98
|
+
-d example.com
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Test run
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
certbot certonly \
|
|
105
|
+
--register-unsafely-without-email \
|
|
106
|
+
-a dns-dnspod-109 \
|
|
107
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
108
|
+
-v \
|
|
109
|
+
--dry-run
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# 简体中文
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## 只是另一个适用于 Certbot 的 DNSPod DNS Authenticator 插件
|
|
124
|
+
|
|
125
|
+
`certbot-dns-dnspod-109` 插件通过使用 Dnspod API(腾讯云 API 3.0)创建并随后删除 TXT 记录,自动完成`dns-01` 质询(`~acme.challenges.DNS01`)。
|
|
126
|
+
|
|
127
|
+
## 使用方法
|
|
128
|
+
|
|
129
|
+
### 1. 安装
|
|
130
|
+
|
|
131
|
+
#### pip:
|
|
132
|
+
```bash
|
|
133
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
134
|
+
```
|
|
135
|
+
或者
|
|
136
|
+
```bash
|
|
137
|
+
pip install certbot-dns-dnspod-109
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### snap:
|
|
141
|
+
```bash
|
|
142
|
+
snap install certbot-dns-dnspod-109
|
|
143
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
如果你使用 root snap:
|
|
147
|
+
```bash
|
|
148
|
+
snap install certbot-dns-dnspod-109
|
|
149
|
+
snap set certbot trust-plugin-with-root=ok
|
|
150
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. 获取SecretId和SecretKey
|
|
154
|
+
1. 访问 https://console.cloud.tencent.com/cam 创建子用户
|
|
155
|
+
2. 子用户访问方式选择“编程访问”
|
|
156
|
+
3. 授予子用户 QcloudDNSPodFullAccess(Cloud DNS 完全读写访问权限)权限
|
|
157
|
+
4. 记录 SecretId 和 SecretKey
|
|
158
|
+
|
|
159
|
+
### 3. 准备凭证文件
|
|
160
|
+
|
|
161
|
+
foobar.ini:
|
|
162
|
+
```ini
|
|
163
|
+
dns_dnspod_109_secret_id=foo
|
|
164
|
+
dns_dnspod_109_secret_key=bar
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 4. 准备就绪
|
|
168
|
+
|
|
169
|
+
#### 使用示例
|
|
170
|
+
|
|
171
|
+
获取 `example.com` 的证书
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
certbot certonly \
|
|
175
|
+
-a dns-dnspod-109 \
|
|
176
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
177
|
+
-d example.com
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
获取同时有 `example.com` 和 `www.example.com` 的单个证书
|
|
181
|
+
```bash
|
|
182
|
+
certbot certonly \
|
|
183
|
+
-a dns-dnspod-109 \
|
|
184
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
185
|
+
-d example.com \
|
|
186
|
+
-d www.example.com
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
获取 `example.com` 的证书,但设置等待 60 秒(等待 DNS 传播)
|
|
190
|
+
```bash
|
|
191
|
+
certbot certonly \
|
|
192
|
+
-a dns-dnspod-109 \
|
|
193
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
194
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
195
|
+
-d example.com
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
测试运行
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
certbot certonly \
|
|
202
|
+
--register-unsafely-without-email \
|
|
203
|
+
-a dns-dnspod-109 \
|
|
204
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
205
|
+
-v \
|
|
206
|
+
--dry-run
|
|
207
|
+
```
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
[English](#english) | [简体中文](#%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# English
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## Just Another DNSPod DNS Authenticator plugin for Certbot
|
|
8
|
+
The `certbot-dns-dnspod-109` plugin automates the process of
|
|
9
|
+
completing a `dns-01` challenge (`~acme.challenges.DNS01`)
|
|
10
|
+
by creating, and subsequently removing, TXT records using the
|
|
11
|
+
Dnspod API (Tencent Cloud API 3.0).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### 1. Install
|
|
16
|
+
|
|
17
|
+
#### pip:
|
|
18
|
+
```bash
|
|
19
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
20
|
+
```
|
|
21
|
+
or
|
|
22
|
+
```bash
|
|
23
|
+
pip install certbot-dns-dnspod-109
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
#### snap:
|
|
28
|
+
```bash
|
|
29
|
+
snap install certbot-dns-dnspod-109
|
|
30
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
if root snap:
|
|
34
|
+
```bash
|
|
35
|
+
snap install certbot-dns-dnspod-109
|
|
36
|
+
snap set certbot trust-plugin-with-root=ok
|
|
37
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Obtain SecretId and SecretKey
|
|
41
|
+
1. Visit https://console.cloud.tencent.com/cam to create a sub-user
|
|
42
|
+
2. Select "Programmatic access" for the sub-user access method
|
|
43
|
+
3. Grant the sub-user QcloudDNSPodFullAccess (Cloud DNS full read and write access rights) permission
|
|
44
|
+
4. Record SecretId and SecretKey
|
|
45
|
+
|
|
46
|
+
### 3. Prepare Credentials File
|
|
47
|
+
|
|
48
|
+
foobar.ini:
|
|
49
|
+
```ini
|
|
50
|
+
dns_dnspod_109_secret_id=foo
|
|
51
|
+
dns_dnspod_109_secret_key=bar
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 4. Ready to go
|
|
55
|
+
|
|
56
|
+
#### Usage Examples
|
|
57
|
+
|
|
58
|
+
To acquire a certificate for `example.com`
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
certbot certonly \
|
|
62
|
+
-a dns-dnspod-109 \
|
|
63
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
64
|
+
-d example.com
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
To acquire a single certificate for both example.com and www.example.com
|
|
68
|
+
```bash
|
|
69
|
+
certbot certonly \
|
|
70
|
+
-a dns-dnspod-109 \
|
|
71
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
72
|
+
-d example.com \
|
|
73
|
+
-d www.example.com
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
To acquire a certificate for example.com, waiting 60 seconds for DNS propagation
|
|
77
|
+
```bash
|
|
78
|
+
certbot certonly \
|
|
79
|
+
-a dns-dnspod-109 \
|
|
80
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
81
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
82
|
+
-d example.com
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Test run
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
certbot certonly \
|
|
89
|
+
--register-unsafely-without-email \
|
|
90
|
+
-a dns-dnspod-109 \
|
|
91
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
92
|
+
-v \
|
|
93
|
+
--dry-run
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# 简体中文
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
## 只是另一个适用于 Certbot 的 DNSPod DNS Authenticator 插件
|
|
108
|
+
|
|
109
|
+
`certbot-dns-dnspod-109` 插件通过使用 Dnspod API(腾讯云 API 3.0)创建并随后删除 TXT 记录,自动完成`dns-01` 质询(`~acme.challenges.DNS01`)。
|
|
110
|
+
|
|
111
|
+
## 使用方法
|
|
112
|
+
|
|
113
|
+
### 1. 安装
|
|
114
|
+
|
|
115
|
+
#### pip:
|
|
116
|
+
```bash
|
|
117
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
118
|
+
```
|
|
119
|
+
或者
|
|
120
|
+
```bash
|
|
121
|
+
pip install certbot-dns-dnspod-109
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### snap:
|
|
125
|
+
```bash
|
|
126
|
+
snap install certbot-dns-dnspod-109
|
|
127
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
如果你使用 root snap:
|
|
131
|
+
```bash
|
|
132
|
+
snap install certbot-dns-dnspod-109
|
|
133
|
+
snap set certbot trust-plugin-with-root=ok
|
|
134
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 2. 获取SecretId和SecretKey
|
|
138
|
+
1. 访问 https://console.cloud.tencent.com/cam 创建子用户
|
|
139
|
+
2. 子用户访问方式选择“编程访问”
|
|
140
|
+
3. 授予子用户 QcloudDNSPodFullAccess(Cloud DNS 完全读写访问权限)权限
|
|
141
|
+
4. 记录 SecretId 和 SecretKey
|
|
142
|
+
|
|
143
|
+
### 3. 准备凭证文件
|
|
144
|
+
|
|
145
|
+
foobar.ini:
|
|
146
|
+
```ini
|
|
147
|
+
dns_dnspod_109_secret_id=foo
|
|
148
|
+
dns_dnspod_109_secret_key=bar
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 4. 准备就绪
|
|
152
|
+
|
|
153
|
+
#### 使用示例
|
|
154
|
+
|
|
155
|
+
获取 `example.com` 的证书
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
certbot certonly \
|
|
159
|
+
-a dns-dnspod-109 \
|
|
160
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
161
|
+
-d example.com
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
获取同时有 `example.com` 和 `www.example.com` 的单个证书
|
|
165
|
+
```bash
|
|
166
|
+
certbot certonly \
|
|
167
|
+
-a dns-dnspod-109 \
|
|
168
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
169
|
+
-d example.com \
|
|
170
|
+
-d www.example.com
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
获取 `example.com` 的证书,但设置等待 60 秒(等待 DNS 传播)
|
|
174
|
+
```bash
|
|
175
|
+
certbot certonly \
|
|
176
|
+
-a dns-dnspod-109 \
|
|
177
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
178
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
179
|
+
-d example.com
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
测试运行
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
certbot certonly \
|
|
186
|
+
--register-unsafely-without-email \
|
|
187
|
+
-a dns-dnspod-109 \
|
|
188
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
189
|
+
-v \
|
|
190
|
+
--dry-run
|
|
191
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The `certbot_certbot_dns_dnspod_109._internal.dns_dnspod` plugin automates the process of
|
|
3
|
+
completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and
|
|
4
|
+
subsequently removing, TXT records using the Dnspod API (Tencent Cloud).
|
|
5
|
+
|
|
6
|
+
.. note::
|
|
7
|
+
The plugin is not installed by default. To use this plugin, you must install it separately.
|
|
8
|
+
|
|
9
|
+
Named Arguments
|
|
10
|
+
---------------
|
|
11
|
+
|
|
12
|
+
======================================== =====================================
|
|
13
|
+
``--dns-dnspod-109-credentials`` Dnspod credentials_ INI file.
|
|
14
|
+
(Required)
|
|
15
|
+
``--dns-dnspod-109-propagation-seconds`` The number of seconds to wait for DNS
|
|
16
|
+
to propagate before asking the ACME
|
|
17
|
+
server to verify the DNS record.
|
|
18
|
+
(Default: 10)
|
|
19
|
+
======================================== =====================================
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Credentials
|
|
23
|
+
-----------
|
|
24
|
+
|
|
25
|
+
Use of this plugin requires a configuration file containing Tencent Cloud API
|
|
26
|
+
credentials, obtained from your
|
|
27
|
+
`Tencent Cloud Account Console <https://console.cloud.tencent.com/cam>`_.
|
|
28
|
+
|
|
29
|
+
The credentials file should contain the following information:
|
|
30
|
+
|
|
31
|
+
.. code-block:: ini
|
|
32
|
+
:name: certbot_dns_dnspod_109.ini
|
|
33
|
+
:caption: Example credentials file:
|
|
34
|
+
|
|
35
|
+
# Dnspod API credentials used by Certbot
|
|
36
|
+
dns_dnspod_109_secret_id = your_secret_id
|
|
37
|
+
dns_dnspod_109_secret_key = your_secret_key
|
|
38
|
+
|
|
39
|
+
The path to this file can be provided interactively or using the
|
|
40
|
+
``--dnspod-credentials`` command-line argument. Certbot records the path
|
|
41
|
+
to this file for use during renewal, but does not store the file's contents.
|
|
42
|
+
|
|
43
|
+
.. caution::
|
|
44
|
+
You should protect these API credentials as you would the password to your
|
|
45
|
+
Tencent Cloud account. Users who can read this file can use these credentials
|
|
46
|
+
to issue arbitrary API calls on your behalf. Users who can cause Certbot to
|
|
47
|
+
run using these credentials can complete a ``dns-01`` challenge to acquire
|
|
48
|
+
new certificates or revoke existing certificates for associated domains,
|
|
49
|
+
even if those domains aren't being managed by this server.
|
|
50
|
+
|
|
51
|
+
Certbot will emit a warning if it detects that the credentials file can be
|
|
52
|
+
accessed by other users on your system. The warning reads "Unsafe permissions
|
|
53
|
+
on credentials configuration file", followed by the path to the credentials
|
|
54
|
+
file. This warning will be emitted each time Certbot uses the credentials file,
|
|
55
|
+
including for renewal, and cannot be silenced except by addressing the issue
|
|
56
|
+
(e.g., by using a command like ``chmod 600`` to restrict access to the file).
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
|
|
62
|
+
.. code-block:: bash
|
|
63
|
+
:caption: To acquire a certificate for ``example.com``
|
|
64
|
+
|
|
65
|
+
certbot certonly \\
|
|
66
|
+
-a dns-dnspod-109 \\
|
|
67
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod.ini \\
|
|
68
|
+
-d example.com
|
|
69
|
+
|
|
70
|
+
.. code-block:: bash
|
|
71
|
+
:caption: To acquire a single certificate for both ``example.com`` and
|
|
72
|
+
``www.example.com``
|
|
73
|
+
|
|
74
|
+
certbot certonly \\
|
|
75
|
+
-a dns-dnspod-109 \\
|
|
76
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod.ini \\
|
|
77
|
+
-d example.com \\
|
|
78
|
+
-d www.example.com
|
|
79
|
+
|
|
80
|
+
.. code-block:: bash
|
|
81
|
+
:caption: To acquire a certificate for ``example.com``, waiting 60 seconds
|
|
82
|
+
for DNS propagation
|
|
83
|
+
|
|
84
|
+
certbot certonly \\
|
|
85
|
+
-a dns-dnspod-109 \\
|
|
86
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod.ini \\
|
|
87
|
+
--dns-dnspod-109-propagation-seconds 60 \\
|
|
88
|
+
-d example.com
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Internal implementation of `certbot_certbot_dns_dnspod_109._internal.dns_dnspod` plugin."""
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""DNS Authenticator for Dnspod."""
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Any
|
|
4
|
+
from typing import Callable
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
from certbot import errors
|
|
8
|
+
from certbot.plugins import dns_common
|
|
9
|
+
from certbot.plugins.dns_common import CredentialsConfiguration
|
|
10
|
+
|
|
11
|
+
from tencentcloud.common import credential
|
|
12
|
+
from tencentcloud.dnspod.v20210323 import dnspod_client, models
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Authenticator(dns_common.DNSAuthenticator):
|
|
18
|
+
"""DNS Authenticator for Dnspod https://www.dnspod.cn/ (Tencent Cloud https://cloud.tencent.com/)
|
|
19
|
+
|
|
20
|
+
This Authenticator uses the Dnspod API to fulfill a dns-01 challenge.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
24
|
+
super().__init__(*args, **kwargs)
|
|
25
|
+
self.credentials: Optional[CredentialsConfiguration] = None
|
|
26
|
+
self.description = 'Obtain certificates using a DNS TXT record (if you are using Dnspod for DNS).'
|
|
27
|
+
self.ACCOUNT_URL = 'https://console.cloud.tencent.com/cam'
|
|
28
|
+
self.ttl = 600
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def add_parser_arguments(cls, add: Callable[..., None],
|
|
32
|
+
default_propagation_seconds: int = 10) -> None:
|
|
33
|
+
super().add_parser_arguments(add, default_propagation_seconds)
|
|
34
|
+
add('credentials', help='Dnspod credentials INI file.')
|
|
35
|
+
|
|
36
|
+
def more_info(self) -> str:
|
|
37
|
+
return 'This plugin configures a DNS TXT record to respond to a dns-01 challenge using ' + \
|
|
38
|
+
'the Dnspod API.'
|
|
39
|
+
|
|
40
|
+
def _setup_credentials(self) -> None:
|
|
41
|
+
self.credentials = self._configure_credentials(
|
|
42
|
+
'credentials',
|
|
43
|
+
'Dnspod credentials INI file',
|
|
44
|
+
{
|
|
45
|
+
'secret_id': f'Secret ID, from Tencent Cloud {self.ACCOUNT_URL}',
|
|
46
|
+
'secret_key': f'Secret Key, from Tencent Cloud {self.ACCOUNT_URL}',
|
|
47
|
+
},
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def _perform(self, domain: str, validation_name: str, validation: str) -> None:
|
|
51
|
+
self._get_dnspod_client().add_txt_record(domain, validation_name, validation, self.ttl)
|
|
52
|
+
|
|
53
|
+
def _cleanup(self, domain: str, validation_name: str, validation: str) -> None:
|
|
54
|
+
self._get_dnspod_client().del_txt_record(domain, validation_name, validation)
|
|
55
|
+
|
|
56
|
+
def _get_dnspod_client(self) -> "_DnspodClient":
|
|
57
|
+
if not self.credentials: # pragma: no cover
|
|
58
|
+
raise errors.Error("Plugin has not been prepared, did you set 'credentials'?")
|
|
59
|
+
if self.credentials.conf('secret_id') and self.credentials.conf('secret_key'):
|
|
60
|
+
return _DnspodClient(secret_id=self.credentials.conf('secret_id'),
|
|
61
|
+
secret_key=self.credentials.conf('secret_key'),
|
|
62
|
+
endpoint=self.credentials.conf('endpoint') or "https://dnspod.tencentcloudapi.com")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class _DnspodClient:
|
|
66
|
+
"""
|
|
67
|
+
Encapsulates all communication with the Tencent Cloud API 3.0.
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
def __init__(self, secret_id: str, secret_key: str, endpoint: str) -> None:
|
|
71
|
+
# Use Tencent Cloud SDK
|
|
72
|
+
cred = credential.Credential(secret_id, secret_key)
|
|
73
|
+
self.client = dnspod_client.DnspodClient(cred, "")
|
|
74
|
+
|
|
75
|
+
def add_txt_record(self, domain: str, record_name: str, record_content: str, record_ttl: int) -> None:
|
|
76
|
+
"""
|
|
77
|
+
Add a TXT record using the supplied information.
|
|
78
|
+
|
|
79
|
+
:param domain: The domain to use to look up the DNS zone.
|
|
80
|
+
:param record_name: The record name (typically '_acme-challenge.').
|
|
81
|
+
:param record_content: The record content (typically the challenge validation string).
|
|
82
|
+
:param record_ttl: The record TTL in seconds.
|
|
83
|
+
"""
|
|
84
|
+
logger.info(f"Adding TXT record for {record_name}")
|
|
85
|
+
|
|
86
|
+
req = models.CreateTXTRecordRequest()
|
|
87
|
+
req.Domain = domain
|
|
88
|
+
req.RecordLine = '默认' # required
|
|
89
|
+
req.Value = record_content
|
|
90
|
+
req.TTL = record_ttl
|
|
91
|
+
req.SubDomain = record_name.split(".")[0]
|
|
92
|
+
|
|
93
|
+
response = self.client.CreateTXTRecord(req)
|
|
94
|
+
record_id = response.RequestId
|
|
95
|
+
|
|
96
|
+
if not record_id:
|
|
97
|
+
raise Exception(f"Failed to add TXT record: {response}")
|
|
98
|
+
logger.info(f"Successfully added TXT record: {record_id}")
|
|
99
|
+
|
|
100
|
+
def del_txt_record(self, domain: str, record_name: str, record_content: str) -> None:
|
|
101
|
+
"""
|
|
102
|
+
Delete a TXT record using the supplied information.
|
|
103
|
+
|
|
104
|
+
:param domain: The domain to use to look up the DNS zone.
|
|
105
|
+
:param record_name: The record name (typically '_acme-challenge.').
|
|
106
|
+
:param record_content: The record content (typically the challenge validation string).
|
|
107
|
+
"""
|
|
108
|
+
try:
|
|
109
|
+
logger.info("Deleting TXT record for %s", record_name)
|
|
110
|
+
|
|
111
|
+
record_id = self._find_txt_record_id(domain, record_name, record_content)
|
|
112
|
+
if not record_id:
|
|
113
|
+
logger.warning("Record not found, skipping deletion.")
|
|
114
|
+
return
|
|
115
|
+
|
|
116
|
+
req = models.DeleteRecordRequest()
|
|
117
|
+
req.Domain = domain
|
|
118
|
+
req.RecordId = record_id
|
|
119
|
+
|
|
120
|
+
response = self.client.DeleteRecord(req)
|
|
121
|
+
if response.RequestId:
|
|
122
|
+
logger.info(f"Successfully deleted TXT record: {record_id}, RequestId ID: {response.RequestId}")
|
|
123
|
+
except Exception as e:
|
|
124
|
+
logger.error(f"Failed to delete TXT record: {e}")
|
|
125
|
+
|
|
126
|
+
def _find_txt_record_id(self, domain: str, record_name: str, record_content: str) -> Optional[int]:
|
|
127
|
+
"""
|
|
128
|
+
Find the record ID for a TXT record with the given name and content.
|
|
129
|
+
|
|
130
|
+
:param domain: The domain to use to look up the DNS zone.
|
|
131
|
+
:param record_name: The record name (typically '_acme-challenge.').
|
|
132
|
+
:param record_content: The record content (typically the challenge validation string).
|
|
133
|
+
:returns: The record ID, if found.
|
|
134
|
+
"""
|
|
135
|
+
logger.info(f"Searching for TXT record for {record_name}")
|
|
136
|
+
|
|
137
|
+
req = models.DescribeRecordFilterListRequest()
|
|
138
|
+
req.Domain = domain
|
|
139
|
+
req.SubDomain = record_name.split(".")[0]
|
|
140
|
+
req.RecordType = ["TXT"]
|
|
141
|
+
|
|
142
|
+
response = self.client.DescribeRecordFilterList(req)
|
|
143
|
+
records = response.RecordList
|
|
144
|
+
|
|
145
|
+
for record in records:
|
|
146
|
+
if record.Name == record_name.split(".")[0] and record.Value == record_content:
|
|
147
|
+
logger.info(f"Found TXT record for {record.Name}")
|
|
148
|
+
return record.RecordId
|
|
149
|
+
|
|
150
|
+
logger.warning(f"No TXT record found for {record_name}")
|
|
151
|
+
return None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Tests for certbot_certbot_dns_dnspod_109._internal.dns_dnspod"""
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"""Tests for certbot_certbot_dns_dnspod_109._internal.dns_dnspod"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import unittest
|
|
5
|
+
from unittest import mock
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from certbot import errors
|
|
10
|
+
from certbot.compat import os
|
|
11
|
+
from certbot.plugins import dns_test_common
|
|
12
|
+
from certbot.plugins.dns_test_common import DOMAIN
|
|
13
|
+
from certbot.tests import util as test_util
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Simulate the exception returned by Tencent Cloud Dnspod API to test error handling
|
|
17
|
+
class MockApiException(Exception):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AuthenticatorTest(test_util.TempDirTestCase, dns_test_common.BaseAuthenticatorTest):
|
|
22
|
+
|
|
23
|
+
def setUp(self):
|
|
24
|
+
from certbot_dns_dnspod_109._internal.dns_dnspod import Authenticator
|
|
25
|
+
|
|
26
|
+
super().setUp()
|
|
27
|
+
|
|
28
|
+
path = os.path.join(self.tempdir, 'file.ini')
|
|
29
|
+
dns_test_common.write({"dnspod_secret_id": "test_id", "dnspod_secret_key": "test_key"}, path)
|
|
30
|
+
|
|
31
|
+
self.config = mock.MagicMock(dnspod_credentials=path,
|
|
32
|
+
dnspod_propagation_seconds=0) # Don't wait for actual records to take effect in tests
|
|
33
|
+
|
|
34
|
+
self.auth = Authenticator(self.config, "dnspod")
|
|
35
|
+
|
|
36
|
+
self.mock_client = mock.MagicMock()
|
|
37
|
+
# Mock _get_dnspod_client
|
|
38
|
+
self.auth._get_dnspod_client = mock.MagicMock(return_value=self.mock_client)
|
|
39
|
+
|
|
40
|
+
@test_util.patch_display_util()
|
|
41
|
+
def test_perform(self, unused_mock_get_utility):
|
|
42
|
+
# Test whether the perform method calls add_txt_record correctly
|
|
43
|
+
self.auth.perform([self.achall])
|
|
44
|
+
|
|
45
|
+
expected = [mock.call.add_txt_record(DOMAIN, '_acme-challenge.' + DOMAIN, mock.ANY, mock.ANY)]
|
|
46
|
+
assert expected == self.mock_client.mock_calls
|
|
47
|
+
|
|
48
|
+
def test_cleanup(self):
|
|
49
|
+
# Test that the cleanup method calls del_txt_record correctly
|
|
50
|
+
self.auth._attempt_cleanup = True
|
|
51
|
+
self.auth.cleanup([self.achall])
|
|
52
|
+
|
|
53
|
+
expected = [mock.call.del_txt_record(DOMAIN, '_acme-challenge.' + DOMAIN, mock.ANY)]
|
|
54
|
+
assert expected == self.mock_client.mock_calls
|
|
55
|
+
|
|
56
|
+
def test_no_creds(self):
|
|
57
|
+
# Test that an exception is thrown when correct credentials are not provided
|
|
58
|
+
path = os.path.join(self.tempdir, 'empty.ini')
|
|
59
|
+
dns_test_common.write({}, path)
|
|
60
|
+
self.config.dnspod_credentials = path
|
|
61
|
+
|
|
62
|
+
from certbot_dns_dnspod_109._internal.dns_dnspod import Authenticator
|
|
63
|
+
auth = Authenticator(self.config, "dnspod")
|
|
64
|
+
with pytest.raises(errors.PluginError):
|
|
65
|
+
auth.perform([self.achall])
|
|
66
|
+
|
|
67
|
+
def test_missing_secret_id(self):
|
|
68
|
+
# Test whether an exception is thrown when no credentials are provided
|
|
69
|
+
path = os.path.join(self.tempdir, 'no_id.ini')
|
|
70
|
+
dns_test_common.write({"secret_key": "test_key"}, path)
|
|
71
|
+
self.config.dnspod_credentials = path
|
|
72
|
+
|
|
73
|
+
from certbot_dns_dnspod_109._internal.dns_dnspod import Authenticator
|
|
74
|
+
auth = Authenticator(self.config, "dnspod")
|
|
75
|
+
with pytest.raises(errors.PluginError):
|
|
76
|
+
auth.perform([self.achall])
|
|
77
|
+
|
|
78
|
+
def test_missing_secret_key(self):
|
|
79
|
+
# Test whether an exception is thrown when no credentials are provided
|
|
80
|
+
path = os.path.join(self.tempdir, 'no_key.ini')
|
|
81
|
+
dns_test_common.write({"secret_id": "test_id"}, path)
|
|
82
|
+
self.config.dnspod_credentials = path
|
|
83
|
+
|
|
84
|
+
from certbot_dns_dnspod_109._internal.dns_dnspod import Authenticator
|
|
85
|
+
auth = Authenticator(self.config, "dnspod")
|
|
86
|
+
with pytest.raises(errors.PluginError):
|
|
87
|
+
auth.perform([self.achall])
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class DnspodClientTest(unittest.TestCase):
|
|
91
|
+
record_name = "_acme-challenge"
|
|
92
|
+
record_content = "test_challenge"
|
|
93
|
+
record_ttl = 600
|
|
94
|
+
domain = DOMAIN
|
|
95
|
+
record_id = 12345
|
|
96
|
+
|
|
97
|
+
def setUp(self):
|
|
98
|
+
from certbot_dns_dnspod_109._internal.dns_dnspod import _DnspodClient
|
|
99
|
+
# Create a simulated dnspod_client
|
|
100
|
+
self.mock_dnspod_client = mock.MagicMock()
|
|
101
|
+
self.mock_credential = mock.MagicMock()
|
|
102
|
+
self.mock_dnspod_sdk_client = mock.MagicMock()
|
|
103
|
+
|
|
104
|
+
# Patch dnspod_client.DnspodClient constructor returns mock_dnspod_sdk_client
|
|
105
|
+
patcher = mock.patch('certbot_dns_dnspod_109._internal.dns_dnspod.dnspod_client.DnspodClient',
|
|
106
|
+
return_value=self.mock_dnspod_sdk_client)
|
|
107
|
+
patcher.start()
|
|
108
|
+
self.addCleanup(patcher.stop)
|
|
109
|
+
|
|
110
|
+
# Patch models module
|
|
111
|
+
self.models_patcher = mock.patch('certbot_dns_dnspod_109._internal.dns_dnspod.models')
|
|
112
|
+
self.mock_models = self.models_patcher.start()
|
|
113
|
+
self.addCleanup(self.models_patcher.stop)
|
|
114
|
+
|
|
115
|
+
self.CreateTXTRecordRequest = mock.MagicMock()
|
|
116
|
+
self.DeleteRecordRequest = mock.MagicMock()
|
|
117
|
+
self.DescribeRecordFilterListRequest = mock.MagicMock()
|
|
118
|
+
|
|
119
|
+
self.mock_models.CreateTXTRecordRequest.return_value = self.CreateTXTRecordRequest
|
|
120
|
+
self.mock_models.DeleteRecordRequest.return_value = self.DeleteRecordRequest
|
|
121
|
+
self.mock_models.DescribeRecordFilterListRequest.return_value = self.DescribeRecordFilterListRequest
|
|
122
|
+
|
|
123
|
+
self.client = _DnspodClient(secret_id="test_id", secret_key="test_key",
|
|
124
|
+
endpoint="https://dnspod.tencentcloudapi.com")
|
|
125
|
+
|
|
126
|
+
def test_add_txt_record(self):
|
|
127
|
+
# Simulate the return of a successful RequestId when adding a record
|
|
128
|
+
mock_response = mock.MagicMock()
|
|
129
|
+
mock_response.RequestId = "mock_request_id"
|
|
130
|
+
self.mock_dnspod_sdk_client.CreateTXTRecord.return_value = mock_response
|
|
131
|
+
|
|
132
|
+
self.client.add_txt_record(self.domain, self.record_name, self.record_content, self.record_ttl)
|
|
133
|
+
self.mock_dnspod_sdk_client.CreateTXTRecord.assert_called_once_with(self.CreateTXTRecordRequest)
|
|
134
|
+
|
|
135
|
+
# Check if the request parameters are correctly assigned
|
|
136
|
+
assert self.CreateTXTRecordRequest.Domain == self.domain
|
|
137
|
+
assert self.CreateTXTRecordRequest.Value == self.record_content
|
|
138
|
+
assert self.CreateTXTRecordRequest.TTL == self.record_ttl
|
|
139
|
+
assert self.CreateTXTRecordRequest.SubDomain == self.record_name
|
|
140
|
+
|
|
141
|
+
def test_add_txt_record_failed(self):
|
|
142
|
+
# Simulate adding records and return no RequestId
|
|
143
|
+
mock_response = mock.MagicMock()
|
|
144
|
+
mock_response.RequestId = ""
|
|
145
|
+
self.mock_dnspod_sdk_client.CreateTXTRecord.return_value = mock_response
|
|
146
|
+
|
|
147
|
+
with pytest.raises(Exception):
|
|
148
|
+
self.client.add_txt_record(self.domain, self.record_name, self.record_content, self.record_ttl)
|
|
149
|
+
|
|
150
|
+
def test_del_txt_record(self):
|
|
151
|
+
# Simulate the return of matching records when searching for record IDs
|
|
152
|
+
mock_record = mock.MagicMock()
|
|
153
|
+
mock_record.RecordId = self.record_id
|
|
154
|
+
mock_record.Name = self.record_name
|
|
155
|
+
mock_record.Value = self.record_content
|
|
156
|
+
mock_response = mock.MagicMock()
|
|
157
|
+
mock_response.RecordList = [mock_record]
|
|
158
|
+
self.mock_dnspod_sdk_client.DescribeRecordFilterList.return_value = mock_response
|
|
159
|
+
|
|
160
|
+
# Simulate the success of deleting records
|
|
161
|
+
mock_del_response = mock.MagicMock()
|
|
162
|
+
mock_del_response.RequestId = "del_request_id"
|
|
163
|
+
self.mock_dnspod_sdk_client.DeleteRecord.return_value = mock_del_response
|
|
164
|
+
|
|
165
|
+
self.client.del_txt_record(self.domain, self.record_name, self.record_content)
|
|
166
|
+
|
|
167
|
+
self.mock_dnspod_sdk_client.DescribeRecordFilterList.assert_called_once_with(
|
|
168
|
+
self.DescribeRecordFilterListRequest)
|
|
169
|
+
self.mock_dnspod_sdk_client.DeleteRecord.assert_called_once_with(self.DeleteRecordRequest)
|
|
170
|
+
|
|
171
|
+
assert self.DeleteRecordRequest.RecordId == self.record_id
|
|
172
|
+
assert self.DeleteRecordRequest.Domain == self.domain
|
|
173
|
+
|
|
174
|
+
def test_del_txt_record_not_found(self):
|
|
175
|
+
# Simulate that no matching records are found
|
|
176
|
+
mock_response = mock.MagicMock()
|
|
177
|
+
mock_response.RecordList = []
|
|
178
|
+
self.mock_dnspod_sdk_client.DescribeRecordFilterList.return_value = mock_response
|
|
179
|
+
|
|
180
|
+
# Calling to delete a record will not throw an exception but will generate a warning
|
|
181
|
+
self.client.del_txt_record(self.domain, self.record_name, self.record_content)
|
|
182
|
+
self.mock_dnspod_sdk_client.DeleteRecord.assert_not_called()
|
|
183
|
+
|
|
184
|
+
def test_del_txt_record_error(self):
|
|
185
|
+
# Simulate the return of records when searching for record IDs, but throw an exception when deleting
|
|
186
|
+
mock_record = mock.MagicMock()
|
|
187
|
+
mock_record.RecordId = self.record_id
|
|
188
|
+
mock_record.Name = self.record_name
|
|
189
|
+
mock_record.Value = self.record_content
|
|
190
|
+
mock_response = mock.MagicMock()
|
|
191
|
+
mock_response.RecordList = [mock_record]
|
|
192
|
+
self.mock_dnspod_sdk_client.DescribeRecordFilterList.return_value = mock_response
|
|
193
|
+
|
|
194
|
+
self.mock_dnspod_sdk_client.DeleteRecord.side_effect = MockApiException("Delete error")
|
|
195
|
+
|
|
196
|
+
# Should not throw exceptions, but errors will be logged
|
|
197
|
+
self.client.del_txt_record(self.domain, self.record_name, self.record_content)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
if __name__ == "__main__":
|
|
201
|
+
sys.exit(pytest.main(sys.argv[1:] + [__file__])) # pragma: no cover
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: certbot-dns-dnspod-109
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The `certbot-dns-dnspod-109` plugin automates the process of completing a `dns-01` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the Dnspod API (Tencent Cloud API 3.0).
|
|
5
|
+
Home-page: https://github.com/10935336/certbot-dns-dnspod-109
|
|
6
|
+
Author: 10935336
|
|
7
|
+
Author-email: 10935336 <109@pha.pub>
|
|
8
|
+
Project-URL: Homepage, https://github.com/10935336/certbot-dns-dnspod-109
|
|
9
|
+
Project-URL: Issues, https://github.com/10935336/certbot-dns-dnspod-109/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE.txt
|
|
16
|
+
|
|
17
|
+
[English](#english) | [简体中文](#%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# English
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Just Another DNSPod DNS Authenticator plugin for Certbot
|
|
24
|
+
The `certbot-dns-dnspod-109` plugin automates the process of
|
|
25
|
+
completing a `dns-01` challenge (`~acme.challenges.DNS01`)
|
|
26
|
+
by creating, and subsequently removing, TXT records using the
|
|
27
|
+
Dnspod API (Tencent Cloud API 3.0).
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### 1. Install
|
|
32
|
+
|
|
33
|
+
#### pip:
|
|
34
|
+
```bash
|
|
35
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
36
|
+
```
|
|
37
|
+
or
|
|
38
|
+
```bash
|
|
39
|
+
pip install certbot-dns-dnspod-109
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#### snap:
|
|
44
|
+
```bash
|
|
45
|
+
snap install certbot-dns-dnspod-109
|
|
46
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
if root snap:
|
|
50
|
+
```bash
|
|
51
|
+
snap install certbot-dns-dnspod-109
|
|
52
|
+
snap set certbot trust-plugin-with-root=ok
|
|
53
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2. Obtain SecretId and SecretKey
|
|
57
|
+
1. Visit https://console.cloud.tencent.com/cam to create a sub-user
|
|
58
|
+
2. Select "Programmatic access" for the sub-user access method
|
|
59
|
+
3. Grant the sub-user QcloudDNSPodFullAccess (Cloud DNS full read and write access rights) permission
|
|
60
|
+
4. Record SecretId and SecretKey
|
|
61
|
+
|
|
62
|
+
### 3. Prepare Credentials File
|
|
63
|
+
|
|
64
|
+
foobar.ini:
|
|
65
|
+
```ini
|
|
66
|
+
dns_dnspod_109_secret_id=foo
|
|
67
|
+
dns_dnspod_109_secret_key=bar
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 4. Ready to go
|
|
71
|
+
|
|
72
|
+
#### Usage Examples
|
|
73
|
+
|
|
74
|
+
To acquire a certificate for `example.com`
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
certbot certonly \
|
|
78
|
+
-a dns-dnspod-109 \
|
|
79
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
80
|
+
-d example.com
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
To acquire a single certificate for both example.com and www.example.com
|
|
84
|
+
```bash
|
|
85
|
+
certbot certonly \
|
|
86
|
+
-a dns-dnspod-109 \
|
|
87
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
88
|
+
-d example.com \
|
|
89
|
+
-d www.example.com
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To acquire a certificate for example.com, waiting 60 seconds for DNS propagation
|
|
93
|
+
```bash
|
|
94
|
+
certbot certonly \
|
|
95
|
+
-a dns-dnspod-109 \
|
|
96
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
97
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
98
|
+
-d example.com
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Test run
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
certbot certonly \
|
|
105
|
+
--register-unsafely-without-email \
|
|
106
|
+
-a dns-dnspod-109 \
|
|
107
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
108
|
+
-v \
|
|
109
|
+
--dry-run
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# 简体中文
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
## 只是另一个适用于 Certbot 的 DNSPod DNS Authenticator 插件
|
|
124
|
+
|
|
125
|
+
`certbot-dns-dnspod-109` 插件通过使用 Dnspod API(腾讯云 API 3.0)创建并随后删除 TXT 记录,自动完成`dns-01` 质询(`~acme.challenges.DNS01`)。
|
|
126
|
+
|
|
127
|
+
## 使用方法
|
|
128
|
+
|
|
129
|
+
### 1. 安装
|
|
130
|
+
|
|
131
|
+
#### pip:
|
|
132
|
+
```bash
|
|
133
|
+
pip install git+https://github.com/10935336/certbot-dns-dnspod-109.git
|
|
134
|
+
```
|
|
135
|
+
或者
|
|
136
|
+
```bash
|
|
137
|
+
pip install certbot-dns-dnspod-109
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### snap:
|
|
141
|
+
```bash
|
|
142
|
+
snap install certbot-dns-dnspod-109
|
|
143
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
如果你使用 root snap:
|
|
147
|
+
```bash
|
|
148
|
+
snap install certbot-dns-dnspod-109
|
|
149
|
+
snap set certbot trust-plugin-with-root=ok
|
|
150
|
+
snap connect certbot:plugin certbot-dns-dnspod-109
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. 获取SecretId和SecretKey
|
|
154
|
+
1. 访问 https://console.cloud.tencent.com/cam 创建子用户
|
|
155
|
+
2. 子用户访问方式选择“编程访问”
|
|
156
|
+
3. 授予子用户 QcloudDNSPodFullAccess(Cloud DNS 完全读写访问权限)权限
|
|
157
|
+
4. 记录 SecretId 和 SecretKey
|
|
158
|
+
|
|
159
|
+
### 3. 准备凭证文件
|
|
160
|
+
|
|
161
|
+
foobar.ini:
|
|
162
|
+
```ini
|
|
163
|
+
dns_dnspod_109_secret_id=foo
|
|
164
|
+
dns_dnspod_109_secret_key=bar
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 4. 准备就绪
|
|
168
|
+
|
|
169
|
+
#### 使用示例
|
|
170
|
+
|
|
171
|
+
获取 `example.com` 的证书
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
certbot certonly \
|
|
175
|
+
-a dns-dnspod-109 \
|
|
176
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
177
|
+
-d example.com
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
获取同时有 `example.com` 和 `www.example.com` 的单个证书
|
|
181
|
+
```bash
|
|
182
|
+
certbot certonly \
|
|
183
|
+
-a dns-dnspod-109 \
|
|
184
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
185
|
+
-d example.com \
|
|
186
|
+
-d www.example.com
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
获取 `example.com` 的证书,但设置等待 60 秒(等待 DNS 传播)
|
|
190
|
+
```bash
|
|
191
|
+
certbot certonly \
|
|
192
|
+
-a dns-dnspod-109 \
|
|
193
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
194
|
+
--dns-dnspod-109-propagation-seconds 60 \
|
|
195
|
+
-d example.com
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
测试运行
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
certbot certonly \
|
|
202
|
+
--register-unsafely-without-email \
|
|
203
|
+
-a dns-dnspod-109 \
|
|
204
|
+
--dns-dnspod-109-credentials ~/.secrets/certbot/dnspod-109.ini \
|
|
205
|
+
-v \
|
|
206
|
+
--dry-run
|
|
207
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
Readme.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
certbot_dns_dnspod_109/__init__.py
|
|
6
|
+
certbot_dns_dnspod_109.egg-info/PKG-INFO
|
|
7
|
+
certbot_dns_dnspod_109.egg-info/SOURCES.txt
|
|
8
|
+
certbot_dns_dnspod_109.egg-info/dependency_links.txt
|
|
9
|
+
certbot_dns_dnspod_109.egg-info/entry_points.txt
|
|
10
|
+
certbot_dns_dnspod_109.egg-info/top_level.txt
|
|
11
|
+
certbot_dns_dnspod_109/_internal/__init__.py
|
|
12
|
+
certbot_dns_dnspod_109/_internal/dns_dnspod.py
|
|
13
|
+
certbot_dns_dnspod_109/_internal/tests/__init__.py
|
|
14
|
+
certbot_dns_dnspod_109/_internal/tests/dns_dnspod_test.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
certbot_dns_dnspod_109
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "certbot-dns-dnspod-109"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name="10935336", email="109@pha.pub" },
|
|
6
|
+
]
|
|
7
|
+
description = "The `certbot-dns-dnspod-109` plugin automates the process of completing a `dns-01` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the Dnspod API (Tencent Cloud API 3.0)."
|
|
8
|
+
readme = "Readme.md"
|
|
9
|
+
requires-python = ">=3.9"
|
|
10
|
+
classifiers = [
|
|
11
|
+
'Programming Language :: Python :: 3',
|
|
12
|
+
'License :: OSI Approved :: Apache Software License',
|
|
13
|
+
'Operating System :: POSIX :: Linux',
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Homepage = "https://github.com/10935336/certbot-dns-dnspod-109"
|
|
18
|
+
Issues = "https://github.com/10935336/certbot-dns-dnspod-109/issues"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from setuptools import find_packages, setup
|
|
3
|
+
|
|
4
|
+
version = '1.0.0'
|
|
5
|
+
|
|
6
|
+
install_requires = [
|
|
7
|
+
# Minimum dependencies for the plugin to function correctly
|
|
8
|
+
f'acme>=3.0.1',
|
|
9
|
+
f'certbot>=3.0.1',
|
|
10
|
+
"tencentcloud-sdk-python-common>=3.0.1227",
|
|
11
|
+
"tencentcloud-sdk-python-dnspod>=3.0.1227",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
if os.environ.get('SNAP_BUILD'):
|
|
15
|
+
install_requires.append('packaging')
|
|
16
|
+
|
|
17
|
+
docs_extras = [
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
test_extras = [
|
|
21
|
+
'pytest', # for running tests
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
setup(
|
|
25
|
+
name='certbot-dns-dnspod-109',
|
|
26
|
+
version=version,
|
|
27
|
+
description="Dnspod DNS Authenticator plugin for Certbot",
|
|
28
|
+
url='https://github.com/10935336/certbot-dns-dnspod-109',
|
|
29
|
+
author="10935336",
|
|
30
|
+
author_email='109@pha.pub',
|
|
31
|
+
python_requires='>=3.9',
|
|
32
|
+
classifiers=[
|
|
33
|
+
'Development Status :: 5 - Production/Stable',
|
|
34
|
+
'Environment :: Plugins',
|
|
35
|
+
'Intended Audience :: System Administrators',
|
|
36
|
+
'License :: OSI Approved :: Apache Software License',
|
|
37
|
+
'Operating System :: POSIX :: Linux',
|
|
38
|
+
'Programming Language :: Python',
|
|
39
|
+
'Programming Language :: Python :: 3',
|
|
40
|
+
'Programming Language :: Python :: 3.9',
|
|
41
|
+
'Programming Language :: Python :: 3.10',
|
|
42
|
+
'Programming Language :: Python :: 3.11',
|
|
43
|
+
'Programming Language :: Python :: 3.12',
|
|
44
|
+
'Topic :: Internet :: WWW/HTTP',
|
|
45
|
+
'Topic :: Security',
|
|
46
|
+
'Topic :: System :: Installation/Setup',
|
|
47
|
+
'Topic :: System :: Networking',
|
|
48
|
+
'Topic :: System :: Systems Administration',
|
|
49
|
+
'Topic :: Utilities',
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
packages=find_packages(),
|
|
53
|
+
include_package_data=True,
|
|
54
|
+
install_requires=install_requires,
|
|
55
|
+
extras_require={
|
|
56
|
+
'docs': docs_extras,
|
|
57
|
+
'test': test_extras,
|
|
58
|
+
},
|
|
59
|
+
entry_points={
|
|
60
|
+
'certbot.plugins': [
|
|
61
|
+
'dns-dnspod-109 = certbot_dns_dnspod_109._internal.dns_dnspod:Authenticator',
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
)
|