Commit d5a77158 authored by aoh's avatar aoh
Browse files

generate_key_example.py: Update

parent 6ca0ba20
#!/bin/bash
echo $0 $1 $2 $3 $4 $5 $6 $7 $8 $9
echo "K$9.+157+20416"
......@@ -8,8 +8,18 @@ with DB() as d:
for sid in d.get_subdomain_ids(id):
subdomain_name = d.get_subdomain_name(sid)
fqdn = subdomain_name + '.' + domain_name
command = './dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 512 -n HOST'
# TODO remove "./" from dnssec-keygen
command = './dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 512 -n HOST' # TODO add -K <dirname>
args = command.split(' ')
args += [fqdn]
with subprocess.Popen(args, stdout=subprocess.PIPE) as proc:
print(proc.stdout.read())
filename = "{}.key".format(proc.stdout.read().decode('utf-8'))
filename = filename.replace("\n", "")
# TODO read file from correct dir
with open(filename, "r") as keyfile:
row = keyfile.readline()
# TODO not sure about the syntax of the keyfile, this is just a guess..
public_key, part = row.split(" ")[6:8]
private_key = public_key + part
print(public_key)
print(private_key)
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