Package list python-certbot-dns-rfc2136 / f97f463
New upstream version 0.24.0 Harlan Lieberman-Berg 3 years ago
6 changed file(s) with 22 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
00 Metadata-Version: 2.1
11 Name: certbot-dns-rfc2136
2 Version: 0.23.0
2 Version: 0.24.0
33 Summary: RFC 2136 DNS Authenticator plugin for Certbot
44 Home-page: https://github.com/certbot/certbot
55 Author: Certbot Project
2020 -----------
2121
2222 Use of this plugin requires a configuration file containing the target DNS
23 server that supports RFC 2136 Dynamic Updates, the name of the TSIG key, the
24 TSIG key secret itself and the algorithm used if it's different to HMAC-MD5.
23 server and optional port that supports RFC 2136 Dynamic Updates, the name
24 of the TSIG key, the TSIG key secret itself and the algorithm used if it's
25 different to HMAC-MD5.
2526
2627 .. code-block:: ini
2728 :name: credentials.ini
2930
3031 # Target DNS server
3132 dns_rfc2136_server = 192.0.2.1
33 # Target DNS port
34 dns_rfc2136_port = 53
3235 # TSIG key name
3336 dns_rfc2136_name = keyname.
3437 # TSIG key secret
3434 'HMAC-SHA384': dns.tsig.HMAC_SHA384,
3535 'HMAC-SHA512': dns.tsig.HMAC_SHA512
3636 }
37
38 PORT = 53
3739
3840 description = 'Obtain certificates using a DNS TXT record (if you are using BIND for DNS).'
3941 ttl = 120
7779
7880 def _get_rfc2136_client(self):
7981 return _RFC2136Client(self.credentials.conf('server'),
82 int(self.credentials.conf('port') or self.PORT),
8083 self.credentials.conf('name'),
8184 self.credentials.conf('secret'),
8285 self.ALGORITHMS.get(self.credentials.conf('algorithm'),
8790 """
8891 Encapsulates all communication with the target DNS server.
8992 """
90 def __init__(self, server, key_name, key_secret, key_algorithm):
93 def __init__(self, server, port, key_name, key_secret, key_algorithm):
9194 self.server = server
95 self.port = port
9296 self.keyring = dns.tsigkeyring.from_text({
9397 key_name: key_secret
9498 })
117121 update.add(rel, record_ttl, dns.rdatatype.TXT, record_content)
118122
119123 try:
120 response = dns.query.tcp(update, self.server)
124 response = dns.query.tcp(update, self.server, port=self.port)
121125 except Exception as e:
122126 raise errors.PluginError('Encountered error adding TXT record: {0}'
123127 .format(e))
152156 update.delete(rel, dns.rdatatype.TXT, record_content)
153157
154158 try:
155 response = dns.query.tcp(update, self.server)
159 response = dns.query.tcp(update, self.server, port=self.port)
156160 except Exception as e:
157161 raise errors.PluginError('Encountered error deleting TXT record: {0}'
158162 .format(e))
201205 request.flags ^= dns.flags.RD
202206
203207 try:
204 response = dns.query.udp(request, self.server)
208 response = dns.query.udp(request, self.server, port=self.port)
205209 rcode = response.rcode()
206210
207211 # Authoritative Answer bit should be set
1313 from certbot.tests import util as test_util
1414
1515 SERVER = '192.0.2.1'
16 PORT = 53
1617 NAME = 'a-tsig-key.'
1718 SECRET = 'SSB3b25kZXIgd2hvIHdpbGwgYm90aGVyIHRvIGRlY29kZSB0aGlzIHRleHQK'
1819 VALID_CONFIG = {"rfc2136_server": SERVER, "rfc2136_name": NAME, "rfc2136_secret": SECRET}
7374 def setUp(self):
7475 from certbot_dns_rfc2136.dns_rfc2136 import _RFC2136Client
7576
76 self.rfc2136_client = _RFC2136Client(SERVER, NAME, SECRET, dns.tsig.HMAC_MD5)
77 self.rfc2136_client = _RFC2136Client(SERVER, PORT, NAME, SECRET, dns.tsig.HMAC_MD5)
7778
7879 @mock.patch("dns.query.tcp")
7980 def test_add_txt_record(self, query_mock):
8384
8485 self.rfc2136_client.add_txt_record("bar", "baz", 42)
8586
86 query_mock.assert_called_with(mock.ANY, SERVER)
87 query_mock.assert_called_with(mock.ANY, SERVER, port=PORT)
8788 self.assertTrue("bar. 42 IN TXT \"baz\"" in str(query_mock.call_args[0][0]))
8889
8990 @mock.patch("dns.query.tcp")
116117
117118 self.rfc2136_client.del_txt_record("bar", "baz")
118119
119 query_mock.assert_called_with(mock.ANY, SERVER)
120 query_mock.assert_called_with(mock.ANY, SERVER, port=PORT)
120121 self.assertTrue("bar. 0 NONE TXT \"baz\"" in str(query_mock.call_args[0][0]))
121122
122123 @mock.patch("dns.query.tcp")
168169 # _query_soa | pylint: disable=protected-access
169170 result = self.rfc2136_client._query_soa(DOMAIN)
170171
171 query_mock.assert_called_with(mock.ANY, SERVER)
172 query_mock.assert_called_with(mock.ANY, SERVER, port=PORT)
172173 self.assertTrue(result == True)
173174
174175 @mock.patch("dns.query.udp")
178179 # _query_soa | pylint: disable=protected-access
179180 result = self.rfc2136_client._query_soa(DOMAIN)
180181
181 query_mock.assert_called_with(mock.ANY, SERVER)
182 query_mock.assert_called_with(mock.ANY, SERVER, port=PORT)
182183 self.assertTrue(result == False)
183184
184185 @mock.patch("dns.query.udp")
00 Metadata-Version: 2.1
11 Name: certbot-dns-rfc2136
2 Version: 0.23.0
2 Version: 0.24.0
33 Summary: RFC 2136 DNS Authenticator plugin for Certbot
44 Home-page: https://github.com/certbot/certbot
55 Author: Certbot Project
33 from setuptools import find_packages
44
55
6 version = '0.23.0'
6 version = '0.24.0'
77
88 # Remember to update local-oldest-requirements.txt when changing the minimum
99 # acme/certbot version.