Handle multiple KSK at the same time

This commit is contained in:
Benjamin Graillot 2018-12-25 21:14:16 +01:00
parent 462a0bebc4
commit 9f9e950d5c
2 changed files with 19 additions and 15 deletions

View file

@ -16,19 +16,22 @@ except:
if __name__ == '__main__':
ds_records = {}
for zone in zones:
cds = subprocess.check_output(['/usr/sbin/knotc', 'zone-read', zone, '@', 'CDS'])[:-1].decode('utf-8')
ds = {}
try:
cds = cds.split(' ')
ds['subzone'] = cds[1]
ds['id'] = cds[4]
ds['algo'] = cds[5]
ds['type'] = cds[6]
ds['fp'] = cds[7]
except:
print('Unable to find ksk for', zone)
continue
ds['ttl'] = 172800
ds_records[zone] = ds
cdss = subprocess.check_output(['/usr/sbin/knotc', 'zone-read', zone, '@', 'CDS'])[:-1].decode('utf-8').split('\n')
for cds in cdss:
ds = {}
try:
cds = cds.split(' ')
ds['subzone'] = cds[1]
ds['id'] = cds[4]
ds['algo'] = cds[5]
ds['type'] = cds[6]
ds['fp'] = cds[7]
except:
print('Unable to find ksk for', zone)
continue
ds['ttl'] = 172800
if not zone in ds_records:
ds_records[zone] = []
ds_records[zone].append(ds)
with open('dnssec.json', 'w') as dnssec:
json.dump(ds_records, dnssec)