Commit 4c472095 authored by Valentin Samir's avatar Valentin Samir

Lets -key print all DNSKEYS. We add -KSK and -ZSK options to print only theses keys

parent 6d0843b9
...@@ -191,9 +191,13 @@ class Zone(object): ...@@ -191,9 +191,13 @@ class Zone(object):
p = subprocess.Popen(cmd) p = subprocess.Popen(cmd)
p.wait() p.wait()
def key(self): def key(self, show_ksk=False, show_zsk=False):
for ksk in self.KSK: if show_ksk:
print ksk for ksk in self.KSK:
print ksk
if show_zsk:
for zsk in self.ZSK:
print zsk
def __init__(self, name): def __init__(self, name):
path = os.path.join(BASE, name) path = os.path.join(BASE, name)
...@@ -501,13 +505,23 @@ if __name__ == '__main__': ...@@ -501,13 +505,23 @@ if __name__ == '__main__':
parser.add_argument( parser.add_argument(
'-ds', '-ds',
action='store_true', action='store_true',
help='Show DS for each supplied zone or for all zones if no zone supplied' help='Show KSK DS for each supplied zone or for all zones if no zone supplied'
) )
parser.add_argument( parser.add_argument(
'-key', '-key',
action='store_true', action='store_true',
help='Show DNSKEY for each zone supplied zone or for all zones if no zone supplied' help='Show DNSKEY for each zone supplied zone or for all zones if no zone supplied'
) )
parser.add_argument(
'-KSK',
action='store_true',
help='Show KSK DNSKEY for each zone supplied zone or for all zones if no zone supplied'
)
parser.add_argument(
'-ZSK',
action='store_true',
help='Show ZSK DNSKEY for each zone supplied zone or for all zones if no zone supplied'
)
parser.add_argument( parser.add_argument(
'--ds-seen', '--ds-seen',
metavar='KEYID', metavar='KEYID',
...@@ -547,8 +561,15 @@ if __name__ == '__main__': ...@@ -547,8 +561,15 @@ if __name__ == '__main__':
zone.ds() zone.ds()
if args.key: if args.key:
for zone in zones: for zone in zones:
zone.key() zone.key(show_ksk=True, show_zsk=True)
if not any([args.make, args.cron, args.ds, args.key, args.ds_seen, args.nsec3]): else:
if args.KSK:
for zone in zones:
zone.key(show_ksk=True)
if args.ZSK:
for zone in zones:
zone.key(show_zsk=True)
if not any([args.make, args.cron, args.ds, args.key, args.ds_seen, args.nsec3, args.KSK, args.ZSK]):
parser.print_help() parser.print_help()
except ValueError as error: except ValueError as error:
sys.stderr.write("%s\n" % error) sys.stderr.write("%s\n" % error)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment