ascension

Migrate DNS zones to the GNU Name System
Log | Files | Refs | README | LICENSE

commit 2829a7614d724fb1e2f01f81d9afd0661dd2e553
parent e495d920dec5452e52d3cb48a137330c7ec7bf58
Author: rexxnor <rexxnor+gnunet@brief.li>
Date:   Fri, 28 Sep 2018 15:05:35 +0200

reworked the incremental zone transfer, added notice for bind

Diffstat:
Mgnsmigrator/gnsmigrator.py | 18+++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gnsmigrator/gnsmigrator.py b/gnsmigrator/gnsmigrator.py @@ -216,8 +216,6 @@ class GNSMigrator(): """ Refresh the zone using IXFR and the previous serial as reference - Returns 0 on unchanged and 1 on changed - :param domain: The domain to transfer and migrate :param zonetuple: The necessary data tuple for the transfer :param dnsresolver: Optional user specified resolver for subdomains @@ -229,20 +227,26 @@ class GNSMigrator(): # Ugly way to get serial oldserial = int(str(zone.get_rdataset('@', dns.rdatatype.SOA)).split(' ')[5]) + + # A normal BIND9 returns a normal AXFR response with the entire zone + # if the serial is newer. This is why there is no real incremental + # zone transfer using bind. This makes the merger_zones function + # unnecessary. Furthermore this try except block updates only if + # there is a newer zone availible (according to serial). The IXFR + # returns only a SOA record with a new serial if it has not changed try: newzone = dns.zone.from_xfr(dns.query.xfr(xfrinfo[0], xfrinfo[1], rdtype=dns.rdatatype.IXFR, serial=oldserial)) + cls.zones[domain] = (newzone, (xfrinfo[0], + xfrinfo[1], + zone.get_rdataset('@', dns.rdatatype.SOA).ttl)) except dns.zone.NoNS: print('the zone for domain %s was not updated' % domain) # Merge old and new zone - updatedzone = cls.merge_zones(domain, zone, newzone) - cls.zones[domain] = (updatedzone, (xfrinfo[0], - xfrinfo[1], - zone.get_rdataset('@', dns.rdatatype.SOA).ttl)) - + # updatedzone = cls.merge_zones(domain, zone, newzone) def main(): """