ascension

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

commit 4b9ec9a52d9af6061febb06911c53a5d9ca3a0ee
parent c1ee00c35074ef188ecd9a416dd98fe55aa37b7a
Author: rexxnor <rexxnor+gnunet@brief.li>
Date:   Wed,  1 May 2019 21:19:43 +0200

added reading of subzonedict from GNS

Diffstat:
Mascension/ascension.py | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/ascension/ascension.py b/ascension/ascension.py @@ -65,7 +65,7 @@ GNUNET_ARM_COMMAND = 'gnunet-arm' # in this list and not in the OBSOLETE_RECORD_TYPES list will # create a warning (information loss during migration). SUPPORTED_RECORD_TYPES = [ - "A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME" + "A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME", ] # Record types that exist in DNS but that won't ever exist in GNS # as they are not needed anymore (so we should not create a warning @@ -75,7 +75,7 @@ OBSOLETE_RECORD_TYPES = [ "SIG", "KEY", "RRSIG", "NSEC", "DNSKEY", "NSEC3", "NSEC3PARAM", "CDNSKEY", "TKEY", "TSIG", - "TA", "DLV" + "TA", "DLV", ] class Ascender(): @@ -500,7 +500,7 @@ class Ascender(): soa_serial = re.findall(soapattern, serial)[0] else: soa_serial = 0 - return soa_serial + return int(soa_serial) @staticmethod def get_zone_soa(zone) -> dns.rdatatype.SOA: @@ -614,6 +614,14 @@ class Ascender(): """ domain = self.domain + # Build Dictionary from GNS identities + ids = sp.run([GNUNET_ZONE_CREATION_COMMAND, '-d'], stdout=sp.PIPE) + domainlist = ''.join(col for col in ids.stdout.decode()).split('\n') + altdomainlist = [e for e in domainlist if domain + " " in e] + for zone in altdomainlist: + zonename, _, pkey = zone.split(" ") + self.subzonedict[zonename] = (pkey, self.minimum) + zonelist = self.subzonedict.items() sortedlist = sorted(zonelist, key=lambda s: len(str(s).split('.'))) for zone, pkeyttltuple in sortedlist: