add dkim keys to dns records during fetch

This commit is contained in:
Usman Nasir
2020-05-10 02:20:10 +05:00
parent 157da73ae2
commit b82360f01b
4 changed files with 22 additions and 16 deletions

View File

@@ -474,16 +474,22 @@ class DNS:
leftIndex = output.index('(') + 2
rightIndex = output.rindex(')') - 1
record = Records(domainOwner=zone,
domain_id=zone.id,
name="default._domainkey." + topLevelDomain,
type="TXT",
content=output[leftIndex:rightIndex],
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
if Records.objects.filter(domainOwner=zone, name="default._domainkey." + topLevelDomain).count() == 0:
record = Records(domainOwner=zone,
domain_id=zone.id,
name="default._domainkey." + topLevelDomain,
type="TXT",
content=output[leftIndex:rightIndex],
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
command = ' systemctl restart pdns'
ProcessUtilities.executioner(command)
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
command = ' systemctl restart pdns'