1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Allow octoDNS managed _acme-challenge records to exist by marking them

This commit is contained in:
Ross McFarland
2021-08-11 07:21:37 -07:00
parent 44b7c6880d
commit 181dcec71b

View File

@@ -16,18 +16,29 @@ class AcmeIgnoringProcessor(BaseProcessor):
def __init__(self, name):
super(AcmeIgnoringProcessor, self).__init__(name)
def _process(self, zone, *args, **kwargs):
def process_source_zone(self, zone, *args, **kwargs):
ret = self._clone_zone(zone)
for record in zone.records:
if record._type == 'TXT' and \
record.name.startswith('_acme-challenge'):
# We have a managed acme challenge record (owned by octoDNS) so
# we should mark it as such
record = record.copy()
record.values.append('*octoDNS*')
record.values.sort()
ret.add_record(record)
return ret
def process_target_zone(self, zone, *args, **kwargs):
ret = self._clone_zone(zone)
for record in zone.records:
# Uses a startswith rather than == to ignore subdomain challenges,
# e.g. _acme-challenge.foo.domain.com when managing domain.com
if record._type == 'TXT' and \
record.name.startswith('_acme-challenge'):
record.name.startswith('_acme-challenge') and \
'*octoDNS*' not in record.values:
self.log.info('_process: ignoring %s', record.fqdn)
continue
ret.add_record(record)
return ret
process_source_zone = _process
process_target_zone = _process