diff --git a/plogical/installUtilities.py b/plogical/installUtilities.py index 9afaf067b..cedfbf654 100755 --- a/plogical/installUtilities.py +++ b/plogical/installUtilities.py @@ -138,9 +138,9 @@ class installUtilities: try: if ProcessUtilities.decideServer() == ProcessUtilities.OLS: - command = "sudo systemctl restart lsws" + command = "systemctl restart lsws" else: - command = "sudo /usr/local/lsws/bin/lswsctrl restart" + command = "/usr/local/lsws/bin/lswsctrl restart" ProcessUtilities.normalExecutioner(command) diff --git a/plogical/renew.py b/plogical/renew.py index 2a6ab45da..08709fc7a 100644 --- a/plogical/renew.py +++ b/plogical/renew.py @@ -37,6 +37,14 @@ class Renew: if int(diff.days) >= 15: logging.writeToFile( 'SSL exists for %s and is not ready to renew, skipping..' % (website.domain)) + elif x509.get_issuer().get_components()[1][1] == 'Denial': + logging.writeToFile( + 'SSL exists for %s and ready to renew..' % (website.domain)) + logging.writeToFile( + 'Renewing SSL for %s..' % (website.domain)) + + virtualHostUtilities.issueSSL(website.domain, '/home/%s/public_html' % (website.domain), + website.adminEmail) else: logging.writeToFile( 'SSL exists for %s and ready to renew..' % (website.domain)) @@ -69,6 +77,14 @@ class Renew: if int(diff.days) >= 15: logging.writeToFile( 'SSL exists for %s and is not ready to renew, skipping..' % (website.domain)) + elif x509.get_issuer().get_components()[1][1] == 'Denial': + logging.writeToFile( + 'SSL exists for %s and ready to renew..' % (website.domain)) + logging.writeToFile( + 'Renewing SSL for %s..' % (website.domain)) + + virtualHostUtilities.issueSSL(website.domain, website.path, + website.master.adminEmail) else: logging.writeToFile( 'SSL exists for %s and ready to renew..' % (website.domain)) diff --git a/plogical/sslUtilities.py b/plogical/sslUtilities.py index 6bc3ed8ba..0d6f6cae9 100755 --- a/plogical/sslUtilities.py +++ b/plogical/sslUtilities.py @@ -348,7 +348,19 @@ def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain = None): else: return [0, "210 Failed to install SSL for domain. [issueSSLForDomain]"] else: - return [0, "283 Failed to obtain SSL for domain. [issueSSLForDomain]"] + + pathToStoreSSLPrivKey = "/etc/letsencrypt/live/%s/privkey.pem" % (domain) + pathToStoreSSLFullChain = "/etc/letsencrypt/live/%s/fullchain.pem" % (domain) + + command = 'openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout ' + pathToStoreSSLPrivKey + ' -out ' + pathToStoreSSLFullChain + cmd = shlex.split(command) + subprocess.call(cmd) + + if sslUtilities.installSSLForDomain(domain) == 1: + logging.CyberCPLogFileWriter.writeToFile("Self signed SSL issued for " + domain + ".") + return [1, "None"] + else: + return [0, "210 Failed to install SSL for domain. [issueSSLForDomain]"] except BaseException,msg: return [0, "347 "+ str(msg)+ " [issueSSLForDomain]"] diff --git a/plogical/test.py b/plogical/test.py index e69de29bb..fd0da0efd 100755 --- a/plogical/test.py +++ b/plogical/test.py @@ -0,0 +1,8 @@ +import OpenSSL +from datetime import datetime +filePath = '/etc/letsencrypt/live/%s/fullchain.pem' % ('hello.com') +x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, + open(filePath, 'r').read()) +expireData = x509.get_notAfter().decode('ascii') +finalDate = datetime.strptime(expireData, '%Y%m%d%H%M%SZ') +print x509.get_issuer().get_components()[1][1] \ No newline at end of file diff --git a/websiteFunctions/templates/websiteFunctions/launchChild.html b/websiteFunctions/templates/websiteFunctions/launchChild.html index 12ef9ea45..b6f2ff99b 100755 --- a/websiteFunctions/templates/websiteFunctions/launchChild.html +++ b/websiteFunctions/templates/websiteFunctions/launchChild.html @@ -79,7 +79,7 @@ {% if viewSSL == 1 %}
Your SSL will expire in {{ days }} days.
Your SSL will expire in {{ days }} days.