summaryrefslogtreecommitdiff
path: root/reconfigure/tests/parsers/bind9_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'reconfigure/tests/parsers/bind9_tests.py')
-rw-r--r--reconfigure/tests/parsers/bind9_tests.py133
1 files changed, 127 insertions, 6 deletions
diff --git a/reconfigure/tests/parsers/bind9_tests.py b/reconfigure/tests/parsers/bind9_tests.py
index 0f2527e..3892319 100644
--- a/reconfigure/tests/parsers/bind9_tests.py
+++ b/reconfigure/tests/parsers/bind9_tests.py
@@ -7,11 +7,12 @@ class BIND9ParserTest (BaseParserTest):
parser = BIND9Parser()
source = """p1 asd;
-sec {
+key {
s1p1 asd;
/*s1p2 wqe;*/
- sec2 test {
+ zone
+ test {
::1;
s2p1 qwe;
};
@@ -23,11 +24,11 @@ sec {
return """
p1 asd;
-sec {
+key {
s1p1 asd;
# s1p2 wqe;
- sec2 test {
+ zone test {
::1;
s2p1 qwe;
};
@@ -38,10 +39,10 @@ sec {
None,
PropertyNode('p1', 'asd'),
Node(
- 'sec',
+ 'key',
PropertyNode('s1p1', 'asd'),
Node(
- 'sec2',
+ 'zone',
PropertyNode('', '::1'),
PropertyNode('s2p1', 'qwe'),
parameter='test',
@@ -53,3 +54,123 @@ sec {
del BaseParserTest
+
+
+
+import unittest
+
+class BIND9ParserHangTest (unittest.TestCase):
+ source = """
+options {
+ listen-on port 53 { 127.0.0.1; };
+ listen-on-v6 port 53 { ::1; };
+ directory "/var/named";
+ dump-file "/var/named/data/cache_dump.db";
+ statistics-file "/var/named/data/named_stats.txt";
+ memstatistics-file "/var/named/data/named_mem_stats.txt";
+ allow-query { localhost; };
+
+ /*
+ - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
+ - If you are building a RECURSIVE (caching) DNS server, you need to enable
+ recursion.
+ - If your recursive DNS server has a public IP address, you MUST enable access
+ control to limit queries to your legitimate users. Failing to do so will
+ cause your server to become part of large scale DNS amplification
+ attacks. Implementing BCP38 within your network would greatly
+ reduce such attack surface
+ */
+ recursion yes;
+
+ dnssec-enable yes;
+ dnssec-validation yes;
+ dnssec-lookaside auto;
+
+ /* Path to ISC DLV key */
+ bindkeys-file "/etc/named.iscdlv.key";
+
+ managed-keys-directory "/var/named/dynamic";
+
+ pid-file "/run/named/named.pid";
+ session-keyfile "/run/named/session.key";
+};
+
+logging {
+ channel default_debug {
+ file "data/named.run";
+ severity dynamic;
+ };
+};
+
+zone "." IN {
+ type hint;
+ file "named.ca";
+};
+
+zone "localhost.localdomain" IN {
+ type master;
+ file "named.localhost";
+ allow-update { none; };
+};
+
+zone "localhost" IN {
+ type master;
+ file "named.localhost";
+ allow-update { none; };
+};
+
+zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
+ type master;
+ file "named.loopback";
+ allow-update { none; };
+};
+
+zone "1.0.0.127.in-addr.arpa" IN {
+ type master;
+ file "named.loopback";
+ allow-update { none; };
+};
+
+zone "0.in-addr.arpa" IN {
+ type master;
+ file "named.empty";
+ allow-update { none; };
+};
+
+managed-keys {
+ # DNSKEY for the root zone.
+ # Updates are published on root-dnssec-announce@icann.org
+ . initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq QxA+Uk1ihz0=";
+};
+
+
+managed-keys {
+ # ISC DLV: See https://www.isc.org/solutions/dlv for details.
+ # NOTE: This key is activated by setting "dnssec-lookaside auto;"
+ # in named.conf.
+ dlv.isc.org. initial-key 257 3 5 "BEAAAAPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2
+ brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+
+ 1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5
+ ymX4BI/oQ+cAK50/xvJv00Frf8kw6ucMTwFlgPe+jnGxPPEmHAte/URk
+ Y62ZfkLoBAADLHQ9IrS2tryAe7mbBZVcOwIeU/Rw/mRx/vwwMCTgNboM
+ QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt
+ TDN0YUuWrBNh";
+
+ # ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml
+ # for current trust anchor information.
+ # NOTE: This key is activated by setting "dnssec-validation auto;"
+ # in named.conf.
+ . initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
+ FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
+ bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
+ X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
+ W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
+ Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
+ QxA+Uk1ihz0=";
+};
+
+"""
+
+ def test_hang(self):
+ BIND9Parser().parse(self.source)
+