]>
Commit | Line | Data |
---|---|---|
7a0ea291 | 1 | from __future__ import print_function |
11886ab9 PL |
2 | from basicDNSSEC import BasicDNSSEC |
3 | import os | |
4 | import subprocess | |
5 | ||
6 | class basicNSEC3(BasicDNSSEC): | |
7 | __test__ = True | |
8 | _confdir = 'basicNSEC3' | |
9 | ||
10 | @classmethod | |
11 | def secureZone(cls, confdir, zonename, key=None): | |
12 | zone = '.' if zonename == 'ROOT' else zonename | |
13 | if not key: | |
14 | pdnsutilCmd = [os.environ['PDNSUTIL'], | |
15 | '--config-dir=%s' % confdir, | |
16 | 'secure-zone', | |
17 | zone] | |
18 | else: | |
19 | keyfile = os.path.join(confdir, 'dnssec.key') | |
20 | with open(keyfile, 'w') as fdKeyfile: | |
21 | fdKeyfile.write(key) | |
22 | ||
23 | pdnsutilCmd = [os.environ['PDNSUTIL'], | |
24 | '--config-dir=%s' % confdir, | |
25 | 'import-zone-key', | |
26 | zone, | |
27 | keyfile, | |
28 | 'active', | |
29 | 'ksk'] | |
30 | ||
7a0ea291 | 31 | print(' '.join(pdnsutilCmd)) |
11886ab9 PL |
32 | try: |
33 | subprocess.check_output(pdnsutilCmd, stderr=subprocess.STDOUT) | |
34 | except subprocess.CalledProcessError as e: | |
7a0ea291 | 35 | print(e.output) |
11886ab9 PL |
36 | raise |
37 | ||
38 | params = "1 0 100 AABBCCDDEEFF112233" | |
39 | ||
40 | if zone == "optout.example": | |
41 | params = "1 1 100 AABBCCDDEEFF112233" | |
42 | ||
43 | pdnsutilCmd = [os.environ['PDNSUTIL'], | |
44 | '--config-dir=%s' % confdir, | |
45 | 'set-nsec3', | |
46 | zone, | |
47 | params] | |
48 | ||
7a0ea291 | 49 | print(' '.join(pdnsutilCmd)) |
11886ab9 PL |
50 | try: |
51 | subprocess.check_output(pdnsutilCmd, stderr=subprocess.STDOUT) | |
52 | except subprocess.CalledProcessError as e: | |
7a0ea291 | 53 | print(e.output) |
11886ab9 | 54 | raise |