mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-05 23:29:45 +01:00
DKIM Support.
This commit is contained in:
@@ -20,6 +20,13 @@ app.controller('createWebsite', function($scope,$http) {
|
||||
var ssl = 0
|
||||
}
|
||||
|
||||
if ($scope.dkimCheck === true){
|
||||
var dkimCheck = 1;
|
||||
}
|
||||
else{
|
||||
var dkimCheck = 0
|
||||
}
|
||||
|
||||
|
||||
$("#webSiteCreation").fadeIn();
|
||||
|
||||
@@ -39,6 +46,7 @@ app.controller('createWebsite', function($scope,$http) {
|
||||
phpSelection: phpSelection,
|
||||
ssl:ssl,
|
||||
websiteOwner:websiteOwner,
|
||||
dkimCheck:dkimCheck
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="sslCheck" type="checkbox" value="">
|
||||
@@ -94,6 +94,15 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="dkimCheck" type="checkbox" value="">
|
||||
DKIM Support
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input ng-pattern="/([\da-z\.-]+\.[a-z\.]{2,6}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?$/i" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
|
||||
<input ng-pattern="*" name="dom" type="text" class="form-control" ng-model="domainNameCreate" required>
|
||||
</div>
|
||||
<div ng-show="websiteCreationForm.dom.$error.pattern" class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
|
||||
<div style="margin-bottom: 1%;" class=" col-sm-1">
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user