mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 18:07:03 +02:00
Alias Manager.
This commit is contained in:
BIN
websiteFunctions/static/images/icons/web-domain.png
Normal file
BIN
websiteFunctions/static/images/icons/web-domain.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -2426,14 +2426,259 @@ app.controller('manageCronController', function($scope,$http) {
|
||||
|
||||
/* Java script code to manage cron */
|
||||
|
||||
app.controller('manageAliasController', function($scope,$http) {
|
||||
app.controller('manageAliasController', function($scope,$http, $timeout, $window) {
|
||||
|
||||
|
||||
var masterDomain = "";
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = false;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
$scope.showAliasForm = function (domainName) {
|
||||
|
||||
$scope.domainAliasForm = false;
|
||||
$scope.aliasTable = true;
|
||||
$scope.addAliasButton = true;
|
||||
|
||||
masterDomain = domainName;
|
||||
|
||||
};
|
||||
|
||||
$scope.addAliasFunc = function () {
|
||||
|
||||
$scope.manageAliasLoading = false;
|
||||
|
||||
var ssl;
|
||||
|
||||
if ($scope.sslCheck === true){
|
||||
ssl = 1;
|
||||
}
|
||||
else{
|
||||
ssl = 0
|
||||
}
|
||||
|
||||
url = "/websites/submitAliasCreation";
|
||||
|
||||
var data = {
|
||||
masterDomain: masterDomain,
|
||||
aliasDomain:$scope.aliasDomain,
|
||||
ssl:ssl
|
||||
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.createAliasStatus === 1){
|
||||
|
||||
$scope.aliasTable = true;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = false;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = false;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.aliasTable = true;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = false;
|
||||
$scope.aliasError = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.aliasTable = true;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = false;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.issueSSL = function (masterDomain, aliasDomain) {
|
||||
|
||||
$scope.manageAliasLoading = false;
|
||||
|
||||
|
||||
url = "/websites/issueAliasSSL";
|
||||
|
||||
var data = {
|
||||
masterDomain: masterDomain,
|
||||
aliasDomain:aliasDomain,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.sslStatus === 1){
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = false;
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.removeAlias = function (masterDomain, aliasDomain) {
|
||||
|
||||
$scope.manageAliasLoading = false;
|
||||
|
||||
url = "/websites/delateAlias";
|
||||
|
||||
var data = {
|
||||
masterDomain: masterDomain,
|
||||
aliasDomain:aliasDomain,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers : {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.deleteAlias === 1){
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = false;
|
||||
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.aliasTable = false;
|
||||
$scope.addAliasButton = true;
|
||||
$scope.domainAliasForm = true;
|
||||
$scope.aliasError = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.aliasCreated = true;
|
||||
$scope.manageAliasLoading = true;
|
||||
$scope.operationSuccess = true;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
<!------ Modification form that appears after a click --------------->
|
||||
<div class="form-group">
|
||||
<div ng-hide="addAliasButton" class="form-group">
|
||||
<div class="col-sm-4">
|
||||
<button class="btn ra-100 btn-blue-alt">Create Alias</button>
|
||||
<button ng-click="showAliasForm('{{ masterDomain }}')" class="btn ra-100 btn-blue-alt">{% trans 'Create Alias' %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
<td>{{ masterDomain }}</td>
|
||||
<td>{{ alias }}</td>
|
||||
<td>{{ path }}</td>
|
||||
<td><button type="button" ng-click="issueSSL(record.childDomain,record.path)" class="btn ra-100 btn-purple">{% trans "Issue" %}</button></td>
|
||||
<td><button type="button" ng-click="issueSSL('{{ masterDomain }}', '{{ alias }}')" class="btn ra-100 btn-purple">{% trans "Issue" %}</button></td>
|
||||
<td>
|
||||
<a class="btn btn-warning" ng-click="removeAlias()" href=""><i class="glyph-icon icon-trash" title="{% trans "Delete" %}"></i></a>
|
||||
<a class="btn btn-warning" ng-click="removeAlias('{{ masterDomain }}', '{{ alias }}')" href=""><i class="glyph-icon icon-trash" title="{% trans "Delete" %}"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -71,58 +71,63 @@
|
||||
|
||||
<!------ Modification form that appears after a click --------------->
|
||||
|
||||
<div ng-hide="domainAliasForm">
|
||||
<form action="/" class="form-horizontal bordered-row ng-scope ng-dirty ng-valid-parse ng-valid ng-valid-required">
|
||||
<input type="hidden" ng-value="line" required="">
|
||||
<div ng-hide="domainAliasForm">
|
||||
<form action="/" class="form-horizontal bordered-row ng-scope ng-dirty ng-valid-parse ng-valid ng-valid-required">
|
||||
<input type="hidden" ng-value="line" required="">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Alias Domain" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control ng-pristine ng-untouched ng-not-empty ng-valid ng-valid-required" ng-model="aliasDomain" required="">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Alias Domain" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control ng-pristine ng-untouched ng-not-empty ng-valid ng-valid-required" ng-model="aliasDomain" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="sslCheck" type="checkbox" value="">
|
||||
SSL
|
||||
<div ng-show="sslCheck" style="margin-top: 2%;margin-bottom: -2%" class="alert alert-warning">
|
||||
<p>{% trans "For SSL to work DNS of domain should point to server, otherwise self signed SSL will be issued, you can add your own SSL later." %}</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="addAliasFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create Alias" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="sslCheck" type="checkbox" value="">
|
||||
SSL
|
||||
<div ng-show="sslCheck" style="margin-top: 2%;margin-bottom: -2%" class="alert alert-warning">
|
||||
<p>{% trans "For SSL to work DNS of domain should point to server, otherwise self signed SSL will be issued, you can add your own SSL later." %}</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
</form>
|
||||
<div ng-hide="addAliasButton" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="addAliasFunc()" class="btn btn-primary btn-lg btn-block">{% trans "Create Alias" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<div ng-hide="aliasError" class="alert alert-danger">
|
||||
<p>{% trans "Operation failed. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<div ng-hide="aliasError" class="alert alert-danger">
|
||||
<p>{% trans "Operation failed. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="aliasCreated" class="alert alert-success">
|
||||
<p>{% trans "Alias successfully created." %}</p>
|
||||
</div>
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="aliasCreated" class="alert alert-success">
|
||||
<p>{% trans "Alias successfully created. Refreshing page in 3 seconds..." %}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="operationSuccess" class="alert alert-success">
|
||||
<p>{% trans "Operation Successfull." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
@@ -70,6 +70,8 @@ urlpatterns = [
|
||||
## Domain Alias
|
||||
|
||||
url(r'^(?P<domain>([\da-z\.-]+\.[a-z\.]{2,12}|[\d\.]+)([\/:?=&#]{1}[\da-z\.-]+)*[\/\?]?)/domainAlias$', views.domainAlias, name='domainAlias'),
|
||||
|
||||
url(r'^submitAliasCreation',views.submitAliasCreation,name="submitAliasCreation"),
|
||||
url(r'^issueAliasSSL',views.issueAliasSSL,name="issueAliasSSL"),
|
||||
url(r'^delateAlias',views.delateAlias,name="delateAlias"),
|
||||
|
||||
]
|
||||
@@ -24,6 +24,7 @@ import re
|
||||
from random import randint
|
||||
import hashlib
|
||||
from xml.etree import ElementTree
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
# Create your views here.
|
||||
|
||||
|
||||
@@ -308,24 +309,6 @@ def dnsTemplate(request, domain, admin, dkimCheck):
|
||||
auth=1)
|
||||
record.save()
|
||||
|
||||
## DKIM Support
|
||||
|
||||
if 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:
|
||||
@@ -412,24 +395,6 @@ def dnsTemplate(request, domain, admin, dkimCheck):
|
||||
auth=1)
|
||||
record.save()
|
||||
|
||||
## DKIM Support
|
||||
|
||||
if 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()
|
||||
|
||||
## Creating sub-domain level record.
|
||||
|
||||
zone = Domains.objects.get(name=topLevelDomain)
|
||||
@@ -468,6 +433,35 @@ def dnsTemplate(request, domain, admin, dkimCheck):
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
"We had errors while creating DNS records for: " + domain + ". Error message: " + str(msg))
|
||||
|
||||
def createDKIMRecords(request, domain, admin):
|
||||
try:
|
||||
|
||||
import tldextract
|
||||
|
||||
extractDomain = tldextract.extract(domain)
|
||||
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
|
||||
|
||||
zone = Domains.objects.get(name=topLevelDomain)
|
||||
|
||||
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()
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
"We had errors while creating DNS records for: " + domain + ". Error message: " + str(msg))
|
||||
|
||||
|
||||
def siteState(request):
|
||||
try:
|
||||
@@ -579,6 +573,12 @@ def submitWebsiteCreation(request):
|
||||
|
||||
####### Limitations Check End
|
||||
|
||||
##### Zone creation
|
||||
|
||||
dnsTemplate(requests, domain, admin, data['dkimCheck'])
|
||||
|
||||
## zone creation
|
||||
|
||||
numberOfWebsites = str(Websites.objects.count() + ChildDomains.objects.count())
|
||||
sslpath = "/home/" + domain + "/public_html"
|
||||
|
||||
@@ -601,11 +601,10 @@ def submitWebsiteCreation(request):
|
||||
|
||||
## Create Configurations ends here
|
||||
|
||||
##### Zone creation
|
||||
## DKIM Check
|
||||
|
||||
dnsTemplate(requests, domain, admin, data['dkimCheck'])
|
||||
|
||||
## zone creation
|
||||
if data['dkimCheck'] == 1:
|
||||
createDKIMRecords(request,domain,admin)
|
||||
|
||||
selectedPackage = Package.objects.get(packageName=packageName)
|
||||
|
||||
@@ -683,6 +682,18 @@ def submitDomainCreation(request):
|
||||
else:
|
||||
path = "/home/" + masterDomain + "/public_html/" + domain
|
||||
|
||||
### Zone creation.
|
||||
|
||||
try:
|
||||
restore = data['restore']
|
||||
restart = 0
|
||||
except BaseException, msg:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
dnsTemplate(requests, domain, admin, data['dkimCheck'])
|
||||
|
||||
## Zone creation.
|
||||
|
||||
externalApp = master.externalApp
|
||||
numberOfWebsites = str(Websites.objects.count() + ChildDomains.objects.count())
|
||||
|
||||
@@ -700,22 +711,17 @@ def submitDomainCreation(request):
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## Create Configurations ends here
|
||||
|
||||
### Zone creation.
|
||||
## DKIM Check
|
||||
|
||||
try:
|
||||
restore = data['restore']
|
||||
restart = 0
|
||||
except BaseException,msg:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
dnsTemplate(requests, domain, admin, data['dkimCheck'])
|
||||
|
||||
## Zone creation.
|
||||
|
||||
|
||||
|
||||
## Create Configurations ends here
|
||||
except BaseException, msg:
|
||||
if data['dkimCheck'] == 1:
|
||||
createDKIMRecords(request, domain, admin)
|
||||
|
||||
website = ChildDomains(master=master, domain=domain, path=path, phpSelection=phpSelection, ssl=ssl)
|
||||
|
||||
@@ -1811,6 +1817,8 @@ def saveSSL(request):
|
||||
data = json.loads(request.body)
|
||||
domain = data['virtualHost']
|
||||
|
||||
mailUtilities.checkHome()
|
||||
|
||||
## writing data temporary to file
|
||||
|
||||
|
||||
@@ -2647,7 +2655,9 @@ def domainAlias(request,domain):
|
||||
else:
|
||||
noAlias = 1
|
||||
for i in range(3, length):
|
||||
aliases.append(data[i])
|
||||
aliases.append(data[i].rstrip(','))
|
||||
|
||||
aliases = list(set(aliases))
|
||||
|
||||
return render(request, 'websiteFunctions/domainAlias.html', {
|
||||
'masterDomain': domain,
|
||||
@@ -2659,4 +2669,147 @@ def domainAlias(request,domain):
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse(str(msg))
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def submitAliasCreation(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
masterDomain = data['masterDomain']
|
||||
aliasDomain = data['aliasDomain']
|
||||
ssl = data['ssl']
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
##### Zone creation
|
||||
|
||||
dnsTemplate(requests, aliasDomain, admin, 0)
|
||||
|
||||
### Zone creation
|
||||
|
||||
|
||||
|
||||
sslpath = "/home/" + masterDomain + "/public_html"
|
||||
|
||||
## Create Configurations
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " createAlias --masterDomain " + masterDomain + " --aliasDomain " + aliasDomain + " --ssl " + str(
|
||||
ssl) + " --sslPath " + sslpath + " --administratorEmail " + admin.email
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {'createAliasStatus': 0, 'error_message': output, "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## Create Configurations ends here
|
||||
|
||||
|
||||
|
||||
data_ret = {'createAliasStatus': 1, 'error_message': "None", "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'createAliasStatus': 0, 'error_message': str(msg), "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def issueAliasSSL(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
masterDomain = data['masterDomain']
|
||||
aliasDomain = data['aliasDomain']
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
|
||||
sslpath = "/home/" + masterDomain + "/public_html"
|
||||
|
||||
## Create Configurations
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " issueAliasSSL --masterDomain " + masterDomain + " --aliasDomain " + aliasDomain + " --sslPath " + sslpath + " --administratorEmail " + admin.email
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {'sslStatus': 0, 'error_message': output, "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## Create Configurations ends here
|
||||
|
||||
|
||||
|
||||
data_ret = {'sslStatus': 1, 'error_message': "None", "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'sslStatus': 0, 'error_message': str(msg), "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def delateAlias(request):
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
masterDomain = data['masterDomain']
|
||||
aliasDomain = data['aliasDomain']
|
||||
|
||||
admin = Administrator.objects.get(pk=request.session['userID'])
|
||||
|
||||
|
||||
sslpath = "/home/" + masterDomain + "/public_html"
|
||||
|
||||
## Create Configurations
|
||||
|
||||
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
|
||||
execPath = execPath + " deleteAlias --masterDomain " + masterDomain + " --aliasDomain " + aliasDomain
|
||||
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
pass
|
||||
else:
|
||||
data_ret = {'deleteAlias': 0, 'error_message': output, "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
## Create Configurations ends here
|
||||
|
||||
|
||||
|
||||
data_ret = {'deleteAlias': 1, 'error_message': "None", "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'deleteAlias': 0, 'error_message': str(msg), "existsStatus": 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
Reference in New Issue
Block a user