certbot-dns-lightsail 0.2.0__py3-none-any.whl
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_lightsail/__init__.py +0 -0
- certbot_dns_lightsail/authentication.py +96 -0
- certbot_dns_lightsail-0.2.0.dist-info/METADATA +117 -0
- certbot_dns_lightsail-0.2.0.dist-info/RECORD +8 -0
- certbot_dns_lightsail-0.2.0.dist-info/WHEEL +5 -0
- certbot_dns_lightsail-0.2.0.dist-info/entry_points.txt +2 -0
- certbot_dns_lightsail-0.2.0.dist-info/licenses/LICENSE +21 -0
- certbot_dns_lightsail-0.2.0.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Callable
|
|
3
|
+
|
|
4
|
+
import boto3
|
|
5
|
+
|
|
6
|
+
from certbot import configuration
|
|
7
|
+
from certbot import errors
|
|
8
|
+
from certbot.plugins import dns_common
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Authenticator(dns_common.DNSAuthenticator):
|
|
14
|
+
description = 'This plugin proves you have control over a domain ' \
|
|
15
|
+
'by DNS-01 challenge to the Amazon Lightsail DNS.'
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
config: configuration.NamespaceConfig,
|
|
20
|
+
name: str,
|
|
21
|
+
) -> None:
|
|
22
|
+
super().__init__(config, name)
|
|
23
|
+
self._client = _LightsailClient()
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def add_parser_arguments(
|
|
27
|
+
cls,
|
|
28
|
+
add: Callable[..., None],
|
|
29
|
+
default_propagation_seconds: int = 60,
|
|
30
|
+
) -> None:
|
|
31
|
+
super().add_parser_arguments(add, default_propagation_seconds)
|
|
32
|
+
|
|
33
|
+
def more_info(self) -> str:
|
|
34
|
+
return self.description
|
|
35
|
+
|
|
36
|
+
def _perform(
|
|
37
|
+
self,
|
|
38
|
+
domain: str,
|
|
39
|
+
validation_domain_name: str,
|
|
40
|
+
validation: str,
|
|
41
|
+
) -> None:
|
|
42
|
+
try:
|
|
43
|
+
self._client.create_txt_record(
|
|
44
|
+
domain,
|
|
45
|
+
validation_domain_name,
|
|
46
|
+
validation,
|
|
47
|
+
)
|
|
48
|
+
except Exception as e:
|
|
49
|
+
raise errors.PluginError(
|
|
50
|
+
f'Failed to create TXT record ({validation_domain_name}): {e}'
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def _cleanup(
|
|
54
|
+
self,
|
|
55
|
+
domain: str,
|
|
56
|
+
validation_domain_name: str,
|
|
57
|
+
validation: str,
|
|
58
|
+
) -> None:
|
|
59
|
+
try:
|
|
60
|
+
self._client.delete_txt_record(
|
|
61
|
+
domain,
|
|
62
|
+
validation_domain_name,
|
|
63
|
+
validation,
|
|
64
|
+
)
|
|
65
|
+
except Exception as e:
|
|
66
|
+
logger.error(
|
|
67
|
+
f'Failed to delete TXT record ({validation_domain_name}): {e}'
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def _setup_credentials(self) -> None:
|
|
71
|
+
pass
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class _LightsailClient:
|
|
75
|
+
def __init__(self) -> None:
|
|
76
|
+
self._client = boto3.client('lightsail')
|
|
77
|
+
|
|
78
|
+
def create_txt_record(self, domain: str, name: str, value: str) -> None:
|
|
79
|
+
self._client.create_domain_entry(
|
|
80
|
+
domainName=domain,
|
|
81
|
+
domainEntry={
|
|
82
|
+
'type': 'TXT',
|
|
83
|
+
'name': name,
|
|
84
|
+
'target': f'"{value}"',
|
|
85
|
+
},
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def delete_txt_record(self, domain: str, name: str, value: str) -> None:
|
|
89
|
+
self._client.delete_domain_entry(
|
|
90
|
+
domainName=domain,
|
|
91
|
+
domainEntry={
|
|
92
|
+
'type': 'TXT',
|
|
93
|
+
'name': name,
|
|
94
|
+
'target': f'"{value}"',
|
|
95
|
+
},
|
|
96
|
+
)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: certbot-dns-lightsail
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Amazon Lightsail DNS Authenticator Plugin for Certbot
|
|
5
|
+
Home-page: https://github.com/noi/certbot-dns-lightsail
|
|
6
|
+
Author: Nobuki Fujii
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Certbot, https://certbot.eff.org/
|
|
9
|
+
Project-URL: Amazon Lightsail, https://aws.amazon.com/lightsail/
|
|
10
|
+
Classifier: Programming Language :: Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Environment :: Plugins
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: certbot<6,>=5.0.0
|
|
24
|
+
Requires-Dist: acme<6,>=5.0.0
|
|
25
|
+
Requires-Dist: boto3>=1.40.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: tox; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8-import-order; extra == "dev"
|
|
30
|
+
Requires-Dist: build; extra == "dev"
|
|
31
|
+
Requires-Dist: twine; extra == "dev"
|
|
32
|
+
Dynamic: author
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: license
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: project-url
|
|
40
|
+
Dynamic: provides-extra
|
|
41
|
+
Dynamic: requires-dist
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
Dynamic: summary
|
|
44
|
+
|
|
45
|
+
# Amazon Lightsail DNS Authenticator Plugin for Certbot
|
|
46
|
+
[](https://github.com/noi/certbot-dns-lightsail/actions/workflows/ci.yml)
|
|
47
|
+
[](https://pypi.org/project/certbot-dns-lightsail/)
|
|
48
|
+
[](https://pypi.org/project/certbot-dns-lightsail/)
|
|
49
|
+
[](https://github.com/noi/certbot-dns-lightsail/blob/main/LICENSE)
|
|
50
|
+
|
|
51
|
+
This plugin proves you have control over a domain by DNS-01 challenge to the Amazon Lightsail DNS.
|
|
52
|
+
|
|
53
|
+
## Additional Arguments for Certbot
|
|
54
|
+
- `--authenticator dns-lightsail`
|
|
55
|
+
- Use this plugin as an authenticator. (required)
|
|
56
|
+
- `--dns-lightsail-propagation-seconds ${value}`
|
|
57
|
+
- The number of seconds to wait for DNS to propagate before asking the ACME server to verify the DNS record. (default: 60, The default TTL for Amazon Lightsail DNS records is 60 seconds so I recommend to set a value greater than it)
|
|
58
|
+
|
|
59
|
+
## Getting Started
|
|
60
|
+
### Requirements
|
|
61
|
+
- Python 3.10 or later
|
|
62
|
+
- Certbot 5.0.0 or later
|
|
63
|
+
|
|
64
|
+
### Installation
|
|
65
|
+
Install this plugin using `pip`:
|
|
66
|
+
```
|
|
67
|
+
pip install certbot-dns-lightsail
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Usage
|
|
71
|
+
This plugin requires AWS region and credential settings before it can be used. And the region must be `us-east-1`.
|
|
72
|
+
|
|
73
|
+
#### 1. Create Access Key
|
|
74
|
+
Create an access key using IAM policy below:
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"Version": "2012-10-17",
|
|
78
|
+
"Statement": [
|
|
79
|
+
{
|
|
80
|
+
"Effect": "Allow",
|
|
81
|
+
"Action": [
|
|
82
|
+
"lightsail:CreateDomainEntry",
|
|
83
|
+
"lightsail:DeleteDomainEntry"
|
|
84
|
+
],
|
|
85
|
+
"Resource": "arn:aws:lightsail:us-east-1:${YOUR-ACCOUNT-ID}:Domain/${YOUR-DOMAIN-ID}"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### 2. Create Setting Files
|
|
92
|
+
Create setting files below:
|
|
93
|
+
```
|
|
94
|
+
# ~/.aws/config
|
|
95
|
+
[default]
|
|
96
|
+
region=us-east-1
|
|
97
|
+
|
|
98
|
+
# ~/.aws/credentials
|
|
99
|
+
[default]
|
|
100
|
+
aws_access_key_id=${YOUR-ACCESS-KEY-ID}
|
|
101
|
+
aws_secret_access_key=${YOUR-SECRET-ACCESS-KEY}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### 3. Run Certbot
|
|
105
|
+
You are ready to run this plugin with Certbot!
|
|
106
|
+
|
|
107
|
+
For example, run command below to obtain a certificate using this plugin:
|
|
108
|
+
```sh
|
|
109
|
+
certbot certonly \
|
|
110
|
+
--authenticator dns-lightsail \
|
|
111
|
+
--dns-lightsail-propagation-seconds 70 \
|
|
112
|
+
--non-interactive \
|
|
113
|
+
--agree-tos \
|
|
114
|
+
-m 'mail@example.com' \
|
|
115
|
+
-d 'example.com' \
|
|
116
|
+
-d '*.example.com'
|
|
117
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
certbot_dns_lightsail/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
certbot_dns_lightsail/authentication.py,sha256=zV38WUqXyzTobknYsuSFVCKwjpPGlUP80-r82p37g68,2537
|
|
3
|
+
certbot_dns_lightsail-0.2.0.dist-info/licenses/LICENSE,sha256=Kr8WPYnPjFYBI7vsBVqYkJf1_NY8q4Zo8GBLqmxkyDY,1069
|
|
4
|
+
certbot_dns_lightsail-0.2.0.dist-info/METADATA,sha256=DFYtHz0-yejTOqi2kfu-QKbC_O016R6KH98N1L9R0lc,3905
|
|
5
|
+
certbot_dns_lightsail-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
6
|
+
certbot_dns_lightsail-0.2.0.dist-info/entry_points.txt,sha256=xPBwr-67yaC9_7GBZNpcvTtOTmMPy1zRxncs-EycmDE,85
|
|
7
|
+
certbot_dns_lightsail-0.2.0.dist-info/top_level.txt,sha256=LMlj41RY6oHXGSir_wN-RHHz5IMdPATOgbq_JfnUCcA,22
|
|
8
|
+
certbot_dns_lightsail-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Nobuki Fujii
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
certbot_dns_lightsail
|