Commit 60517bdd authored by Andreas Kempe's avatar Andreas Kempe
Browse files

Convert generate_keys.py to a CGI script.

parent c110895c
......@@ -2,14 +2,18 @@
from db import DB
from dnssec_keygen import dnssec_keygen
with DB() as d:
for id in d.get_domain_ids():
domain_name = d.get_domain_name(id)
for sid in d.get_subdomain_ids_without_keys(id):
subdomain_name = d.get_subdomain_name(sid)
fqdn = subdomain_name + '.' + domain_name
with dnssec_keygen() as dk:
print('Generating keys for {}'.format(sid))
public_key, private_key = dk.create_keys(fqdn)
if not d.set_subdomain_keys(sid, public_key, private_key):
print('Could not save keys for {}!'.format(sid))
def application(env, start_response):
with DB() as d:
for id in d.get_domain_ids():
domain_name = d.get_domain_name(id)
for sid in d.get_subdomain_ids_without_keys(id):
subdomain_name = d.get_subdomain_name(sid)
fqdn = subdomain_name + '.' + domain_name
with dnssec_keygen() as dk:
print('Generating keys for {}'.format(sid))
public_key, private_key = dk.create_keys(fqdn)
if not d.set_subdomain_keys(sid, public_key, private_key):
print('Could not save keys for {}!'.format(sid))
start_response('200 OK', [('Content-Type', 'text/html')])
return [b""]
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