DKIM Support.

This commit is contained in:
usmannasir
2018-05-01 00:49:47 +05:00
parent ff9161322a
commit 69a9dcd3d2
10 changed files with 326 additions and 18 deletions

View File

@@ -290,7 +290,7 @@ def submitWebsiteCreation(request):
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
execPath = execPath + " createVirtualHost --virtualHostName " + domain + " --administratorEmail " + adminEmail + " --phpVersion '" + phpSelection + "' --virtualHostUser " + externalApp + " --numberOfSites " + numberOfWebsites + " --ssl " + str(
data['ssl']) + " --sslPath " + sslpath
data['ssl']) + " --sslPath " + sslpath + " --dkimCheck " + str(data['dkimCheck'])
output = subprocess.check_output(shlex.split(execPath))
@@ -404,6 +404,68 @@ def submitWebsiteCreation(request):
disabled=0,
auth=1)
record.save()
## TXT Records for mail
record = Records(domainOwner=zone,
domain_id=zone.id,
name=topLevelDomain,
type="TXT",
content="v=spf1 a mx ip4:" + ipAddress + " ~all",
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
record = Records(domainOwner=zone,
domain_id=zone.id,
name="_dmarc." + topLevelDomain,
type="TXT",
content="v=DMARC1; p=none",
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
record = Records(domainOwner=zone,
domain_id=zone.id,
name="_domainkey." + topLevelDomain,
type="TXT",
content="t=y; o=~;",
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
## DKIM Support
if data['dkimCheck'] == 1:
path = "/etc/opendkim/keys/" + topLevelDomain + "/default.txt"
command = "sudo cat " + path
output = subprocess.check_output(shlex.split(command))
record = Records(domainOwner=zone,
domain_id=zone.id,
name="default._domainkey." + topLevelDomain,
type="TXT",
content="v=DKIM1; k=rsa; p=" + output[53:269],
ttl=3600,
prio=0,
disabled=0,
auth=1)
record.save()
else:
if Domains.objects.filter(name=topLevelDomain).count() == 0: