@classmethod
def generateAuthConfig(cls, confdir, threads, extra=''):
bind_dnssec_db = os.path.join(confdir, 'bind-dnssec.sqlite3')
-
+ print('writing to ' + os.path.join(confdir, 'pdns.conf'))
with open(os.path.join(confdir, 'pdns.conf'), 'w') as pdnsconf:
pdnsconf.write("""
module-dir={moduledir}
authconfdir = os.path.join(confdir, 'auth-%s' % auth_suffix)
os.mkdir(authconfdir)
-
+ print(authconfdir)
cls.generateAuthConfig(authconfdir, threads)
cls.generateAuthNamedConf(authconfdir, zones)
if cls._zone_keys.get(zone, None):
cls.secureZone(authconfdir, zone, cls._zone_keys.get(zone))
+ @classmethod
+ def setUpClassSpecialAuths(cls):
+ # tear down existing auths, and start with our own special config
+ confdir = os.path.join('configs', 'auths')
+ cls.tearDownAuth()
+ #confdir = os.path.join('configs', cls._confdir)
+ print("Specialized auth setup" + confdir)
+ cls.createConfigDir(confdir)
+ cls.generateAllAuthConfig(confdir)
+ cls.startAllAuth(confdir)
+
@classmethod
def startAllAuth(cls, confdir):
if cls._auth_zones:
print("Launching tests..")
@classmethod
- def tearDownClass(cls):
+ def tearDownClass(cls, withAuths=False):
rec = None
- #auth = None
+ auth = None
resp = None
try:
cls.tearDownRecursor()
except BaseException as e:
rec = e
- #try:
- # cls.tearDownAuth()
- #except BaseException as e:
- # auth = e
+ try:
+ if withAuths:
+ cls.tearDownAuth()
+ except BaseException as e:
+ auth = e
try:
cls.tearDownResponders()
except BaseException as e:
resp = e
if rec is not None:
raise rec
- #if auth is not None:
- # raise auth
+ if auth is not None:
+ raise auth
if resp is not None:
raise resp
An object to indicate a drop action shall be taken
"""
pass
+
+
import subprocess
import extendederrors
import pytest
+import shutil
class AggressiveNSECCacheBase(RecursorTest):
__test__ = False
self.assertEqual(res.options[0].otype, 15)
self.assertEqual(res.options[0], extendederrors.ExtendedErrorOption(9, b''))
-@pytest.mark.skip(reason="changes auth config")
class AggressiveNSECCacheNSEC3Test(AggressiveNSECCacheBase):
_confdir = 'AggressiveNSECCacheNSEC3'
__test__ = True
+ @classmethod
+ def setUpClass(cls):
+ cls.setUpClassSpecialAuths()
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ confdir = os.path.join('configs', cls._confdir)
+ print("Specialized auth teardown " + confdir)
+ # tear down specialized auths, and then start standard ones
+ super().tearDownClass(True)
+ print("Starting default auths")
+ confdir = 'configs/auths'
+ shutil.rmtree(confdir, True)
+ os.mkdir(confdir)
+ # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+ RecursorTest.generateAllAuthConfig(confdir)
+ RecursorTest.startAllAuth(confdir)
+
@classmethod
def secureZone(cls, confdir, zonename, key=None):
zone = '.' if zonename == 'ROOT' else zonename
import dns
import extendederrors
import pytest
+import shutil
from recursortests import RecursorTest
-
-@pytest.mark.skip(reason="changes auth config")
class ExpiredTest(RecursorTest):
"""This regression test starts the authoritative servers with a clock that is
set 15 days into the past. Hence, the recursor must reject the signatures
_auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
'FAKETIME':'-15d'}
+ @classmethod
+ def setUpClass(cls):
+ cls.setUpClassSpecialAuths()
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ confdir = os.path.join('configs', 'auths')
+ print("Specialized auth teardown " + confdir)
+ # tear down specialized auths, and then start standard ones
+ super().tearDownClass(True)
+ print("Starting default auths")
+ #confdir = 'configs/auths'
+ shutil.rmtree(confdir, True)
+ os.mkdir(confdir)
+ # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+ RecursorTest.generateAllAuthConfig(confdir)
+ RecursorTest.startAllAuth(confdir)
+
def testA(self):
query = dns.message.make_query('host1.secure.example', 'A')
res = self.sendUDPQuery(query)
self.assertRcodeEqual(res, dns.rcode.SERVFAIL)
-@pytest.mark.skip(reason="changes auth config")
class ExpiredWithEDETest(RecursorTest):
"""This regression test starts the authoritative servers with a clock that is
set 15 days into the past. Hence, the recursor must reject the signatures
_auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
'FAKETIME':'-15d'}
+ @classmethod
+ def setUpClass(cls):
+ cls.setUpClassSpecialAuths()
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ confdir = os.path.join('configs', 'auths')
+ print("Specialized auth teardown " + confdir)
+ # tear down specialized auths, and then start standard ones
+ super().tearDownClass(True)
+ print("Starting default auths")
+ #confdir = 'configs/auths'
+ shutil.rmtree(confdir, True)
+ os.mkdir(confdir)
+ # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+ RecursorTest.generateAllAuthConfig(confdir)
+ RecursorTest.startAllAuth(confdir)
def testA(self):
qname = 'host1.secure.example'
import os
import dns
import pytest
+import shutil
from recursortests import RecursorTest
-@pytest.mark.skip(reason="changes auth config")
class NotYetValidTest(RecursorTest):
"""This regression test starts the authoritative servers with a clock that is
set 15 days into the future. Hence, the recursor must reject the signatures
_auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
'FAKETIME':'+15d'}
+ @classmethod
+ def setUpClass(cls):
+ cls.setUpClassSpecialAuths()
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ confdir = os.path.join('configs', 'auths')
+ print("Specialized auth teardown " + confdir)
+ # tear down specialized auths, and then start standard ones
+ super().tearDownClass(True)
+ print("Starting default auths")
+ #confdir = 'configs/auths'
+ shutil.rmtree(confdir, True)
+ os.mkdir(confdir)
+ # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+ RecursorTest.generateAllAuthConfig(confdir)
+ RecursorTest.startAllAuth(confdir)
+
def testA(self):
query = dns.message.make_query('host1.secure.example', 'A')
res = self.sendUDPQuery(query)
import dns
import dnstap_pb2
import pytest
+import traceback
from recursortests import RecursorTest
FSTRM_CONTROL_ACCEPT = 0x01
elif cft == FSTRM_CONTROL_START:
return None
else:
- raise Exception('unhandled control frame ' + cft)
+ raise Exception('unhandled control frame ' + str(cft))
def fstrm_read_and_dispatch_control_frame(conn):
import dns
import os
import pytest
+import shutil
from recursortests import RecursorTest
-@pytest.mark.skip(reason="changes auth config")
class SimpleCookiesTest(RecursorTest):
_confdir = 'SimpleCookies'
_auth_zones = RecursorTest._default_auth_zones
def generateAuthConfig(cls, confdir, threads):
super(SimpleCookiesAuthEnabledTest, cls).generateAuthConfig(confdir, threads, "edns-cookie-secret=01234567890123456789012345678901")
+ @classmethod
+ def setUpClass(cls):
+ cls.setUpClassSpecialAuths()
+ super().setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ confdir = os.path.join('configs', 'auths')
+ print("Specialized auth teardown " + confdir)
+ # tear down specialized auths, and then start standard ones
+ super().tearDownClass(True)
+ print("Starting default auths")
+ #confdir = 'configs/auths'
+ shutil.rmtree(confdir, True)
+ os.mkdir(confdir)
+ # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+ RecursorTest.generateAllAuthConfig(confdir)
+ RecursorTest.startAllAuth(confdir)