certbot-dns-stackit 0.1.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,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.1
2
+ Name: certbot-dns-stackit
3
+ Version: 0.1.0
4
+ Summary: STACKIT DNS Authenticator plugin for Certbot
5
+ Home-page: https://github.com/stackitcloud/certbot-dns-stackit
6
+ Author: STACKIT DNS
7
+ Author-email: stackit-dns@mail.schwarz
8
+ License: Apache License 2.0
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Plugins
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.4
17
+ Classifier: Programming Language :: Python :: 3.5
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Topic :: Internet :: WWW/HTTP
25
+ Classifier: Topic :: Security
26
+ Classifier: Topic :: System :: Installation/Setup
27
+ Classifier: Topic :: System :: Networking
28
+ Classifier: Topic :: System :: Systems Administration
29
+ Classifier: Topic :: Utilities
30
+ Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+
34
+ # Certbot DNS-STACKIT Authenticator Plugin
35
+
36
+ [![License](https://img.shields.io/badge/License-Apache2.0-blue.svg)](https://github.com/stackitcloud/certbot-dns-stackit/blob/main/LICENSE)
37
+ [![GitHub Release](https://img.shields.io/github/v/release/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/releases)
38
+ [![Python Version](https://img.shields.io/badge/Python-%3E=3.7-blue.svg)](https://www.python.org/downloads/)
39
+ [![Downloads](https://img.shields.io/pypi/dm/certbot-dns-stackit.svg)](https://pypi.org/project/certbot-dns-stackit/)
40
+ [![Code Size](https://img.shields.io/github/languages/code-size/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit)
41
+ [![Contributors](https://img.shields.io/github/contributors/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/graphs/contributors)
42
+
43
+ The Certbot DNS-STACKIT Authenticator Plugin facilitates the procurement of SSL/TLS certificates from Let's Encrypt
44
+ utilizing the DNS-01 challenge methodology in conjunction with STACKIT as the designated DNS service provider. This
45
+ document elucidates the procedural steps for the installation and operational utilization of this plugin.
46
+
47
+ ## Installation
48
+
49
+ To initialize the Certbot DNS-STACKIT Authenticator Plugin, deploy the following pip command:
50
+
51
+ ```bash
52
+ pip install certbot-dns-stackit
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ Upon successful integration of the plugin, it becomes viable to employ it with Certbot for the retrieval of SSL/TLS
58
+ certificates. The subsequent section delineates the pertinent arguments and their respective examples:
59
+
60
+ ### Arguments
61
+
62
+ | Argument | Example Value | Description |
63
+ |-------------------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64
+ | `--authenticator` | dns-stackit | Engages the STACKIT authenticator mechanism. This must be configured as dns-stackit. (Mandatory) |
65
+ | `--dns-stackit-credentials` | ./credentials.ini | Denotes the directory path to the credentials file for STACKIT DNS. This document must encapsulate the dns_stackit_auth_token and dns_stackit_project_id variables. (Mandatory) |
66
+ | `--dns-stackit-propagation-seconds` | 900 | Configures the delay prior to initiating the DNS record query. A 900-second interval (equivalent to 15 minutes) is recommended. (Default: 900) |
67
+
68
+ ### Example
69
+
70
+ Below is a structured example detailing the application of Certbot in conjunction with the DNS-STACKIT
71
+ Authenticator Plugin to retrieve a certificate:
72
+
73
+ ```bash
74
+ certbot certonly \
75
+ --authenticator dns-stackit \
76
+ --dns-stackit-credentials ./credentials.ini \
77
+ --dns-stackit-propagation-seconds 900 \
78
+ --server https://acme-v02.api.letsencrypt.org/directory \
79
+ --agree-tos \
80
+ --rsa-key-size 4096 \
81
+ -d 'example.runs.onstackit.cloud' \
82
+ -d '*.example.runs.onstackit.cloud'
83
+ ```
84
+
85
+ For this example, example.runs.onstackit.cloud represents the designated domain (zone) for certificate procurement.
86
+
87
+ ### Example of credentials.ini
88
+
89
+ To operationalize the plugin, it's imperative to curate a credentials.ini file encompassing your STACKIT DNS
90
+ credentials:
91
+
92
+ ```ini
93
+ dns_stackit_auth_token = "your_token_here"
94
+ dns_stackit_project_id = "your_project_id_here"
95
+ ```
96
+
97
+ It's crucial to replace "your_token_here" and "your_project_id_here" placeholders with the genuine STACKIT
98
+ authentication token and project ID. The token's associated service account necessitates project membership privileges
99
+ for record set creation.
100
+
101
+ ## Test Procedures
102
+
103
+ - Unit Testing:
104
+ ```bash
105
+ make test
106
+ ```
107
+
108
+ - Linting:
109
+ ```bash
110
+ make lint
111
+ ```
@@ -0,0 +1,78 @@
1
+ # Certbot DNS-STACKIT Authenticator Plugin
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache2.0-blue.svg)](https://github.com/stackitcloud/certbot-dns-stackit/blob/main/LICENSE)
4
+ [![GitHub Release](https://img.shields.io/github/v/release/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/releases)
5
+ [![Python Version](https://img.shields.io/badge/Python-%3E=3.7-blue.svg)](https://www.python.org/downloads/)
6
+ [![Downloads](https://img.shields.io/pypi/dm/certbot-dns-stackit.svg)](https://pypi.org/project/certbot-dns-stackit/)
7
+ [![Code Size](https://img.shields.io/github/languages/code-size/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit)
8
+ [![Contributors](https://img.shields.io/github/contributors/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/graphs/contributors)
9
+
10
+ The Certbot DNS-STACKIT Authenticator Plugin facilitates the procurement of SSL/TLS certificates from Let's Encrypt
11
+ utilizing the DNS-01 challenge methodology in conjunction with STACKIT as the designated DNS service provider. This
12
+ document elucidates the procedural steps for the installation and operational utilization of this plugin.
13
+
14
+ ## Installation
15
+
16
+ To initialize the Certbot DNS-STACKIT Authenticator Plugin, deploy the following pip command:
17
+
18
+ ```bash
19
+ pip install certbot-dns-stackit
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ Upon successful integration of the plugin, it becomes viable to employ it with Certbot for the retrieval of SSL/TLS
25
+ certificates. The subsequent section delineates the pertinent arguments and their respective examples:
26
+
27
+ ### Arguments
28
+
29
+ | Argument | Example Value | Description |
30
+ |-------------------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
31
+ | `--authenticator` | dns-stackit | Engages the STACKIT authenticator mechanism. This must be configured as dns-stackit. (Mandatory) |
32
+ | `--dns-stackit-credentials` | ./credentials.ini | Denotes the directory path to the credentials file for STACKIT DNS. This document must encapsulate the dns_stackit_auth_token and dns_stackit_project_id variables. (Mandatory) |
33
+ | `--dns-stackit-propagation-seconds` | 900 | Configures the delay prior to initiating the DNS record query. A 900-second interval (equivalent to 15 minutes) is recommended. (Default: 900) |
34
+
35
+ ### Example
36
+
37
+ Below is a structured example detailing the application of Certbot in conjunction with the DNS-STACKIT
38
+ Authenticator Plugin to retrieve a certificate:
39
+
40
+ ```bash
41
+ certbot certonly \
42
+ --authenticator dns-stackit \
43
+ --dns-stackit-credentials ./credentials.ini \
44
+ --dns-stackit-propagation-seconds 900 \
45
+ --server https://acme-v02.api.letsencrypt.org/directory \
46
+ --agree-tos \
47
+ --rsa-key-size 4096 \
48
+ -d 'example.runs.onstackit.cloud' \
49
+ -d '*.example.runs.onstackit.cloud'
50
+ ```
51
+
52
+ For this example, example.runs.onstackit.cloud represents the designated domain (zone) for certificate procurement.
53
+
54
+ ### Example of credentials.ini
55
+
56
+ To operationalize the plugin, it's imperative to curate a credentials.ini file encompassing your STACKIT DNS
57
+ credentials:
58
+
59
+ ```ini
60
+ dns_stackit_auth_token = "your_token_here"
61
+ dns_stackit_project_id = "your_project_id_here"
62
+ ```
63
+
64
+ It's crucial to replace "your_token_here" and "your_project_id_here" placeholders with the genuine STACKIT
65
+ authentication token and project ID. The token's associated service account necessitates project membership privileges
66
+ for record set creation.
67
+
68
+ ## Test Procedures
69
+
70
+ - Unit Testing:
71
+ ```bash
72
+ make test
73
+ ```
74
+
75
+ - Linting:
76
+ ```bash
77
+ make lint
78
+ ```
@@ -0,0 +1,33 @@
1
+ """
2
+ certbot_dns_stackit.
3
+
4
+ -------------------
5
+
6
+ This module provides functionality to integrate STACKIT DNS with Certbot
7
+ for DNS-01 challenge type. The module contains two main classes:
8
+
9
+ - Authenticator: This class is responsible for solving the DNS-01 challenge by uploading
10
+ the required validation token to a STACKIT DNS record.
11
+
12
+ - _StackitClient: This is an internal helper class that facilitates interactions
13
+ with the STACKIT DNS API.
14
+
15
+ Note:
16
+ The `_StackitClient` class is intended for internal use within this module and
17
+ may not provide a stable public API for external consumers.
18
+
19
+ Examples:
20
+ To use the `Authenticator` class for DNS-01 challenge:
21
+
22
+ ```python
23
+ authenticator = Authenticator(config, name)
24
+ authenticator.perform(domain, validation_name, validation)
25
+ ```
26
+
27
+ For further details on each class and their methods, refer to their respective docstrings.
28
+
29
+ """
30
+
31
+ from .stackit import Authenticator
32
+
33
+ __all__ = ["Authenticator"]
@@ -0,0 +1,289 @@
1
+ import logging
2
+ from dataclasses import dataclass
3
+ from typing import Optional, List, Callable
4
+
5
+ import requests
6
+ from certbot import errors
7
+ from certbot.plugins import dns_common
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+
12
+ @dataclass
13
+ class Record:
14
+ """Represents a Record."""
15
+
16
+ content: str
17
+ id: str
18
+
19
+
20
+ @dataclass
21
+ class RRSet:
22
+ """Represents a RRSet."""
23
+
24
+ id: str
25
+ records: List[Record]
26
+
27
+
28
+ class _StackitClient(object):
29
+ """
30
+ A client to interact with the STACKIT DNS API.
31
+
32
+ Attributes:
33
+ auth_token (str): The authentication token for the API.
34
+ project_id (str): The project ID associated with the domain (zone).
35
+ base_url (str): The base URL endpoint for the STACKIT API.
36
+ headers (dict): The headers to be used in API requests.
37
+ """
38
+
39
+ def __init__(self, auth_token: str, project_id: str, base_url: str):
40
+ """
41
+ Initialize the StackitClient.
42
+
43
+ :param auth_token: The authentication token for the API.
44
+ :param project_id: The project ID associated with the domain (zone).
45
+ :param base_url: The base URL endpoint for the STACKIT API.
46
+ """
47
+ self.auth_token = auth_token
48
+ self.project_id = project_id
49
+ self.base_url = base_url
50
+ self.headers = {"Authorization": f"Bearer {self.auth_token}"}
51
+
52
+ def add_txt_record(self, domain: str, validation_name: str, validation: str):
53
+ """
54
+ Add a TXT record using the supplied information.
55
+
56
+ :param domain: The zone dnsName.
57
+ :param validation_name: The record name.
58
+ :param validation: The record content.
59
+ """
60
+ zone_id = self._get_zone_id(domain)
61
+ rrset = self._get_rrset(zone_id, validation_name)
62
+ # rrset does not exist therefore add it
63
+ if rrset is None:
64
+ self._create_rrset(zone_id, validation_name, validation)
65
+ else:
66
+ # rrset exists. If it does not contain the validation record, add it
67
+ records = [record.content for record in rrset.records]
68
+ if validation not in records:
69
+ self._add_record_to_rrset(zone_id, rrset.id, validation)
70
+
71
+ def _create_rrset(self, zone_id: str, validation_name: str, validation: str):
72
+ """
73
+ Create a new rrset for the supplied zone id.
74
+
75
+ :param zone_id: The zone ID where the rrset will be created.
76
+ :param validation_name: The record name.
77
+ :param validation: The record content.
78
+ """
79
+ # append a dot if the validation name does not end with a dot
80
+ if not validation_name.endswith("."):
81
+ validation_name = f"{validation_name}."
82
+
83
+ body = {
84
+ "name": validation_name,
85
+ "type": "TXT",
86
+ "ttl": 60,
87
+ "records": [
88
+ {
89
+ "content": validation,
90
+ }
91
+ ],
92
+ }
93
+
94
+ res = requests.post(
95
+ f"{self.base_url}/v1/projects/{self.project_id}/zones/{zone_id}/rrsets",
96
+ headers=self.headers,
97
+ json=body,
98
+ )
99
+
100
+ if res.status_code != 202:
101
+ raise errors.PluginError(
102
+ f"Could not create rrset for zone id {zone_id}. Response: {res.text}"
103
+ )
104
+
105
+ def _add_record_to_rrset(self, zone_id: str, rrset_id: str, validation: str):
106
+ """
107
+ Add a record to an existing rrset.
108
+
109
+ :param zone_id: The zone ID where the rrset is located.
110
+ :param rrset_id: The rrset ID where the record will be added.
111
+ :param validation: The record content.
112
+ """
113
+ body = {
114
+ "action": "add",
115
+ "records": [
116
+ {
117
+ "content": validation,
118
+ }
119
+ ],
120
+ }
121
+
122
+ res = requests.patch(
123
+ f"{self.base_url}/v1/projects/{self.project_id}/zones/{zone_id}/rrsets/{rrset_id}/records",
124
+ headers=self.headers,
125
+ json=body,
126
+ )
127
+
128
+ if res.status_code != 202:
129
+ raise errors.PluginError(
130
+ f"Could not add record to rrset {rrset_id}. Response: {res.text}"
131
+ )
132
+
133
+ def _get_zone_id(self, domain: str) -> str:
134
+ """
135
+ Retrieve the zone ID for the given domain.
136
+
137
+ :param domain: The domain (zone dnsName) for which the zone ID is needed.
138
+ :return: The ID of the zone.
139
+ """
140
+ res = requests.get(
141
+ f"{self.base_url}/v1/projects/{self.project_id}/zones?dnsName[eq]={domain}&active[eq]=true",
142
+ headers=self.headers,
143
+ )
144
+ if res.status_code != 200 or len(res.json()["zones"]) == 0:
145
+ raise errors.PluginError(
146
+ f"Could not find zone id for domain {domain}, Response: {res.text}"
147
+ )
148
+
149
+ return res.json()["zones"][0]["id"]
150
+
151
+ def _get_rrset(self, zone_id: str, validation_name: str) -> Optional[RRSet]:
152
+ """
153
+ Retrieve the rrset ID for the given zone ID and validation name.
154
+
155
+ :param zone_id: The zone ID where the rrset is located.
156
+ :param validation_name: The name of the rrset to retrieve.
157
+ :return: The rrset object if found; otherwise, None.
158
+ """
159
+ if not validation_name.endswith("."):
160
+ validation_name = f"{validation_name}."
161
+
162
+ res = requests.get(
163
+ f"{self.base_url}/v1/projects/{self.project_id}/zones/{zone_id}/rrsets?name[eq]={validation_name}&type[eq]=TXT&active[eq]=true",
164
+ headers=self.headers,
165
+ )
166
+ if res.status_code != 200:
167
+ raise errors.PluginError(
168
+ f"Could not find rrset id for zone id {zone_id} and validation name {validation_name}, Response: {res.text}"
169
+ )
170
+
171
+ if len(res.json()["rrSets"]) == 0:
172
+ return None
173
+
174
+ records = []
175
+ for record in res.json()["rrSets"][0]["records"]:
176
+ records.append(Record(content=record["content"], id=record["id"]))
177
+
178
+ rrset = RRSet(id=res.json()["rrSets"][0]["id"], records=records)
179
+
180
+ return rrset
181
+
182
+ def del_txt_record(self, domain: str, validation_name: str, validation: str):
183
+ """
184
+ Delete a TXT record using the supplied information.
185
+
186
+ :param domain: The zone dnsName.
187
+ :param validation_name: The record name.
188
+ :param validation: The record content.
189
+ """
190
+ zone_id = self._get_zone_id(domain)
191
+ rrset = self._get_rrset(zone_id, validation_name)
192
+ # delete rrset only if it exists. If it does not exist, we do not need to delete it
193
+ if rrset is not None:
194
+ self._delete_record_set(zone_id, rrset.id)
195
+
196
+ def _delete_record_set(self, zone_id: str, rrset_id: str):
197
+ """
198
+ Delete the rrset using the supplied zone ID and rrset ID.
199
+
200
+ :param zone_id: The zone ID where the rrset is located.
201
+ :param rrset_id: The ID of the rrset to be deleted.
202
+ """
203
+ res = requests.delete(
204
+ f"{self.base_url}/v1/projects/{self.project_id}/zones/{zone_id}/rrsets/{rrset_id}",
205
+ headers=self.headers,
206
+ )
207
+
208
+ if res.status_code != 202:
209
+ raise errors.PluginError(
210
+ f"Could not delete rrset id {rrset_id}. Response: {res.text}"
211
+ )
212
+
213
+
214
+ class Authenticator(dns_common.DNSAuthenticator):
215
+ """
216
+ STACKIT DNS Authenticator.
217
+
218
+ This authenticator resolves a DNS01 challenge by publishing the required
219
+ validation token (record within a record set within a zone) to a STACKIT DNS record.
220
+
221
+ Attributes:
222
+ credentials: A configuration object that holds STACKIT API credentials.
223
+ """
224
+
225
+ def __init__(self, *args, **kwargs):
226
+ """Initialize the Authenticator by calling the parent's init method."""
227
+ super(Authenticator, self).__init__(*args, **kwargs)
228
+
229
+ @classmethod
230
+ def add_parser_arguments(cls, add: Callable, **kwargs):
231
+ """
232
+ Add custom arguments for the STACKIT DNS Authenticator.
233
+
234
+ :param add: Callable to add an argument.
235
+ :param kwargs: Additional keyword arguments.
236
+ """
237
+ super(Authenticator, cls).add_parser_arguments(
238
+ add, default_propagation_seconds=900
239
+ )
240
+ add("credentials", help="STACKIT credentials INI file.")
241
+
242
+ def _setup_credentials(self):
243
+ """Set up and configure the STACKIT credentials."""
244
+ self.credentials = self._configure_credentials(
245
+ "credentials",
246
+ "STACKIT credentials for the STACKIT DNS API",
247
+ {
248
+ "project_id": "Specifies the project id of the STACKIT project.",
249
+ "auth_token": "Defines the authentication token for the STACKIT DNS API. Keep in mind that the "
250
+ "service account to this token need to have project edit permissions as we create txt "
251
+ "records in the zone",
252
+ },
253
+ )
254
+
255
+ def _perform(self, domain: str, validation_name: str, validation: str):
256
+ """
257
+ Carry out a DNS update.
258
+
259
+ :param domain: The domain where the DNS record will be added.
260
+ :param validation_name: The name of the DNS record.
261
+ :param validation: The validation content to be added to the DNS record.
262
+ """
263
+ self._get_stackit_client().add_txt_record(domain, validation_name, validation)
264
+
265
+ def _cleanup(self, domain: str, validation_name: str, validation: str):
266
+ """
267
+ Remove the previously added DNS record.
268
+
269
+ :param domain: The domain from which the DNS record will be deleted.
270
+ :param validation_name: The name of the DNS record to be deleted.
271
+ :param validation: The validation content of the DNS record to be deleted.
272
+ """
273
+ self._get_stackit_client().del_txt_record(domain, validation_name, validation)
274
+
275
+ def _get_stackit_client(self) -> _StackitClient:
276
+ """
277
+ Instantiate and return a StackitClient object.
278
+
279
+ :return: A _StackitClient instance to interact with the STACKIT DNS API.
280
+ """
281
+ base_url = "https://dns.api.stackit.cloud"
282
+ if self.credentials.conf("base_url") is not None:
283
+ base_url = self.credentials.conf("base_url")
284
+
285
+ return _StackitClient(
286
+ self.credentials.conf("auth_token"),
287
+ self.credentials.conf("project_id"),
288
+ base_url,
289
+ )
@@ -0,0 +1,266 @@
1
+ import unittest
2
+ from unittest.mock import patch, Mock
3
+
4
+ from certbot import errors
5
+ from certbot_dns_stackit.stackit import _StackitClient, RRSet, Record, Authenticator
6
+
7
+
8
+ class TestStackitClient(unittest.TestCase):
9
+ def setUp(self):
10
+ self.client = _StackitClient("test_token", "test_project", "https://test.url")
11
+ self.mock_response = Mock()
12
+ self.mock_rrset = Mock(
13
+ id="rrset_id_test", records=[Mock(content="existing_validation_test")]
14
+ )
15
+
16
+ def test_get_zone_id_success(self):
17
+ self.mock_response.json.return_value = {"zones": [{"id": "12345"}]}
18
+ self.mock_response.status_code = 200
19
+
20
+ with patch("requests.get", return_value=self.mock_response) as mock_get:
21
+ zone_id = self.client._get_zone_id("test_domain")
22
+ self.assertEqual(zone_id, "12345")
23
+ mock_get.assert_called_once()
24
+
25
+ def test_get_zone_id_failure(self):
26
+ self.mock_response.status_code = 404
27
+
28
+ with patch("requests.get", return_value=self.mock_response) as mock_get:
29
+ with self.assertRaises(errors.PluginError):
30
+ self.client._get_zone_id("test_domain")
31
+ mock_get.assert_called_once()
32
+
33
+ def test_create_rrset(self):
34
+ self.mock_response.status_code = 202
35
+
36
+ with patch("requests.post", return_value=self.mock_response) as mock_post:
37
+ self.client._create_rrset(
38
+ "zone_123", "validation_name_test", "validation_test"
39
+ )
40
+ mock_post.assert_called_once()
41
+
42
+ def test_create_rrset_failure(self):
43
+ self.mock_response.status_code = 400
44
+ self.mock_response.text = "Bad Request"
45
+
46
+ with patch.object(self.client, "_get_zone_id", return_value="zone_123"):
47
+ with patch("requests.post", return_value=self.mock_response):
48
+ with self.assertRaises(errors.PluginError) as context:
49
+ self.client._create_rrset(
50
+ "zone_123", "validation_name_test", "validation_test"
51
+ )
52
+
53
+ self.assertEqual(
54
+ str(context.exception),
55
+ "Could not create rrset for zone id zone_123. Response: Bad Request",
56
+ )
57
+
58
+ def test_add_record_to_rrset(self):
59
+ self.mock_response.status_code = 202
60
+
61
+ with patch("requests.patch", return_value=self.mock_response) as mock_patch:
62
+ self.client._add_record_to_rrset(
63
+ "zone_123", "rrset_id_test", "validation_test"
64
+ )
65
+ mock_patch.assert_called_once()
66
+
67
+ def test_add_record_to_rrset_failure(self):
68
+ self.mock_response.status_code = 400
69
+ self.mock_response.text = "Bad Request"
70
+
71
+ with patch("requests.patch", return_value=self.mock_response):
72
+ with self.assertRaises(errors.PluginError) as context:
73
+ self.client._add_record_to_rrset(
74
+ "zone_123", "rrset_id_test", "validation_test"
75
+ )
76
+
77
+ self.assertEqual(
78
+ str(context.exception),
79
+ "Could not add record to rrset rrset_id_test. Response: Bad Request",
80
+ )
81
+
82
+ def test_get_rrset_exists(self):
83
+ self.mock_response.json.return_value = {
84
+ "rrSets": [
85
+ {
86
+ "id": "rrset_id_test",
87
+ "records": [{"content": "test_content", "id": "record_id_test"}],
88
+ }
89
+ ]
90
+ }
91
+ self.mock_response.status_code = 200
92
+
93
+ with patch("requests.get", return_value=self.mock_response) as mock_get:
94
+ rrset = self.client._get_rrset("zone_123", "validation_name_test")
95
+ self.assertIsInstance(rrset, RRSet)
96
+ self.assertEqual(rrset.id, "rrset_id_test")
97
+ self.assertIsInstance(rrset.records[0], Record)
98
+ mock_get.assert_called_once()
99
+
100
+ def test_get_rrset_not_exists(self):
101
+ self.mock_response.json.return_value = {"rrSets": []}
102
+ self.mock_response.status_code = 200
103
+
104
+ with patch("requests.get", return_value=self.mock_response) as mock_get:
105
+ rrset = self.client._get_rrset("zone_123", "validation_name_test")
106
+ self.assertIsNone(rrset)
107
+ mock_get.assert_called_once()
108
+
109
+ def test_get_rrset_failure(self):
110
+ self.mock_response.status_code = 400
111
+ self.mock_response.text = "Bad Request"
112
+
113
+ with patch("requests.get", return_value=self.mock_response):
114
+ with self.assertRaises(errors.PluginError) as context:
115
+ self.client._get_rrset("zone_123", "validation_name_test")
116
+
117
+ expected_msg = "Could not find rrset id for zone id zone_123 and validation name validation_name_test., Response: Bad Request"
118
+ self.assertEqual(str(context.exception), expected_msg)
119
+
120
+ def test_del_txt_record(self):
121
+ self.mock_response.status_code = 202
122
+ with patch.object(
123
+ self.client, "_get_zone_id", return_value="zone_123"
124
+ ) as mock_get_zone_id, patch.object(
125
+ self.client,
126
+ "_get_rrset",
127
+ return_value=RRSet(id="rrset_id_test", records=[]),
128
+ ) as mock_get_rrset, patch(
129
+ "requests.delete", return_value=self.mock_response
130
+ ) as mock_delete:
131
+ self.client.del_txt_record(
132
+ "test_domain", "validation_name_test", "validation_test"
133
+ )
134
+ mock_get_zone_id.assert_called_once()
135
+ mock_get_rrset.assert_called_once()
136
+ mock_delete.assert_called_once()
137
+
138
+ def test_delete_record_set(self):
139
+ self.mock_response.status_code = 202
140
+
141
+ with patch("requests.delete", return_value=self.mock_response) as mock_delete:
142
+ self.client._delete_record_set("zone_123", "rrset_id_test")
143
+ mock_delete.assert_called_once()
144
+
145
+ def test_delete_record_set_failure(self):
146
+ self.mock_response.status_code = 400
147
+ self.mock_response.text = "Bad Request"
148
+
149
+ with patch("requests.delete", return_value=self.mock_response):
150
+ with self.assertRaises(errors.PluginError) as context:
151
+ self.client._delete_record_set("zone_123", "rrset_id_test")
152
+
153
+ self.assertEqual(
154
+ str(context.exception),
155
+ "Could not delete rrset id rrset_id_test. Response: Bad Request",
156
+ )
157
+
158
+ def test_add_txt_record_no_rrset(self):
159
+ with patch.object(
160
+ self.client, "_get_zone_id", return_value="zone_123"
161
+ ) as mock_get_zone_id, patch.object(
162
+ self.client, "_get_rrset", return_value=None
163
+ ) as mock_get_rrset, patch.object(
164
+ self.client, "_create_rrset"
165
+ ) as mock_create_rrset:
166
+ self.client.add_txt_record(
167
+ "test_domain", "validation_name_test", "validation_test"
168
+ )
169
+
170
+ mock_get_zone_id.assert_called_once()
171
+ mock_get_rrset.assert_called_once()
172
+ mock_create_rrset.assert_called_once_with(
173
+ "zone_123", "validation_name_test", "validation_test"
174
+ )
175
+
176
+ def test_add_txt_record_with_rrset_without_validation(self):
177
+ with patch.object(
178
+ self.client, "_get_zone_id", return_value="zone_123"
179
+ ) as mock_get_zone_id, patch.object(
180
+ self.client, "_get_rrset", return_value=self.mock_rrset
181
+ ) as mock_get_rrset, patch.object(
182
+ self.client, "_add_record_to_rrset"
183
+ ) as mock_add_record:
184
+ self.client.add_txt_record(
185
+ "test_domain", "validation_name_test", "new_validation_test"
186
+ )
187
+
188
+ mock_get_zone_id.assert_called_once()
189
+ mock_get_rrset.assert_called_once()
190
+ mock_add_record.assert_called_once_with(
191
+ "zone_123", "rrset_id_test", "new_validation_test"
192
+ )
193
+
194
+ def test_add_txt_record_with_rrset_with_validation(self):
195
+ with patch.object(
196
+ self.client, "_get_zone_id", return_value="zone_123"
197
+ ) as mock_get_zone_id, patch.object(
198
+ self.client, "_get_rrset", return_value=self.mock_rrset
199
+ ) as mock_get_rrset:
200
+ self.client.add_txt_record(
201
+ "test_domain", "validation_name_test", "existing_validation_test"
202
+ )
203
+
204
+ mock_get_zone_id.assert_called_once()
205
+ mock_get_rrset.assert_called_once()
206
+ # Assert that _add_record_to_rrset wasn't called because validation already exists in rrset
207
+ with self.assertRaises(AttributeError):
208
+ self.client._add_record_to_rrset.assert_called_once()
209
+
210
+
211
+ class TestAuthenticator(unittest.TestCase):
212
+ def setUp(self):
213
+ mock_config = Mock()
214
+ mock_name = Mock()
215
+ self.authenticator = Authenticator(mock_config, mock_name)
216
+
217
+ @patch.object(Authenticator, "_configure_credentials")
218
+ def test_setup_credentials(self, mock_configure_credentials):
219
+ mock_creds = Mock()
220
+ mock_configure_credentials.return_value = mock_creds
221
+
222
+ self.authenticator._setup_credentials()
223
+
224
+ mock_configure_credentials.assert_called_once_with(
225
+ "credentials",
226
+ "STACKIT credentials for the STACKIT DNS API",
227
+ {
228
+ "project_id": "Specifies the project id of the STACKIT project.",
229
+ "auth_token": "Defines the authentication token for the STACKIT DNS API. Keep in mind that the "
230
+ "service account to this token need to have project edit permissions as we create txt "
231
+ "records in the zone",
232
+ },
233
+ )
234
+ self.assertEqual(self.authenticator.credentials, mock_creds)
235
+
236
+ @patch.object(Authenticator, "_get_stackit_client")
237
+ def test_perform(self, mock_get_client):
238
+ mock_client = Mock()
239
+ mock_get_client.return_value = mock_client
240
+
241
+ self.authenticator._perform(
242
+ "test_domain", "validation_name_test", "validation_test"
243
+ )
244
+
245
+ mock_get_client.assert_called_once()
246
+ mock_client.add_txt_record.assert_called_once_with(
247
+ "test_domain", "validation_name_test", "validation_test"
248
+ )
249
+
250
+ @patch.object(Authenticator, "_get_stackit_client")
251
+ def test_cleanup(self, mock_get_client):
252
+ mock_client = Mock()
253
+ mock_get_client.return_value = mock_client
254
+
255
+ self.authenticator._cleanup(
256
+ "test_domain", "validation_name_test", "validation_test"
257
+ )
258
+
259
+ mock_get_client.assert_called_once()
260
+ mock_client.del_txt_record.assert_called_once_with(
261
+ "test_domain", "validation_name_test", "validation_test"
262
+ )
263
+
264
+
265
+ if __name__ == "__main__":
266
+ unittest.main()
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.1
2
+ Name: certbot-dns-stackit
3
+ Version: 0.1.0
4
+ Summary: STACKIT DNS Authenticator plugin for Certbot
5
+ Home-page: https://github.com/stackitcloud/certbot-dns-stackit
6
+ Author: STACKIT DNS
7
+ Author-email: stackit-dns@mail.schwarz
8
+ License: Apache License 2.0
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Environment :: Plugins
11
+ Classifier: Intended Audience :: System Administrators
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.4
17
+ Classifier: Programming Language :: Python :: 3.5
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Topic :: Internet :: WWW/HTTP
25
+ Classifier: Topic :: Security
26
+ Classifier: Topic :: System :: Installation/Setup
27
+ Classifier: Topic :: System :: Networking
28
+ Classifier: Topic :: System :: Systems Administration
29
+ Classifier: Topic :: Utilities
30
+ Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+
34
+ # Certbot DNS-STACKIT Authenticator Plugin
35
+
36
+ [![License](https://img.shields.io/badge/License-Apache2.0-blue.svg)](https://github.com/stackitcloud/certbot-dns-stackit/blob/main/LICENSE)
37
+ [![GitHub Release](https://img.shields.io/github/v/release/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/releases)
38
+ [![Python Version](https://img.shields.io/badge/Python-%3E=3.7-blue.svg)](https://www.python.org/downloads/)
39
+ [![Downloads](https://img.shields.io/pypi/dm/certbot-dns-stackit.svg)](https://pypi.org/project/certbot-dns-stackit/)
40
+ [![Code Size](https://img.shields.io/github/languages/code-size/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit)
41
+ [![Contributors](https://img.shields.io/github/contributors/stackitcloud/certbot-dns-stackit.svg)](https://github.com/stackitcloud/certbot-dns-stackit/graphs/contributors)
42
+
43
+ The Certbot DNS-STACKIT Authenticator Plugin facilitates the procurement of SSL/TLS certificates from Let's Encrypt
44
+ utilizing the DNS-01 challenge methodology in conjunction with STACKIT as the designated DNS service provider. This
45
+ document elucidates the procedural steps for the installation and operational utilization of this plugin.
46
+
47
+ ## Installation
48
+
49
+ To initialize the Certbot DNS-STACKIT Authenticator Plugin, deploy the following pip command:
50
+
51
+ ```bash
52
+ pip install certbot-dns-stackit
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ Upon successful integration of the plugin, it becomes viable to employ it with Certbot for the retrieval of SSL/TLS
58
+ certificates. The subsequent section delineates the pertinent arguments and their respective examples:
59
+
60
+ ### Arguments
61
+
62
+ | Argument | Example Value | Description |
63
+ |-------------------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64
+ | `--authenticator` | dns-stackit | Engages the STACKIT authenticator mechanism. This must be configured as dns-stackit. (Mandatory) |
65
+ | `--dns-stackit-credentials` | ./credentials.ini | Denotes the directory path to the credentials file for STACKIT DNS. This document must encapsulate the dns_stackit_auth_token and dns_stackit_project_id variables. (Mandatory) |
66
+ | `--dns-stackit-propagation-seconds` | 900 | Configures the delay prior to initiating the DNS record query. A 900-second interval (equivalent to 15 minutes) is recommended. (Default: 900) |
67
+
68
+ ### Example
69
+
70
+ Below is a structured example detailing the application of Certbot in conjunction with the DNS-STACKIT
71
+ Authenticator Plugin to retrieve a certificate:
72
+
73
+ ```bash
74
+ certbot certonly \
75
+ --authenticator dns-stackit \
76
+ --dns-stackit-credentials ./credentials.ini \
77
+ --dns-stackit-propagation-seconds 900 \
78
+ --server https://acme-v02.api.letsencrypt.org/directory \
79
+ --agree-tos \
80
+ --rsa-key-size 4096 \
81
+ -d 'example.runs.onstackit.cloud' \
82
+ -d '*.example.runs.onstackit.cloud'
83
+ ```
84
+
85
+ For this example, example.runs.onstackit.cloud represents the designated domain (zone) for certificate procurement.
86
+
87
+ ### Example of credentials.ini
88
+
89
+ To operationalize the plugin, it's imperative to curate a credentials.ini file encompassing your STACKIT DNS
90
+ credentials:
91
+
92
+ ```ini
93
+ dns_stackit_auth_token = "your_token_here"
94
+ dns_stackit_project_id = "your_project_id_here"
95
+ ```
96
+
97
+ It's crucial to replace "your_token_here" and "your_project_id_here" placeholders with the genuine STACKIT
98
+ authentication token and project ID. The token's associated service account necessitates project membership privileges
99
+ for record set creation.
100
+
101
+ ## Test Procedures
102
+
103
+ - Unit Testing:
104
+ ```bash
105
+ make test
106
+ ```
107
+
108
+ - Linting:
109
+ ```bash
110
+ make lint
111
+ ```
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ setup.cfg
4
+ setup.py
5
+ certbot_dns_stackit/__init__.py
6
+ certbot_dns_stackit/stackit.py
7
+ certbot_dns_stackit/test_stackit.py
8
+ certbot_dns_stackit.egg-info/PKG-INFO
9
+ certbot_dns_stackit.egg-info/SOURCES.txt
10
+ certbot_dns_stackit.egg-info/dependency_links.txt
11
+ certbot_dns_stackit.egg-info/entry_points.txt
12
+ certbot_dns_stackit.egg-info/requires.txt
13
+ certbot_dns_stackit.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [certbot.plugins]
2
+ dns-stackit = certbot_dns_stackit.stackit:Authenticator
@@ -0,0 +1,15 @@
1
+ acme>=2.6.0
2
+ certbot>=2.6.0
3
+ setuptools
4
+ requests
5
+ mock
6
+ requests-mock
7
+ mypy
8
+ mypy-extensions
9
+ types-requests
10
+ types-urllib3
11
+ flake8
12
+ pydocstyle
13
+ black
14
+ click==8.0.4
15
+ coverage
@@ -0,0 +1 @@
1
+ certbot_dns_stackit
@@ -0,0 +1,66 @@
1
+ [metadata]
2
+ name = certbot-dns-stackit
3
+ version = attr: PACKAGE_VERSION
4
+ description = STACKIT DNS Authenticator plugin for Certbot
5
+ long_description = file: README.md
6
+ long_description_content_type = text/markdown
7
+ url = https://github.com/stackitcloud/certbot-dns-stackit
8
+ author = STACKIT DNS
9
+ author_email = stackit-dns@mail.schwarz
10
+ license = Apache License 2.0
11
+ classifiers =
12
+ Development Status :: 5 - Production/Stable
13
+ Environment :: Plugins
14
+ Intended Audience :: System Administrators
15
+ License :: OSI Approved :: Apache Software License
16
+ Operating System :: POSIX :: Linux
17
+ Programming Language :: Python
18
+ Programming Language :: Python :: 3
19
+ Programming Language :: Python :: 3.4
20
+ Programming Language :: Python :: 3.5
21
+ Programming Language :: Python :: 3.6
22
+ Programming Language :: Python :: 3.7
23
+ Programming Language :: Python :: 3.8
24
+ Programming Language :: Python :: 3.9
25
+ Programming Language :: Python :: 3.10
26
+ Programming Language :: Python :: 3.11
27
+ Topic :: Internet :: WWW/HTTP
28
+ Topic :: Security
29
+ Topic :: System :: Installation/Setup
30
+ Topic :: System :: Networking
31
+ Topic :: System :: Systems Administration
32
+ Topic :: Utilities
33
+ python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
34
+
35
+ [options]
36
+ packages = find:
37
+ include_package_data = True
38
+ install_requires =
39
+ acme>=2.6.0
40
+ certbot>=2.6.0
41
+ setuptools
42
+ requests
43
+ mock
44
+ requests-mock
45
+ mypy
46
+ mypy-extensions
47
+ types-requests
48
+ types-urllib3
49
+ flake8
50
+ pydocstyle
51
+ black
52
+ click==8.0.4
53
+ coverage
54
+
55
+ [options.entry_points]
56
+ certbot.plugins =
57
+ dns-stackit = certbot_dns_stackit.stackit:Authenticator
58
+
59
+ [options.packages.find]
60
+ exclude =
61
+ tests*
62
+
63
+ [egg_info]
64
+ tag_build =
65
+ tag_date = 0
66
+
@@ -0,0 +1,73 @@
1
+ from setuptools import setup
2
+ from setuptools import find_packages
3
+ import os
4
+
5
+ version = os.environ.get("PACKAGE_VERSION", "v0.1.0")
6
+
7
+ install_requires = [
8
+ "acme>=2.6.0",
9
+ "certbot>=2.6.0",
10
+ "setuptools",
11
+ "requests",
12
+ "mock",
13
+ "requests-mock",
14
+ "mypy",
15
+ "mypy-extensions",
16
+ "types-requests",
17
+ "types-urllib3",
18
+ "flake8",
19
+ "pydocstyle",
20
+ "black",
21
+ "click==8.0.4",
22
+ "coverage",
23
+ ]
24
+
25
+ # read the contents of your README file
26
+ from os import path
27
+
28
+ this_directory = path.abspath(path.dirname(__file__))
29
+ with open(path.join(this_directory, "README.md")) as f:
30
+ long_description = f.read()
31
+
32
+ setup(
33
+ name="certbot-dns-stackit",
34
+ version=version,
35
+ description="STACKIT DNS Authenticator plugin for Certbot",
36
+ long_description=long_description,
37
+ long_description_content_type="text/markdown",
38
+ url="https://github.com/stackitcloud/certbot-dns-stackit",
39
+ author="STACKIT DNS",
40
+ author_email="stackit-dns@mail.schwarz",
41
+ license="Apache License 2.0",
42
+ python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
43
+ classifiers=[
44
+ "Development Status :: 5 - Production/Stable",
45
+ "Environment :: Plugins",
46
+ "Intended Audience :: System Administrators",
47
+ "License :: OSI Approved :: Apache Software License",
48
+ "Operating System :: POSIX :: Linux",
49
+ "Programming Language :: Python",
50
+ "Programming Language :: Python :: 3",
51
+ "Programming Language :: Python :: 3.4",
52
+ "Programming Language :: Python :: 3.5",
53
+ "Programming Language :: Python :: 3.6",
54
+ "Programming Language :: Python :: 3.7",
55
+ "Programming Language :: Python :: 3.8",
56
+ "Programming Language :: Python :: 3.9",
57
+ "Programming Language :: Python :: 3.10",
58
+ "Programming Language :: Python :: 3.11",
59
+ "Topic :: Internet :: WWW/HTTP",
60
+ "Topic :: Security",
61
+ "Topic :: System :: Installation/Setup",
62
+ "Topic :: System :: Networking",
63
+ "Topic :: System :: Systems Administration",
64
+ "Topic :: Utilities",
65
+ ],
66
+ packages=find_packages(),
67
+ include_package_data=True,
68
+ install_requires=install_requires,
69
+ entry_points={
70
+ "certbot.plugins": ["dns-stackit = certbot_dns_stackit.stackit:Authenticator"]
71
+ },
72
+ test_suite="certbot_dns_stackit",
73
+ )