ascension

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

commit 5bdbb5f19776aff0a9a673e1f0fd3c7aefe19650
parent 714dd1a7629360ad72cdf4397dc01a9f803aecb4
Author: rexxnor <rexxnor+gnunet@brief.li>
Date:   Wed,  1 May 2019 14:52:31 +0200

switched to gnunet.gnu as test domain

Diffstat:
Mascension/ascension.py | 11+++++------
Mascension/test/basic_named.conf | 2+-
Mascension/test/gnunet.zone | 8++++----
Mascension/test/test_ascension_simple.sh | 34+++++++++++++++++-----------------
4 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/ascension/ascension.py b/ascension/ascension.py @@ -131,13 +131,13 @@ class Ascender(): # compared to AXFR/IXFR - changed to respect this try: soa_answer = dns.resolver.query(domain, 'SOA') + master_answer = myresolver.query(soa_answer[0].mname, 'A') except dns.resolver.NoAnswer: logging.warning("The domain '%s' is not publicly resolvable.", domain) except dns.resolver.NXDOMAIN: logging.warning("The domain '%s' is not publicly resolvable.", domain) - master_answer = dns.resolver.query(soa_answer[0].mname, 'A') try: if resolver: zone = dns.zone.from_xfr(dns.query.xfr( @@ -150,12 +150,11 @@ class Ascender(): logging.error("Nameserver for '%s' did not answer.", domain) except dns.exception.FormError: logging.critical("Domain '%s' does not allow xfr requests.", domain) - # FIXME: do not exit, throw exception, catch in main, retry based on GNS SOA (or default value) - sys.exit(1) + return None except dns.query.TransferError: logging.critical("Domain '%s' does not allow xfr requests.", domain) - # FIXME: do not exit, throw exception, catch in main, retry based on GNS SOA (or default value) - sys.exit(1) + return None + for soa_record in zone.iterate_rdatas(rdtype=dns.rdatatype.SOA): if not cls.transferns: mname = soa_record[2].mname @@ -746,7 +745,7 @@ def main(): if standalone: return 2 time.sleep(retry) - continue + continue # FIXME: return value (or exception) to observe success/failure of operation! ascender.add_records_to_gns() diff --git a/ascension/test/basic_named.conf b/ascension/test/basic_named.conf @@ -13,7 +13,7 @@ options { server-id none; }; -zone "gnunet.org" IN { +zone "gnunet.gnu" IN { type master; file "gnunet.zone"; allow-query { any; }; diff --git a/ascension/test/gnunet.zone b/ascension/test/gnunet.zone @@ -1,12 +1,12 @@ $TTL 3600 -@ IN SOA ns1.gnunet.org. root.gnunet.org. ( +@ IN SOA ns1.gnunet.gnu. root.gnunet.gnu. ( 2018090830 ; Serial 3600 ; Refresh 1800 ; Retry 604800 ; Expire 3600 ) ; Negative Cache TTL -@ IN NS ns1.gnunet.org. -@ IN NS gns--pkey--7h4hfww26fmdamt243dhssens2w5qevphbm9bhv54sz3cz1053ng.gnunet.org. +@ IN NS ns1.gnunet.gnu. +@ IN NS gns--pkey--7h4hfww26fmdamt243dhssens2w5qevphbm9bhv54sz3cz1053ng.gnunet.gnu. @ IN A 127.0.0.1 gns--pkey--7h4hfww26fmdamt243dhssens2w5qevphbm9bhv54sz3cz1053ng IN A 0.0.0.0 foo IN AAAA 2002:: @@ -18,7 +18,7 @@ www IN A 127.0.0.1 $TTL 7200 owncloud IN A 127.0.0.1 nextcloud IN A 127.0.0.1 -mail IN MX 10 mail.gnunet.org. +mail IN MX 10 mail.gnunet.gnu. mail IN A 127.0.0.1 multiple.subzones.dns IN A 127.0.0.1 subzones.dns IN A 127.1.1.1 diff --git a/ascension/test/test_ascension_simple.sh b/ascension/test/test_ascension_simple.sh @@ -12,9 +12,9 @@ # Shutdown named cleanup() { pkill named - gnunet-identity -D gnunet.org - gnunet-identity -D dns.gnunet.org - gnunet-identity -D subzones.dns.gnunet.org + gnunet-identity -D gnunet.gnu + gnunet-identity -D dns.gnunet.gnu + gnunet-identity -D subzones.dns.gnunet.gnu } # Check for required packages @@ -44,15 +44,15 @@ fi named -c basic_named.conf -p 5000 # Check if domain resolves -nslookup -port=5000 gnunet.org 127.0.0.1 +nslookup -port=5000 gnunet.gnu localhost if [ "$?" -ne 0 ]; then echo "Something went wrong with named" cleanup exit 1 fi -# Let ascension run on gnunet.org test domain -ascension gnunet.org -n 127.0.0.1 -p 5000 -s -d +# Let ascension run on gnunet.gnu test domain +ascension gnunet.gnu -n localhost -p 5000 -s -d if [ "$?" -ne 0 ]; then echo "ascension failed adding the records!" cleanup @@ -77,27 +77,27 @@ checkfailimp() { } # TESTING explicit records -a=$(gnunet-gns -t CNAME -u asdf.gnunet.org) +a=$(gnunet-gns -t CNAME -u asdf.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t AAAA -u foo.gnunet.org) +a=$(gnunet-gns -t AAAA -u foo.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u mail.gnunet.org) +a=$(gnunet-gns -t A -u mail.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u ns1.gnunet.org) +a=$(gnunet-gns -t A -u ns1.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u ns2.gnunet.org) +a=$(gnunet-gns -t A -u ns2.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u ns2.gnunet.org) +a=$(gnunet-gns -t A -u ns2.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t MX -u mail.gnunet.org) +a=$(gnunet-gns -t MX -u mail.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u nextcloud.gnunet.org) +a=$(gnunet-gns -t A -u nextcloud.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t SOA -u gnunet.org) +a=$(gnunet-gns -t SOA -u gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u multiple.subzones.dns.gnunet.org) +a=$(gnunet-gns -t A -u multiple.subzones.dns.gnunet.gnu) checkfailexp "$a" -a=$(gnunet-gns -t A -u subzones.dns.gnunet.org) +a=$(gnunet-gns -t A -u subzones.dns.gnunet.gnu) checkfailexp "$a" # cleanup if we get this far