Commit 9f9e950d authored by Benjamin Graillot's avatar Benjamin Graillot

Handle multiple KSK at the same time

parent 462a0beb
......@@ -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)
......@@ -218,7 +218,8 @@ def write_dns_file(zone):
zones_ds = json.load(ds)
ds_records = ""
for zone in zones_ds:
ds_records += template_ds.format(**zones_ds[zone]) + "\n"
for ds in zones_ds[zone]:
ds_records += template_ds.format(**ds) + "\n"
else:
ds_records = "\n"
......
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