From 80f66589a88d6ffd5eee9619b5bed0c7749eb317 Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Tue, 4 Apr 2023 13:47:48 +0500 Subject: [PATCH] v2 sSL --- .../templates/manageSSL/v2ManageSSL.html | 251 +++++++++++------- manageSSL/views.py | 87 +++--- .../websiteFunctions/CyberpanelPricing.html | 2 - 3 files changed, 195 insertions(+), 145 deletions(-) diff --git a/manageSSL/templates/manageSSL/v2ManageSSL.html b/manageSSL/templates/manageSSL/v2ManageSSL.html index a151f7379..e4f88e182 100755 --- a/manageSSL/templates/manageSSL/v2ManageSSL.html +++ b/manageSSL/templates/manageSSL/v2ManageSSL.html @@ -7,135 +7,184 @@ {% get_current_language as LANGUAGE_CODE %} - -
-
-

{% trans "SSL v2" %} - {% trans "DNS Docs" %}

-

{% trans "On this page, you have the option to configure DNS providers that CyberPanel can utilize for issuing SSL certificates, providing enhanced flexibility and ease of renewal." %}

-
-
-
-

- {% trans "SSL v2" %} -

-
- {% if SaveSuccess %} -
- -
-
-

{% trans "Changes saved succesfully." %}

+ {% if PremStat %} +
+
+

{% trans "SSL v2" %} - {% trans "DNS Docs" %}

+

{% trans "On this page, you have the option to configure DNS providers that CyberPanel can utilize for issuing SSL certificates, providing enhanced flexibility and ease of renewal." %}

+
+
+
+

+ {% trans "SSL v2" %} +

+
+ {% if SaveSuccess %} +
+ +
+
+

{% trans "Changes saved succesfully." %}

+
-
- {% endif %} - +
+
+
-
+ -
- -
- -
-
- +
+ +
+ +
+
+ +
+
-
+
-
- -
-

SSL Status: {$ sslStatus $}

- +

SSL Status: {$ sslStatus $}

+
+ +
+ + + + +
+
+ +
+ +
+ {% csrf_token %} + +

{% trans "Cloudflare Settings" %}

+ +
+ +
+ +
-
+
+ +
+ +
+
+
+ +
+ + +
+
+ +
-
-
- {% csrf_token %} - -

{% trans "Cloudflare Settings" %}

- -
- -
- -
-
- -
- -
- -
-
- - -
- -
- - -
-
-
- -
- -
+ +
+ {% else %} + +
+
+

SSLv2 Comes with Full Automation + Wildcard SSLs!

+

Are you tired of the hassle that comes with + setting up SSL certificates for your website? Do you want a faster and easier way to secure your + website without the need for manual verification?

+ Introducing CyberPanel's new feature, SSL v2! With SSL v2, you can automatically issue SSL + certificates using the ACME DNS verification method. This means that you no longer have to worry + about going through the manual process of verifying ownership of your domain.

-

+ What's even better is that we've integrated two of the most popular domain registrars, Cloudflare + and Namecheap, so you can easily issue SSL certificates with just a few clicks. No more fiddling + around with complicated settings and DNS configurations!

+ + With SSL v2, you can rest easy knowing that your website is secure and your visitors' data is + protected. Don't wait any longer to upgrade your website's security - get SSL v2 today!

+
+

+ +

+
+ + + + + + +
+ +
+ {% endif %} {% endblock %} diff --git a/manageSSL/views.py b/manageSSL/views.py index 389433b59..9d92fcbd3 100755 --- a/manageSSL/views.py +++ b/manageSSL/views.py @@ -34,6 +34,11 @@ def v2ManageSSL(request): data = {} + if ACLManager.CheckForPremFeature('all'): + data['PremStat'] = 1 + else: + data['PremStat'] = 0 + if request.method == 'POST': SAVED_CF_Key = request.POST.get('SAVED_CF_Key') SAVED_CF_Email = request.POST.get('SAVED_CF_Email') @@ -42,7 +47,6 @@ def v2ManageSSL(request): data['SaveSuccess'] = 1 - RetStatus, SAVED_CF_Key, SAVED_CF_Email = ACLManager.FetchCloudFlareAPIKeyFromAcme() from plogical.dnsUtilities import DNS DNS.ConfigurePowerDNSInAcme() @@ -60,56 +64,55 @@ def v2IssueSSL(request): userID = request.session['userID'] admin = Administrator.objects.get(pk=userID) try: - if request.method == 'POST': - currentACL = ACLManager.loadedACL(userID) + if ACLManager.CheckForPremFeature('all'): + if request.method == 'POST': + currentACL = ACLManager.loadedACL(userID) - if currentACL['admin'] == 1: - pass - elif currentACL['manageSSL'] == 1: - pass - else: - return ACLManager.loadErrorJson('SSL', 0) + if currentACL['admin'] == 1: + pass + elif currentACL['manageSSL'] == 1: + pass + else: + return ACLManager.loadErrorJson('SSL', 0) - data = json.loads(request.body) - virtualHost = data['virtualHost'] + data = json.loads(request.body) + virtualHost = data['virtualHost'] - if ACLManager.checkOwnership(virtualHost, admin, currentACL) == 1: - pass - else: - return ACLManager.loadErrorJson() + if ACLManager.checkOwnership(virtualHost, admin, currentACL) == 1: + pass + else: + return ACLManager.loadErrorJson() - try: - website = ChildDomains.objects.get(domain=virtualHost) - adminEmail = website.master.adminEmail - path = website.path - except: - website = Websites.objects.get(domain=virtualHost) - adminEmail = website.adminEmail - path = "/home/" + virtualHost + "/public_html" + try: + website = ChildDomains.objects.get(domain=virtualHost) + adminEmail = website.master.adminEmail + path = website.path + except: + website = Websites.objects.get(domain=virtualHost) + adminEmail = website.adminEmail + path = "/home/" + virtualHost + "/public_html" - ## ssl issue + ## ssl issue - execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" - execPath = execPath + " issueSSLv2 --virtualHostName " + virtualHost + " --administratorEmail " + adminEmail + " --path " + path - output = ProcessUtilities.outputExecutioner(execPath) + execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = execPath + " issueSSLv2 --virtualHostName " + virtualHost + " --administratorEmail " + adminEmail + " --path " + path + output = ProcessUtilities.outputExecutioner(execPath) - if output.find("1,") > -1: - ## ssl issue ends - - website.ssl = 1 - website.save() - - data_ret = {'status': 1, "SSL": 1, - 'error_message': "None", 'sslLogs': output} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - else: - data_ret = {'status': 0, "SSL": 0, - 'error_message': output, 'sslLogs': output} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + if output.find("1,") > -1: + ## ssl issue ends + website.ssl = 1 + website.save() + data_ret = {'status': 1, "SSL": 1, + 'error_message': "None", 'sslLogs': output} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + else: + data_ret = {'status': 0, "SSL": 0, + 'error_message': output, 'sslLogs': output} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) except BaseException as msg: data_ret = {'status': 0, "SSL": 0, 'error_message': str(msg)} diff --git a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html index d7b5f6c9a..f0f8f643e 100644 --- a/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html +++ b/websiteFunctions/templates/websiteFunctions/CyberpanelPricing.html @@ -156,8 +156,6 @@
- -