]>
Commit | Line | Data |
---|---|---|
98194c31 O |
1 | import dns |
2 | import os | |
3 | import subprocess | |
4 | from recursortests import RecursorTest | |
5 | ||
6 | class testSimpleDoT(RecursorTest): | |
7 | """ | |
8 | This tests DoT to auth server in a very basic way and is dependent on powerdns.com nameservers having DoT enabled. | |
9 | """ | |
10 | ||
11 | _confdir = 'SimpleDoT' | |
12 | _config_template = """ | |
13 | dnssec=validate | |
14 | dot-to-auth-names=powerdns.com | |
7d3d2f4f | 15 | devonly-regression-test-mode |
98194c31 O |
16 | """ |
17 | ||
18 | _roothints = None | |
19 | ||
20 | @classmethod | |
21 | def setUpClass(cls): | |
22 | ||
23 | # we don't need all the auth stuff | |
24 | cls.setUpSockets() | |
25 | cls.startResponders() | |
26 | ||
27 | confdir = os.path.join('configs', cls._confdir) | |
28 | cls.createConfigDir(confdir) | |
29 | ||
30 | cls.generateRecursorConfig(confdir) | |
31 | cls.startRecursor(confdir, cls._recursorPort) | |
32 | ||
33 | def testA(self): | |
34 | expected = dns.rrset.from_text('www.powerdns.com.', 0, dns.rdataclass.IN, 'A', '188.166.104.92') | |
35 | query = dns.message.make_query('www.powerdns.com', 'A', want_dnssec=True) | |
36 | query.flags |= dns.flags.AD | |
37 | ||
38 | res = self.sendUDPQuery(query) | |
39 | ||
40 | self.assertMessageIsAuthenticated(res) | |
41 | self.assertRRsetInAnswer(res, expected) | |
42 | self.assertMatchingRRSIGInAnswer(res, expected) | |
43 | ||
44 | rec_controlCmd = [os.environ['RECCONTROL'], | |
45 | '--config-dir=%s' % 'configs/' + self._confdir, | |
46 | 'get dot-outqueries'] | |
47 | try: | |
48 | ret = subprocess.check_output(rec_controlCmd, stderr=subprocess.STDOUT) | |
49 | self.assertNotEqual(ret, b'UNKNOWN\n') | |
50 | self.assertNotEqual(ret, b'0\n') | |
51 | ||
52 | except subprocess.CalledProcessError as e: | |
53 | print(e.output) | |
54 | raise | |
55 | ||
56 | rec_controlCmd = [os.environ['RECCONTROL'], | |
57 | '--config-dir=%s' % 'configs/' + self._confdir, | |
58 | 'get tcp-outqueries'] | |
59 | try: | |
60 | ret = subprocess.check_output(rec_controlCmd, stderr=subprocess.STDOUT) | |
61 | self.assertEqual(ret, b'0\n') | |
62 | ||
63 | except subprocess.CalledProcessError as e: | |
64 | print(e.output) | |
65 | raise | |
66 |