diff --git a/backup/templates/backup/backupSchedule.html b/backup/templates/backup/backupSchedule.html index 3d792c749..a977d9c0b 100644 --- a/backup/templates/backup/backupSchedule.html +++ b/backup/templates/backup/backupSchedule.html @@ -40,8 +40,8 @@
diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 1bf74b1f9..9839a9cca 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -449,6 +449,7 @@ diff --git a/dns/templates/dns/addDeleteDNSRecords.html b/dns/templates/dns/addDeleteDNSRecords.html index 8df918ef8..81b526702 100644 --- a/dns/templates/dns/addDeleteDNSRecords.html +++ b/dns/templates/dns/addDeleteDNSRecords.html @@ -48,7 +48,7 @@
  • SPF
  • NS
  • SOA
  • -
  • SRV
  • +
  • SRV
  • diff --git a/install/FileManager/.idea/workspace.xml b/install/FileManager/.idea/workspace.xml index 22a227462..6abcfb429 100644 --- a/install/FileManager/.idea/workspace.xml +++ b/install/FileManager/.idea/workspace.xml @@ -111,6 +111,7 @@ + @@ -128,7 +129,6 @@ - @@ -165,25 +165,26 @@ + - - + - + - + @@ -256,6 +257,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/manageSSL/static/manageSSL/manageSSL.js b/manageSSL/static/manageSSL/manageSSL.js index 8b65bf973..8c4753276 100644 --- a/manageSSL/static/manageSSL/manageSSL.js +++ b/manageSSL/static/manageSSL/manageSSL.js @@ -174,4 +174,91 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) { }; }); -/* Java script code to issue SSL for hostname */ \ No newline at end of file +/* Java script code to issue SSL for hostname */ + + +/* Java script code to issue SSL for MailServer */ +app.controller('sslIssueForMailServer', function($scope,$http) { + + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = true; + $scope.canNotIssue = true; + $scope.sslIssued = true; + $scope.couldNotConnect = true; + + $scope.showbtn = function () { + $scope.issueSSLBtn = false; + }; + + + $scope.issueSSL = function(){ + + $scope.manageSSLLoading = false; + + var url = "/manageSSL/obtainMailServerSSL"; + + + var data = { + virtualHost:$scope.virtualHost, + }; + + var config = { + headers : { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if(response.data.SSL === 1){ + + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = true; + $scope.sslIssued = false; + $scope.couldNotConnect = true; + + $scope.sslDomain = $scope.virtualHost; + + + } + + else + { + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = false; + $scope.sslIssued = true; + $scope.couldNotConnect = true; + $scope.errorMessage = response.data.error_message; + + } + + + + } + function cantLoadInitialDatas(response) { + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = true; + $scope.sslIssued = true; + $scope.couldNotConnect = false; + + } + + + + + + }; + +}); +/* Java script code to issue SSL for MailServer */ \ No newline at end of file diff --git a/manageSSL/templates/manageSSL/sslForMailServer.html b/manageSSL/templates/manageSSL/sslForMailServer.html new file mode 100644 index 000000000..191306c5a --- /dev/null +++ b/manageSSL/templates/manageSSL/sslForMailServer.html @@ -0,0 +1,81 @@ +{% extends "baseTemplate/index.html" %} +{% load i18n %} +{% block title %}{% trans "Issue SSL For MailServer - CyberPanel" %}{% endblock %} +{% block content %} + +{% load static %} +{% get_current_language as LANGUAGE_CODE %} + + + +
    +
    +

    {% trans "Issue SSL For MailServer" %}

    +

    {% trans "Let’s Encrypt SSL for MailServer (Postfix/Dovecot)." %}

    +
    + +
    +
    +

    + {% trans "Issue SSL For MailServer" %} +

    +
    + + +
    + + +
    + +
    + +
    +
    + +
    + +
    + + +
    +
    + + +
    + +
    +
    +

    {% trans "Cannot issue SSL. Error message:" %} {$ errorMessage $}

    +
    + +
    +

    {% trans "SSL Issued, your mail server now uses Lets Encrypt!" %}

    +
    + +
    +

    {% trans "Could not connect to server, please refresh this page." %}

    +
    +
    + + + +
    + + +
    + + + +
    +
    +
    + + +
    + + +{% endblock %} \ No newline at end of file diff --git a/manageSSL/urls.py b/manageSSL/urls.py index 2fa66ee15..02065f33b 100644 --- a/manageSSL/urls.py +++ b/manageSSL/urls.py @@ -9,5 +9,8 @@ urlpatterns = [ url(r'^issueSSL', views.issueSSL, name='issueSSL'), url(r'^sslForHostName', views.sslForHostName, name='sslForHostName'), - url(r'^obtainHostNameSSL', views.obtainHostNameSSL, name='obtainHostNameSSL'), + url(r'^obtainHostNameSSL$', views.obtainHostNameSSL, name='obtainHostNameSSL'), + + url(r'^sslForMailServer', views.sslForMailServer, name='sslForMailServer'), + url(r'^obtainMailServerSSL', views.obtainMailServerSSL, name='obtainMailServerSSL'), ] \ No newline at end of file diff --git a/manageSSL/views.py b/manageSSL/views.py index daf0d3bbb..902268566 100644 --- a/manageSSL/views.py +++ b/manageSSL/views.py @@ -167,7 +167,6 @@ def sslForHostName(request): except KeyError: return redirect(loadLoginPage) - def obtainHostNameSSL(request): try: val = request.session['userID'] @@ -209,6 +208,95 @@ def obtainHostNameSSL(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) except KeyError: + data_ret = {"SSL": 0, + 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + +def sslForMailServer(request): + try: + val = request.session['userID'] + + admin = Administrator.objects.get(pk=request.session['userID']) + + if admin.type==1: + pass + else: + return HttpResponse("You should be admin to issue SSL For Hostname.") + + if admin.type == 1: + websites = Websites.objects.all() + websitesName = [] + + for items in websites: + websitesName.append(items.domain) + else: + if admin.type == 2: + websites = admin.websites_set.all() + admins = Administrator.objects.filter(owner=admin.pk) + websitesName = [] + + for items in websites: + websitesName.append(items.domain) + + for items in admins: + webs = items.websites_set.all() + + for web in webs: + websitesName.append(web.domain) + else: + websitesName = [] + websites = Websites.objects.filter(admin=admin) + for items in websites: + websitesName.append(items.domain) + + return render(request, 'manageSSL/sslForMailServer.html',{'websiteList':websitesName}) + except KeyError: + return redirect(loadLoginPage) + +def obtainMailServerSSL(request): + try: + val = request.session['userID'] + try: + if request.method == 'POST': + + data = json.loads(request.body) + virtualHost = data['virtualHost'] + + website = Websites.objects.get(domain=virtualHost) + + path = "/home/" + virtualHost + "/public_html" + + ## ssl issue + + execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + + execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path + + logging.writeToFile(execPath) + + + output = subprocess.check_output(shlex.split(execPath)) + + if output.find("1,None") > -1: + data_ret = {"SSL": 1, + 'error_message': "None"} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + else: + data_ret = {"SSL": 0, + 'error_message': output} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + ## ssl issue ends + + except BaseException,msg: + data_ret = {"SSL": 0, + 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + except KeyError,msg: data_ret = {"SSL": 0, 'error_message': str(msg)} json_data = json.dumps(data_ret) diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 2ce230f7f..c2a809a2d 100644 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -1577,6 +1577,141 @@ def issueSSLForHostName(virtualHost,path): str(msg) + " [issueSSLForHostName]") print "0,"+str(msg) +def issueSSLForMailServer(virtualHost,path): + try: + + FNULL = open(os.devnull, 'w') + + srcPrivKey = "/etc/letsencrypt/live/" + virtualHost + "/privkey.pem" + srcFullChain = "/etc/letsencrypt/live/" + virtualHost + "/fullchain.pem" + + pathToStoreSSL = virtualHostUtilities.Server_root + "/conf/vhosts/" + "SSL-" + virtualHost + + pathToStoreSSLPrivKey = pathToStoreSSL + "/privkey.pem" + pathToStoreSSLFullChain = pathToStoreSSL + "/fullchain.pem" + + + ## removing old certs + + if os.path.exists(pathToStoreSSLPrivKey): + os.remove(pathToStoreSSLPrivKey) + if os.path.exists(pathToStoreSSLFullChain): + os.remove(pathToStoreSSLFullChain) + + + adminEmail = "email@" + virtualHost + + if not (os.path.exists(srcPrivKey) and os.path.exists(srcFullChain)): + + retValues = sslUtilities.issueSSLForDomain(virtualHost, adminEmail, path) + + if retValues[0] == 0: + print "0," + str(retValues[1]) + return + + + else: + ###### Copy SSL To config location ###### + + try: + os.mkdir(pathToStoreSSL) + except BaseException, msg: + logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Directory for SSL already exists.. Continuing [issueSSLForHostName]]") + + srcPrivKey = "/etc/letsencrypt/live/" + virtualHost + "/privkey.pem" + srcFullChain = "/etc/letsencrypt/live/" + virtualHost + "/fullchain.pem" + + shutil.copy(srcPrivKey, pathToStoreSSLPrivKey) + shutil.copy(srcFullChain, pathToStoreSSLFullChain) + + + ## MailServer specific functions + + if os.path.exists("/etc/postfix/cert.pem"): + os.remove("/etc/postfix/cert.pem") + + if os.path.exists("/etc/postfix/key.pem"): + os.remove("/etc/postfix/key.pem") + + if os.path.exists("/etc/pki/dovecot/private/dovecot.pem"): + os.remove("/etc/pki/dovecot/private/dovecot.pem") + + if os.path.exists("/etc/pki/dovecot/certs/dovecot.pem"): + os.remove("/etc/pki/dovecot/certs/dovecot.pem") + + if os.path.exists("/etc/dovecot/key.pem"): + os.remove("/etc/dovecot/key.pem") + + if os.path.exists("/etc/dovecot/cert.pem"): + os.remove("/etc/dovecot/cert.pem") + + + ## Postfix + + shutil.copy(srcPrivKey, "/etc/postfix/key.pem") + shutil.copy(srcFullChain, "/etc/postfix/cert.pem") + + ## Dovecot + + shutil.copy(srcPrivKey, "/etc/pki/dovecot/private/dovecot.pem") + shutil.copy(srcFullChain, "/etc/pki/dovecot/certs/dovecot.pem") + + ## Dovecot 2ND + + shutil.copy(srcPrivKey, "/etc/dovecot/key.pem") + shutil.copy(srcFullChain, "/etc/dovecot/cert.pem") + + + vhostPath = virtualHostUtilities.Server_root + "/conf/vhosts" + command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath + cmd = shlex.split(command) + subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT) + + ## Update postmaster address dovecot + + filePath = "/etc/dovecot/dovecot.conf" + + data = open(filePath,'r').readlines() + + writeFile = open(filePath,'w') + + for items in data: + if items.find('postmaster_address') > -1: + writeFile.writelines(' postmaster_address = postmaster@' + virtualHost + '\n') + else: + writeFile.writelines(items) + + writeFile.close() + + ## Update myhostname address postfix + + filePath = "/etc/postfix/main.cf" + + data = open(filePath, 'r').readlines() + + writeFile = open(filePath, 'w') + + for items in data: + if items.find('myhostname') > -1: + writeFile.writelines('myhostname = ' + virtualHost + '\n') + else: + writeFile.writelines(items) + + writeFile.close() + + command = 'systemctl restart postfix' + subprocess.call(shlex.split(command)) + + command = 'systemctl restart dovecot' + subprocess.call(shlex.split(command)) + + print "1,None" + + except BaseException,msg: + logging.CyberCPLogFileWriter.writeToFile( + str(msg) + " [issueSSLForHostName]") + print "0,"+str(msg) + def saveSSL(virtualHost,pathToStoreSSL,keyPath,certPath,sslCheck): @@ -1693,6 +1828,8 @@ def main(): installJoomla(args.virtualHostName,args.path,args.virtualHostUser,args.dbName,args.dbUser,args.dbPassword,args.username,args.password,args.prefix,args.sitename) elif args.function == "issueSSLForHostName": issueSSLForHostName(args.virtualHostName,args.path) + elif args.function == "issueSSLForMailServer": + issueSSLForMailServer(args.virtualHostName,args.path) elif args.function == "findDomainBW": virtualHostUtilities.findDomainBW(args.virtualHostName, int(args.bandwidth)) diff --git a/static/dns/dns.js b/static/dns/dns.js index cc19e3c84..3071300e1 100644 --- a/static/dns/dns.js +++ b/static/dns/dns.js @@ -47,7 +47,7 @@ app.controller('createNameserver', function($scope,$http) { function ListInitialDatas(response) { - if(response.data.NSCreation == 1){ + if(response.data.NSCreation === 1){ $scope.createNameserverLoading = true; $scope.nameserverCreationFailed = true; $scope.nameserverCreated = false; @@ -119,7 +119,7 @@ app.controller('createDNSZone', function($scope,$http) { function ListInitialDatas(response) { - if(response.data.zoneCreation == 1){ + if(response.data.zoneCreation === 1){ $scope.createDNSZoneLoading = true; $scope.dnsZoneCreationFailed = true; $scope.dnsZoneCreated = false; @@ -160,23 +160,46 @@ app.controller('createDNSZone', function($scope,$http) { app.controller('addModifyDNSRecords', function($scope,$http) { - $scope.addRecordsBox = true; - $scope.currentRecords = true; - $scope.canNotFetchRecords = true; - $scope.recordsFetched = true; - $scope.recordDeleted = true; - $scope.recordAdded = true; - $scope.couldNotConnect = true; - $scope.recordsLoading = true; - $scope.recordDeleted = true; - $scope.couldNotDeleteRecords = true; - $scope.couldNotAddRecord = true; - $scope.recordValueDefault = false; - $scope.recordValueMX = true; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = true; - $scope.recordValueTXT = true; + $scope.addRecordsBox = true; + $scope.currentRecords = true; + $scope.canNotFetchRecords = true; + $scope.recordsFetched = true; + $scope.recordDeleted = true; + $scope.recordAdded = true; + $scope.couldNotConnect = true; + $scope.recordsLoading = true; + $scope.recordDeleted = true; + $scope.couldNotDeleteRecords = true; + $scope.couldNotAddRecord = true; + $scope.recordValueDefault = false; + + // Hide records boxes + $(".aaaaRecord").hide(); + $(".cNameRecord").hide(); + $(".mxRecord").hide(); + $(".txtRecord").hide(); + $(".spfRecord").hide(); + $(".nsRecord").hide(); + $(".soaRecord").hide(); + $(".srvRecord").hide(); + + + + + + var currentSelection = "aRecord"; + $("#"+currentSelection).addClass("active"); + + $scope.fetchRecordsTabs = function (recordType) { + $("#"+currentSelection).removeClass("active"); + $("."+currentSelection).hide(); + $scope.recordsLoading = false; + currentSelection = recordType; + $("#"+currentSelection).addClass("active"); + $("."+currentSelection).show(); + populateCurrentRecords(); + }; + $scope.fetchRecords = function(){ @@ -186,7 +209,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) { }; - $scope.addDNSRecord = function(){ + $scope.addDNSRecord = function(type){ $scope.recordsLoading = false; @@ -194,56 +217,82 @@ app.controller('addModifyDNSRecords', function($scope,$http) { url = "/dns/addDNSRecord"; - var selectedZone = $scope.selectedZone; - var recordName = $scope.recordName; - var recordType = $scope.recordType; - - //specific values - - var recordContentMX = ""; - var recordContentA = ""; - var recordContentAAAA = ""; - var recordContentCNAME = ""; - var recordContentSPF = ""; - var recordContentTXT = ""; - - - // Record specific values - if($scope.recordType=="MX"){ - recordContentMX = $scope.recordContentMX; + var data = {}; + + if(type === "MX"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentMX = $scope.recordContentMX; + data.priority = $scope.priority; + data.ttl = $scope.ttl; + data.recordType = type; } - else if($scope.recordType=="A"){ - recordContentA = $scope.recordContentA; + else if(type === "A"){ + + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentA = $scope.recordContentA; + data.ttl = $scope.ttl; + data.recordType = type; + } - else if($scope.recordType=="AAAA"){ - recordContentAAAA = $scope.recordContentAAAA; + else if(type === "AAAA"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentAAAA = $scope.recordContentAAAA; + data.ttl = $scope.ttl; + data.recordType = type; } - else if($scope.recordType=="CNAME"){ - recordContentCNAME = $scope.recordContentCNAME; + else if(type === "CNAME"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentCNAME = $scope.recordContentCNAME; + data.ttl = $scope.ttl; + data.recordType = type; } - else if($scope.recordType=="SPF"){ - recordContentSPF = $scope.recordContentSPF; + else if(type === "SPF"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentSPF = $scope.recordContentSPF; + data.ttl = $scope.ttl; + data.recordType = type; } - else if($scope.recordType=="TXT"){ - recordContentTXT = $scope.recordContentTXT; + else if(type === "SOA"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.selectedZone; + data.recordContentSOA = $scope.recordContentSOA; + data.ttl = $scope.ttl; + data.recordType = type; + } + else if(type === "TXT"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentTXT = $scope.recordContentTXT; + data.ttl = $scope.ttl; + data.recordType = type; + } + else if(type === "NS"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.selectedZone; + data.recordContentNS = $scope.recordContentNS; + data.ttl = $scope.ttl; + data.recordType = type; + } + else if(type === "SRV"){ + data.selectedZone = $scope.selectedZone; + data.recordName = $scope.recordName; + data.recordContentSRV = $scope.recordContentSRV; + data.priority = $scope.priority; + data.ttl = $scope.ttl; + data.recordType = type; } - var data = { - selectedZone:selectedZone, - recordName:recordName, - recordType:recordType, - recordContentA:recordContentA, - recordContentMX:recordContentMX, - recordContentAAAA:recordContentAAAA, - recordContentCNAME:recordContentCNAME, - recordContentSPF:recordContentSPF, - recordContentTXT:recordContentTXT, - }; + var config = { headers : { @@ -258,7 +307,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) { function ListInitialDatas(response) { - if(response.data.add_status == 1){ + if(response.data.add_status === 1){ populateCurrentRecords(); @@ -313,6 +362,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) { var data = { selectedZone:selectedZone, + currentSelection:currentSelection }; var config = { @@ -327,9 +377,7 @@ app.controller('addModifyDNSRecords', function($scope,$http) { function ListInitialDatas(response) { - - - if(response.data.fetchStatus == 1){ + if(response.data.fetchStatus === 1){ $scope.records = JSON.parse(response.data.data); @@ -378,7 +426,6 @@ app.controller('addModifyDNSRecords', function($scope,$http) { }; - $scope.deleteRecord = function(id){ @@ -469,66 +516,6 @@ app.controller('addModifyDNSRecords', function($scope,$http) { - // MX Record Settings - - $scope.detectType = function(){ - - - if($scope.recordType=="MX") - { - $scope.recordValueDefault = true; - $scope.recordValueMX = false; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = true; - $scope.recordValueTXT = true; - } - else if($scope.recordType=="A"){ - $scope.recordValueDefault = false; - $scope.recordValueMX = true; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = true; - $scope.recordValueTXT = true; - } - else if($scope.recordType=="AAAA"){ - $scope.recordValueDefault = true; - $scope.recordValueMX = true; - $scope.recordValueAAAA = false; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = true; - $scope.recordValueTXT = true; - } - else if($scope.recordType=="CNAME"){ - $scope.recordValueDefault = true; - $scope.recordValueMX = true; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = false; - $scope.recordValueSPF = true; - $scope.recordValueTXT = true; - } - else if($scope.recordType=="SPF"){ - $scope.recordValueDefault = true; - $scope.recordValueMX = true; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = false; - $scope.recordValueTXT = true; - } - else if($scope.recordType=="TXT"){ - $scope.recordValueDefault = true; - $scope.recordValueMX = true; - $scope.recordValueAAAA = true; - $scope.recordValueCNAME = true; - $scope.recordValueSPF = true; - $scope.recordValueTXT = false; - } - - - }; - - - }); /* Java script code to delete DNS Zone */ @@ -549,7 +536,7 @@ app.controller('deleteDNSZone', function($scope,$http) { $scope.deleteZoneButton = false; $scope.deleteFailure = true; $scope.deleteSuccess = true; - } + }; $scope.deleteZoneFinal = function(){ diff --git a/static/manageSSL/manageSSL.js b/static/manageSSL/manageSSL.js index 8b65bf973..8c4753276 100644 --- a/static/manageSSL/manageSSL.js +++ b/static/manageSSL/manageSSL.js @@ -174,4 +174,91 @@ app.controller('sslIssueForHostNameCtrl', function($scope,$http) { }; }); -/* Java script code to issue SSL for hostname */ \ No newline at end of file +/* Java script code to issue SSL for hostname */ + + +/* Java script code to issue SSL for MailServer */ +app.controller('sslIssueForMailServer', function($scope,$http) { + + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = true; + $scope.canNotIssue = true; + $scope.sslIssued = true; + $scope.couldNotConnect = true; + + $scope.showbtn = function () { + $scope.issueSSLBtn = false; + }; + + + $scope.issueSSL = function(){ + + $scope.manageSSLLoading = false; + + var url = "/manageSSL/obtainMailServerSSL"; + + + var data = { + virtualHost:$scope.virtualHost, + }; + + var config = { + headers : { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if(response.data.SSL === 1){ + + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = true; + $scope.sslIssued = false; + $scope.couldNotConnect = true; + + $scope.sslDomain = $scope.virtualHost; + + + } + + else + { + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = false; + $scope.sslIssued = true; + $scope.couldNotConnect = true; + $scope.errorMessage = response.data.error_message; + + } + + + + } + function cantLoadInitialDatas(response) { + $scope.sslIssueCtrl = true; + $scope.manageSSLLoading = true; + $scope.issueSSLBtn = false; + $scope.canNotIssue = true; + $scope.sslIssued = true; + $scope.couldNotConnect = false; + + } + + + + + + }; + +}); +/* Java script code to issue SSL for MailServer */ \ No newline at end of file