commit 65215add2c0313e2c311b4db98635f165abc2f5b
parent 76926f6f0234db1fc8853b8ad08bdef55c72dfe3
Author: rexxnor <rexxnor+gnunet@brief.li>
Date: Wed, 17 Apr 2019 18:15:42 +0200
fixed a few ascension bugs, updated ciscripts and gitlabci
Diffstat:
3 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
@@ -15,6 +15,7 @@ run-build_deb:
- echo "debian/ascension.1" > debian/python3-ascension.manpages
- dh_installman
- cp ../../helpers/postinst_ascension.sh debian/postinst
+ - cp ../../helpers/copyright debian/copyright
- dpkg-buildpackage -rfakeroot -uc -us
- cd ../../ || exit
- apt install -y ./deb_dist/python3-ascension*.deb
@@ -25,6 +26,7 @@ run-build_deb:
- cd ascension/test/
- bash test_ascension_simple.sh
- gnunet-arm -e
+ - apt install -y dh-make
artifacts:
paths:
- deb_dist/python3-ascension*.deb
diff --git a/ascension/ascension.py b/ascension/ascension.py
@@ -44,6 +44,7 @@ Options:
import logging
import queue
import re
+import socket
import sys
import time
import subprocess as sp
@@ -58,8 +59,6 @@ GNUNET_ZONE_CREATION_COMMAND = 'gnunet-identity'
GNUNET_NAMESTORE_COMMAND = 'gnunet-namestore'
GNUNET_GNS_COMMAND = 'gnunet-gns'
GNUNET_ARM_COMMAND = 'gnunet-arm'
-# TODO find better solution for allowed protocols in SRV records
-SUPPORTED_PROTOCOLS = {'_tcp': 6, '_udp': 17}
# TODO find better solution for ignoring DNSSEC record types
SUPPORTED_RECORD_TYPES = [
"A", "AAAA", "NS", "MX", "SRV", "TXT", "CNAME"
@@ -226,7 +225,6 @@ class Ascender():
# ignore NS for itself here
if label == '@' and rdtype == 'NS':
logging.info("ignoring NS record for itself")
- continue
# modify value to fit gns syntax
rdtype, value, label = \
@@ -270,7 +268,7 @@ class Ascender():
# Check if there is zone has already been migrated
nsrecords = cls.zone.iterate_rdatas(dns.rdatatype.NS)
- #
+
gnspkey = list(filter(lambda record: str(record[2]).startswith('gns--pkey--'), nsrecords))
if gnspkey:
label = str(gnspkey[0][0])
@@ -358,6 +356,8 @@ class Ascender():
:returns: a tuple consisting of the new rdtype, the label and value
"""
value = str(record)
+ if label is None:
+ label = '@'
if rdtype == 'SOA':
zonetuple = str(value).split(' ')
authns, owner, serial, refresh, retry, expiry, irefresh = zonetuple
@@ -393,7 +393,7 @@ class Ascender():
if isinstance(dnsresolver, list):
value = []
for nsip in dnsresolver:
- value.append("%s.%s@%s" % (str(label), zonename, nsip))
+ value.append("%s@%s" % (zonename, nsip))
else:
value = '%s.%s@%s' % (str(label), zonename, dnsresolver)
@@ -412,15 +412,18 @@ class Ascender():
# tearing the record apart
try:
- _, proto = str(label).split('.')
- except ValueError:
+ srvrecord = str(label).split('.')
+ proto = srvrecord[1]
+ except IndexError:
logging.warning("could not parse SRV label %s", label)
return (rdtype, None, None)
priority, weight, destport, target = value.split(' ')
- protonum = SUPPORTED_PROTOCOLS.get(proto)
- if protonum is None:
- logging.warning("invalid protocol: %s", proto)
+ try:
+ protostring = proto.strip('_')
+ protonum = socket.getprotobyname(protostring)
+ except OSError:
+ logging.warning("invalid protocol: %s", protostring)
return (rdtype, None, None)
value = '%s %s %s %s %s %s %s' % (
@@ -682,8 +685,11 @@ def main():
ascender.initial_zone_transfer(serial)
ascender.mirror_zone()
ascender.bootstrap_zone()
- ascender.add_records_to_gns()
- logging.info("Finished migrating of the zone %s", ascender.domain)
+ if ascender.zone is not None:
+ ascender.add_records_to_gns()
+ logging.info("Finished migrating of the zone %s", ascender.domain)
+ else:
+ logging.info("Zone %s already up to date", ascender.domain)
refresh = int(ascender.get_zone_refresh_time())
retry = int(ascender.get_zone_retry_time())
if standalone:
diff --git a/helpers/ciscript.sh b/helpers/ciscript.sh
@@ -10,6 +10,7 @@ cp ../../helpers/ascension.1 debian/ascension.1
echo "debian/ascension.1" > debian/python3-ascension.manpages
dh_installman
cp ../../helpers/postinst_ascension.sh debian/postinst
+cp ../../helpers/copyright debian/copyright
dpkg-buildpackage -rfakeroot -uc -us
cd ../../ || exit
apt install -y ./deb_dist/python3-ascension*.deb
@@ -17,6 +18,7 @@ ascension -h
bash helpers/gnunet-installer-0.11-debian.sh Production
apt install -y bind9 dnsutils procps
gnunet-arm -Esq
-cd ascension/test/
+cd ascension/test/ || exit
bash test_ascension_simple.sh
gnunet-arm -e
+apt install -y dh-make