aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrexxnor <rexxnor+gnunet@brief.li>2019-01-07 12:52:17 +0100
committerrexxnor <rexxnor+gnunet@brief.li>2019-01-24 23:45:02 +0100
commit17ab1cadb765bf6de88e2936abb460884e4aef53 (patch)
treecab088d8bca69281165251992bdd0175250d7de3
parent499cda796e1bda84a4ddff60d78ae6448c9c2a71 (diff)
downloadascension-fix.tar.gz
ascension-fix.zip
renamed project to ascensionfix
-rw-r--r--README.md28
-rw-r--r--ascension/__init__.py (renamed from gnsmigrator/__init__.py)0
-rw-r--r--ascension/ascension.py (renamed from gnsmigrator/gnsmigrator.py)34
-rw-r--r--ascension/gnunet.py (renamed from gnsmigrator/gnunet.py)0
-rw-r--r--ascension/test/basic_named.conf (renamed from gnsmigrator/test/basic_named.conf)0
-rw-r--r--ascension/test/gnunet.zone (renamed from gnsmigrator/test/gnunet.zone)0
-rw-r--r--ascension/test/managed-keys.bind33
-rw-r--r--ascension/test/managed-keys.bind.jnlbin0 -> 14262 bytes
-rw-r--r--ascension/test/test_gns_lookup.conf57
-rw-r--r--ascension/test/test_gnsmigrator_simple.sh (renamed from gnsmigrator/test/test_gnsmigrator_simple.sh)10
-rw-r--r--ascension/test/test_namestore_multiple.sh (renamed from gnsmigrator/test/test_namestore_multiple.sh)6
-rw-r--r--ascension/test/test_unit_gnsmigrator.py (renamed from gnsmigrator/test/test_unit_gnsmigrator.py)22
-rw-r--r--setup.py14
13 files changed, 148 insertions, 56 deletions
diff --git a/README.md b/README.md
index 3715d36..6ac54af 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
1# GNS Migrator 1# Ascension
2 2
3The main goal is to develop a tool to easily migrate existing DNS Zones to the 3The main goal is to develop a tool to easily migrate existing DNS Zones to the
4GNU Name System using (incremental) Zone Transfers. (AXFR/IXFR) 4GNU Name System using (incremental) Zone Transfers. (AXFR/IXFR)
5 5
6## How to install 6## How to install
7To install the gnsmigrator simply execute one of the following commands: 7To install the ascension simply execute one of the following commands:
8 8
9```bash 9```bash
10# System wide installation 10# System wide installation
@@ -25,20 +25,20 @@ python3 setup.py develop
25``` 25```
26 26
27## How to use 27## How to use
28If you have installed it, simply execute gnsmigrator with one of several options. 28If you have installed it, simply execute ascension with one of several options.
29You can also just run the file gnsmigrator.py itself directly. 29You can also just run the file ascension.py itself directly.
30 30
31Taken from the dosctring of the gnsmigrator.py file: 31Taken from the dosctring of the ascension.py file:
32``` 32```
33GNS Migrator 33Ascension
34 34
35Usage: 35Usage:
36 gnsmigrator.py <domain> [-d] 36 ascension.py <domain> [-d]
37 gnsmigrator.py <domain> -p <port> [-d] 37 ascension.py <domain> -p <port> [-d]
38 gnsmigrator.py <domain> -ns <transferns> [-d] 38 ascension.py <domain> -ns <transferns> [-d]
39 gnsmigrator.py <domain> -ns <transferns> -p <port> [-d] 39 ascension.py <domain> -ns <transferns> -p <port> [-d]
40 gnsmigrator.py -h | --help 40 ascension.py -h | --help
41 gnsmigrator.py -v | --version 41 ascension.py -v | --version
42 42
43Options: 43Options:
44 <port> Port for zone transfer 44 <port> Port for zone transfer
@@ -52,7 +52,7 @@ Options:
52Example use: 52Example use:
53``` 53```
54# Transfers the sy TLD from ns1.tld.sy. 54# Transfers the sy TLD from ns1.tld.sy.
55gnsmigrator sy -ns ns1.tld.sy. 55ascension sy -ns ns1.tld.sy.
56# Transfers the nu TLD from zonedata.iis.se with debug options enabled 56# Transfers the nu TLD from zonedata.iis.se with debug options enabled
57gnsmigrator nu -ns zonedata.iis.se. -d 57ascension nu -ns zonedata.iis.se. -d
58``` 58```
diff --git a/gnsmigrator/__init__.py b/ascension/__init__.py
index e69de29..e69de29 100644
--- a/gnsmigrator/__init__.py
+++ b/ascension/__init__.py
diff --git a/gnsmigrator/gnsmigrator.py b/ascension/ascension.py
index 47f1cfb..cddaf5a 100644
--- a/gnsmigrator/gnsmigrator.py
+++ b/ascension/ascension.py
@@ -1,13 +1,13 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2"""GNS Migrator 2"""Ascension
3 3
4Usage: 4Usage:
5 gnsmigrator.py <domain> [-d] 5 ascension.py <domain> [-d]
6 gnsmigrator.py <domain> -p <port> [-d] 6 ascension.py <domain> -p <port> [-d]
7 gnsmigrator.py <domain> -ns <transferns> [-d] 7 ascension.py <domain> -ns <transferns> [-d]
8 gnsmigrator.py <domain> -ns <transferns> -p <port> [-d] 8 ascension.py <domain> -ns <transferns> -p <port> [-d]
9 gnsmigrator.py -h | --help 9 ascension.py -h | --help
10 gnsmigrator.py -v | --version 10 ascension.py -v | --version
11 11
12Options: 12Options:
13 <port> Port for zone transfer 13 <port> Port for zone transfer
@@ -39,7 +39,7 @@ SUPPORTED_RECORD_TYPES = [
39 "A", "AAAA", "NS", "MX", "SOA", "SRV", "TXT", "CNAME" 39 "A", "AAAA", "NS", "MX", "SOA", "SRV", "TXT", "CNAME"
40] 40]
41 41
42class GNSMigrator(): 42class Ascender():
43 """ 43 """
44 Class that provides migration for any given domain 44 Class that provides migration for any given domain
45 """ 45 """
@@ -142,7 +142,7 @@ class GNSMigrator():
142 # SOA is different if taken directly from SOA record 142 # SOA is different if taken directly from SOA record
143 # compared to AXFR/IXFR - changed to respect this 143 # compared to AXFR/IXFR - changed to respect this
144 try: 144 try:
145 soa_answer = dns.resolver.query(domain + '.', 'SOA') 145 soa_answer = dns.resolver.query(domain, 'SOA')
146 except dns.resolver.NoAnswer: 146 except dns.resolver.NoAnswer:
147 logging.warning("the domain '%s' does not exist") 147 logging.warning("the domain '%s' does not exist")
148 master_answer = dns.resolver.query(soa_answer[0].mname, 'A') 148 master_answer = dns.resolver.query(soa_answer[0].mname, 'A')
@@ -346,6 +346,8 @@ class GNSMigrator():
346 value = value[:-1] 346 value = value[:-1]
347 else: 347 else:
348 value = "%s.%s" % (value, zonename) 348 value = "%s.%s" % (value, zonename)
349 if domain[-1] == ".":
350 domain = domain[:-1]
349 if nameserver[-1] == ".": 351 if nameserver[-1] == ".":
350 dnsresolver = nameserver[:-1] 352 dnsresolver = nameserver[:-1]
351 else: 353 else:
@@ -427,7 +429,7 @@ class GNSMigrator():
427 """ 429 """
428 Adds a SRV record to GNS 430 Adds a SRV record to GNS
429 """ 431 """
430 if not GNSMigrator.check_if_record_exists_in_zone(record, zonename): 432 if not Ascender.check_if_record_exists_in_zone(record, zonename):
431 value, ttl, rdata = record 433 value, ttl, rdata = record
432 rtype_str = str(dns.rdatatype.to_text(rdata.rdtype)) 434 rtype_str = str(dns.rdatatype.to_text(rdata.rdtype))
433 dnsname_str = str(rdata).split(' ')[3] 435 dnsname_str = str(rdata).split(' ')[3]
@@ -526,12 +528,12 @@ def main():
526 logging.basicConfig(level=logging.DEBUG) 528 logging.basicConfig(level=logging.DEBUG)
527 529
528 # Initialize class instance 530 # Initialize class instance
529 migrator = GNSMigrator(domain, transferns, port) 531 ascender = Ascender(domain, transferns, port)
530 serial = migrator.get_zone_serial(domain) 532 serial = ascender.get_zone_serial(domain)
531 migrator.initial_zone_transfer(serial) 533 ascender.initial_zone_transfer(serial)
532 migrator.bootstrap_zone() 534 ascender.bootstrap_zone()
533 migrator.mirror_zone() 535 ascender.mirror_zone()
534 migrator.add_records_to_gns() 536 ascender.add_records_to_gns()
535 537
536if __name__ == '__main__': 538if __name__ == '__main__':
537 main() 539 main()
diff --git a/gnsmigrator/gnunet.py b/ascension/gnunet.py
index 8a935f0..8a935f0 100644
--- a/gnsmigrator/gnunet.py
+++ b/ascension/gnunet.py
diff --git a/gnsmigrator/test/basic_named.conf b/ascension/test/basic_named.conf
index 920e7af..920e7af 100644
--- a/gnsmigrator/test/basic_named.conf
+++ b/ascension/test/basic_named.conf
diff --git a/gnsmigrator/test/gnunet.zone b/ascension/test/gnunet.zone
index 8fa7124..8fa7124 100644
--- a/gnsmigrator/test/gnunet.zone
+++ b/ascension/test/gnunet.zone
diff --git a/ascension/test/managed-keys.bind b/ascension/test/managed-keys.bind
new file mode 100644
index 0000000..45385ef
--- /dev/null
+++ b/ascension/test/managed-keys.bind
@@ -0,0 +1,33 @@
1$ORIGIN .
2$TTL 0 ; 0 seconds
3@ IN SOA . . (
4 24 ; serial
5 0 ; refresh (0 seconds)
6 0 ; retry (0 seconds)
7 0 ; expire (0 seconds)
8 0 ; minimum (0 seconds)
9 )
10 KEYDATA 20181113222352 20181020181422 19700101000000 257 3 8 (
11 AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQ
12 bSEW0O8gcCjFFVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh
13 /RStIoO8g0NfnfL2MTJRkxoXbfDaUeVPQuYEhg37NZWA
14 JQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaDX6RS6CXp
15 oY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3
16 LQpzW5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGO
17 Yl7OyQdXfZ57relSQageu+ipAdTTJ25AsRTAoub8ONGc
18 LmqrAmRLKBP1dfwhYB4N7knNnulqQxA+Uk1ihz0=
19 ) ; KSK; alg = RSASHA256; key id = 19036
20 ; next refresh: Tue, 13 Nov 2018 22:23:52 GMT
21 ; trusted since: Sat, 20 Oct 2018 18:14:22 GMT
22 KEYDATA 20181113222352 20181020181422 19700101000000 257 3 8 (
23 AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTO
24 iW1vkIbzxeF3+/4RgWOq7HrxRixHlFlExOLAJr5emLvN
25 7SWXgnLh4+B5xQlNVz8Og8kvArMtNROxVQuCaSnIDdD5
26 LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF0jLHwVN8
27 efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7
28 pr+eoZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLY
29 A4/ilBmSVIzuDWfdRUfhHdY6+cn8HFRm+2hM8AnXGXws
30 9555KrUB5qihylGa8subX2Nn6UwNR1AkUTV74bU=
31 ) ; KSK; alg = RSASHA256; key id = 20326
32 ; next refresh: Tue, 13 Nov 2018 22:23:52 GMT
33 ; trusted since: Sat, 20 Oct 2018 18:14:22 GMT
diff --git a/ascension/test/managed-keys.bind.jnl b/ascension/test/managed-keys.bind.jnl
new file mode 100644
index 0000000..526f248
--- /dev/null
+++ b/ascension/test/managed-keys.bind.jnl
Binary files differ
diff --git a/ascension/test/test_gns_lookup.conf b/ascension/test/test_gns_lookup.conf
new file mode 100644
index 0000000..2b874f8
--- /dev/null
+++ b/ascension/test/test_gns_lookup.conf
@@ -0,0 +1,57 @@
1@INLINE@ test_gns_defaults.conf
2
3[namecache]
4DISABLE = YES
5
6[PATHS]
7GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-gns-peer-1/
8
9[dht]
10START_ON_DEMAND = YES
11
12[gns]
13# PREFIX = valgrind --leak-check=full --track-origins=yes
14START_ON_DEMAND = YES
15AUTO_IMPORT_PKEY = YES
16MAX_PARALLEL_BACKGROUND_QUERIES = 10
17DEFAULT_LOOKUP_TIMEOUT = 15 s
18RECORD_PUT_INTERVAL = 1 h
19ZONE_PUBLISH_TIME_WINDOW = 1 h
20DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
21
22[namestore]
23#PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/ns_log
24
25[revocation]
26WORKBITS = 1
27
28[dhtcache]
29QUOTA = 1 MB
30DATABASE = heap
31
32[topology]
33TARGET-CONNECTION-COUNT = 16
34AUTOCONNECT = YES
35FRIENDS-ONLY = NO
36MINIMUM-FRIENDS = 0
37
38[ats]
39WAN_QUOTA_IN = 1 GB
40WAN_QUOTA_OUT = 1 GB
41
42[transport]
43plugins = tcp
44NEIGHBOUR_LIMIT = 50
45PORT = 2091
46
47[transport-tcp]
48TIMEOUT = 300 s
49
50[nat]
51DISABLEV6 = YES
52BINDTO = 127.0.0.1
53ENABLE_UPNP = NO
54BEHIND_NAT = NO
55ALLOW_NAT = NO
56INTERNAL_ADDRESS = 127.0.0.1
57EXTERNAL_ADDRESS = 127.0.0.1
diff --git a/gnsmigrator/test/test_gnsmigrator_simple.sh b/ascension/test/test_gnsmigrator_simple.sh
index f0e6eb2..5a262b8 100644
--- a/gnsmigrator/test/test_gnsmigrator_simple.sh
+++ b/ascension/test/test_gnsmigrator_simple.sh
@@ -18,8 +18,8 @@ if ! [ -x "$(command -v named)" ]; then
18 exit 1 18 exit 1
19fi 19fi
20 20
21if ! [ -x "$(command -v gnsmigrator)" ]; then 21if ! [ -x "$(command -v ascension)" ]; then
22 echo 'gnsmigrator is not installed' >&2 22 echo 'ascension is not installed' >&2
23 exit 1 23 exit 1
24fi 24fi
25 25
@@ -34,10 +34,10 @@ if [ "$?" -ne 0 ]; then
34 exit 1 34 exit 1
35fi 35fi
36 36
37# Let gnsmigrator run on gnunet.org test domain 37# Let ascension run on gnunet.org test domain
38gnsmigrator gnunet.org -ns 127.0.0.1 -p 5000 38ascension gnunet.org -ns 127.0.0.1 -p 5000
39if [ "$?" -ne 0 ]; then 39if [ "$?" -ne 0 ]; then
40 echo "gnsmigrator failed adding the records!" 40 echo "ascension failed adding the records!"
41 cleanup 41 cleanup
42 exit 1 42 exit 1
43fi 43fi
diff --git a/gnsmigrator/test/test_namestore_multiple.sh b/ascension/test/test_namestore_multiple.sh
index f238de1..72862a6 100644
--- a/gnsmigrator/test/test_namestore_multiple.sh
+++ b/ascension/test/test_namestore_multiple.sh
@@ -96,9 +96,9 @@ echo "Testing adding TXT record with -R"
96declare -a arr=('3600 TXT n Pretty_Unicorns') 96declare -a arr=('3600 TXT n Pretty_Unicorns')
97testing test8 "${arr[@]}" 97testing test8 "${arr[@]}"
98# 8 98# 8
99echo "Testing adding TXT record with -R" 99echo "Testing adding SRV record with -R"
100declare -a arr=('3600 SRV n _autodiscover_old._tcp.bfh.ch.') 100declare -a arr=('3600 SRV n 0 0 443 testing')
101testing test8 "${arr[@]}" 101testing _autodiscover_old._tcp "${arr[@]}"
102# 9 102# 9
103echo "Testing adding many A records with -R" 103echo "Testing adding many A records with -R"
104declare -a arr=('3600 A n 127.0.0.1' '3600 A n 127.0.0.2' '3600 A n 127.0.0.3' '3600 A n 127.0.0.4' '3600 A n 127.0.0.5') 104declare -a arr=('3600 A n 127.0.0.1' '3600 A n 127.0.0.2' '3600 A n 127.0.0.3' '3600 A n 127.0.0.4' '3600 A n 127.0.0.5')
diff --git a/gnsmigrator/test/test_unit_gnsmigrator.py b/ascension/test/test_unit_gnsmigrator.py
index b04f456..d9a59fa 100644
--- a/gnsmigrator/test/test_unit_gnsmigrator.py
+++ b/ascension/test/test_unit_gnsmigrator.py
@@ -1,16 +1,16 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2""" 2"""
3Unittests of gnsmigrator 3Unittests of ascension
4""" 4"""
5 5
6import subprocess 6import subprocess
7import unittest 7import unittest
8import mock 8import mock
9from unittest import TestCase 9from unittest import TestCase
10from gnsmigrator import gnsmigrator 10from ascension import ascension
11 11
12 12
13class TestGNSMigrator(TestCase): 13class TestAscender(TestCase):
14 """ 14 """
15 Short Unit Tests for WebArchiver 15 Short Unit Tests for WebArchiver
16 """ 16 """
@@ -19,26 +19,26 @@ class TestGNSMigrator(TestCase):
19 """ 19 """
20 Prepare data for tests 20 Prepare data for tests
21 """ 21 """
22 cls.gnsmigrator = gnsmigrator.GNSMigrator(["pretty.fantasy"]) 22 cls.ascension = ascension.Ascender(["pretty.fantasy"])
23 23
24 def test_constructor(self): 24 def test_constructor(self):
25 """ 25 """
26 Tests constructor 26 Tests constructor
27 """ 27 """
28 self.assertEqual(["pretty.fantasy"], self.gnsmigrator.domainlist) 28 self.assertEqual(["pretty.fantasy"], self.ascension.domainlist)
29 29
30 def test_get_lowest_domain_part(self): 30 def test_get_lowest_domain_part(self):
31 """ 31 """
32 Tests constructor 32 Tests constructor
33 """ 33 """
34 self.assertEqual("pretty", self.gnsmigrator.get_lowest_domain_part( 34 self.assertEqual("pretty", self.ascension.get_lowest_domain_part(
35 self.gnsmigrator.domainlist[0])) 35 self.ascension.domainlist[0]))
36 36
37 def test_bootstrap_zones(self): 37 def test_bootstrap_zones(self):
38 """ 38 """
39 Tests bootstrapping of zones with mocked subprocess commands 39 Tests bootstrapping of zones with mocked subprocess commands
40 """ 40 """
41 self.gnsmigrator.bootstrap_zones() 41 self.ascension.bootstrap_zones()
42 # using mocked subprocesses to prevent inconsistent status 42 # using mocked subprocesses to prevent inconsistent status
43 mocked_ident = mock.create_autospec(subprocess.check_output, return_value='fantasy PKEY') 43 mocked_ident = mock.create_autospec(subprocess.check_output, return_value='fantasy PKEY')
44 self.assertIn('fantasy', mocked_ident(['gnunet-identity', '-d'])) 44 self.assertIn('fantasy', mocked_ident(['gnunet-identity', '-d']))
@@ -51,11 +51,11 @@ class TestGNSMigrator(TestCase):
51 """ 51 """
52 Tests different ways of zone transfer not working 52 Tests different ways of zone transfer not working
53 """ 53 """
54 self.gnsmigrator.initial_zone_transfer() 54 self.ascension.initial_zone_transfer()
55 55
56 # Needs to be done via mock stuff or expect weird stuff 56 # Needs to be done via mock stuff or expect weird stuff
57 #self.assertRaises(dns.resolver.NoAnswer, self.gnsmigrator.initial_zone_transfer()) 57 #self.assertRaises(dns.resolver.NoAnswer, self.ascension.initial_zone_transfer())
58 #self.assertRaises(dns.resolver.NoAnswer, self.gnsmigrator2.initial_zone_transfer()) 58 #self.assertRaises(dns.resolver.NoAnswer, self.ascension2.initial_zone_transfer())
59 59
60 @classmethod 60 @classmethod
61 def tearDownClass(cls): 61 def tearDownClass(cls):
diff --git a/setup.py b/setup.py
index ba58cad..cfd7f0f 100644
--- a/setup.py
+++ b/setup.py
@@ -9,20 +9,20 @@ with open("README.md", "r") as fh:
9 long_description = fh.read() 9 long_description = fh.read()
10 10
11setuptools.setup( 11setuptools.setup(
12 name="gnsmigrator", 12 name="ascension",
13 version="0.1.2", 13 version="0.1.3",
14 author="Patrick Gerber", 14 author="rexxnor",
15 author_email="patrick.gerber@students.bfh.ch", 15 author_email="rexxnor+gnunet@brief.li",
16 description="Tool to migrate DNS Zones to the GNU Name System", 16 description="Tool to migrate DNS Zones to the GNU Name System",
17 long_description=long_description, 17 long_description=long_description,
18 url="https://gitlab.ti.bfh.ch/gerbp6/gnsmigrator", 18 url="https://gnunet.org/git/ascension.git/",
19 packages=['gnsmigrator'], 19 packages=['ascension'],
20 classifiers=[ 20 classifiers=[
21 "Programming Language :: Python :: 3", 21 "Programming Language :: Python :: 3",
22 ], 22 ],
23 entry_points={ 23 entry_points={
24 'console_scripts': [ 24 'console_scripts': [
25 'gnsmigrator=gnsmigrator.gnsmigrator:main', 25 'ascension=ascension.ascension:main',
26 ], 26 ],
27 }, 27 },
28) 28)