[DNS] gestion des DNAME par le service dns
This commit is contained in:
parent
c77cc9d46a
commit
3cb0231c89
1 changed files with 13 additions and 2 deletions
15
main.py
15
main.py
|
@ -39,6 +39,7 @@ template_srv = "_{service}._{protocole}.{zone}. {ttl} IN SRV {priority} {weight}
|
||||||
template_a = "{hostname} IN A {ipv4}"
|
template_a = "{hostname} IN A {ipv4}"
|
||||||
template_aaaa = "{hostname} IN AAAA {ipv6}"
|
template_aaaa = "{hostname} IN AAAA {ipv6}"
|
||||||
template_cname = "{hostname} IN CNAME {alias}."
|
template_cname = "{hostname} IN CNAME {alias}."
|
||||||
|
template_dname = "@ IN DNAME {zone}."
|
||||||
template_ptr = "{target} IN PTR {hostname}."
|
template_ptr = "{target} IN PTR {hostname}."
|
||||||
template_sshfp = "{hostname} SSHFP {algo} {type} {fp}"
|
template_sshfp = "{hostname} SSHFP {algo} {type} {fp}"
|
||||||
|
|
||||||
|
@ -64,7 +65,9 @@ template_zone = (
|
||||||
"\n"
|
"\n"
|
||||||
"{aaaa_records}\n"
|
"{aaaa_records}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"{cname_records}"
|
"{cname_records}\n"
|
||||||
|
"\n"
|
||||||
|
"{dname_records}\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
template_reverse = (
|
template_reverse = (
|
||||||
|
@ -202,6 +205,13 @@ def write_dns_file(zone):
|
||||||
for x in zone['cname_records']
|
for x in zone['cname_records']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dname_records = "\n".join(
|
||||||
|
template_dname.format(
|
||||||
|
zone=x['zone'][1:],
|
||||||
|
)
|
||||||
|
for x in zone['dname_records']
|
||||||
|
)
|
||||||
|
|
||||||
zone_file_content = template_zone.format(
|
zone_file_content = template_zone.format(
|
||||||
soa=soa,
|
soa=soa,
|
||||||
originv4=originv4,
|
originv4=originv4,
|
||||||
|
@ -213,7 +223,8 @@ def write_dns_file(zone):
|
||||||
srv_records=srv_records,
|
srv_records=srv_records,
|
||||||
a_records=a_records,
|
a_records=a_records,
|
||||||
aaaa_records=aaaa_records,
|
aaaa_records=aaaa_records,
|
||||||
cname_records=cname_records
|
cname_records=cname_records,
|
||||||
|
dname_records=dname_records,
|
||||||
)
|
)
|
||||||
|
|
||||||
filename = path+'/generated/dns.{zone}.zone'.format(zone=zone_name)
|
filename = path+'/generated/dns.{zone}.zone'.format(zone=zone_name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue