sshfingerprint in DNS

This commit is contained in:
Charlie Jacomme 2018-08-09 01:26:46 +02:00
parent 65e35fb655
commit a950989980

14
main.py
View file

@ -33,6 +33,7 @@ template_a = "{hostname} IN A {ipv4}"
template_aaaa = "{hostname} IN AAAA {ipv6}"
template_cname = "{hostname} IN CNAME {alias}."
template_ptr = "{target} IN PTR {hostname}."
template_sshfp = "{hostname} SSHFP {algo} {type} {fp}"
template_zone = ("$TTL 2D\n"
"{soa}\n"
@ -42,6 +43,9 @@ template_zone = ("$TTL 2D\n"
"\n"
"{ns_records}\n"
"\n"
"{fp_records}\n"
"\n"
"{ns_records}\n"
"{mx_records}\n"
"\n"
"{txt_records}\n"
@ -105,6 +109,15 @@ def write_dns_files(api_client):
for x in zone['ns_records']
)
fp_records = "\n".join(
template_sshfp.format(hostname=host['hostname'], algo=fp['algo_id'], type="1", fp=fp['hash']['1'] )
+ "\n" +
template_sshfp.format(hostname=host['hostname'], algo=fp['algo_id'], type="2", fp=fp['hash']['2'] )
for host in zone['sshfp_records']
for fp in host['sshfp']
)
mx_records = "\n".join(
template_mx.format(priority=x['priority'],
target=x['target'])
@ -153,6 +166,7 @@ def write_dns_files(api_client):
originv4=originv4,
originv6=originv6,
ns_records=ns_records,
fp_records=fp_records,
mx_records=mx_records,
txt_records=txt_records,
srv_records=srv_records,