+
-
-
+
+
- {% if modSecInstalled == 0 %}
+ {% if modSecInstalled == 0 %}
-
-
{% trans "ModSecurity is not installed " %}
-
-
-
-
-
-
+
+
-
+
+ {% else %}
+
+
+
+
+
{% trans "On this page you can configure ModSecurity settings." %}
+
+
+
+
+
+
+
+
+
+ {% if modSecInstalled == 0 %}
+
+
+
{% trans "ModSecurity is not installed " %}
+
+
+
+
+
+
+
-
+
+
+
+
+ {% else %}
+
+
+
+
+
+ {% endif %}
+
+
+
+
+
+
+
+
+
+
+ {% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/ftp/ftpManager.py b/ftp/ftpManager.py
index e7ce81ef5..8dc4b85f4 100644
--- a/ftp/ftpManager.py
+++ b/ftp/ftpManager.py
@@ -79,12 +79,9 @@ class FTPManager:
path = 'None'
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/ftpUtilities.py"
-
execPath = execPath + " submitFTPCreation --domainName " + domainName + " --userName " + userName \
+ " --password " + password + " --path " + path + " --owner " + admin.userName + ' --api ' + api
-
output = subprocess.check_output(shlex.split(execPath))
-
if output.find("1,None") > -1:
data_ret = {'status': 1, 'creatFTPStatus': 1, 'error_message': 'None'}
json_data = json.dumps(data_ret)
diff --git a/install/install.py b/install/install.py
index 923701a88..48d37e65a 100644
--- a/install/install.py
+++ b/install/install.py
@@ -296,24 +296,26 @@ class preFlightsChecks:
preFlightsChecks.stdOut("Exception during CyberPanel install")
os._exit(os.EX_SOFTWARE)
- else:
- while(1):
- cmd.append("rpm")
- cmd.append("-ivh")
- cmd.append("http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")
- res = subprocess.call(cmd)
+ else:
+ while (1):
+ cmd.append("rpm")
+ cmd.append("-ivh")
+ cmd.append("http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")
+ res = subprocess.call(cmd)
- if res == 1:
- count = count + 1
- preFlightsChecks.stdOut("Unable to add CyberPanel official repository, trying again, try number: " + str(count) + "\n")
- if count == 3:
- logging.InstallLog.writeToFile("Unable to add CyberPanel official repository, exiting installer! [installCyberPanelRepo]")
- preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
- os._exit(0)
- else:
- logging.InstallLog.writeToFile("CyberPanel Repo added!")
- preFlightsChecks.stdOut("CyberPanel Repo added!")
- break
+ if res == 1:
+ count = count + 1
+ preFlightsChecks.stdOut(
+ "Unable to add CyberPanel official repository, trying again, try number: " + str(count) + "\n")
+ if count == 3:
+ logging.InstallLog.writeToFile(
+ "Unable to add CyberPanel official repository, exiting installer! [installCyberPanelRepo]")
+ preFlightsChecks.stdOut("Installation failed, consult: /var/log/installLogs.txt")
+ os._exit(0)
+ else:
+ logging.InstallLog.writeToFile("CyberPanel Repo added!")
+ preFlightsChecks.stdOut("CyberPanel Repo added!")
+ break
def enableEPELRepo(self):
try:
diff --git a/install/installCyberPanel.py b/install/installCyberPanel.py
index 4942079ef..d591262cd 100644
--- a/install/installCyberPanel.py
+++ b/install/installCyberPanel.py
@@ -234,7 +234,6 @@ class InstallCyberPanel:
'lsphp7?-ldap lsphp7?-mysql lsphp7?-opcache lsphp7?-pspell lsphp7?-recode ' \
'lsphp7?-sqlite3 lsphp7?-tidy'
res = os.system(command)
-
else:
command = 'yum -y groupinstall lsphp-all'
cmd = shlex.split(command)
diff --git a/plogical/CyberCPLogFileWriter.py b/plogical/CyberCPLogFileWriter.py
index dc2d11890..2ff68a41d 100644
--- a/plogical/CyberCPLogFileWriter.py
+++ b/plogical/CyberCPLogFileWriter.py
@@ -41,7 +41,7 @@ class CyberCPLogFileWriter:
@staticmethod
def statusWriter(tempStatusPath, mesg):
try:
- statusFile = open(tempStatusPath, 'w')
+ statusFile = open(tempStatusPath, 'a')
statusFile.writelines(mesg)
statusFile.close()
except BaseException, msg:
diff --git a/plogical/filemanager.py b/plogical/filemanager.py
index 2c95c8ca8..69faec37a 100644
--- a/plogical/filemanager.py
+++ b/plogical/filemanager.py
@@ -1,12 +1,7 @@
-import os.path
-import shutil
import CyberCPLogFileWriter as logging
-import subprocess
import argparse
-import shlex
from random import randint
-
class filemanager:
@staticmethod
@@ -25,7 +20,7 @@ class filemanager:
except BaseException,msg:
logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + " [createEmailAccount]")
+ str(msg) + " [createTemporaryFile]")
print "0," + str(msg)
diff --git a/plogical/installUtilities.py b/plogical/installUtilities.py
index 7b697e50d..dfbf42fd1 100644
--- a/plogical/installUtilities.py
+++ b/plogical/installUtilities.py
@@ -4,8 +4,8 @@ import CyberCPLogFileWriter as logging
import shutil
import pexpect
import os
-import thread
import shlex
+from processUtilities import ProcessUtilities
class installUtilities:
@@ -136,15 +136,15 @@ class installUtilities:
@staticmethod
def reStartLiteSpeed():
try:
-
FNULL = open(os.devnull, 'w')
- command = "sudo systemctl restart lsws"
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ command = "sudo systemctl restart lsws"
+ else:
+ command = "sudo /usr/local/lsws/bin/lswsctrl restart"
cmd = shlex.split(command)
-
- res = subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
-
+ subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
except OSError, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartLiteSpeed]")
@@ -159,12 +159,12 @@ class installUtilities:
def reStartOpenLiteSpeed(restart,orestart):
try:
- FNULL = open(os.devnull, 'w')
-
- command = "sudo systemctl restart lsws"
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ command = "sudo systemctl restart lsws"
+ else:
+ command = "sudo /usr/local/lsws/bin/lswsctrl restart"
cmd = shlex.split(command)
-
res = subprocess.call(cmd)
if res == 1:
@@ -177,7 +177,6 @@ class installUtilities:
print(" Litespeed Re-Started ")
print("###############################################")
-
except OSError, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [reStartOpenLiteSpeed]")
return 0
@@ -279,8 +278,6 @@ class installUtilities:
return 1
-
-
@staticmethod
def installMainWebServer():
if installUtilities.enableEPELRepo() == 1:
@@ -370,7 +367,6 @@ class installUtilities:
return 1
-
@staticmethod
def startMariaDB():
@@ -406,7 +402,6 @@ class installUtilities:
return 1
-
@staticmethod
def installMySQL(password):
diff --git a/plogical/modSec.py b/plogical/modSec.py
index efcfae27b..60ec1f8bf 100644
--- a/plogical/modSec.py
+++ b/plogical/modSec.py
@@ -7,6 +7,7 @@ import os
import tarfile
import shutil
from mailUtilities import mailUtilities
+from processUtilities import ProcessUtilities
class modSec:
installLogPath = "/home/cyberpanel/modSecInstallLog"
@@ -111,42 +112,74 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
data = open(tempConfigPath).readlines()
os.remove(tempConfigPath)
- confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
- confData = open(confFile).readlines()
+ confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
+ confData = open(confFile).readlines()
+ conf = open(confFile, 'w')
- conf = open(confFile, 'w')
+ for items in confData:
- for items in confData:
+ if items.find('modsecurity ') > -1:
+ conf.writelines(data[0])
+ continue
+ elif items.find('SecAuditEngine ') > -1:
+ conf.writelines(data[1])
+ continue
+ elif items.find('SecRuleEngine ') > -1:
+ conf.writelines(data[2])
+ continue
+ elif items.find('SecDebugLogLevel') > -1:
+ conf.writelines(data[3])
+ continue
+ elif items.find('SecAuditLogRelevantStatus ') > -1:
+ conf.writelines(data[5])
+ continue
+ elif items.find('SecAuditLogParts ') > -1:
+ conf.writelines(data[4])
+ continue
+ elif items.find('SecAuditLogType ') > -1:
+ conf.writelines(data[6])
+ continue
+ else:
+ conf.writelines(items)
- if items.find('modsecurity ') > -1:
- conf.writelines(data[0])
- continue
- elif items.find('SecAuditEngine ') > -1:
- conf.writelines(data[1])
- continue
- elif items.find('SecRuleEngine ') > -1:
- conf.writelines(data[2])
- continue
- elif items.find('SecDebugLogLevel') > -1:
- conf.writelines(data[3])
- continue
- elif items.find('SecAuditLogRelevantStatus ') > -1:
- conf.writelines(data[5])
- continue
- elif items.find('SecAuditLogParts ') > -1:
- conf.writelines(data[4])
- continue
- elif items.find('SecAuditLogType ') > -1:
- conf.writelines(data[6])
- continue
- else:
- conf.writelines(items)
+ conf.close()
- conf.close()
+ print "1,None"
+ return
+ else:
+ confFile = os.path.join(virtualHostUtilities.Server_root, "conf/modsec.conf")
+ confData = open(confFile).readlines()
+ conf = open(confFile, 'w')
- print "1,None"
- return
+ for items in confData:
+
+ if items.find('SecAuditEngine ') > -1:
+ conf.writelines(data[0])
+ continue
+ elif items.find('SecRuleEngine ') > -1:
+ conf.writelines(data[1])
+ continue
+ elif items.find('SecDebugLogLevel') > -1:
+ conf.writelines(data[2])
+ continue
+ elif items.find('SecAuditLogRelevantStatus ') > -1:
+ conf.writelines(data[4])
+ continue
+ elif items.find('SecAuditLogParts ') > -1:
+ conf.writelines(data[3])
+ continue
+ elif items.find('SecAuditLogType ') > -1:
+ conf.writelines(data[5])
+ continue
+ else:
+ conf.writelines(items)
+
+ conf.close()
+
+ print "1,None"
+ return
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(
@@ -160,7 +193,10 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
data = rulesFile.read()
rulesFile.close()
- rulesFilePath = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/rules.conf")
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ rulesFilePath = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/rules.conf")
+ else:
+ rulesFilePath = os.path.join(virtualHostUtilities.Server_root, "conf/rules.conf")
rulesFile = open(rulesFilePath,'w')
rulesFile.write(data)
@@ -180,26 +216,47 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
@staticmethod
def setupComodoRules():
try:
- pathTOOWASPFolder = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/comodo")
- extractLocation = os.path.join(virtualHostUtilities.Server_root, "conf/modsec")
- if os.path.exists(pathTOOWASPFolder):
- shutil.rmtree(pathTOOWASPFolder)
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ pathTOOWASPFolder = os.path.join(virtualHostUtilities.Server_root, "conf/modsec/comodo")
+ extractLocation = os.path.join(virtualHostUtilities.Server_root, "conf/modsec")
- if os.path.exists('comodo.tar.gz'):
- os.remove('comodo.tar.gz')
+ if os.path.exists(pathTOOWASPFolder):
+ shutil.rmtree(pathTOOWASPFolder)
- command = "wget https://" + modSec.mirrorPath + "/modsec/comodo.tar.gz"
- result = subprocess.call(shlex.split(command))
+ if os.path.exists('comodo.tar.gz'):
+ os.remove('comodo.tar.gz')
- if result == 1:
- return 0
+ command = "wget https://" + modSec.mirrorPath + "/modsec/comodo.tar.gz"
+ result = subprocess.call(shlex.split(command))
- tar = tarfile.open('comodo.tar.gz')
- tar.extractall(extractLocation)
- tar.close()
+ if result == 1:
+ return 0
- return 1
+ tar = tarfile.open('comodo.tar.gz')
+ tar.extractall(extractLocation)
+ tar.close()
+
+ return 1
+ else:
+ if os.path.exists('/usr/local/lsws/conf/comodo_litespeed'):
+ shutil.rmtree('/usr/local/lsws/conf/comodo_litespeed')
+
+ extractLocation = os.path.join(virtualHostUtilities.Server_root, "conf")
+
+ if os.path.exists('cpanel_litespeed_vendor'):
+ os.remove('cpanel_litespeed_vendor')
+
+ command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
+ result = subprocess.call(shlex.split(command))
+
+ if result == 1:
+ return 0
+
+ command = "unzip cpanel_litespeed_vendor -d " + extractLocation
+ subprocess.call(shlex.split(command))
+
+ return 1
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(
@@ -209,60 +266,85 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/rules.conf
@staticmethod
def installComodo():
try:
- if modSec.setupComodoRules() == 0:
- print '0, Unable to download Comodo Rules.'
+
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ if modSec.setupComodoRules() == 0:
+ print '0, Unable to download Comodo Rules.'
+ return
+
+ owaspRulesConf = """modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/modsecurity.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/00_Init_Initialization.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/01_Init_AppsInitialization.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/02_Global_Generic.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/03_Global_Agents.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/04_Global_Domains.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/05_Global_Backdoor.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/06_XSS_XSS.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/07_Global_Other.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/08_Bruteforce_Bruteforce.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/09_HTTP_HTTP.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/10_HTTP_HTTPDoS.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/11_HTTP_Protocol.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/12_HTTP_Request.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/13_Outgoing_FilterGen.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/14_Outgoing_FilterASP.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/15_Outgoing_FilterPHP.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/16_Outgoing_FilterSQL.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/17_Outgoing_FilterOther.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/18_Outgoing_FilterInFrame.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/19_Outgoing_FiltersEnd.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/20_PHP_PHPGen.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/21_SQL_SQLi.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/22_Apps_Joomla.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/23_Apps_JComponent.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/24_Apps_WordPress.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/25_Apps_WPPlugin.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/26_Apps_WHMCS.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/27_Apps_Drupal.conf
+ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/28_Apps_OtherApps.conf
+ """
+
+ confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
+
+ confData = open(confFile).readlines()
+
+ conf = open(confFile, 'w')
+
+ for items in confData:
+ if items.find('/usr/local/lsws/conf/modsec/rules.conf') > -1:
+ conf.writelines(items)
+ conf.write(owaspRulesConf)
+ continue
+ else:
+ conf.writelines(items)
+
+ conf.close()
+
+ print "1,None"
return
+ else:
+ if os.path.exists('/usr/local/lsws/conf/comodo_litespeed'):
+ shutil.rmtree('/usr/local/lsws/conf/comodo_litespeed')
- owaspRulesConf = """modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/modsecurity.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/00_Init_Initialization.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/01_Init_AppsInitialization.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/02_Global_Generic.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/03_Global_Agents.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/04_Global_Domains.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/05_Global_Backdoor.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/06_XSS_XSS.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/07_Global_Other.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/08_Bruteforce_Bruteforce.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/09_HTTP_HTTP.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/10_HTTP_HTTPDoS.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/11_HTTP_Protocol.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/12_HTTP_Request.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/13_Outgoing_FilterGen.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/14_Outgoing_FilterASP.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/15_Outgoing_FilterPHP.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/16_Outgoing_FilterSQL.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/17_Outgoing_FilterOther.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/18_Outgoing_FilterInFrame.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/19_Outgoing_FiltersEnd.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/20_PHP_PHPGen.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/21_SQL_SQLi.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/22_Apps_Joomla.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/23_Apps_JComponent.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/24_Apps_WordPress.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/25_Apps_WPPlugin.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/26_Apps_WHMCS.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/27_Apps_Drupal.conf
-modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/28_Apps_OtherApps.conf
-"""
+ extractLocation = os.path.join(virtualHostUtilities.Server_root, "conf")
- confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
+ if os.path.exists('cpanel_litespeed_vendor'):
+ os.remove('cpanel_litespeed_vendor')
- confData = open(confFile).readlines()
+ command = "wget https://waf.comodo.com/api/cpanel_litespeed_vendor"
+ result = subprocess.call(shlex.split(command))
- conf = open(confFile, 'w')
+ if result == 1:
+ return 0
- for items in confData:
- if items.find('/usr/local/lsws/conf/modsec/rules.conf') > -1:
- conf.writelines(items)
- conf.write(owaspRulesConf)
- continue
- else:
- conf.writelines(items)
+ command = "unzip cpanel_litespeed_vendor -d " + extractLocation
+ result = subprocess.call(shlex.split(command))
- conf.close()
+ command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
+ subprocess.call(shlex.split(command))
- print "1,None"
- return
+ print "1,None"
+ return
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(
@@ -273,19 +355,28 @@ modsecurity_rules_file /usr/local/lsws/conf/modsec/comodo/28_Apps_OtherApps.conf
def disableComodo():
try:
- confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
- confData = open(confFile).readlines()
- conf = open(confFile, 'w')
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ confFile = os.path.join(virtualHostUtilities.Server_root, "conf/httpd_config.conf")
+ confData = open(confFile).readlines()
+ conf = open(confFile, 'w')
- for items in confData:
- if items.find('modsec/comodo') > -1:
- continue
- else:
- conf.writelines(items)
+ for items in confData:
+ if items.find('modsec/comodo') > -1:
+ continue
+ else:
+ conf.writelines(items)
- conf.close()
+ conf.close()
+
+ print "1,None"
+
+ else:
+ try:
+ shutil.rmtree('/usr/local/lsws/conf/comodo_litespeed')
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [disableComodo]')
+ print "1,None"
- print "1,None"
except BaseException, msg:
logging.CyberCPLogFileWriter.writeToFile(
diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py
index a87264190..e86a1b081 100644
--- a/plogical/processUtilities.py
+++ b/plogical/processUtilities.py
@@ -1,11 +1,15 @@
from CyberCPLogFileWriter import CyberCPLogFileWriter as logging
import subprocess
import shlex
-
-
+import os
+from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
class ProcessUtilities:
litespeedProcess = "litespeed"
+ ent = 1
+ OLS = 0
+ centos = 1
+ ubuntu = 0
@staticmethod
def getLitespeedProcessNumber():
@@ -14,7 +18,7 @@ class ProcessUtilities:
try:
import psutil
for proc in psutil.process_iter():
- if proc.name() == ProcessUtilities.litespeedProcess:
+ if proc.name().find(ProcessUtilities.litespeedProcess) > -1:
finalListOfProcesses.append(proc.pid)
except BaseException,msg:
@@ -30,7 +34,11 @@ class ProcessUtilities:
@staticmethod
def restartLitespeed():
try:
- command = "sudo systemctl restart lsws"
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ command = "sudo systemctl restart lsws"
+ else:
+ command = "sudo /usr/local/lsws/bin/lswsctrl restart"
+
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -45,7 +53,11 @@ class ProcessUtilities:
@staticmethod
def stopLitespeed():
try:
- command = "sudo systemctl stop lsws"
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ command = "sudo systemctl stop lsws"
+ else:
+ command = "sudo /usr/local/lsws/bin/lswsctrl stop"
+
cmd = shlex.split(command)
res = subprocess.call(cmd)
@@ -57,4 +69,58 @@ class ProcessUtilities:
except subprocess.CalledProcessError, msg:
logging.writeToFile(str(msg) + "[stopLitespeed]")
+ @staticmethod
+ def executioner(command):
+ try:
+ res = subprocess.call(shlex.split(command))
+ if res == 1:
+ raise 0
+ else:
+ return 1
+ except BaseException, msg:
+ return 0
+
+ @staticmethod
+ def killLiteSpeed():
+ pids = ProcessUtilities.getLitespeedProcessNumber()
+ if pids !=0:
+ for items in pids:
+ try:
+ command = 'sudo kill -9 ' + str(items)
+ ProcessUtilities.executioner(command)
+ except:
+ pass
+
+ @staticmethod
+ def decideServer():
+ entPath = '/usr/local/lsws/bin/lshttpd'
+
+ if os.readlink(entPath) == '/usr/local/lsws/bin/lshttpd/openlitespeed':
+ return ProcessUtilities.OLS
+ else:
+ return ProcessUtilities.ent
+
+ @staticmethod
+ def decideDistro():
+ distroPath = '/etc/lsb-release'
+
+ if os.path.exists(distroPath):
+ return ProcessUtilities.ubuntu
+ else:
+ return ProcessUtilities.centos
+
+ @staticmethod
+ def executioner(command, statusFile):
+ try:
+ res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
+ if res == 1:
+ raise 0
+ else:
+ return 1
+
+ except BaseException, msg:
+ logging.writeToFile(str(msg))
+ return 0
+
+
diff --git a/plogical/sslUtilities.py b/plogical/sslUtilities.py
index 13b66b51f..687a3432c 100644
--- a/plogical/sslUtilities.py
+++ b/plogical/sslUtilities.py
@@ -1,9 +1,10 @@
import CyberCPLogFileWriter as logging
-import shutil
import os
import shlex
import subprocess
import socket
+from plogical.processUtilities import ProcessUtilities
+from websiteFunctions.models import ChildDomains, Websites
class sslUtilities:
@@ -58,109 +59,189 @@ class sslUtilities:
return [0, "347 " + str(msg) + " [issueSSLForDomain]"]
@staticmethod
- def installSSLForDomain(virtualHostName):
+ def installSSLForDomain(virtualHostName, adminEmail='usman@cyberpersons.com'):
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ confPath = sslUtilities.Server_root + "/conf/vhosts/" + virtualHostName
+ completePathToConfigFile = confPath + "/vhost.conf"
- confPath = sslUtilities.Server_root + "/conf/vhosts/" + virtualHostName
- completePathToConfigFile = confPath + "/vhost.conf"
-
- try:
- map = " map " + virtualHostName + " " + virtualHostName + "\n"
-
- if sslUtilities.checkSSLListener() != 1:
-
- writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
-
- listener = "listener SSL {" + "\n"
- address = " address *:443" + "\n"
- secure = " secure 1" + "\n"
- keyFile = " keyFile /etc/letsencrypt/live/" + virtualHostName + "/privkey.pem\n"
- certFile = " certFile /etc/letsencrypt/live/" + virtualHostName + "/fullchain.pem\n"
- certChain = " certChain 1" + "\n"
- sslProtocol = " sslProtocol 30" + "\n"
+ try:
map = " map " + virtualHostName + " " + virtualHostName + "\n"
- final = "}" + "\n" + "\n"
- writeDataToFile.writelines("\n")
- writeDataToFile.writelines(listener)
- writeDataToFile.writelines(address)
- writeDataToFile.writelines(secure)
- writeDataToFile.writelines(keyFile)
- writeDataToFile.writelines(certFile)
- writeDataToFile.writelines(certChain)
- writeDataToFile.writelines(sslProtocol)
- writeDataToFile.writelines(map)
- writeDataToFile.writelines(final)
- writeDataToFile.writelines("\n")
- writeDataToFile.close()
+ if sslUtilities.checkSSLListener() != 1:
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
- else:
-
- if sslUtilities.checkIfSSLMap(virtualHostName) == 0:
-
- data = open("/usr/local/lsws/conf/httpd_config.conf").readlines()
- writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'w')
- sslCheck = 0
-
- for items in data:
- if items.find("listener") > -1 and items.find("SSL") > -1:
- sslCheck = 1
-
- if (sslCheck == 1):
- writeDataToFile.writelines(items)
- writeDataToFile.writelines(map)
- sslCheck = 0
- else:
- writeDataToFile.writelines(items)
- writeDataToFile.close()
-
- ###################### Write per host Configs for SSL ###################
-
- data = open(completePathToConfigFile, "r").readlines()
-
- ## check if vhssl is already in vhconf file
-
- vhsslPresense = 0
-
- for items in data:
- if items.find("vhssl") > -1:
- vhsslPresense = 1
-
- if vhsslPresense == 0:
- writeSSLConfig = open(completePathToConfigFile, "a")
-
- vhssl = "vhssl {" + "\n"
- keyFile = " keyFile /etc/letsencrypt/live/" + virtualHostName + "/privkey.pem\n"
- certFile = " certFile /etc/letsencrypt/live/" + virtualHostName + "/fullchain.pem\n"
+ listener = "listener SSL {" + "\n"
+ address = " address *:443" + "\n"
+ secure = " secure 1" + "\n"
+ keyFile = " keyFile /etc/letsencrypt/live/" + virtualHostName + "/privkey.pem\n"
+ certFile = " certFile /etc/letsencrypt/live/" + virtualHostName + "/fullchain.pem\n"
certChain = " certChain 1" + "\n"
sslProtocol = " sslProtocol 30" + "\n"
- final = "}"
+ map = " map " + virtualHostName + " " + virtualHostName + "\n"
+ final = "}" + "\n" + "\n"
- writeSSLConfig.writelines("\n")
+ writeDataToFile.writelines("\n")
+ writeDataToFile.writelines(listener)
+ writeDataToFile.writelines(address)
+ writeDataToFile.writelines(secure)
+ writeDataToFile.writelines(keyFile)
+ writeDataToFile.writelines(certFile)
+ writeDataToFile.writelines(certChain)
+ writeDataToFile.writelines(sslProtocol)
+ writeDataToFile.writelines(map)
+ writeDataToFile.writelines(final)
+ writeDataToFile.writelines("\n")
+ writeDataToFile.close()
- writeSSLConfig.writelines(vhssl)
- writeSSLConfig.writelines(keyFile)
- writeSSLConfig.writelines(certFile)
- writeSSLConfig.writelines(certChain)
- writeSSLConfig.writelines(sslProtocol)
- writeSSLConfig.writelines(final)
- writeSSLConfig.writelines("\n")
+ else:
- writeSSLConfig.close()
+ if sslUtilities.checkIfSSLMap(virtualHostName) == 0:
- return 1
+ data = open("/usr/local/lsws/conf/httpd_config.conf").readlines()
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'w')
+ sslCheck = 0
+
+ for items in data:
+ if items.find("listener") > -1 and items.find("SSL") > -1:
+ sslCheck = 1
+
+ if (sslCheck == 1):
+ writeDataToFile.writelines(items)
+ writeDataToFile.writelines(map)
+ sslCheck = 0
+ else:
+ writeDataToFile.writelines(items)
+ writeDataToFile.close()
+
+ ###################### Write per host Configs for SSL ###################
+
+ data = open(completePathToConfigFile, "r").readlines()
+
+ ## check if vhssl is already in vhconf file
+
+ vhsslPresense = 0
+
+ for items in data:
+ if items.find("vhssl") > -1:
+ vhsslPresense = 1
+
+ if vhsslPresense == 0:
+ writeSSLConfig = open(completePathToConfigFile, "a")
+
+ vhssl = "vhssl {" + "\n"
+ keyFile = " keyFile /etc/letsencrypt/live/" + virtualHostName + "/privkey.pem\n"
+ certFile = " certFile /etc/letsencrypt/live/" + virtualHostName + "/fullchain.pem\n"
+ certChain = " certChain 1" + "\n"
+ sslProtocol = " sslProtocol 30" + "\n"
+ final = "}"
+
+ writeSSLConfig.writelines("\n")
+
+ writeSSLConfig.writelines(vhssl)
+ writeSSLConfig.writelines(keyFile)
+ writeSSLConfig.writelines(certFile)
+ writeSSLConfig.writelines(certChain)
+ writeSSLConfig.writelines(sslProtocol)
+ writeSSLConfig.writelines(final)
+
+ writeSSLConfig.writelines("\n")
+
+ writeSSLConfig.close()
+
+ return 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [installSSLForDomain]]")
+ return 0
+ else:
+ confPath = sslUtilities.Server_root + "/conf/vhosts/" + virtualHostName
+ completePathToConfigFile = confPath + "/vhost.conf"
+
+ ## Check if SSL VirtualHost already exists
+
+ data = open(completePathToConfigFile, 'r').readlines()
+
+ for items in data:
+ if items.find('*:443') > -1:
+ return 1
+
+ try:
+
+ try:
+ chilDomain = ChildDomains.objects.get(domain=virtualHostName)
+ externalApp = chilDomain.master.externalApp
+ DocumentRoot = ' DocumentRoot ' + chilDomain.path + '\n'
+ except BaseException, msg:
+ website = Websites.objects.get(domain=virtualHostName)
+ externalApp = website.externalApp
+ DocumentRoot = ' DocumentRoot /home/' + virtualHostName + '/public_html\n'
+
+ data = open(completePathToConfigFile, 'r').readlines()
+ phpHandler = ''
+
+ for items in data:
+ if items.find('AddHandler') > -1 and items.find('php') > -1:
+ phpHandler = items
+ break
+
+ confFile = open(completePathToConfigFile, 'a')
+
+ doNotModify = '\n\n# Do not modify this file, this is auto-generated file.\n\n'
+
+ VirtualHost = '
\n\n'
+ ServerName = ' ServerName ' + virtualHostName + '\n'
+ ServerAlias = ' ServerAlias www.' + virtualHostName + '\n'
+ ScriptAlias = ' Alias /.filemanager/ /usr/local/lsws/FileManager\n'
+ ServerAdmin = ' ServerAdmin ' + adminEmail + '\n'
+ SeexecUserGroup = ' SuexecUserGroup ' + externalApp + ' ' + externalApp + '\n'
+ CustomLogCombined = ' CustomLog /home/' + virtualHostName + '/logs/' + virtualHostName + '.access_log combined\n'
+
+ confFile.writelines(doNotModify)
+ confFile.writelines(VirtualHost)
+ confFile.writelines(ServerName)
+ confFile.writelines(ServerAlias)
+ confFile.writelines(ScriptAlias)
+ confFile.writelines(ServerAdmin)
+ confFile.writelines(SeexecUserGroup)
+ confFile.writelines(DocumentRoot)
+ confFile.writelines(CustomLogCombined)
+ DirectoryFileManager = """\n
+ AllowOverride All
+ Options +Includes -Indexes +ExecCGI
+ php_value display_errors "Off"
+ php_value upload_max_filesize "200M"
+ php_value post_max_size "250M"
+ \n"""
+ confFile.writelines(DirectoryFileManager)
+
+ SSLEngine = ' SSLEngine on\n'
+ SSLVerifyClient = ' SSLVerifyClient none\n'
+ SSLCertificateFile = ' SSLCertificateFile /etc/letsencrypt/live/' + virtualHostName + '/fullchain.pem\n'
+ SSLCertificateKeyFile = ' SSLCertificateKeyFile /etc/letsencrypt/live/' + virtualHostName + '/privkey.pem\n'
+
+ confFile.writelines(SSLEngine)
+ confFile.writelines(SSLVerifyClient)
+ confFile.writelines(SSLCertificateFile)
+ confFile.writelines(SSLCertificateKeyFile)
+ confFile.writelines(phpHandler)
+
+ VirtualHostEnd = '\n'
+ confFile.writelines(VirtualHostEnd)
+ confFile.close()
+ return 1
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [installSSLForDomain]")
+ return 0
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [installSSLForDomain]]")
- return 0
@staticmethod
def obtainSSLForADomain(virtualHostName,adminEmail,sslpath, aliasDomain = None):
try:
acmePath = '/root/.acme.sh/acme.sh'
- if os.path.exists('/etc/lsb-release'):
+ if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
acmePath = '/home/cyberpanel/.acme.sh/acme.sh'
if not os.path.exists(acmePath):
@@ -239,30 +320,13 @@ class sslUtilities:
def issueSSLForDomain(domain, adminEmail, sslpath, aliasDomain = None):
try:
-
if sslUtilities.obtainSSLForADomain(domain, adminEmail, sslpath, aliasDomain) == 1:
-
- if sslUtilities.installSSLForDomain(domain) == 1:
+ if sslUtilities.installSSLForDomain(domain, adminEmail) == 1:
return [1, "None"]
else:
return [0, "210 Failed to install SSL for domain. [issueSSLForDomain]"]
else:
- pathToStoreSSL = "/etc/letsencrypt/live/" + domain
- command = 'mkdir -p ' + pathToStoreSSL
- subprocess.call(shlex.split(command))
-
- pathToStoreSSLPrivKey = "/etc/letsencrypt/live/" + domain + "/privkey.pem"
- pathToStoreSSLFullChain = "/etc/letsencrypt/live/" + domain + "/fullchain.pem"
-
- 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, "220 Failed to install SSL for domain. [issueSSLForDomain]"]
+ return [0, "283 Failed to obtain SSL for domain. [issueSSLForDomain]"]
except BaseException,msg:
return [0, "347 "+ str(msg)+ " [issueSSLForDomain]"]
\ No newline at end of file
diff --git a/plogical/vhost.py b/plogical/vhost.py
index a8aa849ce..e9932c80e 100644
--- a/plogical/vhost.py
+++ b/plogical/vhost.py
@@ -16,6 +16,7 @@ from databases.models import Databases
from mysqlUtilities import mysqlUtilities
from dnsUtilities import DNS
from random import randint
+from processUtilities import ProcessUtilities
## If you want justice, you have come to the wrong place.
@@ -87,7 +88,12 @@ class vhost:
cmd = shlex.split(command)
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
- command = "chmod -R 666 " + pathLogs
+
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ command = "chmod -R 666 " + pathLogs
+ else:
+ command = "chmod -R 755 " + pathLogs
+
cmd = shlex.split(command)
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
@@ -176,215 +182,279 @@ class vhost:
@staticmethod
def perHostVirtualConf(vhFile, administratorEmail,virtualHostUser, phpVersion, virtualHostName, openBasedir):
# General Configurations tab
- try:
- confFile = open(vhFile, "w+")
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
+ confFile = open(vhFile, "w+")
- docRoot = "docRoot $VH_ROOT/public_html" + "\n"
- vhDomain = "vhDomain $VH_NAME" + "\n"
- vhAliases = "vhAliases www.$VH_NAME"+ "\n"
- adminEmails = "adminEmails " + administratorEmail + "\n"
- enableGzip = "enableGzip 1" + "\n"
- enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
+ docRoot = "docRoot $VH_ROOT/public_html" + "\n"
+ vhDomain = "vhDomain $VH_NAME" + "\n"
+ vhAliases = "vhAliases www.$VH_NAME"+ "\n"
+ adminEmails = "adminEmails " + administratorEmail + "\n"
+ enableGzip = "enableGzip 1" + "\n"
+ enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
- confFile.writelines(docRoot)
- confFile.writelines(vhDomain)
- confFile.writelines(vhAliases)
- confFile.writelines(adminEmails)
- confFile.writelines(enableGzip)
- confFile.writelines(enableIpGeo)
+ confFile.writelines(docRoot)
+ confFile.writelines(vhDomain)
+ confFile.writelines(vhAliases)
+ confFile.writelines(adminEmails)
+ confFile.writelines(enableGzip)
+ confFile.writelines(enableIpGeo)
- # Index file settings
+ # Index file settings
- index = "index {" + "\n"
- userServer = " useServer 0" + "\n"
- indexFiles = " indexFiles index.php, index.html" + "\n"
- index_end = "}" + "\n" + "\n"
+ index = "index {" + "\n"
+ userServer = " useServer 0" + "\n"
+ indexFiles = " indexFiles index.php, index.html" + "\n"
+ index_end = "}" + "\n" + "\n"
- confFile.writelines(index)
- confFile.writelines(userServer)
- confFile.writelines(indexFiles)
- confFile.writelines(index_end)
+ confFile.writelines(index)
+ confFile.writelines(userServer)
+ confFile.writelines(indexFiles)
+ confFile.writelines(index_end)
- # Error Log Settings
+ # Error Log Settings
- error_log = "errorlog $VH_ROOT/logs/$VH_NAME.error_log {" + "\n"
- useServer = " useServer 0" + "\n"
- logLevel = " logLevel ERROR" + "\n"
- rollingSize = " rollingSize 10M" + "\n"
- error_log_end = "}" + "\n" + "\n"
+ error_log = "errorlog $VH_ROOT/logs/$VH_NAME.error_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logLevel = " logLevel ERROR" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ error_log_end = "}" + "\n" + "\n"
- confFile.writelines(error_log)
- confFile.writelines(useServer)
- confFile.writelines(logLevel)
- confFile.writelines(rollingSize)
- confFile.writelines(error_log_end)
+ confFile.writelines(error_log)
+ confFile.writelines(useServer)
+ confFile.writelines(logLevel)
+ confFile.writelines(rollingSize)
+ confFile.writelines(error_log_end)
- # Access Log Settings
+ # Access Log Settings
- access_Log = "accesslog $VH_ROOT/logs/$VH_NAME.access_log {" + "\n"
- useServer = " useServer 0" + "\n"
- logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
- logHeaders = " logHeaders 5" + "\n"
- rollingSize = " rollingSize 10M" + "\n"
- keepDays = " keepDays 10"
- compressArchive = " compressArchive 1" + "\n"
- access_Log_end = "}" + "\n" + "\n"
+ access_Log = "accesslog $VH_ROOT/logs/$VH_NAME.access_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
+ logHeaders = " logHeaders 5" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ keepDays = " keepDays 10"
+ compressArchive = " compressArchive 1" + "\n"
+ access_Log_end = "}" + "\n" + "\n"
- confFile.writelines(access_Log)
- confFile.writelines(useServer)
- confFile.writelines(logFormat)
- confFile.writelines(logHeaders)
- confFile.writelines(rollingSize)
- confFile.writelines(keepDays)
- confFile.writelines(compressArchive)
- confFile.writelines(access_Log_end)
+ confFile.writelines(access_Log)
+ confFile.writelines(useServer)
+ confFile.writelines(logFormat)
+ confFile.writelines(logHeaders)
+ confFile.writelines(rollingSize)
+ confFile.writelines(keepDays)
+ confFile.writelines(compressArchive)
+ confFile.writelines(access_Log_end)
- # php settings
+ # php settings
- scripthandler = "scripthandler {" + "\n"
- add = " add lsapi:"+virtualHostUser+" php" + "\n"
- php_end = "}" + "\n" + "\n"
+ scripthandler = "scripthandler {" + "\n"
+ add = " add lsapi:"+virtualHostUser+" php" + "\n"
+ php_end = "}" + "\n" + "\n"
- confFile.writelines(scripthandler)
- confFile.writelines(add)
- confFile.writelines(php_end)
+ confFile.writelines(scripthandler)
+ confFile.writelines(add)
+ confFile.writelines(php_end)
- ## external app
+ ## external app
- if phpVersion == "PHP 5.3":
- php = "53"
- elif phpVersion == "PHP 5.4":
- php = "55"
- elif phpVersion == "PHP 5.5":
- php = "55"
- elif phpVersion == "PHP 5.6":
- php = "56"
- elif phpVersion == "PHP 7.0":
- php = "70"
- elif phpVersion == "PHP 7.1":
- php = "71"
- elif phpVersion == "PHP 7.2":
- php = "72"
+ if phpVersion == "PHP 5.3":
+ php = "53"
+ elif phpVersion == "PHP 5.4":
+ php = "55"
+ elif phpVersion == "PHP 5.5":
+ php = "55"
+ elif phpVersion == "PHP 5.6":
+ php = "56"
+ elif phpVersion == "PHP 7.0":
+ php = "70"
+ elif phpVersion == "PHP 7.1":
+ php = "71"
+ elif phpVersion == "PHP 7.2":
+ php = "72"
- extprocessor = "extprocessor "+virtualHostUser+" {\n"
- type = " type lsapi\n"
- address = " address UDS://tmp/lshttpd/"+virtualHostUser+".sock\n"
- maxConns = " maxConns 10\n"
- env = " env LSAPI_CHILDREN=10\n"
- initTimeout = " initTimeout 600\n"
- retryTimeout = " retryTimeout 0\n"
- persistConn = " persistConn 1\n"
- persistConnTimeout = " pcKeepAliveTimeout 1\n"
- respBuffer = " respBuffer 0\n"
- autoStart = " autoStart 1\n"
- path = " path /usr/local/lsws/lsphp"+php+"/bin/lsphp\n"
- extUser = " extUser " + virtualHostUser + "\n"
- extGroup = " extGroup " + virtualHostUser + "\n"
- memSoftLimit = " memSoftLimit 2047M\n"
- memHardLimit = " memHardLimit 2047M\n"
- procSoftLimit = " procSoftLimit 400\n"
- procHardLimit = " procHardLimit 500\n"
- extprocessorEnd = "}\n"
+ extprocessor = "extprocessor "+virtualHostUser+" {\n"
+ type = " type lsapi\n"
+ address = " address UDS://tmp/lshttpd/"+virtualHostUser+".sock\n"
+ maxConns = " maxConns 10\n"
+ env = " env LSAPI_CHILDREN=10\n"
+ initTimeout = " initTimeout 600\n"
+ retryTimeout = " retryTimeout 0\n"
+ persistConn = " persistConn 1\n"
+ persistConnTimeout = " pcKeepAliveTimeout 1\n"
+ respBuffer = " respBuffer 0\n"
+ autoStart = " autoStart 1\n"
+ path = " path /usr/local/lsws/lsphp"+php+"/bin/lsphp\n"
+ extUser = " extUser " + virtualHostUser + "\n"
+ extGroup = " extGroup " + virtualHostUser + "\n"
+ memSoftLimit = " memSoftLimit 2047M\n"
+ memHardLimit = " memHardLimit 2047M\n"
+ procSoftLimit = " procSoftLimit 400\n"
+ procHardLimit = " procHardLimit 500\n"
+ extprocessorEnd = "}\n"
- confFile.writelines(extprocessor)
- confFile.writelines(type)
- confFile.writelines(address)
- confFile.writelines(maxConns)
- confFile.writelines(env)
- confFile.writelines(initTimeout)
- confFile.writelines(retryTimeout)
- confFile.writelines(persistConn)
- confFile.writelines(persistConnTimeout)
- confFile.writelines(respBuffer)
- confFile.writelines(autoStart)
- confFile.writelines(path)
- confFile.writelines(extUser)
- confFile.writelines(extGroup)
- confFile.writelines(memSoftLimit)
- confFile.writelines(memHardLimit)
- confFile.writelines(procSoftLimit)
- confFile.writelines(procHardLimit)
- confFile.writelines(extprocessorEnd)
+ confFile.writelines(extprocessor)
+ confFile.writelines(type)
+ confFile.writelines(address)
+ confFile.writelines(maxConns)
+ confFile.writelines(env)
+ confFile.writelines(initTimeout)
+ confFile.writelines(retryTimeout)
+ confFile.writelines(persistConn)
+ confFile.writelines(persistConnTimeout)
+ confFile.writelines(respBuffer)
+ confFile.writelines(autoStart)
+ confFile.writelines(path)
+ confFile.writelines(extUser)
+ confFile.writelines(extGroup)
+ confFile.writelines(memSoftLimit)
+ confFile.writelines(memHardLimit)
+ confFile.writelines(procSoftLimit)
+ confFile.writelines(procHardLimit)
+ confFile.writelines(extprocessorEnd)
- ## File Manager defination
+ ## File Manager defination
- context = "context /.filemanager {\n"
- location = " location /usr/local/lsws/Example/html/FileManager\n"
- allowBrowse = " allowBrowse 1\n"
- autoIndex = " autoIndex 1\n\n"
+ context = "context /.filemanager {\n"
+ location = " location /usr/local/lsws/Example/html/FileManager\n"
+ allowBrowse = " allowBrowse 1\n"
+ autoIndex = " autoIndex 1\n\n"
- accessControl = " accessControl {\n"
- allow = " allow 127.0.0.1, localhost\n"
- deny = " deny 0.0.0.0/0\n"
- accessControlEnds = " }\n"
+ accessControl = " accessControl {\n"
+ allow = " allow 127.0.0.1, localhost\n"
+ deny = " deny 0.0.0.0/0\n"
+ accessControlEnds = " }\n"
- rewriteInherit = """ rewrite {
- inherit 0
+ rewriteInherit = """ rewrite {
+ inherit 0
+
+ }
+ """
- }
- """
-
- phpIniOverride = "phpIniOverride {\n"
- php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
- php_value = 'php_value display_errors "Off"\n'
- php_value_upload_max_size = 'php_value upload_max_filesize "200M"\n'
- php_value_post_max_size = 'php_value post_max_size "250M"\n'
- endPHPIniOverride = "}\n"
+ phpIniOverride = "phpIniOverride {\n"
+ php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
+ php_value = 'php_value display_errors "Off"\n'
+ php_value_upload_max_size = 'php_value upload_max_filesize "200M"\n'
+ php_value_post_max_size = 'php_value post_max_size "250M"\n'
+ endPHPIniOverride = "}\n"
- defaultCharSet = " addDefaultCharset off\n"
- contextEnds = "}\n"
+ defaultCharSet = " addDefaultCharset off\n"
+ contextEnds = "}\n"
- confFile.writelines(context)
- confFile.writelines(location)
- confFile.writelines(allowBrowse)
- confFile.writelines(autoIndex)
- confFile.writelines(accessControl)
- confFile.writelines(allow)
- confFile.writelines(deny)
- confFile.writelines(accessControlEnds)
- confFile.write(rewriteInherit)
+ confFile.writelines(context)
+ confFile.writelines(location)
+ confFile.writelines(allowBrowse)
+ confFile.writelines(autoIndex)
+ confFile.writelines(accessControl)
+ confFile.writelines(allow)
+ confFile.writelines(deny)
+ confFile.writelines(accessControlEnds)
+ confFile.write(rewriteInherit)
- confFile.writelines(phpIniOverride)
- if openBasedir == 1:
- confFile.writelines(php_admin_value)
- confFile.write(php_value)
- confFile.write(php_value_upload_max_size)
- confFile.write(php_value_post_max_size)
- confFile.writelines(endPHPIniOverride)
+ confFile.writelines(phpIniOverride)
+ if openBasedir == 1:
+ confFile.writelines(php_admin_value)
+ confFile.write(php_value)
+ confFile.write(php_value_upload_max_size)
+ confFile.write(php_value_post_max_size)
+ confFile.writelines(endPHPIniOverride)
- confFile.writelines(defaultCharSet)
- confFile.writelines(contextEnds)
+ confFile.writelines(defaultCharSet)
+ confFile.writelines(contextEnds)
- ## OpenBase Dir Protection
+ ## OpenBase Dir Protection
- phpIniOverride = "phpIniOverride {\n"
- php_admin_value = 'php_admin_value open_basedir "/tmp:$VH_ROOT"\n'
- endPHPIniOverride = "}\n"
+ phpIniOverride = "phpIniOverride {\n"
+ php_admin_value = 'php_admin_value open_basedir "/tmp:$VH_ROOT"\n'
+ endPHPIniOverride = "}\n"
- confFile.writelines(phpIniOverride)
- if openBasedir == 1:
- confFile.writelines(php_admin_value)
- confFile.writelines(endPHPIniOverride)
+ confFile.writelines(phpIniOverride)
+ if openBasedir == 1:
+ confFile.writelines(php_admin_value)
+ confFile.writelines(endPHPIniOverride)
- htaccessAutoLoad = """
-rewrite {
- enable 1
- autoLoadHtaccess 1
-}
-"""
- confFile.write(htaccessAutoLoad)
+ htaccessAutoLoad = """
+ rewrite {
+ enable 1
+ autoLoadHtaccess 1
+ }
+ """
+ confFile.write(htaccessAutoLoad)
- confFile.close()
+ confFile.close()
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostVirtualConf]]")
+ return 0
+ return 1
+ else:
+ try:
+ confFile = open(vhFile, "w+")
+
+ doNotModify = '# Do not modify this file, this is auto-generated file.\n\n'
+
+ VirtualHost = '
\n\n'
+ ServerName = ' ServerName ' + virtualHostName + '\n'
+ ServerAlias = ' ServerAlias www.' + virtualHostName + '\n'
+ ScriptAlias = ' Alias /.filemanager/ /usr/local/lsws/FileManager\n'
+ ServerAdmin = ' ServerAdmin ' + administratorEmail + '\n'
+ SeexecUserGroup = ' SuexecUserGroup ' + virtualHostUser + ' ' + virtualHostUser + '\n'
+ DocumentRoot = ' DocumentRoot /home/' + virtualHostName + '/public_html\n'
+ CustomLogCombined = ' CustomLog /home/' + virtualHostName + '/logs/' + virtualHostName + '.access_log combined\n'
+
+ confFile.writelines(doNotModify)
+ confFile.writelines(VirtualHost)
+ confFile.writelines(ServerName)
+ confFile.writelines(ServerAlias)
+ confFile.writelines(ScriptAlias)
+ confFile.writelines(ServerAdmin)
+ confFile.writelines(SeexecUserGroup)
+ confFile.writelines(DocumentRoot)
+ confFile.writelines(CustomLogCombined)
+
+ DirectoryFileManager = """\n
+ Options +Includes -Indexes +ExecCGI
+ php_value display_errors "Off"
+ php_value upload_max_filesize "200M"
+ php_value post_max_size "250M"
+ \n"""
+ confFile.writelines(DirectoryFileManager)
+
+ ## external app
+
+ if phpVersion == "PHP 5.3":
+ php = "53"
+ elif phpVersion == "PHP 5.4":
+ php = "55"
+ elif phpVersion == "PHP 5.5":
+ php = "55"
+ elif phpVersion == "PHP 5.6":
+ php = "56"
+ elif phpVersion == "PHP 7.0":
+ php = "70"
+ elif phpVersion == "PHP 7.1":
+ php = "71"
+ elif phpVersion == "PHP 7.2":
+ php = "72"
+
+ AddType = ' AddHandler application/x-httpd-php' + php + ' .php .php7 .phtml\n\n'
+ VirtualHostEnd = '\n'
+
+ confFile.writelines(AddType)
+ confFile.writelines(VirtualHostEnd)
+
+ confFile.close()
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostVirtualConf]]")
+ return 0
+ return 1
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + " [IO Error with per host config file [perHostVirtualConf]]")
- return 0
- return 1
@staticmethod
def createNONSSLMapEntry(virtualHostName):
@@ -420,121 +490,203 @@ rewrite {
#restrained 1
#}
- try:
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
- if vhost.createNONSSLMapEntry(virtualHostName) == 0:
- return [0, "Failed to create NON SSL Map Entry [createConfigInMainVirtualHostFile]"]
+ if vhost.createNONSSLMapEntry(virtualHostName) == 0:
+ return [0, "Failed to create NON SSL Map Entry [createConfigInMainVirtualHostFile]"]
- writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
- writeDataToFile.writelines("virtualHost " + virtualHostName + " {\n")
- writeDataToFile.writelines(" vhRoot /home/$VH_NAME\n")
- writeDataToFile.writelines(" configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf\n")
- writeDataToFile.writelines(" allowSymbolLink 1\n")
- writeDataToFile.writelines(" enableScript 1\n")
- writeDataToFile.writelines(" restrained 1\n")
- writeDataToFile.writelines("}\n")
- writeDataToFile.writelines("\n")
+ writeDataToFile.writelines("virtualHost " + virtualHostName + " {\n")
+ writeDataToFile.writelines(" vhRoot /home/$VH_NAME\n")
+ writeDataToFile.writelines(" configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf\n")
+ writeDataToFile.writelines(" allowSymbolLink 1\n")
+ writeDataToFile.writelines(" enableScript 1\n")
+ writeDataToFile.writelines(" restrained 1\n")
+ writeDataToFile.writelines("}\n")
+ writeDataToFile.writelines("\n")
- writeDataToFile.close()
+ writeDataToFile.close()
- writeDataToFile.close()
- return [1,"None"]
+ writeDataToFile.close()
+ return [1,"None"]
+ except BaseException,msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + "223 [IO Error with main config file [createConfigInMainVirtualHostFile]]")
+ return [0,"223 [IO Error with main config file [createConfigInMainVirtualHostFile]]"]
+ else:
+ try:
+ writeDataToFile = open("/usr/local/lsws/conf/httpd.conf", 'a')
+ configFile = 'Include /usr/local/lsws/conf/vhosts/' + virtualHostName + '/vhost.conf\n'
+ writeDataToFile.writelines(configFile)
+ writeDataToFile.close()
- except BaseException,msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + "223 [IO Error with main config file [createConfigInMainVirtualHostFile]]")
- return [0,"223 [IO Error with main config file [createConfigInMainVirtualHostFile]]"]
+ writeDataToFile.close()
+ return [1, "None"]
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + "223 [IO Error with main config file [createConfigInMainVirtualHostFile]]")
+ return [0, "223 [IO Error with main config file [createConfigInMainVirtualHostFile]]"]
@staticmethod
def deleteVirtualHostConfigurations(virtualHostName):
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
- try:
+ ## Deleting master conf
+ numberOfSites = str(Websites.objects.count() + ChildDomains.objects.count())
+ vhost.deleteCoreConf(virtualHostName, numberOfSites)
- ## Deleting master conf
- numberOfSites = str(Websites.objects.count() + ChildDomains.objects.count())
- vhost.deleteCoreConf(virtualHostName, numberOfSites)
+ delWebsite = Websites.objects.get(domain=virtualHostName)
+ databases = Databases.objects.filter(website=delWebsite)
- delWebsite = Websites.objects.get(domain=virtualHostName)
- databases = Databases.objects.filter(website=delWebsite)
+ childDomains = delWebsite.childdomains_set.all()
- childDomains = delWebsite.childdomains_set.all()
+ ## Deleting child domains
- ## Deleting child domains
+ for items in childDomains:
+ numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
+ vhost.deleteCoreConf(items.domain, numberOfSites)
- for items in childDomains:
- numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
- vhost.deleteCoreConf(items.domain, numberOfSites)
+ for items in databases:
+ mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
- for items in databases:
- mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
+ delWebsite.delete()
- delWebsite.delete()
+ ## Deleting DNS Zone if there is any.
- ## Deleting DNS Zone if there is any.
+ DNS.deleteDNSZone(virtualHostName)
- DNS.deleteDNSZone(virtualHostName)
+ installUtilities.installUtilities.reStartLiteSpeed()
- installUtilities.installUtilities.reStartLiteSpeed()
+ ## Delete mail accounts
- ## Delete mail accounts
+ command = "sudo rm -rf /home/vmail/" + virtualHostName
+ subprocess.call(shlex.split(command))
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
+ return 0
+ return 1
+ else:
+ try:
+ ## Deleting master conf
+ numberOfSites = str(Websites.objects.count() + ChildDomains.objects.count())
+ vhost.deleteCoreConf(virtualHostName, numberOfSites)
- command = "sudo rm -rf /home/vmail/" + virtualHostName
- subprocess.call(shlex.split(command))
+ delWebsite = Websites.objects.get(domain=virtualHostName)
+ databases = Databases.objects.filter(website=delWebsite)
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
- return 0
+ childDomains = delWebsite.childdomains_set.all()
+
+ ## Deleting child domains
+
+ for items in childDomains:
+ numberOfSites = Websites.objects.count() + ChildDomains.objects.count()
+ vhost.deleteCoreConf(items.domain, numberOfSites)
+
+ for items in databases:
+ mysqlUtilities.deleteDatabase(items.dbName, items.dbUser)
+
+ delWebsite.delete()
+
+ ## Deleting DNS Zone if there is any.
+
+ DNS.deleteDNSZone(virtualHostName)
+
+ installUtilities.installUtilities.reStartLiteSpeed()
+
+ ## Delete mail accounts
+
+ command = "sudo rm -rf /home/vmail/" + virtualHostName
+ subprocess.call(shlex.split(command))
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
+ return 0
+ return 1
- return 1
@staticmethod
def deleteCoreConf(virtualHostName, numberOfSites):
- try:
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
+ virtualHostPath = "/home/" + virtualHostName
+ if os.path.exists(virtualHostPath):
+ shutil.rmtree(virtualHostPath)
+
+ confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
+ if os.path.exists(confPath):
+ shutil.rmtree(confPath)
+
+ data = open("/usr/local/lsws/conf/httpd_config.conf").readlines()
+
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'w')
+
+ check = 1
+ sslCheck = 1
+
+ for items in data:
+ if numberOfSites == 1:
+ if (items.find(' ' + virtualHostName) > -1 and items.find(" map " + virtualHostName) > -1):
+ continue
+ if (items.find(' ' + virtualHostName) > -1 and (items.find("virtualHost") > -1 or items.find("virtualhost") > -1)):
+ check = 0
+ if items.find("listener") > -1 and items.find("SSL") > -1:
+ sslCheck = 0
+ if (check == 1 and sslCheck == 1):
+ writeDataToFile.writelines(items)
+ if (items.find("}") > -1 and (check == 0 or sslCheck == 0)):
+ check = 1
+ sslCheck = 1
+ else:
+ if (items.find(' ' + virtualHostName) > -1 and items.find(" map " + virtualHostName) > -1):
+ continue
+ if (items.find(' ' + virtualHostName) > -1 and (items.find("virtualHost") > -1 or items.find("virtualhost") > -1)):
+ check = 0
+ if (check == 1):
+ writeDataToFile.writelines(items)
+ if (items.find("}") > -1 and check == 0):
+ check = 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
+ return 0
+ return 1
+ else:
virtualHostPath = "/home/" + virtualHostName
- if os.path.exists(virtualHostPath):
+ try:
shutil.rmtree(virtualHostPath)
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to remove virtual host directory from /home continuing..]")
- confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
- if os.path.exists(confPath):
+ try:
+ confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
shutil.rmtree(confPath)
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to remove virtual host configuration directory from /conf ]")
- data = open("/usr/local/lsws/conf/httpd_config.conf").readlines()
+ try:
+ data = open("/usr/local/lsws/conf/httpd.conf").readlines()
- writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'w')
+ writeDataToFile = open("/usr/local/lsws/conf/httpd.conf", 'w')
- check = 1
- sslCheck = 1
-
- for items in data:
- if numberOfSites == 1:
- if (items.find(' ' + virtualHostName) > -1 and items.find(" map " + virtualHostName) > -1):
- continue
- if (items.find(' ' + virtualHostName) > -1 and (items.find("virtualHost") > -1 or items.find("virtualhost") > -1)):
- check = 0
- if items.find("listener") > -1 and items.find("SSL") > -1:
- sslCheck = 0
- if (check == 1 and sslCheck == 1):
+ for items in data:
+ if items.find('/' + virtualHostName + '/') > -1:
+ pass
+ else:
writeDataToFile.writelines(items)
- if (items.find("}") > -1 and (check == 0 or sslCheck == 0)):
- check = 1
- sslCheck = 1
- else:
- if (items.find(' ' + virtualHostName) > -1 and items.find(" map " + virtualHostName) > -1):
- continue
- if (items.find(' ' + virtualHostName) > -1 and (items.find("virtualHost") > -1 or items.find("virtualhost") > -1)):
- check = 0
- if (check == 1):
- writeDataToFile.writelines(items)
- if (items.find("}") > -1 and check == 0):
- check = 1
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
- return 0
- return 1
+ writeDataToFile.close()
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [Not able to remove virtual host configuration from main configuration file.]")
+ return 0
+ return 1
@staticmethod
def checkIfVirtualHostExists(virtualHostName):
@@ -544,51 +696,88 @@ rewrite {
@staticmethod
def changePHP(vhFile, phpVersion):
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ finalphp = 0
+ try:
+ data = open(vhFile, "r").readlines()
- # General Configurations tab
+ if phpVersion == "PHP 5.3":
+ finalphp = 53
+ elif phpVersion == "PHP 5.4":
+ finalphp = 54
+ elif phpVersion == "PHP 5.5":
+ finalphp = 55
+ elif phpVersion == "PHP 5.6":
+ finalphp = 56
+ elif phpVersion == "PHP 7.0":
+ finalphp = 70
+ elif phpVersion == "PHP 7.1":
+ finalphp = 71
+ elif phpVersion == "PHP 7.2":
+ finalphp = 72
- finalphp = 0
+ writeDataToFile = open(vhFile, "w")
- try:
- data = open(vhFile, "r").readlines()
+ path = " path /usr/local/lsws/lsphp" + str(finalphp) + "/bin/lsphp\n"
- if phpVersion == "PHP 5.3":
- finalphp = 53
- elif phpVersion == "PHP 5.4":
- finalphp = 54
- elif phpVersion == "PHP 5.5":
- finalphp = 55
- elif phpVersion == "PHP 5.6":
- finalphp = 56
- elif phpVersion == "PHP 7.0":
- finalphp = 70
- elif phpVersion == "PHP 7.1":
- finalphp = 71
- elif phpVersion == "PHP 7.2":
- finalphp = 72
+ for items in data:
+ if items.find("/usr/local/lsws/lsphp") > -1 and items.find("path") > -1:
+ writeDataToFile.writelines(path)
+ else:
+ writeDataToFile.writelines(items)
- writeDataToFile = open(vhFile, "w")
+ writeDataToFile.close()
- path = " path /usr/local/lsws/lsphp" + str(finalphp) + "/bin/lsphp\n"
+ installUtilities.installUtilities.reStartLiteSpeed()
- for items in data:
- if items.find("/usr/local/lsws/lsphp") > -1 and items.find("path") > -1:
- writeDataToFile.writelines(path)
- else:
- writeDataToFile.writelines(items)
+ print "1,None"
+ return 1,'None'
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [changePHP]]")
+ print 0,str(msg)
+ return [0, str(msg) + " [IO Error with per host config file [changePHP]]"]
+ else:
+ try:
+ data = open(vhFile, "r").readlines()
+ if phpVersion == "PHP 5.3":
+ finalphp = 53
- writeDataToFile.close()
+ elif phpVersion == "PHP 5.4":
+ finalphp = 54
+ elif phpVersion == "PHP 5.5":
+ finalphp = 55
+ elif phpVersion == "PHP 5.6":
+ finalphp = 56
+ elif phpVersion == "PHP 7.0":
+ finalphp = 70
+ elif phpVersion == "PHP 7.1":
+ finalphp = 71
+ elif phpVersion == "PHP 7.2":
+ finalphp = 72
- installUtilities.installUtilities.reStartLiteSpeed()
+ writeDataToFile = open(vhFile, "w")
- print "1,None"
- return 1,'None'
+ finalString = ' AddHandler application/x-httpd-php' + str(finalphp) + ' .php\n'
+
+ for items in data:
+ if items.find("AddHandler application/x-httpd") > -1:
+ writeDataToFile.writelines(finalString)
+ else:
+ writeDataToFile.writelines(items)
+
+ writeDataToFile.close()
+
+ installUtilities.installUtilities.reStartLiteSpeed()
+
+ print "1,None"
+ return 1, 'None'
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [changePHP]]")
+ print 0, str(msg)
+ return [0, str(msg) + " [IO Error with per host config file [changePHP]]"]
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + " [IO Error with per host config file [changePHP]]")
- print 0,str(msg)
- return [0, str(msg) + " [IO Error with per host config file [changePHP]]"]
@staticmethod
def addRewriteRules(virtualHostName, fileName=None):
@@ -648,8 +837,6 @@ rewrite {
print str(inMB) + "," + str(percentage)
else:
print "0,0"
-
-
except OSError, msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [findDomainBW]")
print "0,0"
@@ -782,176 +969,227 @@ rewrite {
logging.CyberCPLogFileWriter.writeToFile(str(msg) + " [createDirectoryForDomain]]")
return [0, "[351 Not able to directories for virtual host [createDirectoryForDomain]]"]
- if vhost.perHostDomainConf(path, masterDomain, completePathToConfigFile,
- administratorEmail, phpVersion, virtualHostUser, openBasedir) == 1:
+ if vhost.perHostDomainConf(path, masterDomain, domain, completePathToConfigFile,
+ administratorEmail, phpVersion, virtualHostUser, openBasedir) == 1:
return [1, "None"]
else:
return [0, "[359 Not able to create per host virtual configurations [perHostVirtualConf]"]
@staticmethod
- def perHostDomainConf(path, masterDomain, vhFile, administratorEmail, phpVersion, virtualHostUser, openBasedir):
+ def perHostDomainConf(path, masterDomain, domain, vhFile, administratorEmail, phpVersion, virtualHostUser, openBasedir):
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
+ confFile = open(vhFile, "w+")
- # General Configurations tab
+ docRoot = "docRoot " + path + "\n"
+ vhDomain = "vhDomain $VH_NAME" + "\n"
+ vhAliases = "vhAliases www.$VH_NAME" + "\n"
+ adminEmails = "adminEmails " + administratorEmail + "\n"
+ enableGzip = "enableGzip 1" + "\n"
+ enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
- try:
- confFile = open(vhFile, "w+")
+ confFile.writelines(docRoot)
+ confFile.writelines(vhDomain)
+ confFile.writelines(vhAliases)
+ confFile.writelines(adminEmails)
+ confFile.writelines(enableGzip)
+ confFile.writelines(enableIpGeo)
- docRoot = "docRoot " + path + "\n"
- vhDomain = "vhDomain $VH_NAME" + "\n"
- vhAliases = "vhAliases www.$VH_NAME" + "\n"
- adminEmails = "adminEmails " + administratorEmail + "\n"
- enableGzip = "enableGzip 1" + "\n"
- enableIpGeo = "enableIpGeo 1" + "\n" + "\n"
+ # Index file settings
- confFile.writelines(docRoot)
- confFile.writelines(vhDomain)
- confFile.writelines(vhAliases)
- confFile.writelines(adminEmails)
- confFile.writelines(enableGzip)
- confFile.writelines(enableIpGeo)
+ index = "index {" + "\n"
+ userServer = " useServer 0" + "\n"
+ indexFiles = " indexFiles index.php, index.html" + "\n"
+ index_end = "}" + "\n" + "\n"
- # Index file settings
+ confFile.writelines(index)
+ confFile.writelines(userServer)
+ confFile.writelines(indexFiles)
+ confFile.writelines(index_end)
- index = "index {" + "\n"
- userServer = " useServer 0" + "\n"
- indexFiles = " indexFiles index.php, index.html" + "\n"
- index_end = "}" + "\n" + "\n"
-
- confFile.writelines(index)
- confFile.writelines(userServer)
- confFile.writelines(indexFiles)
- confFile.writelines(index_end)
-
- # Error Log Settings
+ # Error Log Settings
- error_log = "errorlog $VH_ROOT/logs/" + masterDomain + ".error_log {" + "\n"
- useServer = " useServer 0" + "\n"
- logLevel = " logLevel ERROR" + "\n"
- rollingSize = " rollingSize 10M" + "\n"
- error_log_end = "}" + "\n" + "\n"
+ error_log = "errorlog $VH_ROOT/logs/" + masterDomain + ".error_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logLevel = " logLevel ERROR" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ error_log_end = "}" + "\n" + "\n"
- confFile.writelines(error_log)
- confFile.writelines(useServer)
- confFile.writelines(logLevel)
- confFile.writelines(rollingSize)
- confFile.writelines(error_log_end)
+ confFile.writelines(error_log)
+ confFile.writelines(useServer)
+ confFile.writelines(logLevel)
+ confFile.writelines(rollingSize)
+ confFile.writelines(error_log_end)
- # Access Log Settings
+ # Access Log Settings
- access_Log = "accesslog $VH_ROOT/logs/" + masterDomain + ".access_log {" + "\n"
- useServer = " useServer 0" + "\n"
- logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
- logHeaders = " logHeaders 5" + "\n"
- rollingSize = " rollingSize 10M" + "\n"
- keepDays = " keepDays 10"
- compressArchive = " compressArchive 1" + "\n"
- access_Log_end = "}" + "\n" + "\n"
+ access_Log = "accesslog $VH_ROOT/logs/" + masterDomain + ".access_log {" + "\n"
+ useServer = " useServer 0" + "\n"
+ logFormat = ' logFormat "%v %h %l %u %t \"%r\" %>s %b"' + "\n"
+ logHeaders = " logHeaders 5" + "\n"
+ rollingSize = " rollingSize 10M" + "\n"
+ keepDays = " keepDays 10"
+ compressArchive = " compressArchive 1" + "\n"
+ access_Log_end = "}" + "\n" + "\n"
- confFile.writelines(access_Log)
- confFile.writelines(useServer)
- confFile.writelines(logFormat)
- confFile.writelines(logHeaders)
- confFile.writelines(rollingSize)
- confFile.writelines(keepDays)
- confFile.writelines(compressArchive)
- confFile.writelines(access_Log_end)
+ confFile.writelines(access_Log)
+ confFile.writelines(useServer)
+ confFile.writelines(logFormat)
+ confFile.writelines(logHeaders)
+ confFile.writelines(rollingSize)
+ confFile.writelines(keepDays)
+ confFile.writelines(compressArchive)
+ confFile.writelines(access_Log_end)
- ## OpenBase Dir Protection
+ ## OpenBase Dir Protection
- phpIniOverride = "phpIniOverride {\n"
- php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
- endPHPIniOverride = "}\n"
+ phpIniOverride = "phpIniOverride {\n"
+ php_admin_value = 'php_admin_value open_basedir "/tmp:/usr/local/lsws/Example/html/FileManager:$VH_ROOT"\n'
+ endPHPIniOverride = "}\n"
- confFile.writelines(phpIniOverride)
- if openBasedir == 1:
- confFile.writelines(php_admin_value)
- confFile.writelines(endPHPIniOverride)
+ confFile.writelines(phpIniOverride)
+ if openBasedir == 1:
+ confFile.writelines(php_admin_value)
+ confFile.writelines(endPHPIniOverride)
- # php settings
+ # php settings
- sockRandomPath = str(randint(1000, 9999))
+ sockRandomPath = str(randint(1000, 9999))
- scripthandler = "scripthandler {" + "\n"
- add = " add lsapi:" + virtualHostUser + sockRandomPath + " php" + "\n"
- php_end = "}" + "\n" + "\n"
+ scripthandler = "scripthandler {" + "\n"
+ add = " add lsapi:" + virtualHostUser + sockRandomPath + " php" + "\n"
+ php_end = "}" + "\n" + "\n"
- confFile.writelines(scripthandler)
- confFile.writelines(add)
- confFile.writelines(php_end)
+ confFile.writelines(scripthandler)
+ confFile.writelines(add)
+ confFile.writelines(php_end)
- ## external app
+ ## external app
- if phpVersion == "PHP 5.3":
- php = "53"
- elif phpVersion == "PHP 5.4":
- php = "55"
- elif phpVersion == "PHP 5.5":
- php = "55"
- elif phpVersion == "PHP 5.6":
- php = "56"
- elif phpVersion == "PHP 7.0":
- php = "70"
- elif phpVersion == "PHP 7.1":
- php = "71"
- elif phpVersion == "PHP 7.2":
- php = "72"
+ if phpVersion == "PHP 5.3":
+ php = "53"
+ elif phpVersion == "PHP 5.4":
+ php = "55"
+ elif phpVersion == "PHP 5.5":
+ php = "55"
+ elif phpVersion == "PHP 5.6":
+ php = "56"
+ elif phpVersion == "PHP 7.0":
+ php = "70"
+ elif phpVersion == "PHP 7.1":
+ php = "71"
+ elif phpVersion == "PHP 7.2":
+ php = "72"
- extprocessor = "extprocessor " + virtualHostUser + sockRandomPath + " {\n"
- type = " type lsapi\n"
- address = " address UDS://tmp/lshttpd/" + virtualHostUser + sockRandomPath + ".sock\n"
- maxConns = " maxConns 10\n"
- env = " env LSAPI_CHILDREN=10\n"
- initTimeout = " initTimeout 60\n"
- retryTimeout = " retryTimeout 0\n"
- persistConn = " persistConn 1\n"
- persistConnTimeout = " pcKeepAliveTimeout 1\n"
- respBuffer = " respBuffer 0\n"
- autoStart = " autoStart 1\n"
- path = " path /usr/local/lsws/lsphp" + php + "/bin/lsphp\n"
- extUser = " extUser " + virtualHostUser + "\n"
- extGroup = " extGroup " + virtualHostUser + "\n"
- memSoftLimit = " memSoftLimit 2047M\n"
- memHardLimit = " memHardLimit 2047M\n"
- procSoftLimit = " procSoftLimit 400\n"
- procHardLimit = " procHardLimit 500\n"
- extprocessorEnd = "}\n"
+ extprocessor = "extprocessor " + virtualHostUser + sockRandomPath + " {\n"
+ type = " type lsapi\n"
+ address = " address UDS://tmp/lshttpd/" + virtualHostUser + sockRandomPath + ".sock\n"
+ maxConns = " maxConns 10\n"
+ env = " env LSAPI_CHILDREN=10\n"
+ initTimeout = " initTimeout 60\n"
+ retryTimeout = " retryTimeout 0\n"
+ persistConn = " persistConn 1\n"
+ persistConnTimeout = " pcKeepAliveTimeout 1\n"
+ respBuffer = " respBuffer 0\n"
+ autoStart = " autoStart 1\n"
+ path = " path /usr/local/lsws/lsphp" + php + "/bin/lsphp\n"
+ extUser = " extUser " + virtualHostUser + "\n"
+ extGroup = " extGroup " + virtualHostUser + "\n"
+ memSoftLimit = " memSoftLimit 2047M\n"
+ memHardLimit = " memHardLimit 2047M\n"
+ procSoftLimit = " procSoftLimit 400\n"
+ procHardLimit = " procHardLimit 500\n"
+ extprocessorEnd = "}\n"
- confFile.writelines(extprocessor)
- confFile.writelines(type)
- confFile.writelines(address)
- confFile.writelines(maxConns)
- confFile.writelines(env)
- confFile.writelines(initTimeout)
- confFile.writelines(retryTimeout)
- confFile.writelines(persistConn)
- confFile.writelines(persistConnTimeout)
- confFile.writelines(respBuffer)
- confFile.writelines(autoStart)
- confFile.writelines(path)
- confFile.writelines(extUser)
- confFile.writelines(extGroup)
- confFile.writelines(memSoftLimit)
- confFile.writelines(memHardLimit)
- confFile.writelines(procSoftLimit)
- confFile.writelines(procHardLimit)
- confFile.writelines(extprocessorEnd)
+ confFile.writelines(extprocessor)
+ confFile.writelines(type)
+ confFile.writelines(address)
+ confFile.writelines(maxConns)
+ confFile.writelines(env)
+ confFile.writelines(initTimeout)
+ confFile.writelines(retryTimeout)
+ confFile.writelines(persistConn)
+ confFile.writelines(persistConnTimeout)
+ confFile.writelines(respBuffer)
+ confFile.writelines(autoStart)
+ confFile.writelines(path)
+ confFile.writelines(extUser)
+ confFile.writelines(extGroup)
+ confFile.writelines(memSoftLimit)
+ confFile.writelines(memHardLimit)
+ confFile.writelines(procSoftLimit)
+ confFile.writelines(procHardLimit)
+ confFile.writelines(extprocessorEnd)
- htaccessAutoLoad = """
-rewrite {
- enable 1
- autoLoadHtaccess 1
-}
-"""
- confFile.write(htaccessAutoLoad)
+ htaccessAutoLoad = """
+ rewrite {
+ enable 1
+ autoLoadHtaccess 1
+ }
+ """
+ confFile.write(htaccessAutoLoad)
- confFile.close()
+ confFile.close()
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostDomainConf]]")
+ return 0
+ return 1
+ else:
+ try:
+
+ confFile = open(vhFile, "w+")
+
+ doNotModify = '# Do not modify this file, this is auto-generated file.\n\n'
+
+ VirtualHost = '
\n\n'
+ ServerName = ' ServerName ' + domain + '\n'
+ ServerAlias = ' ServerAlias www.' + domain + '\n'
+ ServerAdmin = ' ServerAdmin ' + administratorEmail + '\n'
+ SeexecUserGroup = ' SuexecUserGroup ' + virtualHostUser + ' ' + virtualHostUser + '\n'
+ DocumentRoot = ' DocumentRoot ' + path + '\n'
+ CustomLogCombined = ' CustomLog /home/' + masterDomain + '/logs/' + masterDomain + '.access_log combined\n'
+
+ confFile.writelines(doNotModify)
+ confFile.writelines(VirtualHost)
+ confFile.writelines(ServerName)
+ confFile.writelines(ServerAlias)
+ confFile.writelines(ServerAdmin)
+ confFile.writelines(SeexecUserGroup)
+ confFile.writelines(DocumentRoot)
+ confFile.writelines(CustomLogCombined)
+
+ ## external app
+
+ if phpVersion == "PHP 5.3":
+ php = "53"
+ elif phpVersion == "PHP 5.4":
+ php = "55"
+ elif phpVersion == "PHP 5.5":
+ php = "55"
+ elif phpVersion == "PHP 5.6":
+ php = "56"
+ elif phpVersion == "PHP 7.0":
+ php = "70"
+ elif phpVersion == "PHP 7.1":
+ php = "71"
+ elif phpVersion == "PHP 7.2":
+ php = "72"
+
+ AddType = ' AddHandler application/x-httpd-php' + php + ' .php .php7 .phtml\n\n'
+ VirtualHostEnd = '\n'
+
+ confFile.writelines(AddType)
+ confFile.writelines(VirtualHostEnd)
+
+ confFile.close()
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + " [IO Error with per host config file [perHostDomainConf]]")
+ return 0
+ return 1
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + " [IO Error with per host config file [perHostDomainConf]]")
- return 0
- return 1
@staticmethod
def createConfigInMainDomainHostFile(domain, masterDomain):
@@ -963,28 +1201,40 @@ rewrite {
# restrained 1
# }
- try:
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ try:
- if vhost.createNONSSLMapEntry(domain) == 0:
- return [0, "Failed to create NON SSL Map Entry [createConfigInMainVirtualHostFile]"]
+ if vhost.createNONSSLMapEntry(domain) == 0:
+ return [0, "Failed to create NON SSL Map Entry [createConfigInMainVirtualHostFile]"]
- writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
+ writeDataToFile = open("/usr/local/lsws/conf/httpd_config.conf", 'a')
- writeDataToFile.writelines("\n")
- writeDataToFile.writelines("virtualHost " + domain + " {\n")
- writeDataToFile.writelines(" vhRoot /home/" + masterDomain + "\n")
- writeDataToFile.writelines(" configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf\n")
- writeDataToFile.writelines(" allowSymbolLink 1\n")
- writeDataToFile.writelines(" enableScript 1\n")
- writeDataToFile.writelines(" restrained 1\n")
- writeDataToFile.writelines("}\n")
- writeDataToFile.writelines("\n")
+ writeDataToFile.writelines("\n")
+ writeDataToFile.writelines("virtualHost " + domain + " {\n")
+ writeDataToFile.writelines(" vhRoot /home/" + masterDomain + "\n")
+ writeDataToFile.writelines(" configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhost.conf\n")
+ writeDataToFile.writelines(" allowSymbolLink 1\n")
+ writeDataToFile.writelines(" enableScript 1\n")
+ writeDataToFile.writelines(" restrained 1\n")
+ writeDataToFile.writelines("}\n")
+ writeDataToFile.writelines("\n")
- writeDataToFile.close()
+ writeDataToFile.close()
- return [1, "None"]
+ return [1, "None"]
- except BaseException, msg:
- logging.CyberCPLogFileWriter.writeToFile(
- str(msg) + "223 [IO Error with main config file [createConfigInMainDomainHostFile]]")
- return [0, "223 [IO Error with main config file [createConfigInMainDomainHostFile]]"]
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + "223 [IO Error with main config file [createConfigInMainDomainHostFile]]")
+ return [0, "223 [IO Error with main config file [createConfigInMainDomainHostFile]]"]
+ else:
+ try:
+ writeDataToFile = open("/usr/local/lsws/conf/httpd.conf", 'a')
+ configFile = 'Include /usr/local/lsws/conf/vhosts/' + domain + '/vhost.conf\n'
+ writeDataToFile.writelines(configFile)
+ writeDataToFile.close()
+ return [1, "None"]
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(
+ str(msg) + "223 [IO Error with main config file [createConfigInMainDomainHostFile]]")
+ return [0, "223 [IO Error with main config file [createConfigInMainDomainHostFile]]"]
diff --git a/plogical/website.py b/plogical/website.py
index eca026cf5..e35f3c6d3 100644
--- a/plogical/website.py
+++ b/plogical/website.py
@@ -150,7 +150,6 @@ class WebsiteManager:
## Create Configurations
execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
-
execPath = execPath + " createVirtualHost --virtualHostName " + domain + \
" --administratorEmail " + adminEmail + " --phpVersion '" + phpSelection + \
"' --virtualHostUser " + externalApp + " --ssl " + str(data['ssl']) + " --dkimCheck " \
diff --git a/serverStatus/litespeed/FileManager/.idea/FIleManager.iml b/serverStatus/litespeed/FileManager/.idea/FIleManager.iml
new file mode 100644
index 000000000..c956989b2
--- /dev/null
+++ b/serverStatus/litespeed/FileManager/.idea/FIleManager.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/serverStatus/litespeed/FileManager/.idea/modules.xml b/serverStatus/litespeed/FileManager/.idea/modules.xml
new file mode 100644
index 000000000..34abd3fc4
--- /dev/null
+++ b/serverStatus/litespeed/FileManager/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/serverStatus/litespeed/FileManager/.idea/workspace.xml b/serverStatus/litespeed/FileManager/.idea/workspace.xml
new file mode 100644
index 000000000..026ca8720
--- /dev/null
+++ b/serverStatus/litespeed/FileManager/.idea/workspace.xml
@@ -0,0 +1,600 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ../../assets
+ ajax/libs/angularjs/1.2.12/angular.js
+ AbnTestController
+ AbnTest
+ listAction
+ $commandToExecute
+
+
+ assets
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1511505785266
+
+
+ 1511505785266
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/serverStatus/litespeed/FileManager/php/caller.php b/serverStatus/litespeed/FileManager/php/caller.php
new file mode 100755
index 000000000..6a5d4cf17
--- /dev/null
+++ b/serverStatus/litespeed/FileManager/php/caller.php
@@ -0,0 +1,127 @@
+basePath = $basePath ?: dirname(__DIR__);
+ }
+
+ public function requestHandler()
+ {
+ if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['method'])) {
+
+ $pathToSeed = '/home/' . $_POST['domainName'] . '/..filemanagerkey';
+ $receivedSeed = $_POST['domainRandomSeed'];
+
+ $myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
+ $seed = fread($myfile,filesize($pathToSeed));
+ fclose($myfile);
+
+ if ($seed != $receivedSeed){
+ $answer = array(
+ 'uploadStatus' => 0,
+ 'answer' => 'Not allowed to upload in this path.',
+ 'error_message' => "None",
+ 'fileName' => $_FILES['file']['name']
+ );
+ $json = json_encode($answer);
+ echo $json;
+ return;
+ }
+
+ switch ($_POST['method']) {
+ case 'upload':
+ $this->uploadFile();
+ break;
+ }
+ }
+ }
+
+ private function uploadFile(){
+ try {
+ if (!empty($_FILES)) {
+
+ if($this->return_bytes(ini_get('upload_max_filesize')) < $_SERVER['CONTENT_LENGTH']){
+ throw new Exception("Size of uploaded file is greater than upload limit!");
+ }
+
+ $completePath = $this->cleanInput($_POST['completePath']);
+ $fileName = $this->cleanInput($_FILES['file']['name']);
+ $homePath = $this->cleanInput($_POST['home']);
+
+ $tempPath = $_FILES['file']['tmp_name'];
+ $uploadPath = $completePath . DIRECTORY_SEPARATOR . $fileName;
+
+ $pos = strpos($uploadPath, $homePath);
+
+ if ($pos === false) {
+ throw new Exception("Not allowed to upload in this path!");
+ }
+
+
+ if(move_uploaded_file($tempPath, $uploadPath)==true){
+ $answer = array(
+ 'uploadStatus' => 1,
+ 'answer' => 'File transfer completed',
+ 'error_message' => "None",
+ 'fileName' => $_FILES['file']['name']
+ );
+ $json = json_encode($answer);
+ echo $json;
+ }
+ else{
+ throw new Exception("Can not move uploaded file to destination location!");
+ }
+
+ }
+ else {
+ throw new Exception("No Files to upload!");
+ }
+ }
+ catch(Exception $e) {
+ $answer = array(
+ 'uploadStatus' => 0,
+ 'answer' => 'No files',
+ 'error_message' => $e->getMessage(),
+ 'fileName' => $_FILES['file']['name'],
+ );
+ $json = json_encode($answer);
+ echo $json;
+ }
+
+ }
+
+ private function return_bytes($val) {
+ $val = trim($val);
+ $last = strtolower($val[strlen($val)-1]);
+ switch($last) {
+ // The 'G' modifier is available since PHP 5.1.0
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ }
+
+ return $val;
+ }
+
+ private function cleanInput($input) {
+ $search = array(
+ '@@si',
+ '@<[\/\!]*?[^<>]*?>@si',
+ '@@siU',
+ '@@'
+ );
+ $output = preg_replace($search, '', $input);
+ return $output;
+ }
+
+}
+
+$caller = new Caller("/");
+$caller->requestHandler();
\ No newline at end of file
diff --git a/serverStatus/litespeed/FileManager/php/fileManager.php b/serverStatus/litespeed/FileManager/php/fileManager.php
new file mode 100755
index 000000000..d57668452
--- /dev/null
+++ b/serverStatus/litespeed/FileManager/php/fileManager.php
@@ -0,0 +1,748 @@
+domainName . '/..filemanagerkey';
+ $receivedSeed = $request->domainRandomSeed;
+
+ $myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
+ $seed = fread($myfile,filesize($pathToSeed));
+ fclose($myfile);
+
+ if ($seed != $receivedSeed){
+
+ $json_data = array(
+ "error_message" => "You can not open filemanager for this domain.",
+ "copied" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ return;
+ }
+
+
+ if (isset($request->method)) {
+
+ switch ($request->method) {
+ case 'list':
+ $this->listDir($request->completeStartingPath);
+ break;
+ case 'listForTable':
+ $home = $this->cleanInput($request->home);
+ $completeStartingPath = $this->cleanInput($request->completeStartingPath);
+ $this->listForTable($home,$completeStartingPath);
+ break;
+ case 'readFileContents':
+ $this->readFileContents($request->fileName);
+ break;
+ case 'writeFileContents':
+ $this->writeFileContents($request->fileName, $request->fileContent);
+ break;
+ case 'createNewFolder':
+ $folderName = $this->cleanInput($request->folderName);
+ $this->createNewFolder($folderName);
+ break;
+ case 'createNewFile':
+ $fileName = $this->cleanInput($request->fileName);
+ $this->createNewFile($fileName);
+ break;
+ case 'deleteFolderOrFile':
+ $this->deleteFolderOrFile($request->path, $request->fileAndFolders);
+ break;
+ case 'compress':
+ $compressedFileName = $this->cleanInput($request->compressedFileName);
+ $this->compress($request->basePath, $request->listOfFiles, $compressedFileName, $request->compressionType);
+ break;
+ case 'extract':
+ $extractionLocation = $this->cleanInput($request->extractionLocation);
+ $this->extract($request->home,$request->basePath,$request->fileToExtract,$request->extractionType,$extractionLocation);
+ break;
+ case 'move':
+ $this->moveFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
+ break;
+ case 'copy':
+ $this->copyFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
+ break;
+ case 'rename':
+ $newFileName = $this->cleanInput($request->newFileName);
+ $this->renameFileOrFolder($request->basePath,$request->existingName,$newFileName);
+ break;
+ case 'changePermissions':
+ $this->changePermissions($request->basePath, $request->permissionsPath, $request->newPermissions, $request->recursive);
+ break;
+ }
+ }
+ }
+
+ private function changePermissions($basePath, $permissionsPath, $newPermissions, $recursive)
+ {
+ try {
+
+ $completePath = $basePath . DIRECTORY_SEPARATOR . $permissionsPath;
+
+ if($recursive == 1){
+
+ $commandToExecute = 'chmod -R ' . $newPermissions . " '". $completePath . "'";
+ $programOutput = fopen('temp.txt', 'a');
+
+ }else{
+ $commandToExecute = 'chmod ' . $newPermissions . " '". $completePath . "'";
+ $programOutput = fopen('temp.txt', 'a');
+ }
+
+
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => "None",
+ "permissionsChanged" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "permissionsChanged" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function listDir($basePath)
+ {
+ try {
+ $path = "";
+ $listPath = $basePath . $path;
+ $files = scandir($listPath);
+ $json_data = array(
+ "error_message" => "None",
+ "fetchStatus" => 1
+ );
+ $counter = 0;
+
+ $tempDir = array();
+ $tempFiles = array();
+
+ // sorting files at end
+
+ foreach ($files as $dirFile) {
+
+ $completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
+ if (is_dir($completePath) == true) {
+ array_push($tempDir, $dirFile);
+ } else {
+ array_push($tempFiles, $dirFile);
+
+ }
+ }
+
+ $result = array_merge($tempDir, $tempFiles);
+
+ foreach ($result as $dirFile) {
+ if ($dirFile == "." or $dirFile == "..") {
+ continue;
+ }
+ $arrayCounter = 0;
+ $tempArray = array($dirFile);
+ $arrayCounter += 1;
+ $completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
+ $tempArray[$arrayCounter] = $completePath;
+ $arrayCounter += 1;
+
+ if (is_dir($completePath) == true) {
+ $list = true;
+ $tempArray[$arrayCounter] = $list;
+ } else {
+ $list = false;
+ $tempArray[$arrayCounter] = $list;
+ }
+
+ $json_data[(string)$counter] = $tempArray;
+ $counter += 1;
+
+ }
+
+ $json = json_encode($json_data);
+ echo $json;
+ } catch (Exception $e) {
+ $answer = array(
+ 'uploadStatus' => 0,
+ 'answer' => [1, 2, 3],
+ 'error_message' => $e->getMessage(),
+ );
+ $json = json_encode($answer);
+ echo $json;
+ }
+
+ }
+
+ private function getPermissions($fileName){
+
+ $perms = fileperms($fileName);
+
+ switch ($perms & 0xF000) {
+ case 0xC000: // socket
+ $info = 's';
+ break;
+ case 0xA000: // symbolic link
+ $info = 'l';
+ break;
+ case 0x8000: // regular
+ $info = 'r';
+ break;
+ case 0x6000: // block special
+ $info = 'b';
+ break;
+ case 0x4000: // directory
+ $info = 'd';
+ break;
+ case 0x2000: // character special
+ $info = 'c';
+ break;
+ case 0x1000: // FIFO pipe
+ $info = 'p';
+ break;
+ default: // unknown
+ $info = 'u';
+ }
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+
+ return $info;
+
+ }
+
+ private function listForTable($home,$basePath)
+ {
+ try {
+
+ $pos = strpos($basePath, $home);
+
+ if ($pos === false) {
+ throw new Exception("Not allowed to browse this path, going back home!");
+ }
+
+ $path = "";
+ $listPath = $basePath . $path;
+ $files = scandir($listPath);
+ $json_data = array("error_message" => "None",
+ "fetchStatus" => 1
+ );
+ $counter = 0;
+
+ $tempDir = array();
+ $tempFiles = array();
+
+ // sorting files at end
+
+ foreach ($files as $dirFile) {
+
+ $completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
+ if (is_dir($completePath) == true) {
+ array_push($tempDir, $dirFile);
+ } else {
+ array_push($tempFiles, $dirFile);
+ }
+ }
+
+ $result = array_merge($tempDir, $tempFiles);
+
+ foreach ($result as $dirFile) {
+ if ($dirFile == "." or $dirFile == "..") {
+ continue;
+ }
+ $arrayCounter = 0;
+ $tempArray = array($dirFile);
+ $arrayCounter += 1;
+ $completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
+ $tempArray[$arrayCounter] = $completePath;
+ $arrayCounter += 1;
+
+ // find last modified
+
+ $lastModified = date("F d Y H:i:s.", filemtime($completePath));
+ $tempArray[$arrayCounter] = $lastModified;
+ $arrayCounter += 1;
+
+ // find size of file
+
+ $fileSize = (int)(filesize($completePath) / 1024);
+ $tempArray[$arrayCounter] = $fileSize;
+ $arrayCounter += 1;
+
+ // find permissions of file
+
+
+ $tempArray[$arrayCounter] = substr(sprintf('%o', fileperms($completePath)), -4);;
+ $arrayCounter += 1;
+
+
+ // Deciding if the current path is file or dir.
+
+ if (is_dir($completePath) == true) {
+ $list = true;
+ $tempArray[$arrayCounter] = $list;
+ } else {
+ $list = false;
+ $tempArray[$arrayCounter] = $list;
+ }
+
+ $json_data[(string)$counter] = $tempArray;
+ $counter += 1;
+
+ }
+
+ $json = json_encode($json_data);
+ echo $json;
+ } catch (Exception $e) {
+ $answer = array(
+ 'fetchStatus' => 0,
+ 'error_message' => $e->getMessage(),
+ );
+ $json = json_encode($answer);
+ echo $json;
+ }
+
+ }
+
+ private function readFileContents($pathToFile)
+ {
+
+ try {
+ $listPath = $pathToFile;
+ $contentsofFile = file_get_contents($pathToFile);
+
+ if ($contentsofFile !== false) {
+ $json_data = array(
+ "error_message" => "None",
+ "fetchStatus" => 1,
+ "fileContents" => $contentsofFile
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } else {
+ throw new Exception("Can not read the file Contents");
+ }
+
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "fetchStatus" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function writeFileContents($pathToFile, $fileContent)
+ {
+
+ try {
+
+
+ $contentsofFile = file_put_contents($pathToFile, $fileContent);
+
+ if ($contentsofFile !== false) {
+ $json_data = array(
+ "error_message" => "None",
+ "saveStatus" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } else {
+ throw new Exception("Can not write the file Contents.");
+ }
+
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "saveStatus" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function createNewFolder($folderName)
+ {
+
+ try {
+
+
+ $returnVal = mkdir($folderName);
+
+ if ($returnVal !== false) {
+ $json_data = array(
+ "error_message" => "None",
+ "createStatus" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } else {
+ throw new Exception("Can not create Folder");
+ }
+
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "createStatus" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function createNewFile($fileName)
+ {
+
+ try {
+
+
+ if (touch($fileName)) {
+ $json_data = array(
+ "error_message" => "None",
+ "createStatus" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } else {
+ throw new Exception("Can not create file!");
+ }
+
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "createStatus" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function deleteFolderOrFile($basePath, $fileAndFolders)
+ {
+ try {
+
+ foreach ($fileAndFolders as $path) {
+
+ $path = $basePath . DIRECTORY_SEPARATOR . $path;
+
+ if (is_dir($path) == true) {
+ $commandToExecute = 'rm -rf ' . "'".$path ."'";
+ $programOutput = fopen('temp.txt', 'a');
+ exec($commandToExecute, $programOutput);
+ } else {
+ if (unlink($path)) {
+ continue;
+ } else {
+ throw new Exception("Can not delete!");
+ }
+ }
+
+ }
+
+ $json_data = array(
+ "error_message" => "None",
+ "deleteStatus" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "deleteStatus" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function compress($basePath, $listOfFiles, $compressedFileName, $compressionType)
+ {
+ try {
+
+ chdir($basePath);
+
+ if ($compressionType == "zip") {
+
+ $compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".zip";
+
+ $commandToExecute = 'zip -r ' . $compressedFileName . ' ';
+
+ foreach ($listOfFiles as $file) {
+ $completePathToFile = $file;
+ $commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
+ }
+
+ $programOutput = fopen('temp.txt', 'a');
+
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => $commandToExecute,
+ "compressed" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+ else {
+
+ $compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".tar.gz";
+
+ $commandToExecute = 'tar -czvf ' . $compressedFileName . ' ';
+
+ foreach ($listOfFiles as $file) {
+ $completePathToFile = $file;
+ $commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
+ }
+
+ $programOutput = fopen('temp.txt', 'a');
+
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => "None",
+ "compressed" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "compressed" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+ }
+
+ private function extract($home,$basePath,$completeFileToExtract, $extractionType, $extractionLocation)
+ {
+ try {
+
+ $pos = strpos($extractionLocation, $home);
+
+ if ($pos === false) {
+ throw new Exception("Not allowed to extact in this path, please choose location inside home!");
+ }
+
+ if ($extractionType == "zip") {
+
+ $commandToExecute = "unzip -o '" . $completeFileToExtract . "' -d '" . $extractionLocation . "'";
+
+ $programOutput = fopen('temp.txt', 'a');
+
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => $commandToExecute,
+ "extracted" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ } else {
+
+ $commandToExecute = "tar xf '" . $completeFileToExtract . "' -C '" . $extractionLocation . "'";
+
+ $programOutput = fopen('temp.txt', 'a');
+
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => "None",
+ "extracted" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+
+
+ }
+ }catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "extracted" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+ }
+
+ private function moveFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
+ {
+ try {
+
+ $pos = strpos($newPath, $home);
+
+ if ($pos === false) {
+ throw new Exception("Not allowed to move in this path, please choose location inside home!");
+ }
+
+ if(!file_exists($newPath)){
+ if(!mkdir($newPath, 0777, true)){
+ $json_data = array(
+ "error_message" => "Can not create the new folder, it already exists!",
+ "moved" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ die();
+ }
+ }
+
+ foreach ($fileAndFolders as $path) {
+
+ $completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
+ $completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
+
+ $commandToExecute = 'mv ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
+ $programOutput = fopen('temp.txt', 'a');
+ exec($commandToExecute, $programOutput);
+ }
+
+ $json_data = array(
+ "error_message" => "None",
+ "moved" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "moved" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function copyFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
+ {
+ try {
+
+ $pos = strpos($newPath, $home);
+
+ if ($pos === false) {
+ throw new Exception("Not allowed to move in this path, please choose location inside home!");
+ }
+
+ if(!file_exists($newPath)){
+ if(!mkdir($newPath, 0777, true)){
+ throw new Exception("Can not create the new folder, it already exists!");
+ }
+ }
+
+ foreach ($fileAndFolders as $path) {
+
+ $completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
+ $completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
+
+ $commandToExecute = 'cp ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
+ $programOutput = fopen('temp.txt', 'a');
+ exec($commandToExecute, $programOutput);
+ }
+
+ $json_data = array(
+ "error_message" => "None",
+ "copied" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "copied" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function renameFileOrFolder($basePath, $currentName, $newName)
+ {
+ try {
+
+ $completeOldPath = $basePath . DIRECTORY_SEPARATOR . $currentName;
+ $completeNewPath = $basePath . DIRECTORY_SEPARATOR . $newName;
+
+ $commandToExecute = 'mv ' ."'". $completeOldPath . "'" . ' ' . "'" . $completeNewPath . "'";
+ $programOutput = fopen('temp.txt', 'a');
+ exec($commandToExecute, $programOutput);
+
+ $json_data = array(
+ "error_message" => "None",
+ "renamed" => 1,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+
+ } catch (Exception $e) {
+ $json_data = array(
+ "error_message" => $e->getMessage(),
+ "renamed" => 0,
+ );
+ $json = json_encode($json_data);
+ echo $json;
+ }
+
+ }
+
+ private function cleanInput($input) {
+ $search = array(
+ '@@si', // Strip out javascript
+ '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
+ '@@siU', // Strip style tags properly
+ '@@' // Strip multi-line comments
+ );
+ $output = preg_replace($search, '', $input);
+ return $output;
+ }
+}
+
+$caller = new fileManager();
+$caller->requestHandler();
\ No newline at end of file
diff --git a/serverStatus/litespeed/FileManager/php/temp.txt b/serverStatus/litespeed/FileManager/php/temp.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/serverStatus/litespeed/FileManager/php/tests.php b/serverStatus/litespeed/FileManager/php/tests.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/serverStatus/litespeed/conf/httpd_config.conf b/serverStatus/litespeed/conf/httpd_config.conf
new file mode 100644
index 000000000..31783e118
--- /dev/null
+++ b/serverStatus/litespeed/conf/httpd_config.conf
@@ -0,0 +1,202 @@
+#
+# PLAIN TEXT CONFIGURATION FILE
+#
+serverName lscp
+user nobody
+group nobody
+priority 0
+inMemBufSize 60M
+swappingDir /tmp/lshttpd/swap
+autoFix503 1
+gracefulRestartTimeout 300
+mime $SERVER_ROOT/conf/mime.properties
+showVersionNumber 0
+adminEmails root@localhost
+adminRoot $SERVER_ROOT/admin/
+
+errorlog $SERVER_ROOT/logs/error.log {
+ logLevel DEBUG
+ debugLevel 0
+ rollingSize 10M
+ enableStderrLog 1
+}
+
+accesslog $SERVER_ROOT/logs/access.log {
+ rollingSize 10M
+ keepDays 30
+ compressArchive 0
+}
+indexFiles index.html, index.php
+
+expires {
+ enableExpires 1
+ expiresByType image/*=A604800, text/css=A604800, application/x-javascript=A604800
+}
+
+tuning {
+ eventDispatcher best
+ maxConnections 2000
+ maxSSLConnections 1000
+ connTimeout 300
+ maxKeepAliveReq 1000
+ smartKeepAlive 0
+ keepAliveTimeout 5
+ sndBufSize 0
+ rcvBufSize 0
+ maxReqURLLen 8192
+ maxReqHeaderSize 16380
+ maxReqBodySize 2047M
+ maxDynRespHeaderSize 8192
+ maxDynRespSize 2047M
+ maxCachedFileSize 4096
+ totalInMemCacheSize 20M
+ maxMMapFileSize 256K
+ totalMMapCacheSize 40M
+ useSendfile 1
+ fileETag 28
+ enableGzipCompress 1
+ enableDynGzipCompress 1
+ gzipCompressLevel 6
+ compressibleTypes text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
+ gzipAutoUpdateStatic 1
+ gzipStaticCompressLevel 6
+ gzipMaxFileSize 1M
+ gzipMinFileSize 300
+ SSLCryptoDevice null
+}
+
+fileAccessControl {
+ followSymbolLink 1
+ checkSymbolLink 0
+ requiredPermissionMask 000
+ restrictedPermissionMask 000
+}
+
+perClientConnLimit {
+ staticReqPerSec 0
+ dynReqPerSec 0
+ outBandwidth 0
+ inBandwidth 0
+ softLimit 10000
+ hardLimit 10000
+ gracePeriod 15
+ banPeriod 300
+}
+
+CGIRLimit {
+ maxCGIInstances 20
+ minUID 11
+ minGID 10
+ priority 0
+ CPUSoftLimit 10
+ CPUHardLimit 50
+ memSoftLimit 460M
+ memHardLimit 470M
+ procSoftLimit 400
+ procHardLimit 450
+}
+
+accessDenyDir {
+ dir /
+ dir /etc/*
+ dir /dev/*
+ dir $SERVER_ROOT/conf/*
+ dir $SERVER_ROOT/admin/conf/*
+}
+
+accessControl {
+ allow ALL
+}
+
+scripthandler {
+ add lsapi:php70 php
+}
+
+railsDefaults {
+ maxConns 5
+ env LSAPI_MAX_REQS=1000
+ env LSAPI_MAX_IDLE=60
+ initTimeout 60
+ retryTimeout 0
+ pcKeepAliveTimeout 60
+ respBuffer 0
+ backlog 50
+ runOnStartUp 1
+ extMaxIdleTime 300
+ priority 3
+ memSoftLimit 2047M
+ memHardLimit 2047M
+ procSoftLimit 500
+ procHardLimit 600
+}
+
+
+module cache {
+ param <<
" "$LSWS_HOME/conf/httpd_config.xml"`
+ OLD_GROUP_CONF=`grep "" "$LSWS_HOME/conf/httpd_config.xml"`
+ OLD_USER=`expr "$OLD_USER_CONF" : '.*\(.*\).*'`
+ OLD_GROUP=`expr "$OLD_GROUP_CONF" : '.*\(.*\).*'`
+ if [ "x$OLD_USER" != "x" ]; then
+ WS_USER=$OLD_USER
+ fi
+ if [ "x$OLD_GROUP" != "x" ]; then
+ WS_GROUP=$OLD_GROUP
+ else
+ D_GROUP=`$ID_GROUPS $WS_USER`
+ WS_GROUP=`expr "$D_GROUP" : '.*gid=[0-9]*(\(.*\)) groups=.*'`
+ fi
+ DIR_OWN=$WS_USER:$WS_GROUP
+ CONF_OWN=$WS_USER:$WS_GROUP
+
+}
+
+
+
+
+# Get destination directory
+install_dir()
+{
+
+ SUCC=0
+ INSTALL_TYPE="reinstall"
+ SET_LOGIN=1
+
+ if [ $INST_USER = "root" ]; then
+ DEST_RECOM="/usr/local/lsws"
+ if [ -f "/opt/lsws/conf/httpd_config.xml" ]; then
+ DEST_RECOM="/opt/lsws"
+ fi
+ WS_USER="nobody"
+ else
+ cat < "$LSINSTALL_DIR/admin/conf/htpasswd"
+
+ fi
+
+}
+
+
+getUserGroup()
+{
+
+ if [ $INST_USER = "root" ]; then
+ cat </dev/null`
+ TST_USER=`expr "$USER_INFO" : 'uid=.*(\(.*\)) gid=.*'`
+ if [ "x$TST_USER" = "x$TMP_USER" ]; then
+ USER_ID=`expr "$USER_INFO" : 'uid=\(.*\)(.*) gid=.*'`
+ if [ $USER_ID -gt 10 ]; then
+ WS_USER=$TMP_USER
+ SUCC=1
+ else
+ cat <:/
+
+EOF
+
+ SUCC=0
+ DEFAULT_PORT=8088
+ while [ $SUCC -eq "0" ]; do
+ printf "%s" "HTTP port [$DEFAULT_PORT]: "
+ TMP_PORT=80
+ if [ "x$TMP_PORT" = "x" ]; then
+ TMP_PORT=$DEFAULT_PORT
+ fi
+ SUCC=1
+ if [ `expr "$TMP_PORT" : '.*[^0-9]'` -gt 0 ]; then
+ echo "[ERROR] Only digits is allowed, try again!"
+ SUCC=0
+ fi
+ if [ $SUCC -eq 1 ]; then
+ if [ $INST_USER != "root" ]; then
+ if [ $TMP_PORT -le 1024 ]; then
+ echo "[ERROR] Only 'root' can use port below 1024, try again!"
+ SUCC=0
+ fi
+ fi
+ fi
+ if [ $SUCC -eq 1 ]; then
+ if [ `netstat -an | grep -w $TMP_PORT | grep -w LISTEN | wc -l` -gt 0 ]; then
+ echo "[ERROR] Port $TMP_PORT is in use now, stop the server using this port first,"
+ echo " or choose another port."
+ SUCC=0
+ fi
+ fi
+ done
+
+ HTTP_PORT=$TMP_PORT
+}
+
+
+# get administration TCP port
+getAdminPort()
+{
+ cat <:/
+
+EOF
+
+ SUCC=0
+ DEFAULT_PORT=7080
+ while [ $SUCC -eq "0" ]; do
+ printf "%s" "Admin HTTP port [$DEFAULT_PORT]: "
+ TMP_PORT=7080
+ if [ "x$TMP_PORT" = "x" ]; then
+ TMP_PORT=$DEFAULT_PORT
+ fi
+ SUCC=1
+ if [ `expr "$TMP_PORT" : '.*[^0-9]'` -gt 0 ]; then
+ echo "[ERROR] Only digits is allowed, try again!"
+ SUCC=0
+ fi
+ if [ $SUCC -eq 1 ]; then
+ if [ $INST_USER != "root" ]; then
+ if [ $TMP_PORT -le 1024 ]; then
+ echo "[ERROR] Only 'root' can use port below 1024, try again!"
+ SUCC=0
+ fi
+ fi
+ fi
+ if [ $SUCC -eq 1 ]; then
+ if [ $TMP_PORT -eq $HTTP_PORT ]; then
+ echo "[ERROR] The admin HTTP port must be different from the normal HTTP port!"
+ SUCC=0
+ fi
+ fi
+
+ if [ $SUCC -eq 1 ]; then
+ if [ `netstat -an | grep -w $TMP_PORT | grep -w LISTEN | wc -l` -gt 0 ]; then
+ echo "[ERROR] Port $TMP_PORT is in use, stop the server that using this port first,"
+ echo " or choose another port."
+ SUCC=0
+ fi
+ fi
+ done
+
+ ADMIN_PORT=$TMP_PORT
+}
+
+configAdminEmail()
+{
+ cat < "$LSINSTALL_DIR/admin/conf/admin_config.xml"
+
+ sed -e "s/%ADMIN_PORT%/$ADMIN_PORT/" "$LSINSTALL_DIR/admin/conf/admin_config.xml.in" > "$LSINSTALL_DIR/admin/conf/admin_config.xml"
+
+ sed -e "s/%USER%/$WS_USER/" -e "s/%GROUP%/$WS_GROUP/" -e "s#%APACHE_PID_FILE%#$APACHE_PID_FILE#" -e "s/%ADMIN_EMAIL%/$ADMIN_EMAIL/" -e "s#%RUBY_BIN%#$RUBY_PATH#" -e "s/%SERVER_NAME%/$SERVER_NAME/" -e "s/%AP_PORT_OFFSET%/$AP_PORT_OFFSET/" -e "s/%PHP_SUEXEC%/$PHP_SUEXEC/" "$LSINSTALL_DIR/add-ons/$HOST_PANEL/httpd_config.xml${PANEL_VARY}" > "$LSINSTALL_DIR/conf/httpd_config.xml"
+
+}
+
+# pass $1 = "$LSWS_HOME/httpd_config.xml"
+updateCagefsConfig()
+{
+ if [ "x$1" = "x" ]; then
+ conf_file=/usr/local/lsws/conf/httpd_config.xml
+ else
+ conf_file="$1"
+ fi
+ if [ ! -f "$conf_file" ]; then
+ return 1
+ fi
+ cagefsctl --cagefs-status 2>/dev/null 1>&2
+ if [ $? = 0 ]; then
+ cp "$conf_file" "$conf_file.tmp"
+ grep enableLVE "$conf_file" | grep -v grep > /dev/null
+ if [ $? = 0 ]; then
+ grep -e "[23]" "$conf_file" | grep -v grep > /dev/null
+ if [ $? = 0 ]; then
+ return 0
+ fi
+ sed -e "s#.*#2#" "$conf_file.tmp" > "$conf_file"
+ else
+ sed -e "s##2#" "$conf_file.tmp" > "$conf_file"
+ fi
+ fi
+}
+
+buildAdminSslCert()
+{
+ if [ ! -f "$LSWS_HOME/admin/conf/cert/admin.crt" ]; then
+ HN=`hostname`
+ openssl req -subj "/CN=$HN/O=webadmin/C=US" -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout "$LSWS_HOME/admin/conf/cert/admin.key" -out "$LSWS_HOME/admin/conf/cert/admin.crt"
+ fi
+}
+
+
+cPanelSwitchPathsConf()
+{
+ mode=shift
+ if [ "x$mode" == 'xapache' ]; then
+ cp /etc/cpanel/ea4/paths.conf /etc/cpanel/ea4/paths.conf.tmp
+ sed -e 's#/usr/local/lsws/bin/lswsctrl#/usr/sbin/apachectl#' /etc/cpanel/ea4/paths.conf
+ else
+ cp /etc/cpanel/ea4/paths.conf /etc/cpanel/ea4/paths.conf.tmp
+ sed -e 's#/usr/sbin/apachectl#/usr/local/lsws/bin/lswsctrl#' /etc/cpanel/ea4/paths.conf
+ fi
+}
+
+
+# generate configuration from template
+
+buildConfigFiles()
+{
+
+#sed -e "s/%ADMIN_PORT%/$ADMIN_PORT/" -e "s/%PHP_FCGI_PORT%/$ADMIN_PHP_PORT/" "$LSINSTALL_DIR/admin/conf/admin_config.xml.in" > "$LSINSTALL_DIR/admin/conf/admin_config.xml"
+
+ sed -e "s/%ADMIN_PORT%/$ADMIN_PORT/" "$LSINSTALL_DIR/admin/conf/admin_config.xml.in" > "$LSINSTALL_DIR/admin/conf/admin_config.xml"
+
+ sed -e "s/%USER%/$WS_USER/" -e "s/%GROUP%/$WS_GROUP/" -e "s/%ADMIN_EMAIL%/$ADMIN_EMAIL/" -e "s/%HTTP_PORT%/$HTTP_PORT/" -e "s/%RUBY_BIN%/$RUBY_PATH/" -e "s/%SERVER_NAME%/$SERVER_NAME/" "$LSINSTALL_DIR/conf/httpd_config.xml.in" > "$LSINSTALL_DIR/conf/httpd_config.xml.tmp"
+
+ if [ $SETUP_PHP -eq 1 ]; then
+ sed -e "s/%PHP_BEGIN%//" -e "s/%PHP_END%//" -e "s/%PHP_SUFFIX%/$PHP_SUFFIX/" -e "s/%PHP_PORT%/$PHP_PORT/" "$LSINSTALL_DIR/conf/httpd_config.xml.tmp" > "$LSINSTALL_DIR/conf/httpd_config.xml"
+ else
+ sed -e "s/%PHP_BEGIN%//" -e "s/%PHP_SUFFIX%/php/" -e "s/%PHP_PORT%/5201/" "$LSINSTALL_DIR/conf/httpd_config.xml.tmp" > "$LSINSTALL_DIR/conf/httpd_config.xml"
+ fi
+
+}
+
+util_mkdir()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ if [ ! -d "$LSWS_HOME/$arg" ]; then
+ mkdir "$LSWS_HOME/$arg"
+ fi
+ chown "$OWNER" "$LSWS_HOME/$arg"
+ chmod $PERM "$LSWS_HOME/$arg"
+ done
+
+}
+
+
+util_cpfile()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+ chown "$OWNER" "$LSWS_HOME/$arg"
+ chmod $PERM "$LSWS_HOME/$arg"
+ done
+
+}
+
+util_ccpfile()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ if [ ! -f "$LSWS_HOME/$arg" ]; then
+ cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+ fi
+ chown "$OWNER" "$LSWS_HOME/$arg"
+ chmod $PERM "$LSWS_HOME/$arg"
+ done
+}
+
+
+util_cpdir()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/"
+ chown -R "$OWNER" "$LSWS_HOME/$arg/"*
+ #chmod -R $PERM $LSWS_HOME/$arg/*
+ done
+}
+
+
+
+util_cpdirv()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ VERSION=$1
+ shift
+ for arg
+ do
+ cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/"
+ chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+ $TEST_BIN -L "$LSWS_HOME/$arg"
+ if [ $? -eq 0 ]; then
+ rm -f "$LSWS_HOME/$arg"
+ fi
+ FILENAME=`basename $arg`
+ ln -sf "./$FILENAME.$VERSION/" "$LSWS_HOME/$arg"
+ #chmod -R $PERM $LSWS_HOME/$arg/*
+ done
+}
+
+util_cpfilev()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ VERSION=$1
+ shift
+ for arg
+ do
+ cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION"
+ chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+ chmod $PERM "$LSWS_HOME/$arg.$VERSION"
+ $TEST_BIN -L "$LSWS_HOME/$arg"
+ if [ $? -eq 0 ]; then
+ rm -f "$LSWS_HOME/$arg"
+ fi
+ FILENAME=`basename $arg`
+ ln -sf "./$FILENAME.$VERSION" "$LSWS_HOME/$arg"
+ done
+}
+
+
+installation1()
+{
+ umask 022
+ if [ $INST_USER = "root" ]; then
+ SDIR_OWN="root:$ROOTGROUP"
+ chown $SDIR_OWN $LSWS_HOME
+ else
+ SDIR_OWN=$DIR_OWN
+ fi
+ sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
+
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ if [ ! -f "$LSWS_HOME/$arg" ]; then
+ cp "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg"
+ fi
+ chown "$OWNER" "$LSWS_HOME/$arg"
+ chmod $PERM "$LSWS_HOME/$arg"
+ done
+}
+
+
+util_cpdir()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ for arg
+ do
+ cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg/"
+ chown -R "$OWNER" "$LSWS_HOME/$arg/"*
+ #chmod -R $PERM $LSWS_HOME/$arg/*
+ done
+}
+
+
+
+util_cpdirv()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ VERSION=$1
+ shift
+ for arg
+ do
+ cp -R "$LSINSTALL_DIR/$arg/"* "$LSWS_HOME/$arg.$VERSION/"
+ chown -R "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+ $TEST_BIN -L "$LSWS_HOME/$arg"
+ if [ $? -eq 0 ]; then
+ rm -f "$LSWS_HOME/$arg"
+ fi
+ FILENAME=`basename $arg`
+ ln -sf "./$FILENAME.$VERSION/" "$LSWS_HOME/$arg"
+ #chmod -R $PERM $LSWS_HOME/$arg/*
+ done
+}
+
+util_cpfilev()
+{
+ OWNER=$1
+ PERM=$2
+ shift
+ shift
+ VERSION=$1
+ shift
+ for arg
+ do
+ cp -f "$LSINSTALL_DIR/$arg" "$LSWS_HOME/$arg.$VERSION"
+ chown "$OWNER" "$LSWS_HOME/$arg.$VERSION"
+ chmod $PERM "$LSWS_HOME/$arg.$VERSION"
+ $TEST_BIN -L "$LSWS_HOME/$arg"
+ if [ $? -eq 0 ]; then
+ rm -f "$LSWS_HOME/$arg"
+ fi
+ FILENAME=`basename $arg`
+ ln -sf "./$FILENAME.$VERSION" "$LSWS_HOME/$arg"
+ done
+}
+
+compress_admin_file()
+{
+ TMP_DIR=`pwd`
+ cd $LSWS_HOME/admin/html
+ find . | grep -e '\.js$' | xargs -n 1 ../misc/gzipStatic.sh 9
+ find . | grep -e '\.css$' | xargs -n 1 ../misc/gzipStatic.sh 9
+ cd $TMP_DIR
+}
+
+
+install_whm_plugin()
+{
+
+ WHM_PLUGIN_SRCDIR="$LSINSTALL_DIR/add-ons/cpanel/lsws_whm_plugin"
+ $WHM_PLUGIN_SRCDIR/lsws_whm_plugin_install.sh $WHM_PLUGIN_SRCDIR $LSWS_HOME
+
+
+}
+
+create_lsadm_freebsd()
+{
+ pw group add lsadm
+ lsadm_gid=`grep "^lsadm:" /etc/group | awk -F : '{ print $3; }'`
+ pw user add -g $lsadm_gid -d / -s /usr/sbin/nologin -n lsadm
+ pw usermod lsadm -G $WS_GROUP
+}
+
+create_lsadm()
+{
+ groupadd lsadm
+ #1>/dev/null 2>&1
+ lsadm_gid=`grep "^lsadm:" /etc/group | awk -F : '{ print $3; }'`
+ useradd -g $lsadm_gid -d / -r -s /sbin/nologin lsadm
+ usermod -a -G $WS_GROUP lsadm
+ #1>/dev/null 2>&1
+
+}
+
+create_lsadm_solaris()
+{
+ groupadd lsadm
+ #1>/dev/null 2>&1
+ lsadm_gid=`grep "^lsadm:" /etc/group | awk -F: '{ print $3; }'`
+ useradd -g $lsadm_gid -d / -s /bin/false lsadm
+ usermod -G $WS_GROUP lsadm
+
+ #1>/dev/null 2>&1
+
+}
+
+
+create_self_signed_cert_for_admin()
+{
+#$1 = filename
+#$2 = domain_name
+ openssl req -x509 -sha256 -newkey rsa:2048 -keyout $1.key -out $1.crt -days 1024 -nodes -subj '/CN=$2'
+}
+
+
+fix_cloudlinux()
+{
+ if [ -d /proc/lve ]; then
+ lvectl set-user $WS_USER --unlimited
+ if [ "x$SYS_ARCH" != 'xi386' ]; then
+ lvectl set-user $WS_USER --pmem=2000G
+ else
+ lvectl set-user $WS_USER --pmem=2G
+ fi
+ lvectl set-user lsadm --unlimited
+ lvectl set-user lsadm --pmem=2G
+ $LSWS_HOME/admin/misc/fix_cagefs.sh
+ updateCagefsConfig $LSWS_HOME/conf/httpd_config.xml
+ fi
+}
+
+installation()
+{
+ umask 022
+ if [ $INST_USER = "root" ]; then
+ export PATH=/sbin:/usr/sbin:$PATH
+ if [ "x$SYS_NAME" = "xLinux" ]; then
+ create_lsadm
+ elif [ "x$SYS_NAME" = "xFreeBSD" ] || [ "x$SYS_NAME" = "xNetBSD" ]; then
+ create_lsadm_freebsd
+ elif [ "x$SYS_NAME" = "xSunOS" ]; then
+ create_lsadm_solaris
+ fi
+ grep "^lsadm:" /etc/passwd 1>/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ CONF_OWN="lsadm:lsadm"
+ fi
+ SDIR_OWN="root:$ROOTGROUP"
+ chown $SDIR_OWN $LSWS_HOME
+ else
+ SDIR_OWN=$DIR_OWN
+ fi
+ sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc"
+ sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo.in" > "$LSINSTALL_DIR/admin/misc/lsws.rc.gentoo"
+ sed "s:%LSWS_CTRL%:$LSWS_HOME/bin/lswsctrl:" "$LSINSTALL_DIR/admin/misc/lshttpd.service.in" > "$LSINSTALL_DIR/admin/misc/lshttpd.service"
+
+ if [ -d "$LSWS_HOME/admin/html.$VERSION" ]; then
+ rm -rf "$LSWS_HOME/admin/html.$VERSION"
+ fi
+
+
+ util_mkdir "$SDIR_OWN" $DIR_MOD admin bin docs fcgi-bin lib logs admin/logs add-ons share admin/fcgi-bin
+ util_mkdir "$SDIR_OWN" $DIR_MOD admin/html.$VERSION admin/misc
+ util_mkdir "$CONF_OWN" $SDIR_MOD conf conf/cert conf/templates admin/conf admin/conf/cert admin/tmp phpbuild autoupdate
+ util_mkdir "$SDIR_OWN" $SDIR_MOD admin/cgid admin/cgid/secret
+ util_mkdir "$CONF_OWN" $DIR_MOD admin/htpasswds
+ chgrp $WS_GROUP $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid $LSWS_HOME/admin/htpasswds
+ chmod g+x $LSWS_HOME/admin/tmp $LSWS_HOME/admin/cgid $LSWS_HOME/admin/htpasswds
+ chown $CONF_OWN $LSWS_HOME/admin/tmp/sess_* 1>/dev/null 2>&1
+ util_mkdir "$SDIR_OWN" $DIR_MOD DEFAULT
+
+ buildAdminSslCert
+
+ find "$LSWS_HOME/admin/tmp" -type s -atime +1 -delete 2>/dev/null
+ if [ $? -ne 0 ]; then
+ find "$LSWS_HOME/admin/tmp" -type s -atime +1 2>/dev/null | xargs rm -f
+ fi
+
+ find "/tmp/lshttpd" -type s -atime +1 -delete 2>/dev/null
+ if [ $? -ne 0 ]; then
+ find "/tmp/lshttpd" -type s -atime +1 2>/dev/null | xargs rm -f
+ fi
+
+ if [ "x$HOST_PANEL" = "xcpanel" ]; then
+ if [ ! -d "$BUILD_ROOT/usr/local/lib/php/autoindex/" ]; then
+ mkdir -p $BUILD_ROOT/usr/local/lib/php/autoindex
+ fi
+ if [ -f "$BUILD_ROOT/usr/local/lib/php/autoindex/default.php" ]; then
+ mv -f "$BUILD_ROOT/usr/local/lib/php/autoindex/default.php" "$BUILD_ROOT/usr/local/lib/php/autoindex/default.php.old"
+ fi
+ cp -R "$LSINSTALL_DIR/share/autoindex/"* $BUILD_ROOT/usr/local/lib/php/autoindex/
+ if [ -d "$LSWS_HOME/share/autoindex" ]; then
+ rm -rf "$LSWS_HOME/share/autoindex"
+ fi
+ ln -sf /usr/local/lib/php/autoindex "$LSWS_HOME/share/autoindex"
+ if [ -d "$WHM_CGIDIR" ]; then
+ install_whm_plugin
+ fi
+ else
+ util_mkdir "$SDIR_OWN" $DIR_MOD share/autoindex
+ if [ -f "$LSWS_HOME/share/autoindex/default.php" ]; then
+ mv -f "$LSWS_HOME/share/autoindex/default.php" "$LSWS_HOME/share/autoindex/default.php.old"
+ fi
+ util_cpdir "$SDIR_OWN" $DOC_MOD share/autoindex
+ util_cpfile "$SDIR_OWN" $DOC_MOD share/autoindex/default.php
+ fi
+ util_cpdir "$SDIR_OWN" $DOC_MOD add-ons
+ util_cpfile "$SDIR_OWN" $EXEC_MOD add-ons/modsec/inspectmulti.sh
+
+ util_ccpfile "$SDIR_OWN" $EXEC_MOD fcgi-bin/lsperld.fpl
+ util_cpfile "$SDIR_OWN" $EXEC_MOD fcgi-bin/RackRunner.rb fcgi-bin/RailsRunner.rb fcgi-bin/RailsRunner.rb.2.3
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/fcgi-bin/admin_php5
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/rc-inst.sh admin/misc/admpass.sh admin/misc/rc-uninst.sh admin/misc/uninstall.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/lsws.rc admin/misc/lshttpd.service admin/misc/lsws.rc.gentoo admin/misc/enable_ruby_python_selector.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/mgr_ver.sh admin/misc/gzipStatic.sh admin/misc/fp_install.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/create_admin_keypair.sh admin/misc/awstats_install.sh admin/misc/update.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/cleancache.sh admin/misc/cleanlitemage.sh admin/misc/lsup5.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/fix_cagefs.sh admin/misc/cp_switch_ws.sh
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/lscmctl
+ ln -sf ./lsup5.sh "$LSWS_HOME/admin/misc/lsup.sh"
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/ap_lsws.sh.in admin/misc/build_ap_wrapper.sh admin/misc/cpanel_restart_httpd.in
+ util_cpfile "$SDIR_OWN" $DOC_MOD admin/misc/gdb-bt admin/misc/htpasswd.php admin/misc/php.ini admin/misc/genjCryptionKeyPair.php admin/misc/purge_cache_byurl.php
+
+ if [ -f "$LSINSTALL_DIR/admin/misc/chroot.sh" ]; then
+ util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/chroot.sh
+ fi
+
+ if [ $SET_LOGIN -eq 1 ]; then
+ util_cpfile "$CONF_OWN" $CONF_MOD admin/conf/htpasswd
+ else
+ util_ccpfile "$CONF_OWN" $CONF_MOD admin/conf/htpasswd
+ fi
+
+ if [ ! -f "$LSWS_HOME/admin/htpasswds/status" ]; then
+ cp -p "$LSWS_HOME/admin/conf/htpasswd" "$LSWS_HOME/admin/htpasswds/status"
+ fi
+ chown $CONF_OWN "$LSWS_HOME/admin/htpasswds/status"
+ chgrp $WS_GROUP "$LSWS_HOME/admin/htpasswds/status"
+ chmod 0640 "$LSWS_HOME/admin/htpasswds/status"
+
+ if [ $INSTALL_TYPE = "upgrade" ]; then
+ util_ccpfile "$CONF_OWN" $CONF_MOD admin/conf/admin_config.xml
+ util_cpfile "$CONF_OWN" $CONF_MOD admin/conf/php.ini
+ util_ccpfile "$CONF_OWN" $CONF_MOD conf/httpd_config.xml conf/mime.properties conf/templates/ccl.xml conf/templates/phpsuexec.xml conf/templates/rails.xml
+ util_ccpfile "$CONF_OWN" $CONF_MOD conf/templates/ccl.xml
+ $TEST_BIN ! -L "$LSWS_HOME/bin/lshttpd"
+ if [ $? -eq 0 ]; then
+ mv -f "$LSWS_HOME/bin/lshttpd" "$LSWS_HOME/bin/lshttpd.old"
+ fi
+ $TEST_BIN ! -L "$LSWS_HOME/bin/lscgid"
+ if [ $? -eq 0 ]; then
+ mv -f "$LSWS_HOME/bin/lscgid" "$LSWS_HOME/bin/lscgid.old"
+ fi
+ $TEST_BIN ! -L "$LSWS_HOME/bin/lswsctrl"
+ if [ $? -eq 0 ]; then
+ mv -f "$LSWS_HOME/bin/lswsctrl" "$LSWS_HOME/bin/lswsctrl.old"
+ fi
+ $TEST_BIN ! -L "$LSWS_HOME/admin/html"
+ if [ $? -eq 0 ]; then
+ mv -f "$LSWS_HOME/admin/html" "$LSWS_HOME/admin/html.old"
+ fi
+
+ if [ ! -f "$LSWS_HOME/DEFAULT/conf/vhconf.xml" ]; then
+ util_mkdir "$CONF_OWN" $DIR_MOD DEFAULT/conf
+ util_cpdir "$CONF_OWN" $DOC_MOD DEFAULT/conf
+ fi
+ else
+ util_cpfile "$CONF_OWN" $CONF_MOD admin/conf/admin_config.xml
+ util_cpfile "$CONF_OWN" $CONF_MOD conf/templates/ccl.xml conf/templates/phpsuexec.xml conf/templates/rails.xml
+ util_cpfile "$CONF_OWN" $CONF_MOD admin/conf/php.ini
+ util_cpfile "$CONF_OWN" $CONF_MOD conf/httpd_config.xml conf/mime.properties
+ util_mkdir "$CONF_OWN" $DIR_MOD DEFAULT/conf
+ util_cpdir "$CONF_OWN" $DOC_MOD DEFAULT/conf
+ util_mkdir "$SDIR_OWN" $DIR_MOD DEFAULT/html DEFAULT/cgi-bin
+ util_cpdir "$SDIR_OWN" $DOC_MOD DEFAULT/html DEFAULT/cgi-bin
+ fi
+ if [ $SETUP_PHP -eq 1 ]; then
+ if [ ! -s "$LSWS_HOME/fcgi-bin/lsphp" ]; then
+ cp -f "$LSWS_HOME/admin/fcgi-bin/admin_php5" "$LSWS_HOME/fcgi-bin/lsphp"
+ chown "$SDIR_OWN" "$LSWS_HOME/fcgi-bin/lsphp"
+ chmod "$EXEC_MOD" "$LSWS_HOME/fcgi-bin/lsphp"
+ fi
+ if [ ! -f "$LSWS_HOME/fcgi-bin/lsphp4" ]; then
+ ln -sf "./lsphp" "$LSWS_HOME/fcgi-bin/lsphp4"
+ fi
+ if [ ! -f "$LSWS_HOME/fcgi-bin/lsphp5" ]; then
+ ln -sf "./lsphp" "$LSWS_HOME/fcgi-bin/lsphp5"
+ fi
+ if [ ! -e "/usr/local/bin/lsphp" ]; then
+ cp -f "$LSWS_HOME/admin/fcgi-bin/admin_php5" "/usr/local/bin/lsphp"
+ chown "$SDIR_OWN" "/usr/local/bin/lsphp"
+ chmod "$EXEC_MOD" "/usr/local/bin/lsphp"
+ fi
+ fi
+
+ chown -R "$CONF_OWN" "$LSWS_HOME/conf/"
+ chmod -R o-rwx "$LSWS_HOME/conf/"
+
+ util_mkdir "$DIR_OWN" $SDIR_MOD tmp
+
+
+ util_mkdir "$DIR_OWN" $DIR_MOD DEFAULT/logs DEFAULT/fcgi-bin
+ util_cpdirv "$SDIR_OWN" $DOC_MOD $VERSION admin/html
+
+
+ util_cpfile "$SDIR_OWN" $EXEC_MOD bin/wswatch.sh
+ util_cpfilev "$SDIR_OWN" $EXEC_MOD $VERSION bin/lswsctrl bin/lshttpd bin/lscgid
+
+ $TEST_BIN ! -L "$LSWS_HOME/modules"
+ if [ $? -eq 0 ]; then
+ mv -f "$LSWS_HOME/modules" "$LSWS_HOME/modules.old"
+ fi
+
+ if [ -d "$LSWS_HOME/modules.$VERSION" ]; then
+ rm -rf "$LSWS_HOME/modules.$VERSION"
+ fi
+
+ util_mkdir "$SDIR_OWN" $DIR_MOD modules.$VERSION
+ util_cpdirv "$SDIR_OWN" $EXEC_MOD $VERSION modules
+
+ #if [ -e "$LSINSTALL_DIR/bin/lshttpd.dbg" ]; then
+ # if [ -f "$LSINSTALL_DIR/bin/lshttpd.dbg.$VERSION" ]; then
+ # rm "$LSINSTALL_DIR/bin/lshttpd.dbg.$VERSION"
+ # fi
+ # util_cpfilev "$SDIR_OWN" $EXEC_MOD $VERSION bin/lshttpd.dbg
+ #
+ # #enable debug build for beta release
+ # ln -sf ./lshttpd.dbg.$VERSION $LSWS_HOME/bin/lshttpd
+ #fi
+
+ ln -sf ./lshttpd.$VERSION $LSWS_HOME/bin/lshttpd
+ ln -sf lshttpd $LSWS_HOME/bin/litespeed
+
+ ln -sf lscgid.$VERSION $LSWS_HOME/bin/httpd
+ if [ $INST_USER = "root" ]; then
+ chmod u+s "$LSWS_HOME/bin/lscgid.$VERSION"
+
+ fi
+
+ util_cpdir "$SDIR_OWN" $DOC_MOD docs/
+ util_cpfile "$SDIR_OWN" $DOC_MOD VERSION BUILD LICENSE*
+
+ if [ -f $LSWS_HOME/autoupdate/download ]; then
+ rm $LSWS_HOME/autoupdate/download
+ fi
+
+ #compress_admin_file
+
+ if [ ! -f "$LSWS_HOME/admin/conf/jcryption_keypair" ]; then
+ $LSWS_HOME/admin/misc/create_admin_keypair.sh
+ fi
+ chown "$CONF_OWN" "$LSWS_HOME/admin/conf/jcryption_keypair"
+ chmod 0600 "$LSWS_HOME/admin/conf/jcryption_keypair"
+
+ fix_cloudlinux
+
+ if [ $INST_USER = "root" ]; then
+ $LSWS_HOME/admin/misc/rc-inst.sh
+ fi
+
+}
+
+
+setupPHPAccelerator()
+{
+ cat </
+or http://:/
+
+EOF
+
+ if [ $INST_USER = "root" ]; then
+ if [ $INSTALL_TYPE != "upgrade" ]; then
+ printf "%s\n%s" "Would you like to have LiteSpeed Web Server started automatically" "when the server restarts [Y/n]? "
+ START_SERVER='y'
+ echo
+
+ if [ "x$START_SERVER" = "x" ]; then
+ START_SERVER=y
+ fi
+ if [ `expr "$START_SERVER" : '[Yy]'` -gt 0 ]; then
+ $LSWS_HOME/admin/misc/rc-inst.sh
+ else
+ cat <
+ AllowOverride none
+
+
+
+ AllowOverride All
+ Options +Includes -Indexes +ExecCGI
+
+
+DirectoryIndex index.php index.html
+
+
+ Require all denied
+
+
+ErrorLog "/usr/local/lsws/logs/error.log"
+LogLevel warn
+
+LogFormat '"%v %h %l %u %t \"%r\" %>s %b"' combined
+CustomLog "/usr/local/lsws/logs/access.log" combined
+
+
+AddType application/x-compress .Z
+AddType application/x-gzip .gz .tgz
+AddType text/html .shtml
+AddOutputFilter INCLUDES .shtml
+#AddHandler cgi-script .cgi
+
+AddDefaultCharset UTF-8
+
+
+ MIMEMagicFile conf/magic
+
+
+EnableSendfile on
+
+SSLProtocol all -SSLv3 -TLSv1
+SSLHonorCipherOrder on
+
+SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:HIGH:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
+
+
+CacheRoot /home/lscache/
+
+
+
+Include /usr/local/lsws/conf/modsec.conf
diff --git a/serverStatus/litespeed/httpd_config.xml b/serverStatus/litespeed/httpd_config.xml
new file mode 100644
index 000000000..de85c980b
--- /dev/null
+++ b/serverStatus/litespeed/httpd_config.xml
@@ -0,0 +1,388 @@
+
+
+ $HOSTNAME
+ nobody
+ nobody
+ 0
+ /
+ 0
+ 120M
+ /tmp/lshttpd/swap
+ 1
+ 1
+ 0
+ /usr/local/lsws/conf/httpd.conf
+ 0
+ 0
+ 1
+ 5
+ $SERVER_ROOT/conf/mime.properties
+ 0
+ 86400
+ 1
+ usman@cyberpersons.com
+ $SERVER_ROOT/admin/
+
+
+ $SERVER_ROOT/logs/error.log
+ DEBUG
+ 0
+ 10M
+ 1
+ 1
+
+
+ $SERVER_ROOT/logs/access.log
+ 10M
+ 30
+ 0
+
+
+ index.html, index.php
+
+ 0
+ .htaccess
+
+
+ 1
+ image/*=A604800, text/css=A604800, application/x-javascript=A604800, application/javascript=A604800
+
+
+ best
+ 2000
+ 200
+ 300
+ 1000
+ 0
+ 5
+ 0
+ 0
+ 8192
+ 16380
+ 500M
+ 8K
+ 500M
+ 4096
+ 20M
+ 256K
+ 40M
+ 1
+ 1
+ 4
+ 1
+ 1
+ 1
+ text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
+ 1
+ 6
+ 1M
+ 300
+ null
+
+
+ 1
+
+
+
+ 1
+ 0
+ 000
+ 000
+
+
+ 0
+ 0
+ 0
+ 0
+ 10000
+ 10000
+ 15
+ 300
+
+
+ 200
+ 11
+ 10
+ 0
+ 300
+ 600
+ 1450M
+ 1500M
+ 1400
+ 1450
+
+
+ 0
+ 0
+ deny,log,status:403
+ 1
+ /tmp
+ $SERVER_ROOT/logs/security_audit.log
+
+
+ XSS attack
+ log,deny,status:403,msg:'XSS attack'
+ 1
+ SecFilterSelective ARGS "(alert|expression|eval|url)[[:space:]]*\("
+SecFilterSelective ARGS "(&\{.+\}|(&#[[0-9a-fA-F]]|\x5cx[0-9a-fA-F]){2})"
+
+SecFilterSelective ARGS "((javascript|vbscript):|style[[:space:]]*=)"
+SecFilterSelective ARGS "(fromCharCode|http-equiv|<.+>|innerHTML|dynsrc|-->)"
+SecFilterSelective ARGS "document\.(body|cookie|location|write)"
+
+SecFilterSelective ARGS_VALUES "jsessionid|phpsessid|onReadyStateChange|xmlHttp"
+
+SecFilterSelective ARGS "<(applet|div|embed|iframe|img|meta|object|script|textarea)"
+
+# JavaScript event handlers
+SecFilterSelective ARGS "on(Abort|Blur|Click|DblClick|DragDrop|Error|Focus|KeyUp|KeyDown|KeyPrerss|Load|Mouse(Down|Out|Over|Up)|Move|Reset|Resize|Select|Submit|Unload)"
+
+
+ SQL injection
+ log,pass,msg:'SQL Injection attack'
+ 1
+ #SQL generic
+SecFilterSelective ARGS "drop[[:space:]]+(database|table|column|procedure)"
+SecFilterSelective ARGS "delete[[:space:]]+from|create[[:space:]]+table|update.+set.+=|insert[[:space:]]+into.+values"
+SecFilterSelective ARGS "select.+from|bulk[[:space:]]+insert|union.+select|alter[[:space:]]+table"
+SecFilterSelective ARGS "or.+1[[:space:]]*=[[:space:]]1|or 1=1--'|'.+--"
+
+SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+\*/"
+
+
+ /
+ /etc/*
+ /dev/*
+ $SERVER_ROOT/conf/*
+ $SERVER_ROOT/admin/conf/*
+
+
+ ALL
+
+
+
+
+ lsapi
+ lsphp5
+ uds://tmp/lshttpd/lsphp5.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/fcgi-bin/lsphp5
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp53
+ uds://tmp/lshttpd/lsphp53.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp53/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp54
+ uds://tmp/lshttpd/lsphp54.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp54/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp55
+ uds://tmp/lshttpd/lsphp55.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp55/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp56
+ uds://tmp/lshttpd/lsphp56.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp56/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp70
+ uds://tmp/lshttpd/lsphp70.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp70/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp71
+ uds://tmp/lshttpd/lsphp71.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp71/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+ lsapi
+ lsphp72
+ uds://tmp/lshttpd/lsphp72.sock
+ 35
+ PHP_LSAPI_CHILDREN=35
+ 60
+ 0
+ 1
+ 0
+ 3
+ $SERVER_ROOT/lsphp72/bin/lsphp
+ 100
+ 1
+ 0
+ 2047M
+ 2047M
+ 400
+ 500
+
+
+
+
+ php
+ lsapi
+ lsphp5
+
+
+ php5
+ lsapi
+ lsphp5
+
+
+ php53
+ lsapi
+ lsphp53
+
+
+ php54
+ lsapi
+ lsphp54
+
+
+ php55
+ lsapi
+ lsphp55
+
+
+ php56
+ lsapi
+ lsphp56
+
+
+ php70
+ lsapi
+ lsphp70
+
+
+ php71
+ lsapi
+ lsphp71
+
+
+ php72
+ lsapi
+ lsphp72
+
+
+
+ 1
+ 5
+ LSAPI_MAX_IDLE=60
+ 180
+ 0
+ 60
+ 0
+ 50
+ 1
+ 3
+ 2047M
+ 2047M
+ 400
+ 500
+
+
diff --git a/serverStatus/litespeed/install.sh b/serverStatus/litespeed/install.sh
new file mode 100644
index 000000000..5e8d8689c
--- /dev/null
+++ b/serverStatus/litespeed/install.sh
@@ -0,0 +1,506 @@
+#!/bin/sh
+
+cd `dirname "$0"`
+source ./functions.sh 2>/dev/null
+if [ $? != 0 ]; then
+ . ./functions.sh
+ if [ $? != 0 ]; then
+ echo [ERROR] Can not include 'functions.sh'.
+ exit 1
+ fi
+fi
+
+
+test_license()
+{
+ COPY_LICENSE_KEY=1
+ if [ -f "$LSWS_HOME/conf/serial.no" ]; then
+ if [ ! -f "$LSINSTALL_DIR/serial.no" ]; then
+ cp "$LSWS_HOME/conf/serial.no" "$LSINSTALL_DIR/serial.no"
+ else
+ diff "$LSWS_HOME/conf/serial.no" "$LSINSTALL_DIR/serial.no" 1>/dev/null
+ if [ $? -ne 0 ]; then
+ COPY_LICENSE_KEY=0
+ fi
+ fi
+ fi
+# if [ $COPY_LICENSE_KEY -eq 1 ]; then
+# if [ -f "$LSWS_HOME/conf/license.key" ] && [ ! -f "$LSINSTALL_DIR/license.key" ]; then
+# cp "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
+# fi
+# if [ -f "$LSWS_HOME/conf/license.key" ] && [ -f "$LSINSTALL_DIR/license.key" ]; then
+# diff "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
+# if [ $? -ne 0 ]; then
+# cp "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
+# fi
+# fi
+# fi
+ if [ -f "$LSINSTALL_DIR/license.key" ] && [ -f "$LSINSTALL_DIR/serial.no" ]; then
+ echo "License key and serial number are available, testing..."
+ echo
+ bin/lshttpd -V
+ if [ $? -eq 0 ]; then
+ LICENSE_OK=1
+ if [ -f "$LSINSTALL_DIR/conf/license.key" ]; then
+ mv "$LSINSTALL_DIR/conf/license.key" "$LSINSTALL_DIR/license.key"
+ bin/lshttpd -t
+ fi
+ fi
+ echo
+ fi
+
+ if [ "x$LICENSE_OK" = "x" ]; then
+ if [ -f "$LSINSTALL_DIR/serial.no" ]; then
+# echo "Serial number is available."
+# printf "Would you like to register a license key for this server? [Y/n]"
+# read TMP_YN
+# echo ""
+# if [ "x$TMP_YN" = "x" ] || [ `expr "$TMP_YN" : '[Yy]'` -gt 0 ]; then
+ echo "Contacting licensing server ..."
+
+ echo ""
+ $LSINSTALL_DIR/bin/lshttpd -r
+
+ if [ $? -eq 0 ]; then
+ echo "[OK] License key received."
+ $LSINSTALL_DIR/bin/lshttpd -t
+ if [ $? -eq 0 ]; then
+ LICENSE_OK=1
+ else
+ echo "The license key received does not work."
+ fi
+ fi
+# fi
+ fi
+ fi
+
+ if [ "x$LICENSE_OK" = "x" ]; then
+
+ if [ -f "$LSINSTALL_DIR/trial.key" ]; then
+ $LSINSTALL_DIR/bin/lshttpd -t
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ else
+ cat <" "$LSWS_HOME/conf/httpd_config.xml"`
+ OLD_CHROOT_PATH_CONF=`grep "" "$LSWS_HOME/conf/httpd_config.xml"`
+ OLD_ENABLE_CHROOT=`expr "$OLD_ENABLE_CHROOT_CONF" : '.*\(.*\).*'`
+ OLD_CHROOT_PATH=`expr "$OLD_CHROOT_PATH_CONF" : '[^<]*\([^<]*\).*'`
+ if [ "x$OLD_ENABLE_CHROOT" != "x" ]; then
+ ENABLE_CHROOT=$OLD_ENABLE_CHROOT
+ fi
+ if [ "x$OLD_CHROOT_PATH" != "x" ]; then
+ CHROOT_PATH=$OLD_CHROOT_PATH
+ fi
+ fi
+ CHANGE_CHROOT=0
+ if [ $INST_USER = "root" ]; then
+ CHANGE_CHROOT=1
+
+ if [ $INSTALL_TYPE = "upgrade" ]; then
+ CHANGE_CHROOT=0
+ if [ $ENABLE_CHROOT -eq 1 ]; then
+ cat < $CHROOT_PATH/etc/passwd
+ grep "$WS_GROUP" /etc/group > $CHROOT_PATH/etc/group
+ fi
+ fi
+ cp $LSWS_HOME/conf/httpd_config.xml $LSWS_HOME/conf/httpd_config.xml.bak
+ chown "$DIR_OWN" $LSWS_HOME/conf/httpd_config.xml.bak
+ RES=`grep '' $LSWS_HOME/conf/httpd_config.xml.bak`
+ if [ $? -eq 1 ]; then
+ sed -e "s##$CHROOT_PATH$ENABLE_CHROOT#" "$LSWS_HOME/conf/httpd_config.xml.bak" > "$LSWS_HOME/conf/httpd_config.xml"
+ else
+ sed -e "s#.*<\/chrootPath>#$CHROOT_PATH<\/chrootPath>#" -e "s/.*<\/enableChroot>/$ENABLE_CHROOT<\/enableChroot>/" "$LSWS_HOME/conf/httpd_config.xml.bak" > "$LSWS_HOME/conf/httpd_config.xml"
+ fi
+ fi
+}
+
+installLicense()
+{
+ if [ -f ./serial.no ]; then
+ cp -f ./serial.no $LSWS_HOME/conf
+ chown "$SDIR_OWN" $LSWS_HOME/conf/serial.no
+ chmod "$DOC_MOD" $LSWS_HOME/conf/serial.no
+ fi
+
+ if [ -f ./license.key ]; then
+ cp -f ./license.key $LSWS_HOME/conf
+ chown "$SDIR_OWN" $LSWS_HOME/conf/license.key
+ chmod "$CONF_MOD" $LSWS_HOME/conf/license.key
+ fi
+
+ if [ -f ./trial.key ]; then
+ cp -f ./trial.key $LSWS_HOME/conf
+ chown "$SDIR_OWN" $LSWS_HOME/conf/trial.key
+ chmod "$DOC_MOD" $LSWS_HOME/conf/trial.key
+ fi
+}
+
+portOffset()
+{
+SUCC=0
+SEL=0
+while [ $SUCC -eq "0" ]; do
+
+ cat </dev/null`
+ TST_USER=`expr "$USER_INFO" : 'uid=.*(\(.*\)) gid=.*'`
+ if [ "x$TST_USER" = "xapache" ]; then
+ WS_USER=apache
+ WS_GROUP=apache
+ else
+ WS_USER=www-data
+ WS_GROUP=www-data
+ # default PID FILE, source the real one, debian and ubuntu different
+ APACHE_PID_FILE=/var/run/apache2/apache2.pid
+ source /etc/apache2/envvars 2>/dev/null
+ if [ $? != 0 ]; then
+ . /etc/apache2/envvars
+ fi
+ PANEL_VARY=".debian"
+ fi
+ ADMIN_PORT=7088
+ elif [ $SEL -eq "4" ]; then
+ HOST_PANEL="hsphere"
+ WS_USER=httpd
+ WS_GROUP=httpd
+ elif [ $SEL -eq "5" ]; then
+ HOST_PANEL="interworx"
+ WS_USER=apache
+ WS_GROUP=apache
+ elif [ $SEL -eq "6" ]; then
+ HOST_PANEL="lxadminh"
+ WS_USER=apache
+ WS_GROUP=apache
+ elif [ $SEL -eq "7" ]; then
+ HOST_PANEL="ispmanager"
+ WS_USER=apache
+ WS_GROUP=apache
+ fi
+ fi
+ DIR_OWN=$WS_USER:$WS_GROUP
+ CONF_OWN=$WS_USER:$WS_GROUP
+ else
+ SUCC=1
+ fi
+done
+
+}
+
+
+LSINSTALL_DIR=`dirname "$0"`
+cd $LSINSTALL_DIR
+
+init
+license
+install_dir
+test_license
+admin_login
+
+
+if [ $INSTALL_TYPE = "reinstall" ]; then
+
+ configAdminEmail
+ if [ $INST_USER = "root" ]; then
+ hostPanels
+ fi
+ if [ "x$HOST_PANEL" = "x" ]; then
+ getUserGroup
+ stopLshttpd
+ getServerPort
+ getAdminPort
+ configRuby
+ enablePHPHandler
+ else
+ hostPanelConfig
+ fi
+fi
+
+if [ "x$HOST_PANEL" = "x" ]; then
+ configChroot
+fi
+
+cat <
+SecRuleEngine off
+SecAuditEngine on
+SecDebugLogLevel 0
+SecAuditLogRelevantStatus ^(?:5|4(?!04))
+SecAuditLogParts ABIJDEFHZ
+SecAuditLogType Serial
+SecAuditLog /usr/local/lsws/logs/auditmodsec.log
+SecDataDir /usr/local/lsws/modsec
+Include /usr/local/lsws/conf/comodo_litespeed/*.conf
+Include /usr/local/lsws/conf/rules.conf
+
+
diff --git a/serverStatus/serverStatusUtil.py b/serverStatus/serverStatusUtil.py
new file mode 100644
index 000000000..9b8328a7e
--- /dev/null
+++ b/serverStatus/serverStatusUtil.py
@@ -0,0 +1,213 @@
+#!/usr/local/CyberCP/bin/python2
+import os,sys
+sys.path.append('/usr/local/CyberCP')
+import django
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
+django.setup()
+import subprocess
+import shlex
+import argparse
+import shutil
+import plogical.CyberCPLogFileWriter as logging
+from plogical.processUtilities import ProcessUtilities
+
+
+class ServerStatusUtil:
+ lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
+ serverRootPath = '/usr/local/lsws/'
+
+ @staticmethod
+ def executioner(command, statusFile):
+ try:
+ res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
+ if res == 1:
+ raise 0
+ else:
+ return 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg))
+ return 0
+
+ @staticmethod
+ def installLiteSpeed(licenseKey, statusFile):
+ try:
+
+ cwd = os.getcwd()
+ try:
+
+ command = 'groupadd nobody'
+ ServerStatusUtil.executioner(command, statusFile)
+
+ except:
+ pass
+
+ try:
+ command = 'usermod -a -G nobody nobody'
+ ServerStatusUtil.executioner(command, statusFile)
+ except:
+ pass
+ try:
+ command = 'systemctl stop lsws'
+ ServerStatusUtil.executioner(command, statusFile)
+ except:
+ pass
+
+ command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3-ent-x86_64-linux.tar.gz'
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ command = 'tar zxf lsws-5.3-ent-x86_64-linux.tar.gz'
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ writeSerial = open('lsws-5.3/serial.no', 'w')
+ writeSerial.writelines(licenseKey)
+ writeSerial.close()
+
+ shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', 'lsws-5.3/')
+ shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', 'lsws-5.3/')
+
+ os.chdir('lsws-5.3')
+
+ command = 'chmod +x install.sh'
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ command = 'chmod +x functions.sh'
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ command = './install.sh'
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ os.chdir(cwd)
+ confPath = '/usr/local/lsws/conf/'
+ shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/httpd_config.xml', confPath)
+ shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/modsec.conf', confPath)
+ shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/httpd.conf', confPath)
+
+ try:
+ command = 'chown -R lsadm:lsadm ' + confPath
+ subprocess.call(shlex.split(command))
+ except:
+ pass
+
+ return 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg))
+ return 0
+
+ @staticmethod
+ def setupFileManager(statusFile):
+ try:
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Setting up Filemanager files..\n")
+
+ fileManagerPath = ServerStatusUtil.serverRootPath+"FileManager"
+ if os.path.exists(fileManagerPath):
+ shutil.rmtree(fileManagerPath)
+ shutil.copytree("/usr/local/CyberCP/serverStatus/litespeed/FileManager",fileManagerPath)
+
+ ## remove unnecessary files
+
+ command = 'chmod -R 777 ' + fileManagerPath
+ if ServerStatusUtil.executioner(command, statusFile) == 0:
+ return 0
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Filemanager files are set!\n")
+
+ return 1
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg))
+ return 0
+
+ @staticmethod
+ def recover():
+ FNULL = open(os.devnull, 'w')
+
+ if os.path.exists('/usr/local/lsws'):
+ shutil.rmtree('/usr/local/lsws')
+
+ command = 'tar -zxvf /usr/local/olsBackup.tar.gz -C /usr/local/'
+ ServerStatusUtil.executioner(command, FNULL)
+
+ command = 'mv /usr/local/usr/local/lsws /usr/local'
+ ServerStatusUtil.executioner(command, FNULL)
+
+ if os.path.exists('/usr/local/usr'):
+ shutil.rmtree('/usr/local/usr')
+
+ @staticmethod
+ def switchTOLSWS(licenseKey):
+ try:
+ statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
+ FNULL = open(os.devnull, 'w')
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Starting conversion process..\n")
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
+ "Removing OpenLiteSpeed..\n")
+
+ ## Try to stop current LiteSpeed Process
+
+ ProcessUtilities.killLiteSpeed()
+
+ if os.path.exists('/usr/local/lsws'):
+ command = 'tar -zcvf /usr/local/olsBackup.tar.gz /usr/local/lsws'
+ if ServerStatusUtil.executioner(command, FNULL) == 0:
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Failed to create backup of current LSWS. [404]")
+ ServerStatusUtil.recover()
+ return 0
+
+ dirs = os.listdir('/usr/local/lsws')
+ for dir in dirs:
+ if dir.find('lsphp') > -1:
+ continue
+ finalDir = '/usr/local/lsws/' + dir
+ try:
+ shutil.rmtree(finalDir)
+ except:
+ pass
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
+ "OpenLiteSpeed removed.\n")
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
+ "Installing LiteSpeed Enterprise Web Server ..\n")
+
+
+ if ServerStatusUtil.installLiteSpeed(licenseKey, statusFile) == 0:
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Failed to install LiteSpeed. [404]")
+ ServerStatusUtil.recover()
+ return 0
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
+ "LiteSpeed Enterprise Web Server installed.\n")
+
+
+ if ServerStatusUtil.setupFileManager(statusFile) == 0:
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Failed to set up File Manager. [404]")
+ ServerStatusUtil.recover()
+ return 0
+
+ logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Successfully switched to LITESPEED ENTERPRISE WEB SERVER. [200]\n")
+
+ except BaseException, msg:
+ logging.CyberCPLogFileWriter.writeToFile(str(msg))
+ ServerStatusUtil.recover()
+
+
+
+def main():
+
+ parser = argparse.ArgumentParser(description='Server Status Util.')
+ parser.add_argument('function', help='Specific a function to call!')
+ parser.add_argument('--licenseKey', help='LITESPEED ENTERPRISE WEB SERVER License Key')
+
+ args = parser.parse_args()
+
+ if args.function == "switchTOLSWS":
+ ServerStatusUtil.switchTOLSWS(args.licenseKey)
+
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/serverStatus/static/images/agreement.png b/serverStatus/static/images/agreement.png
new file mode 100644
index 000000000..a2fabeef4
Binary files /dev/null and b/serverStatus/static/images/agreement.png differ
diff --git a/serverStatus/static/images/change.png b/serverStatus/static/images/change.png
new file mode 100644
index 000000000..657733415
Binary files /dev/null and b/serverStatus/static/images/change.png differ
diff --git a/serverStatus/static/images/litespeed-logo.png b/serverStatus/static/images/litespeed-logo.png
new file mode 100644
index 000000000..5ac9124e5
Binary files /dev/null and b/serverStatus/static/images/litespeed-logo.png differ
diff --git a/serverStatus/static/serverStatus/serverStatus.js b/serverStatus/static/serverStatus/serverStatus.js
index e52d380fe..d0286b787 100644
--- a/serverStatus/static/serverStatus/serverStatus.js
+++ b/serverStatus/static/serverStatus/serverStatus.js
@@ -5,7 +5,7 @@
/* Java script code to start/stop litespeed */
-app.controller('litespeedStatus', function($scope,$http) {
+app.controller('litespeedStatus', function ($scope, $http) {
$scope.restartorStopLoading = true;
$scope.actionResult = true;
@@ -13,424 +13,627 @@ app.controller('litespeedStatus', function($scope,$http) {
$scope.serverStatusCouldNotConnect = true;
- $scope.restartLitespeed = function(){
+ $scope.restartLitespeed = function () {
- $scope.disableReboot = true;
- $scope.disableStop = true;
- $scope.restartorStopLoading = false;
+ $scope.disableReboot = true;
+ $scope.disableStop = true;
+ $scope.restartorStopLoading = false;
+ var url = "/serverstatus/startorstopLitespeed";
+
+ var data = {
+ reboot: 1,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- var url = "/serverstatus/startorstopLitespeed";
+ function ListInitialDatas(response) {
- var data = {
- reboot:1,
- };
+ $scope.restartorStopLoading = true;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ if (response.data.reboot == 1) {
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
-
-
- function ListInitialDatas(response) {
-
- $scope.restartorStopLoading = true;
- $scope.disableReboot = false;
- $scope.disableStop = false;
-
- if(response.data.reboot == 1){
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = false;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = true;
-
- }
- else{
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = false;
- $scope.serverStatusCouldNotConnect = true;
- }
-
-
- }
- function cantLoadInitialDatas(response) {
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = false;
- $scope.disableReboot = false;
- $scope.disableStop = false;
- }
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = false;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = true;
+
+ }
+ else {
+
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = false;
+ $scope.serverStatusCouldNotConnect = true;
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = false;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
+ }
};
-
- $scope.stopLitespeed = function(){
+ $scope.stopLitespeed = function () {
- $scope.disableReboot = true;
- $scope.disableStop = true;
- $scope.restartorStopLoading = false;
+ $scope.disableReboot = true;
+ $scope.disableStop = true;
+ $scope.restartorStopLoading = false;
+ var url = "/serverstatus/startorstopLitespeed";
+
+ var data = {
+ reboot: 0,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- var url = "/serverstatus/startorstopLitespeed";
+ function ListInitialDatas(response) {
- var data = {
- reboot:0,
- };
+ $scope.restartorStopLoading = true;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ if (response.data.shutdown == 1) {
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = false;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = true;
+
+ }
+ else {
+
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = false;
+ $scope.serverStatusCouldNotConnect = true;
+ }
- function ListInitialDatas(response) {
+ }
- $scope.restartorStopLoading = true;
- $scope.disableReboot = false;
- $scope.disableStop = false;
-
- if(response.data.shutdown == 1){
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = false;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = true;
-
- }
- else{
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = false;
- $scope.serverStatusCouldNotConnect = true;
- }
+ function cantLoadInitialDatas(response) {
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = false;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
+ }
- }
- function cantLoadInitialDatas(response) {
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = false;
- $scope.disableReboot = false;
- $scope.disableStop = false;
- }
+ };
+
+ /// License Manager
+
+ $scope.cpLoading = true;
+ $scope.fetchedData = true;
+ $scope.changeSerialBox = true;
+
+ $scope.hideLicenseStatus = function () {
+ $scope.fetchedData = true;
+ };
+
+ $scope.licenseStatus = function () {
+
+ $scope.cpLoading = false;
+ $scope.changeSerialBox = true;
+
+ var url = "/serverstatus/licenseStatus";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+ function ListInitialDatas(response) {
+
+ if (response.data.status === 1) {
+ $scope.cpLoading = true;
+ $scope.fetchedData = false;
+ new PNotify({
+ title: 'Success!',
+ text: 'Status successfully fetched',
+ type: 'success'
+ });
+ $scope.lsSerial = response.data.lsSerial;
+ $scope.lsexpiration = response.data.lsexpiration;
+ }
+ else {
+ $scope.cpLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.erroMessage,
+ type: 'error'
+ });
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cpLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page.',
+ type: 'error'
+ });
+
+ }
+
+
+ };
+ $scope.showSerialBox = function () {
+ $scope.fetchedData = true;
+ $scope.changeSerialBox = false;
+ };
+ $scope.changeLicense = function () {
+
+ $scope.cpLoading = false;
+
+ var url = "/serverstatus/changeLicense";
+
+ var data = {newKey: $scope.newKey};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+ if (response.data.status === 1) {
+ $scope.cpLoading = true;
+ new PNotify({
+ title: 'Success!',
+ text: 'License successfully Updated',
+ type: 'success'
+ });
+ }
+ else {
+ $scope.cpLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.erroMessage,
+ type: 'error'
+ });
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cpLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page.',
+ type: 'error'
+ });
+
+ }
+
};
});
-
-
/* Java script code to start/stop litespeed */
-
-
-
/* Java script code to read log file */
+app.controller('readCyberCPLogFile', function ($scope, $http) {
-app.controller('readCyberCPLogFile', function($scope,$http) {
+ $scope.logFileLoading = false;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = true;
- $scope.logFileLoading = false;
- $scope.logsFeteched = true;
+
+ var url = "/serverstatus/getFurtherDataFromLogFile";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if (response.data.logstatus == 1) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = false;
+ $scope.couldNotFetchLogs = true;
+
+ $scope.logsData = response.data.logsdata;
+
+
+ }
+ else {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+
+
+ }
+
+
+ }
+
+ function cantLoadInitialDatas(response) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+
+ }
+
+
+ $scope.fetchLogs = function () {
+
+
+ $scope.logFileLoading = false;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = true;
+
+
+ var url = "/serverstatus/getFurtherDataFromLogFile";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if (response.data.logstatus == 1) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
-
- var url = "/serverstatus/getFurtherDataFromLogFile";
-
- var data = {};
-
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
-
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ $scope.logsData = response.data.logsdata;
- function ListInitialDatas(response) {
+ }
+ else {
-
-
- if(response.data.logstatus == 1){
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = false;
- $scope.couldNotFetchLogs = true;
-
- $scope.logsData = response.data.logsdata;
-
-
-
- }
- else{
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
-
- }
-
-
- }
- function cantLoadInitialDatas(response) {
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
- }
-
-
-
-
- $scope.fetchLogs = function(){
-
-
- $scope.logFileLoading = false;
+ $scope.logFileLoading = true;
$scope.logsFeteched = true;
- $scope.couldNotFetchLogs = true;
+ $scope.couldNotFetchLogs = false;
- var url = "/serverstatus/getFurtherDataFromLogFile";
-
- var data = {};
-
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
-
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ }
- function ListInitialDatas(response) {
-
-
-
- if(response.data.logstatus == 1){
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = false;
- $scope.couldNotFetchLogs = true;
-
- $scope.logsData = response.data.logsdata;
-
-
-
- }
- else{
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
-
- }
-
-
- }
- function cantLoadInitialDatas(response) {
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
- }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+ }
};
});
-
-
/* Java script code to read log file ends here */
-
/* Java script code to read log file ends here */
/* Services */
-app.controller('servicesManager', function($scope,$http) {
+app.controller('servicesManager', function ($scope, $http) {
- $scope.services = false;
- $scope.btnDisable = false;
- $scope.actionLoader = false;
+ $scope.services = false;
+ $scope.btnDisable = false;
+ $scope.actionLoader = false;
- function getServiceStatus(){
- $scope.btnDisable = true;
+ function getServiceStatus() {
+ $scope.btnDisable = true;
- url = "/serverstatus/servicesStatus";
+ url = "/serverstatus/servicesStatus";
- $http.post(url).then(ListInitialDatas, cantLoadInitialDatas);
+ $http.post(url).then(ListInitialDatas, cantLoadInitialDatas);
- function ListInitialDatas(response) {
+ function ListInitialDatas(response) {
- if (response.data.status.litespeed) {
- $scope.olsStatus = "Running";
- $scope.olsStats = true;
- $scope.olsStart = false;
- $scope.olsStop = true;
- $scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB";
- }
- else {
- $scope.olsStatus = "Stopped";
- $scope.olsStats = false;
- $scope.olsStart = true;
- $scope.olsStop = false;
- }
+ if (response.data.status.litespeed) {
+ $scope.olsStatus = "Running";
+ $scope.olsStats = true;
+ $scope.olsStart = false;
+ $scope.olsStop = true;
+ $scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB";
+ }
+ else {
+ $scope.olsStatus = "Stopped";
+ $scope.olsStats = false;
+ $scope.olsStart = true;
+ $scope.olsStop = false;
+ }
- // Update SQL stats
+ // Update SQL stats
- if (response.data.status.mysql) {
- $scope.sqlStatus = "Running";
- $scope.sqlStats = true;
- $scope.sqlStart = false;
- $scope.sqlStop = true;
- $scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB";
- }
- else {
- $scope.sqlStatus = "Stopped";
- $scope.sqlStats = false;
- $scope.sqlStart = true;
- $scope.sqlStop = false;
- }
+ if (response.data.status.mysql) {
+ $scope.sqlStatus = "Running";
+ $scope.sqlStats = true;
+ $scope.sqlStart = false;
+ $scope.sqlStop = true;
+ $scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB";
+ }
+ else {
+ $scope.sqlStatus = "Stopped";
+ $scope.sqlStats = false;
+ $scope.sqlStart = true;
+ $scope.sqlStop = false;
+ }
- // Update DNS stats
+ // Update DNS stats
- if (response.data.status.powerdns) {
- $scope.dnsStatus = "Running";
- $scope.dnsStats = true;
- $scope.dnsStart = false;
- $scope.dnsStop = true;
- $scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB";
- }
- else {
- $scope.dnsStatus = "Stopped";
- $scope.dnsStats = false;
- $scope.dnsStart = true;
- $scope.dnsStop = false;
- }
+ if (response.data.status.powerdns) {
+ $scope.dnsStatus = "Running";
+ $scope.dnsStats = true;
+ $scope.dnsStart = false;
+ $scope.dnsStop = true;
+ $scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB";
+ }
+ else {
+ $scope.dnsStatus = "Stopped";
+ $scope.dnsStats = false;
+ $scope.dnsStart = true;
+ $scope.dnsStop = false;
+ }
- // Update FTP stats
+ // Update FTP stats
- if (response.data.status.pureftp) {
- $scope.ftpStatus = "Running";
- $scope.ftpStats = true;
- $scope.ftpStart = false;
- $scope.ftpStop = true;
- $scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB";
- }
- else {
- $scope.ftpStatus = "Stopped";
- $scope.ftpStats = false;
- $scope.ftpStart = true;
- $scope.ftpStop = false;
- }
+ if (response.data.status.pureftp) {
+ $scope.ftpStatus = "Running";
+ $scope.ftpStats = true;
+ $scope.ftpStart = false;
+ $scope.ftpStop = true;
+ $scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB";
+ }
+ else {
+ $scope.ftpStatus = "Stopped";
+ $scope.ftpStats = false;
+ $scope.ftpStart = true;
+ $scope.ftpStop = false;
+ }
- $scope.services = true;
+ $scope.services = true;
- $scope.btnDisable = false;
+ $scope.btnDisable = false;
- }
- function cantLoadInitialDatas(response) {
- $scope.couldNotConnect = true;
+ }
- }
+ function cantLoadInitialDatas(response) {
+ $scope.couldNotConnect = true;
- };
- getServiceStatus();
+ }
- $scope.serviceAction = function(serviceName, action){
- $scope.ActionProgress = true;
- $scope.btnDisable = true;
- $scope.ActionSuccessfull = false;
- $scope.ActionFailed = false;
- $scope.couldNotConnect = false;
- $scope.actionLoader = true;
+ };
+ getServiceStatus();
- url = "/serverstatus/servicesAction";
+ $scope.serviceAction = function (serviceName, action) {
+ $scope.ActionProgress = true;
+ $scope.btnDisable = true;
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = false;
+ $scope.couldNotConnect = false;
+ $scope.actionLoader = true;
- var data = {
- service:serviceName,
- action:action
- };
+ url = "/serverstatus/servicesAction";
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ var data = {
+ service: serviceName,
+ action: action
+ };
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
- function ListInitialDatas(response) {
- console.log(response.data);
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- if(response.data.serviceAction == 1){
- setTimeout(function() {
- getServiceStatus();
- $scope.ActionSuccessfull = true;
- $scope.ActionFailed = false;
- $scope.couldNotConnect = false;
- $scope.actionLoader = false;
- $scope.btnDisable = false;
- }, 3000);
- }
- else{
- setTimeout(function() {
- getServiceStatus();
- $scope.ActionSuccessfull = false;
- $scope.ActionFailed = true;
- $scope.couldNotConnect = false;
- $scope.actionLoader = false;
- $scope.btnDisable = false;
- }, 5000);
+ function ListInitialDatas(response) {
+ console.log(response.data);
- }
-
- }
- function cantLoadInitialDatas(response) {
- $scope.ActionSuccessfull = false;
+ if (response.data.serviceAction == 1) {
+ setTimeout(function () {
+ getServiceStatus();
+ $scope.ActionSuccessfull = true;
$scope.ActionFailed = false;
- $scope.couldNotConnect = true;
+ $scope.couldNotConnect = false;
$scope.actionLoader = false;
$scope.btnDisable = false;
- }
+ }, 3000);
+ }
+ else {
+ setTimeout(function () {
+ getServiceStatus();
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = true;
+ $scope.couldNotConnect = false;
+ $scope.actionLoader = false;
+ $scope.btnDisable = false;
+ }, 5000);
- }
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = false;
+ $scope.couldNotConnect = true;
+ $scope.actionLoader = false;
+ $scope.btnDisable = false;
+ }
+
+ }
});
+
+app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) {
+
+
+ $scope.cyberPanelLoading = true;
+ $scope.installBoxGen = true;
+
+ $scope.switchTOLSWS = function () {
+
+ $scope.cyberPanelLoading = false;
+ $scope.installBoxGen = true;
+
+ url = "/serverstatus/switchTOLSWS";
+
+ var data = {
+ licenseKey: $scope.licenseKey
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ if (response.data.status === 1) {
+ $scope.installBoxGen = false;
+ getRequestStatus();
+ }
+ else {
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+ }
+
+ };
+
+ function getRequestStatus() {
+ $scope.cyberPanelLoading = false;
+
+ url = "/serverstatus/switchTOLSWSStatus";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ if (response.data.abort === 0) {
+ $scope.requestData = response.data.requestStatus;
+ $timeout(getRequestStatus, 1000);
+ }
+ else {
+ // Notifications
+ $scope.cyberPanelLoading = true;
+ $timeout.cancel();
+ $scope.requestData = response.data.requestStatus;
+ if (response.data.installed === 1) {
+ $timeout(function () {
+ $window.location.reload();
+ }, 3000);
+ }
+
+ }
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+
+
+ }
+
+ }
+
+});
\ No newline at end of file
diff --git a/serverStatus/templates/serverStatus/litespeedStatus.html b/serverStatus/templates/serverStatus/litespeedStatus.html
index 33f180914..a77e7d078 100644
--- a/serverStatus/templates/serverStatus/litespeedStatus.html
+++ b/serverStatus/templates/serverStatus/litespeedStatus.html
@@ -3,14 +3,13 @@
{% block title %}{% trans "LiteSpeed Status - CyberPanel" %}{% endblock %}
{% block content %}
-{% load static %}
-{% get_current_language as LANGUAGE_CODE %}
-
+ {% load static %}
+ {% get_current_language as LANGUAGE_CODE %}
+
-
-
-
+ {% if OLS %}
+
{% trans "LiteSpeed Status:" %} 
@@ -20,17 +19,17 @@
-
-
+
+
-
+
{% if processList %}
+ {% trans "LiteSpeed Processes" %}
+
@@ -42,7 +41,7 @@
{% for items in processList %}
-
+
| {{ forloop.counter }} |
{{ items }} |
@@ -58,22 +57,24 @@
{% endif %}
- {% endfor %}
+ {% endfor %}
{% else %}
-
{% trans "Could not fetch details, either LiteSpeed is not running or some error occurred, please see CyberPanel Main log file." %}
+
{% trans "Could not fetch details, either LiteSpeed is not running or some error occurred, please see CyberPanel Main log file." %}
{% endif %}
-
+
+
+
+
+
+
+
+
+
+
+
+ | {{ modules }} |
+
+
+
+ {% for items in loadedModules %}
+
+ | {{ items }} |
+
+
+ {% endfor %}
+
+
+
-
-
-
-
-
-
-
-
-
-
-
- | {{ modules }} |
-
-
-
- {% for items in loadedModules %}
-
- | {{ items }} |
-
-
- {% endfor %}
-
-
-
-
-
+
+
+
+
+
+ {% else %}
+
+
+
+
{% trans "LiteSpeed Status:" %} 
+
{% trans "On this page you can get information regarding your LiteSpeed processes." %}
+
+
+
+
+
+
+
+
+
+ {% if processList %}
+
+
+
+
+
+
+ | # |
+ {% trans "Process ID" %} |
+ {% trans "Name" %} |
+
+
+
+ {% for items in processList %}
+
+ | {{ forloop.counter }} |
+
+ {{ items }} |
+
+ {% if forloop.counter == 1 %}
+ {% trans "Main Process" %} |
+
+ {% elif forloop.counter == 2 %}
+ {% trans "lscgid Process" %} |
+
+ {% else %}
+ {% trans "Worker Process" %} |
+
+ {% endif %}
+
+ {% endfor %}
+
+
+
+ {% else %}
+
+
{% trans "Could not fetch details, either LiteSpeed is not running or some error occurred, please see CyberPanel Main log file." %}
+
+ {% endif %}
+
+
+ {% trans "Reboot Litespeed" %}
+
+
+
+
+ {% trans "Stop LiteSpeed" %}
+
+
+
+

+
+
+
+
{% trans "Action successful." %}
+
+
+
+
+
{% trans "Error Occurred. See CyberPanel main log file." %}
+
+
+
+
+
{% trans "Could not connect to server." %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{$ lsSerial $}
+
{$ lsexpiration $}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% endif %}
{% endblock %}
\ No newline at end of file
diff --git a/serverStatus/templates/serverStatus/services.html b/serverStatus/templates/serverStatus/services.html
index 54ed94e0f..dab445905 100644
--- a/serverStatus/templates/serverStatus/services.html
+++ b/serverStatus/templates/serverStatus/services.html
@@ -35,7 +35,7 @@
-
OpenLiteSpeed
+ {{ serverName }}
Stopped
diff --git a/serverStatus/urls.py b/serverStatus/urls.py
index fa6060e27..39569e1c4 100644
--- a/serverStatus/urls.py
+++ b/serverStatus/urls.py
@@ -3,13 +3,17 @@ import views
urlpatterns = [
url(r'^$', views.serverStatusHome, name='serverStatusHome'),
- url(r'^litespeedStatus', views.litespeedStatus, name='litespeedStatus'),
- url(r'^startorstopLitespeed', views.stopOrRestartLitespeed, name='startorstopLitespeed'),
- url(r'^cyberCPMainLogFile', views.cyberCPMainLogFile, name='cyberCPMainLogFile'),
- url(r'^getFurtherDataFromLogFile',views.getFurtherDataFromLogFile,name='getFurtherDataFromLogFile'),
+ url(r'^litespeedStatus$', views.litespeedStatus, name='litespeedStatus'),
+ url(r'^startorstopLitespeed$', views.stopOrRestartLitespeed, name='startorstopLitespeed'),
+ url(r'^cyberCPMainLogFile$', views.cyberCPMainLogFile, name='cyberCPMainLogFile'),
+ url(r'^getFurtherDataFromLogFile$',views.getFurtherDataFromLogFile,name='getFurtherDataFromLogFile'),
- url(r'^servicesStatus', views.servicesStatus, name='servicesStatus'),
- url(r'^servicesAction', views.servicesAction, name='servicesAction'),
- url(r'^services', views.services, name='services'),
+ url(r'^servicesStatus$', views.servicesStatus, name='servicesStatus'),
+ url(r'^servicesAction$', views.servicesAction, name='servicesAction'),
+ url(r'^services$', views.services, name='services'),
+ url(r'^switchTOLSWS$', views.switchTOLSWS, name='switchTOLSWS'),
+ url(r'^switchTOLSWSStatus$', views.switchTOLSWSStatus, name='switchTOLSWSStatus'),
+ url(r'^licenseStatus$', views.licenseStatus, name='licenseStatus'),
+ url(r'^changeLicense$', views.changeLicense, name='changeLicense'),
]
\ No newline at end of file
diff --git a/serverStatus/views.py b/serverStatus/views.py
index 623bd8f1f..b269fadd2 100644
--- a/serverStatus/views.py
+++ b/serverStatus/views.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
from django.shortcuts import render,redirect
from django.http import HttpResponse
-from plogical.processUtilities import ProcessUtilities
import plogical.CyberCPLogFileWriter as logging
from loginSystem.views import loadLoginPage
import json
@@ -13,6 +12,10 @@ import shlex
import socket
from plogical.acl import ACLManager
import os
+from plogical.virtualHostUtilities import virtualHostUtilities
+import time
+import serverStatusUtil
+from plogical.processUtilities import ProcessUtilities
# Create your views here.
def serverStatusHome(request):
@@ -26,7 +29,6 @@ def litespeedStatus(request):
try:
userID = request.session['userID']
-
currentACL = ACLManager.loadedACL(userID)
if currentACL['admin'] == 1:
@@ -36,6 +38,9 @@ def litespeedStatus(request):
processList = ProcessUtilities.getLitespeedProcessNumber()
+ OLS = 0
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ OLS = 1
try:
versionInformation = subprocess.check_output(["/usr/local/lsws/bin/lshttpd", "-v"]).split("\n")
@@ -54,16 +59,16 @@ def litespeedStatus(request):
except subprocess.CalledProcessError,msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
- return render(request,"serverStatus/litespeedStatus.html",{"processList":processList,"liteSpeedVersionStatus":"For some reaons not able to load version details, see CyberCP main log file."})
+ return render(request,"serverStatus/litespeedStatus.html",{"processList":processList,"liteSpeedVersionStatus":"For some reaons not able to load version details, see CyberCP main log file.", 'OLS': OLS})
if(processList!=0):
dataForHtml = {"processList": processList, "lsversion": lsversion, "modules": modules,
- "loadedModules": loadedModules}
+ "loadedModules": loadedModules, 'OLS':OLS}
return render(request,"serverStatus/litespeedStatus.html",dataForHtml)
else:
dataForHtml = {"lsversion": lsversion, "modules": modules,
- "loadedModules": loadedModules}
+ "loadedModules": loadedModules, 'OLS': OLS}
return render(request, "serverStatus/litespeedStatus.html",dataForHtml)
except KeyError,msg:
@@ -152,8 +157,14 @@ def services(request):
pass
else:
return ACLManager.loadError()
+ data = {}
- return render(request, 'serverStatus/services.html')
+ if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
+ data['serverName'] = 'OpenLiteSpeed'
+ else:
+ data['serverName'] = 'LiteSpeed Ent'
+
+ return render(request, 'serverStatus/services.html', data)
except KeyError:
return redirect(loadLoginPage)
@@ -302,3 +313,134 @@ def servicesAction(request):
final_dic = {'serviceAction': 0, 'error_message': str(msg)}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
+
+def switchTOLSWS(request):
+ try:
+ userID = request.session['userID']
+
+ currentACL = ACLManager.loadedACL(userID)
+
+ if currentACL['admin'] == 1:
+ pass
+ else:
+ return ACLManager.loadErrorJson('status', 0)
+
+ data = json.loads(request.body)
+
+ execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/serverStatus/serverStatusUtil.py"
+ execPath = execPath + " switchTOLSWS --licenseKey " + data['licenseKey']
+
+ subprocess.Popen(shlex.split(execPath))
+ time.sleep(2)
+
+ data_ret = {'status': 1, 'error_message': "None", }
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+
+ except BaseException, msg:
+ data_ret = {'status': 0, 'error_message': str(msg)}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+
+def switchTOLSWSStatus(request):
+ try:
+
+ command = 'sudo cat ' + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
+ output = subprocess.check_output(shlex.split(command))
+
+ if output.find('[404]') > -1:
+ data_ret = {'abort': 1, 'requestStatus': output, 'installed': 0}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+ elif output.find('[200]') > -1:
+ data_ret = {'abort': 1, 'requestStatus': output, 'installed': 1}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+ else:
+ data_ret = {'abort': 0, 'requestStatus': output, 'installed': 0}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+
+ except BaseException, msg:
+ data_ret = {'abort': 1, 'requestStatus': str(msg), 'installed': 0}
+ json_data = json.dumps(data_ret)
+ return HttpResponse(json_data)
+
+def licenseStatus(request):
+ try:
+ userID = request.session['userID']
+
+ try:
+ currentACL = ACLManager.loadedACL(userID)
+
+ if currentACL['admin'] == 1:
+ pass
+ else:
+ return ACLManager.loadErrorJson('status', 0)
+
+ command = 'sudo cat /usr/local/lsws/conf/serial.no'
+ serial = subprocess.check_output(shlex.split(command))
+
+
+ command = 'sudo /usr/local/lsws/bin/lshttpd -V'
+ expiration = subprocess.check_output(shlex.split(command))
+
+ final_dic = {'status': 1, "erroMessage": 0, 'lsSerial': serial, 'lsexpiration': expiration}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
+
+ except BaseException, msg:
+ final_dic = {'status': 0, 'erroMessage': str(msg)}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
+ except KeyError, msg:
+ final_dic = {'status': 0, 'erroMessage': str(msg)}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
+
+def changeLicense(request):
+ try:
+ userID = request.session['userID']
+
+ try:
+ currentACL = ACLManager.loadedACL(userID)
+
+ if currentACL['admin'] == 1:
+ pass
+ else:
+ return ACLManager.loadErrorJson('status', 0)
+
+ data = json.loads(request.body)
+ newKey = data['newKey']
+
+ command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
+ subprocess.call(shlex.split(command))
+
+ serialPath = '/usr/local/lsws/conf/serial.no'
+ serialFile = open(serialPath, 'w')
+ serialFile.write(newKey)
+ serialFile.close()
+
+ command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
+ subprocess.call(shlex.split(command))
+
+
+ command = 'sudo /usr/local/lsws/bin/lshttpd -r'
+ subprocess.call(shlex.split(command))
+
+ command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
+ subprocess.call(shlex.split(command))
+
+
+ final_dic = {'status': 1, "erroMessage": 'None'}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
+
+ except BaseException, msg:
+ final_dic = {'status': 0, 'erroMessage': str(msg)}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
+ except KeyError, msg:
+ final_dic = {'status': 0, 'erroMessage': str(msg)}
+ final_json = json.dumps(final_dic)
+ return HttpResponse(final_json)
\ No newline at end of file
diff --git a/static/firewall/firewall.js b/static/firewall/firewall.js
index ba9df9207..bb0e4a07f 100644
--- a/static/firewall/firewall.js
+++ b/static/firewall/firewall.js
@@ -3,10 +3,6 @@
*/
-
-
-
-
/* Java script code to ADD Firewall Rules */
app.controller('firewallController', function($scope,$http) {
@@ -548,8 +544,6 @@ app.controller('firewallController', function($scope,$http) {
/* Java script code to ADD Firewall Rules */
-
-
/* Java script code to Secure SSH */
app.controller('secureSSHCTRL', function($scope,$http) {
diff --git a/static/images/litespeed-logo.png b/static/images/litespeed-logo.png
new file mode 100644
index 000000000..5ac9124e5
Binary files /dev/null and b/static/images/litespeed-logo.png differ
diff --git a/static/serverStatus/serverStatus.js b/static/serverStatus/serverStatus.js
index e52d380fe..99b324364 100644
--- a/static/serverStatus/serverStatus.js
+++ b/static/serverStatus/serverStatus.js
@@ -5,7 +5,7 @@
/* Java script code to start/stop litespeed */
-app.controller('litespeedStatus', function($scope,$http) {
+app.controller('litespeedStatus', function ($scope, $http) {
$scope.restartorStopLoading = true;
$scope.actionResult = true;
@@ -13,424 +13,507 @@ app.controller('litespeedStatus', function($scope,$http) {
$scope.serverStatusCouldNotConnect = true;
- $scope.restartLitespeed = function(){
+ $scope.restartLitespeed = function () {
- $scope.disableReboot = true;
- $scope.disableStop = true;
- $scope.restartorStopLoading = false;
+ $scope.disableReboot = true;
+ $scope.disableStop = true;
+ $scope.restartorStopLoading = false;
+ var url = "/serverstatus/startorstopLitespeed";
+
+ var data = {
+ reboot: 1,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- var url = "/serverstatus/startorstopLitespeed";
+ function ListInitialDatas(response) {
- var data = {
- reboot:1,
- };
+ $scope.restartorStopLoading = true;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ if (response.data.reboot == 1) {
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
-
-
- function ListInitialDatas(response) {
-
- $scope.restartorStopLoading = true;
- $scope.disableReboot = false;
- $scope.disableStop = false;
-
- if(response.data.reboot == 1){
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = false;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = true;
-
- }
- else{
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = false;
- $scope.serverStatusCouldNotConnect = true;
- }
-
-
- }
- function cantLoadInitialDatas(response) {
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = false;
- $scope.disableReboot = false;
- $scope.disableStop = false;
- }
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = false;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = true;
+
+ }
+ else {
+
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = false;
+ $scope.serverStatusCouldNotConnect = true;
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = false;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
+ }
};
- $scope.stopLitespeed = function(){
+ $scope.stopLitespeed = function () {
- $scope.disableReboot = true;
- $scope.disableStop = true;
- $scope.restartorStopLoading = false;
+ $scope.disableReboot = true;
+ $scope.disableStop = true;
+ $scope.restartorStopLoading = false;
+ var url = "/serverstatus/startorstopLitespeed";
+
+ var data = {
+ reboot: 0,
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- var url = "/serverstatus/startorstopLitespeed";
+ function ListInitialDatas(response) {
- var data = {
- reboot:0,
- };
+ $scope.restartorStopLoading = true;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ if (response.data.shutdown == 1) {
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
-
-
- function ListInitialDatas(response) {
-
- $scope.restartorStopLoading = true;
- $scope.disableReboot = false;
- $scope.disableStop = false;
-
- if(response.data.shutdown == 1){
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = false;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = true;
-
- }
- else{
-
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = false;
- $scope.serverStatusCouldNotConnect = true;
- }
-
-
- }
- function cantLoadInitialDatas(response) {
- $scope.restartorStopLoading = true;
- $scope.actionResult = true;
- $scope.actionResultBad = true;
- $scope.serverStatusCouldNotConnect = false;
- $scope.disableReboot = false;
- $scope.disableStop = false;
- }
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = false;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = true;
+
+ }
+ else {
+
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = false;
+ $scope.serverStatusCouldNotConnect = true;
+ }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.restartorStopLoading = true;
+ $scope.actionResult = true;
+ $scope.actionResultBad = true;
+ $scope.serverStatusCouldNotConnect = false;
+ $scope.disableReboot = false;
+ $scope.disableStop = false;
+ }
};
});
-
-
/* Java script code to start/stop litespeed */
-
-
-
/* Java script code to read log file */
+app.controller('readCyberCPLogFile', function ($scope, $http) {
-app.controller('readCyberCPLogFile', function($scope,$http) {
+ $scope.logFileLoading = false;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = true;
- $scope.logFileLoading = false;
- $scope.logsFeteched = true;
+
+ var url = "/serverstatus/getFurtherDataFromLogFile";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if (response.data.logstatus == 1) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = false;
+ $scope.couldNotFetchLogs = true;
+
+ $scope.logsData = response.data.logsdata;
+
+
+ }
+ else {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+
+
+ }
+
+
+ }
+
+ function cantLoadInitialDatas(response) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+
+ }
+
+
+ $scope.fetchLogs = function () {
+
+
+ $scope.logFileLoading = false;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = true;
+
+
+ var url = "/serverstatus/getFurtherDataFromLogFile";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+
+
+ if (response.data.logstatus == 1) {
+
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = false;
$scope.couldNotFetchLogs = true;
-
- var url = "/serverstatus/getFurtherDataFromLogFile";
-
- var data = {};
-
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
-
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ $scope.logsData = response.data.logsdata;
- function ListInitialDatas(response) {
+ }
+ else {
-
-
- if(response.data.logstatus == 1){
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = false;
- $scope.couldNotFetchLogs = true;
-
- $scope.logsData = response.data.logsdata;
-
-
-
- }
- else{
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
-
- }
-
-
- }
- function cantLoadInitialDatas(response) {
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
- }
-
-
-
-
- $scope.fetchLogs = function(){
-
-
- $scope.logFileLoading = false;
+ $scope.logFileLoading = true;
$scope.logsFeteched = true;
- $scope.couldNotFetchLogs = true;
+ $scope.couldNotFetchLogs = false;
- var url = "/serverstatus/getFurtherDataFromLogFile";
-
- var data = {};
-
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
-
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ }
- function ListInitialDatas(response) {
-
-
-
- if(response.data.logstatus == 1){
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = false;
- $scope.couldNotFetchLogs = true;
-
- $scope.logsData = response.data.logsdata;
-
-
-
- }
- else{
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
-
- }
-
-
- }
- function cantLoadInitialDatas(response) {
-
- $scope.logFileLoading = true;
- $scope.logsFeteched = true;
- $scope.couldNotFetchLogs = false;
-
- }
+ }
+ function cantLoadInitialDatas(response) {
+ $scope.logFileLoading = true;
+ $scope.logsFeteched = true;
+ $scope.couldNotFetchLogs = false;
+ }
};
});
-
-
/* Java script code to read log file ends here */
-
/* Java script code to read log file ends here */
/* Services */
-app.controller('servicesManager', function($scope,$http) {
+app.controller('servicesManager', function ($scope, $http) {
- $scope.services = false;
- $scope.btnDisable = false;
- $scope.actionLoader = false;
+ $scope.services = false;
+ $scope.btnDisable = false;
+ $scope.actionLoader = false;
- function getServiceStatus(){
- $scope.btnDisable = true;
+ function getServiceStatus() {
+ $scope.btnDisable = true;
- url = "/serverstatus/servicesStatus";
+ url = "/serverstatus/servicesStatus";
- $http.post(url).then(ListInitialDatas, cantLoadInitialDatas);
+ $http.post(url).then(ListInitialDatas, cantLoadInitialDatas);
- function ListInitialDatas(response) {
+ function ListInitialDatas(response) {
- if (response.data.status.litespeed) {
- $scope.olsStatus = "Running";
- $scope.olsStats = true;
- $scope.olsStart = false;
- $scope.olsStop = true;
- $scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB";
- }
- else {
- $scope.olsStatus = "Stopped";
- $scope.olsStats = false;
- $scope.olsStart = true;
- $scope.olsStop = false;
- }
+ if (response.data.status.litespeed) {
+ $scope.olsStatus = "Running";
+ $scope.olsStats = true;
+ $scope.olsStart = false;
+ $scope.olsStop = true;
+ $scope.olsMem = Math.round(parseInt(response.data.memUsage.litespeed) / 1048576) + " MB";
+ }
+ else {
+ $scope.olsStatus = "Stopped";
+ $scope.olsStats = false;
+ $scope.olsStart = true;
+ $scope.olsStop = false;
+ }
- // Update SQL stats
+ // Update SQL stats
- if (response.data.status.mysql) {
- $scope.sqlStatus = "Running";
- $scope.sqlStats = true;
- $scope.sqlStart = false;
- $scope.sqlStop = true;
- $scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB";
- }
- else {
- $scope.sqlStatus = "Stopped";
- $scope.sqlStats = false;
- $scope.sqlStart = true;
- $scope.sqlStop = false;
- }
+ if (response.data.status.mysql) {
+ $scope.sqlStatus = "Running";
+ $scope.sqlStats = true;
+ $scope.sqlStart = false;
+ $scope.sqlStop = true;
+ $scope.sqlMem = Math.round(parseInt(response.data.memUsage.mysql) / 1048576) + " MB";
+ }
+ else {
+ $scope.sqlStatus = "Stopped";
+ $scope.sqlStats = false;
+ $scope.sqlStart = true;
+ $scope.sqlStop = false;
+ }
- // Update DNS stats
+ // Update DNS stats
- if (response.data.status.powerdns) {
- $scope.dnsStatus = "Running";
- $scope.dnsStats = true;
- $scope.dnsStart = false;
- $scope.dnsStop = true;
- $scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB";
- }
- else {
- $scope.dnsStatus = "Stopped";
- $scope.dnsStats = false;
- $scope.dnsStart = true;
- $scope.dnsStop = false;
- }
+ if (response.data.status.powerdns) {
+ $scope.dnsStatus = "Running";
+ $scope.dnsStats = true;
+ $scope.dnsStart = false;
+ $scope.dnsStop = true;
+ $scope.dnsMem = Math.round(parseInt(response.data.memUsage.powerdns) / 1048576) + " MB";
+ }
+ else {
+ $scope.dnsStatus = "Stopped";
+ $scope.dnsStats = false;
+ $scope.dnsStart = true;
+ $scope.dnsStop = false;
+ }
- // Update FTP stats
+ // Update FTP stats
- if (response.data.status.pureftp) {
- $scope.ftpStatus = "Running";
- $scope.ftpStats = true;
- $scope.ftpStart = false;
- $scope.ftpStop = true;
- $scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB";
- }
- else {
- $scope.ftpStatus = "Stopped";
- $scope.ftpStats = false;
- $scope.ftpStart = true;
- $scope.ftpStop = false;
- }
+ if (response.data.status.pureftp) {
+ $scope.ftpStatus = "Running";
+ $scope.ftpStats = true;
+ $scope.ftpStart = false;
+ $scope.ftpStop = true;
+ $scope.ftpMem = Math.round(parseInt(response.data.memUsage.pureftp) / 1048576) + " MB";
+ }
+ else {
+ $scope.ftpStatus = "Stopped";
+ $scope.ftpStats = false;
+ $scope.ftpStart = true;
+ $scope.ftpStop = false;
+ }
- $scope.services = true;
+ $scope.services = true;
- $scope.btnDisable = false;
+ $scope.btnDisable = false;
- }
- function cantLoadInitialDatas(response) {
- $scope.couldNotConnect = true;
+ }
- }
+ function cantLoadInitialDatas(response) {
+ $scope.couldNotConnect = true;
- };
- getServiceStatus();
+ }
- $scope.serviceAction = function(serviceName, action){
- $scope.ActionProgress = true;
- $scope.btnDisable = true;
- $scope.ActionSuccessfull = false;
- $scope.ActionFailed = false;
- $scope.couldNotConnect = false;
- $scope.actionLoader = true;
+ };
+ getServiceStatus();
- url = "/serverstatus/servicesAction";
+ $scope.serviceAction = function (serviceName, action) {
+ $scope.ActionProgress = true;
+ $scope.btnDisable = true;
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = false;
+ $scope.couldNotConnect = false;
+ $scope.actionLoader = true;
- var data = {
- service:serviceName,
- action:action
- };
+ url = "/serverstatus/servicesAction";
- var config = {
- headers : {
- 'X-CSRFToken': getCookie('csrftoken')
- }
- };
+ var data = {
+ service: serviceName,
+ action: action
+ };
- $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
- function ListInitialDatas(response) {
- console.log(response.data);
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
- if(response.data.serviceAction == 1){
- setTimeout(function() {
- getServiceStatus();
- $scope.ActionSuccessfull = true;
- $scope.ActionFailed = false;
- $scope.couldNotConnect = false;
- $scope.actionLoader = false;
- $scope.btnDisable = false;
- }, 3000);
- }
- else{
- setTimeout(function() {
- getServiceStatus();
- $scope.ActionSuccessfull = false;
- $scope.ActionFailed = true;
- $scope.couldNotConnect = false;
- $scope.actionLoader = false;
- $scope.btnDisable = false;
- }, 5000);
+ function ListInitialDatas(response) {
+ console.log(response.data);
- }
-
- }
- function cantLoadInitialDatas(response) {
- $scope.ActionSuccessfull = false;
+ if (response.data.serviceAction == 1) {
+ setTimeout(function () {
+ getServiceStatus();
+ $scope.ActionSuccessfull = true;
$scope.ActionFailed = false;
- $scope.couldNotConnect = true;
+ $scope.couldNotConnect = false;
$scope.actionLoader = false;
$scope.btnDisable = false;
- }
+ }, 3000);
+ }
+ else {
+ setTimeout(function () {
+ getServiceStatus();
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = true;
+ $scope.couldNotConnect = false;
+ $scope.actionLoader = false;
+ $scope.btnDisable = false;
+ }, 5000);
- }
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.ActionSuccessfull = false;
+ $scope.ActionFailed = false;
+ $scope.couldNotConnect = true;
+ $scope.actionLoader = false;
+ $scope.btnDisable = false;
+ }
+
+ }
});
+
+app.controller('lswsSwitch', function ($scope, $http, $timeout, $window) {
+
+
+ $scope.cyberPanelLoading = true;
+ $scope.installBoxGen = true;
+
+ $scope.switchTOLSWS = function () {
+
+ $scope.cyberPanelLoading = false;
+ $scope.installBoxGen = true;
+
+ url = "/serverstatus/switchTOLSWS";
+
+ var data = {
+ licenseKey: $scope.licenseKey
+ };
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ if (response.data.status === 1) {
+ $scope.installBoxGen = false;
+ getRequestStatus();
+ }
+ else {
+ new PNotify({
+ title: 'Operation Failed!',
+ text: response.data.error_message,
+ type: 'error'
+ });
+ }
+
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+ }
+
+ };
+
+ function getRequestStatus() {
+ $scope.cyberPanelLoading = false;
+
+ url = "/serverstatus/switchTOLSWSStatus";
+
+ var data = {};
+
+ var config = {
+ headers: {
+ 'X-CSRFToken': getCookie('csrftoken')
+ }
+ };
+
+
+ $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
+
+
+ function ListInitialDatas(response) {
+ if (response.data.abort === 0) {
+ $scope.requestData = response.data.requestStatus;
+ $timeout(getRequestStatus, 1000);
+ }
+ else {
+ // Notifications
+ $scope.cyberPanelLoading = true;
+ $timeout.cancel();
+ $scope.requestData = response.data.requestStatus;
+ if (response.data.installed === 1) {
+ $timeout(function () {
+ $window.location.reload();
+ }, 3000);
+ }
+
+ }
+ }
+
+ function cantLoadInitialDatas(response) {
+ $scope.cyberPanelLoading = true;
+ new PNotify({
+ title: 'Operation Failed!',
+ text: 'Could not connect to server, please refresh this page',
+ type: 'error'
+ });
+
+
+ }
+
+ }
+
+});
\ No newline at end of file