mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge remote-tracking branch 'origin/main' into je/arpa-matching-fix
This commit is contained in:
@@ -14,6 +14,10 @@ Alternatively the value can be a dictionary with configuration options for the A
|
|||||||
---
|
---
|
||||||
manager:
|
manager:
|
||||||
auto_arpa:
|
auto_arpa:
|
||||||
|
# Whether duplicate records should replace rather than error
|
||||||
|
# (optiona, default False)
|
||||||
|
populate_should_replace: false
|
||||||
|
# Explicitly set the TTL of auto-created records, default is 3600s, 1hr
|
||||||
ttl: 1800
|
ttl: 1800
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -22,8 +26,16 @@ Once enabled a singleton `AutoArpa` instance, `auto-arpa`, will be added to the
|
|||||||
In order to add `PTR` records for a zone the `auto-arpa` source should be added to the list of sources for the zone.
|
In order to add `PTR` records for a zone the `auto-arpa` source should be added to the list of sources for the zone.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
# Zones are matched on suffix so `0.10.in-addr.arpa.` would match anything
|
||||||
|
# under `10.0/16` or `0.8.e.f.ip6-.arpa.` would match any IPv6 address under
|
||||||
|
# `fe80::`, 0.0.10 here matches 10.0.0/24.
|
||||||
0.0.10.in-addr.arpa.:
|
0.0.10.in-addr.arpa.:
|
||||||
sources:
|
sources:
|
||||||
|
# In most cases you'll have some statically configured records combined in
|
||||||
|
# with the auto-generated records as shown here, but that's not strictly
|
||||||
|
# required and this could just be `auto-arpa`.
|
||||||
|
# would throw an DuplicateRecordException.
|
||||||
|
- config
|
||||||
- auto-arpa
|
- auto-arpa
|
||||||
targets:
|
targets:
|
||||||
- ...
|
- ...
|
||||||
@@ -44,24 +56,23 @@ providers:
|
|||||||
class: octodns.provider.yaml.YamlProvider
|
class: octodns.provider.yaml.YamlProvider
|
||||||
directory: tests/config
|
directory: tests/config
|
||||||
|
|
||||||
powerdns:
|
route53:
|
||||||
class: octodns_powerdns.PowerDnsProvider
|
class: octodns_route53.Route53Provider
|
||||||
host: 10.0.0.53
|
access_key_id: env/AWS_ACCESS_KEY_ID
|
||||||
port: 8081
|
secret_access_key: env/AWS_SECRET_ACCESS_KEY
|
||||||
api_key: env/POWERDNS_API_KEY
|
|
||||||
|
|
||||||
zones:
|
zones:
|
||||||
exxampled.com.:
|
exxampled.com.:
|
||||||
sources:
|
sources:
|
||||||
- config
|
- config
|
||||||
targets:
|
targets:
|
||||||
- powerdns
|
- route53
|
||||||
|
|
||||||
0.0.10.in-addr.arpa.:
|
0.0.10.in-addr.arpa.:
|
||||||
sources:
|
sources:
|
||||||
- auto-arpa
|
- auto-arpa
|
||||||
targets:
|
targets:
|
||||||
- powerdns
|
- route53
|
||||||
```
|
```
|
||||||
|
|
||||||
#### config/exxampled.com.yaml
|
#### config/exxampled.com.yaml
|
||||||
|
@@ -11,10 +11,16 @@ from .base import BaseProcessor
|
|||||||
|
|
||||||
|
|
||||||
class AutoArpa(BaseProcessor):
|
class AutoArpa(BaseProcessor):
|
||||||
def __init__(self, name, ttl=3600):
|
def __init__(self, name, ttl=3600, populate_should_replace=False):
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
self.log = getLogger(f'AutoArpa[{name}]')
|
self.log = getLogger(f'AutoArpa[{name}]')
|
||||||
|
self.log.info(
|
||||||
|
'__init__: ttl=%d, populate_should_replace=%s',
|
||||||
|
ttl,
|
||||||
|
populate_should_replace,
|
||||||
|
)
|
||||||
self.ttl = ttl
|
self.ttl = ttl
|
||||||
|
self.populate_should_replace = populate_should_replace
|
||||||
self._records = defaultdict(set)
|
self._records = defaultdict(set)
|
||||||
|
|
||||||
def process_source_zone(self, desired, sources):
|
def process_source_zone(self, desired, sources):
|
||||||
@@ -56,7 +62,7 @@ class AutoArpa(BaseProcessor):
|
|||||||
name,
|
name,
|
||||||
{'ttl': self.ttl, 'type': 'PTR', 'values': fqdns},
|
{'ttl': self.ttl, 'type': 'PTR', 'values': fqdns},
|
||||||
)
|
)
|
||||||
zone.add_record(record)
|
zone.add_record(record, replace=self.populate_should_replace)
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
'populate: found %s records', len(zone.records) - before
|
'populate: found %s records', len(zone.records) - before
|
||||||
|
Reference in New Issue
Block a user