|
@@ -541,6 +541,16 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
socket.AI_NUMERICHOST)[0][4])
|
|
|
self.assertEqual(isc.acl.acl.REJECT, self.unix._acl.execute(context))
|
|
|
|
|
|
+ def check_loaded_ACL(self):
|
|
|
+ context = isc.acl.dns.RequestContext(socket.getaddrinfo("127.0.0.1",
|
|
|
+ 1234, 0, 0, 0,
|
|
|
+ socket.AI_NUMERICHOST)[0][4])
|
|
|
+ self.assertEqual(isc.acl.acl.ACCEPT, self.unix._acl.execute(context))
|
|
|
+ context = isc.acl.dns.RequestContext(socket.getaddrinfo("192.0.2.1",
|
|
|
+ 1234, 0, 0, 0,
|
|
|
+ socket.AI_NUMERICHOST)[0][4])
|
|
|
+ self.assertEqual(isc.acl.acl.REJECT, self.unix._acl.execute(context))
|
|
|
+
|
|
|
def test_updata_config_data(self):
|
|
|
self.check_default_ACL()
|
|
|
tsig_key_str = 'example.com:SFuWd/q99SzF8Yzd1QbB9g=='
|
|
@@ -563,6 +573,16 @@ class TestUnixSockServer(unittest.TestCase):
|
|
|
self.assertRaises(None, self.unix.update_config_data(config_data))
|
|
|
self.assertEqual(self.unix.tsig_key_ring.size(), 0)
|
|
|
|
|
|
+ # Load the ACL
|
|
|
+ self.unix.update_config_data({'ACL': [{'from': '127.0.0.1',
|
|
|
+ 'action': 'ACCEPT'}]})
|
|
|
+ self.check_loaded_ACL()
|
|
|
+ # Pass a wrong data there and check it does not replace the old one
|
|
|
+ self.assertRaises(isc.acl.acl.LoaderError,
|
|
|
+ self.unix.update_config_data,
|
|
|
+ {'ACL': ['Something bad']})
|
|
|
+ self.check_loaded_ACL()
|
|
|
+
|
|
|
def test_get_db_file(self):
|
|
|
self.assertEqual(self.unix.get_db_file(), "initdb.file")
|
|
|
|