New upstream version 1.18.0
Harlan Lieberman-Berg
1 year, 3 months ago
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: certbot-dns-rfc2136 |
2 | Version: 1.12.0 | |
2 | Version: 1.18.0 | |
3 | 3 | Summary: RFC 2136 DNS Authenticator plugin for Certbot |
4 | 4 | Home-page: https://github.com/certbot/certbot |
5 | 5 | Author: Certbot Project |
6 | Author-email: client-dev@letsencrypt.org | |
6 | Author-email: certbot-dev@eff.org | |
7 | 7 | License: Apache License 2.0 |
8 | Description: UNKNOWN | |
9 | 8 | Platform: UNKNOWN |
10 | 9 | Classifier: Development Status :: 5 - Production/Stable |
11 | 10 | Classifier: Environment :: Plugins |
26 | 25 | Classifier: Topic :: Utilities |
27 | 26 | Requires-Python: >=3.6 |
28 | 27 | Provides-Extra: docs |
28 | License-File: LICENSE.txt | |
29 | ||
30 | UNKNOWN | |
31 |
0 | 0 | """DNS Authenticator using RFC 2136 Dynamic Updates.""" |
1 | 1 | import logging |
2 | from typing import Optional | |
2 | 3 | |
3 | 4 | import dns.flags |
4 | 5 | import dns.message |
9 | 10 | import dns.tsig |
10 | 11 | import dns.tsigkeyring |
11 | 12 | import dns.update |
12 | import zope.interface | |
13 | 13 | |
14 | 14 | from certbot import errors |
15 | from certbot import interfaces | |
16 | 15 | from certbot.plugins import dns_common |
16 | from certbot.plugins.dns_common import CredentialsConfiguration | |
17 | 17 | |
18 | 18 | logger = logging.getLogger(__name__) |
19 | 19 | |
20 | 20 | DEFAULT_NETWORK_TIMEOUT = 45 |
21 | 21 | |
22 | @zope.interface.implementer(interfaces.IAuthenticator) | |
23 | @zope.interface.provider(interfaces.IPluginFactory) | |
22 | ||
24 | 23 | class Authenticator(dns_common.DNSAuthenticator): |
25 | 24 | """DNS Authenticator using RFC 2136 Dynamic Updates |
26 | 25 | |
27 | This Authenticator uses RFC 2136 Dynamic Updates to fulfull a dns-01 challenge. | |
26 | This Authenticator uses RFC 2136 Dynamic Updates to fulfill a dns-01 challenge. | |
28 | 27 | """ |
29 | 28 | |
30 | 29 | ALGORITHMS = { |
42 | 41 | ttl = 120 |
43 | 42 | |
44 | 43 | def __init__(self, *args, **kwargs): |
45 | super(Authenticator, self).__init__(*args, **kwargs) | |
46 | self.credentials = None | |
44 | super().__init__(*args, **kwargs) | |
45 | self.credentials: Optional[CredentialsConfiguration] = None | |
47 | 46 | |
48 | 47 | @classmethod |
49 | 48 | def add_parser_arguments(cls, add): # pylint: disable=arguments-differ |
50 | super(Authenticator, cls).add_parser_arguments(add, default_propagation_seconds=60) | |
49 | super().add_parser_arguments(add, default_propagation_seconds=60) | |
51 | 50 | add('credentials', help='RFC 2136 credentials INI file.') |
52 | 51 | |
53 | 52 | def more_info(self): # pylint: disable=missing-function-docstring |
79 | 78 | self._get_rfc2136_client().del_txt_record(validation_name, validation) |
80 | 79 | |
81 | 80 | def _get_rfc2136_client(self): |
81 | if not self.credentials: # pragma: no cover | |
82 | raise errors.Error("Plugin has not been prepared.") | |
82 | 83 | return _RFC2136Client(self.credentials.conf('server'), |
83 | 84 | int(self.credentials.conf('port') or self.PORT), |
84 | 85 | self.credentials.conf('name'), |
87 | 88 | dns.tsig.HMAC_MD5)) |
88 | 89 | |
89 | 90 | |
90 | class _RFC2136Client(object): | |
91 | class _RFC2136Client: | |
91 | 92 | """ |
92 | 93 | Encapsulates all communication with the target DNS server. |
93 | 94 | """ |
0 | 0 | Metadata-Version: 2.1 |
1 | 1 | Name: certbot-dns-rfc2136 |
2 | Version: 1.12.0 | |
2 | Version: 1.18.0 | |
3 | 3 | Summary: RFC 2136 DNS Authenticator plugin for Certbot |
4 | 4 | Home-page: https://github.com/certbot/certbot |
5 | 5 | Author: Certbot Project |
6 | Author-email: client-dev@letsencrypt.org | |
6 | Author-email: certbot-dev@eff.org | |
7 | 7 | License: Apache License 2.0 |
8 | Description: UNKNOWN | |
9 | 8 | Platform: UNKNOWN |
10 | 9 | Classifier: Development Status :: 5 - Production/Stable |
11 | 10 | Classifier: Environment :: Plugins |
26 | 25 | Classifier: Topic :: Utilities |
27 | 26 | Requires-Python: >=3.6 |
28 | 27 | Provides-Extra: docs |
28 | License-File: LICENSE.txt | |
29 | ||
30 | UNKNOWN | |
31 |
0 | 0 | dnspython |
1 | 1 | setuptools>=39.0.1 |
2 | 2 | zope.interface |
3 | acme>=0.29.0 | |
4 | certbot>=1.1.0 | |
5 | ||
6 | [:python_version < "3.3"] | |
7 | mock | |
3 | acme>=1.18.0 | |
4 | certbot>=1.18.0 | |
8 | 5 | |
9 | 6 | [docs] |
10 | 7 | Sphinx>=1.0 |
0 | from distutils.version import LooseVersion | |
1 | 0 | import os |
2 | 1 | import sys |
3 | 2 | |
4 | from setuptools import __version__ as setuptools_version | |
5 | 3 | from setuptools import find_packages |
6 | 4 | from setuptools import setup |
7 | 5 | |
8 | version = '1.12.0' | |
6 | version = '1.18.0' | |
9 | 7 | |
10 | # Remember to update local-oldest-requirements.txt when changing the minimum | |
11 | # acme/certbot version. | |
12 | 8 | install_requires = [ |
13 | 9 | 'dnspython', |
14 | 10 | 'setuptools>=39.0.1', |
17 | 13 | |
18 | 14 | if not os.environ.get('SNAP_BUILD'): |
19 | 15 | install_requires.extend([ |
20 | 'acme>=0.29.0', | |
21 | 'certbot>=1.1.0', | |
16 | # We specify the minimum acme and certbot version as the current plugin | |
17 | # version for simplicity. See | |
18 | # https://github.com/certbot/certbot/issues/8761 for more info. | |
19 | f'acme>={version}', | |
20 | f'certbot>={version}', | |
22 | 21 | ]) |
23 | 22 | elif 'bdist_wheel' in sys.argv[1:]: |
24 | 23 | raise RuntimeError('Unset SNAP_BUILD when building wheels ' |
25 | 24 | 'to include certbot dependencies.') |
26 | 25 | if os.environ.get('SNAP_BUILD'): |
27 | 26 | install_requires.append('packaging') |
28 | ||
29 | setuptools_known_environment_markers = (LooseVersion(setuptools_version) >= LooseVersion('36.2')) | |
30 | if setuptools_known_environment_markers: | |
31 | install_requires.append('mock ; python_version < "3.3"') | |
32 | elif 'bdist_wheel' in sys.argv[1:]: | |
33 | raise RuntimeError('Error, you are trying to build certbot wheels using an old version ' | |
34 | 'of setuptools. Version 36.2+ of setuptools is required.') | |
35 | elif sys.version_info < (3,3): | |
36 | install_requires.append('mock') | |
37 | 27 | |
38 | 28 | docs_extras = [ |
39 | 29 | 'Sphinx>=1.0', # autodoc_member_order = 'bysource', autodoc_default_flags |
46 | 36 | description="RFC 2136 DNS Authenticator plugin for Certbot", |
47 | 37 | url='https://github.com/certbot/certbot', |
48 | 38 | author="Certbot Project", |
49 | author_email='client-dev@letsencrypt.org', | |
39 | author_email='certbot-dev@eff.org', | |
50 | 40 | license='Apache License 2.0', |
51 | 41 | python_requires='>=3.6', |
52 | 42 | classifiers=[ |
27 | 27 | def setUp(self): |
28 | 28 | from certbot_dns_rfc2136._internal.dns_rfc2136 import Authenticator |
29 | 29 | |
30 | super(AuthenticatorTest, self).setUp() | |
30 | super().setUp() | |
31 | 31 | |
32 | 32 | path = os.path.join(self.tempdir, 'file.ini') |
33 | 33 | dns_test_common.write(VALID_CONFIG, path) |
41 | 41 | # _get_rfc2136_client | pylint: disable=protected-access |
42 | 42 | self.auth._get_rfc2136_client = mock.MagicMock(return_value=self.mock_client) |
43 | 43 | |
44 | def test_perform(self): | |
44 | @test_util.patch_display_util() | |
45 | def test_perform(self, unused_mock_get_utility): | |
45 | 46 | self.auth.perform([self.achall]) |
46 | 47 | |
47 | 48 | expected = [mock.call.add_txt_record('_acme-challenge.'+DOMAIN, mock.ANY, mock.ANY)] |
64 | 65 | self.auth.perform, |
65 | 66 | [self.achall]) |
66 | 67 | |
67 | def test_valid_algorithm_passes(self): | |
68 | @test_util.patch_display_util() | |
69 | def test_valid_algorithm_passes(self, unused_mock_get_utility): | |
68 | 70 | config = VALID_CONFIG.copy() |
69 | 71 | config["rfc2136_algorithm"] = "HMAC-sha512" |
70 | 72 | dns_test_common.write(config, self.config.rfc2136_credentials) |