From b2481335b8fa37218e838a4b07f330444f391a0b Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 27 Aug 2019 14:40:02 +0500 Subject: [PATCH] bug fix: remote transfer --- CLManager/CLManagerMain.py | 2 +- api/views.py | 2 +- backup/backupManager.py | 12 ++++---- cloudAPI/cloudManager.py | 2 +- containerization/containerManager.py | 2 +- databases/views.py | 2 +- dockerManager/container.py | 2 +- emailPremium/views.py | 8 ++--- firewall/firewallManager.py | 20 ++++++------ mailServer/mailserverManager.py | 4 +-- managePHP/views.py | 8 ++--- manageSSL/views.py | 6 ++-- plogical/backupUtilities.py | 4 +-- plogical/processUtilities.py | 2 +- plogical/remoteTransferUtilities.py | 2 +- plogical/upgrade.py | 8 +++-- pluginInstaller/pluginInstaller.py | 2 +- serverLogs/views.py | 2 +- tuning/tuning.py | 4 +-- websiteFunctions/StagingSetup.py | 2 +- websiteFunctions/website.py | 46 ++++++++++++++-------------- 21 files changed, 73 insertions(+), 69 deletions(-) diff --git a/CLManager/CLManagerMain.py b/CLManager/CLManagerMain.py index 6a58cbb64..d476c7b05 100644 --- a/CLManager/CLManagerMain.py +++ b/CLManager/CLManagerMain.py @@ -73,7 +73,7 @@ def submitCageFSInstall(self): 1) return 0 - execPath = "sudo python /usr/local/CyberCP/CLManager/CageFS.py" + execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/CLManager/CageFS.py" execPath = execPath + " --function submitCageFSInstall" ProcessUtilities.outputExecutioner(execPath) diff --git a/api/views.py b/api/views.py index ca819a439..158d87da0 100755 --- a/api/views.py +++ b/api/views.py @@ -379,7 +379,7 @@ def remoteTransfer(request): ## Accounts to transfer is a path to file, containing accounts. - execPath = "python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" execPath = execPath + " remoteTransfer --ipAddress " + ipAddress + " --dir " + dir + " --accountsToTransfer " + path ProcessUtilities.popenExecutioner(execPath) diff --git a/backup/backupManager.py b/backup/backupManager.py index 1d93345b9..db40bea2c 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -249,7 +249,7 @@ def cancelBackupCreation(self, userID = None, data = None): backupCancellationDomain = data['backupCancellationDomain'] fileName = data['fileName'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " cancelBackupCreation --backupCancellationDomain " + backupCancellationDomain + " --fileName " + fileName subprocess.call(shlex.split(execPath)) @@ -310,7 +310,7 @@ def submitRestore(self, data = None, userID = None): else: return ACLManager.loadErrorJson() - execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir ProcessUtilities.popenExecutioner(execPath) time.sleep(4) @@ -424,7 +424,7 @@ def submitDestinationCreation(self, userID = None, data = None): except: port = "22" - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " submitDestinationCreation --ipAddress " + ipAddress + " --password " \ + password + " --port " + port @@ -503,7 +503,7 @@ def getConnectionStatus(self, userID = None, data = None): ipAddress = data['IPAddress'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " getConnectionStatus --ipAddress " + ipAddress output = ProcessUtilities.executioner(execPath) @@ -891,7 +891,7 @@ def submitRemoteBackups(self, userID = None, data = None): ## - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" execPath = execPath + " writeAuthKey --pathToKey " + pathToKey output = ProcessUtilities.outputExecutioner(execPath) @@ -1057,7 +1057,7 @@ def remoteBackupRestore(self, userID = None, data = None): ## - execPath = "python " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/remoteTransferUtilities.py" execPath = execPath + " remoteBackupRestore --backupDirComplete " + backupDirComplete + " --backupDir " + str( backupDir) diff --git a/cloudAPI/cloudManager.py b/cloudAPI/cloudManager.py index ee62f4859..6f6b5cfb1 100755 --- a/cloudAPI/cloudManager.py +++ b/cloudAPI/cloudManager.py @@ -128,7 +128,7 @@ def fetchWebsiteData(self): ## bw usage calculation try: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " findDomainBW --virtualHostName " + self.data[ 'domainName'] + " --bandwidth " + str( website.package.bandwidth) diff --git a/containerization/containerManager.py b/containerization/containerManager.py index 1a5b573cf..d419b9435 100755 --- a/containerization/containerManager.py +++ b/containerization/containerManager.py @@ -124,7 +124,7 @@ def submitContainerInstall(self): 1) return 0 - execPath = "sudo python /usr/local/CyberCP/containerization/container.py" + execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/containerization/container.py" execPath = execPath + " --function submitContainerInstall" ProcessUtilities.outputExecutioner(execPath) diff --git a/databases/views.py b/databases/views.py index b9e97de24..853198776 100755 --- a/databases/views.py +++ b/databases/views.py @@ -134,7 +134,7 @@ def setupPHPMYAdminSession(request): userID = request.session['userID'] admin = Administrator.objects.get(id = userID) - execPath = "sudo python /usr/local/CyberCP/databases/databaseManager.py" + execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/databases/databaseManager.py" execPath = execPath + " generatePHPMYAdminData --userID " + str(userID) output = ProcessUtilities.outputExecutioner(execPath) diff --git a/dockerManager/container.py b/dockerManager/container.py index c6f9bceca..6a5606848 100755 --- a/dockerManager/container.py +++ b/dockerManager/container.py @@ -82,7 +82,7 @@ def submitInstallDocker(self): writeToFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w') writeToFile.close() - execPath = "sudo python /usr/local/CyberCP/dockerManager/dockerInstall.py" + execPath = "/usr/local/CyberCP/bin/python2 /usr/local/CyberCP/dockerManager/dockerInstall.py" ProcessUtilities.executioner(execPath) time.sleep(2) diff --git a/emailPremium/views.py b/emailPremium/views.py index 1f07bb7ae..5c1908382 100755 --- a/emailPremium/views.py +++ b/emailPremium/views.py @@ -101,7 +101,7 @@ def savePolicyServerStatus(request): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " savePolicyServerStatus --install " + install output = ProcessUtilities.outputExecutioner(execPath) @@ -784,7 +784,7 @@ def installSpamAssassin(request): return ACLManager.loadErrorJson() try: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " installSpamAssassin" ProcessUtilities.popenExecutioner(execPath) @@ -810,7 +810,7 @@ def installStatusSpamAssassin(request): if installStatus.find("[200]")>-1: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " configureSpamAssassin" output = ProcessUtilities.outputExecutioner(execPath) @@ -981,7 +981,7 @@ def saveSpamAssassinConfigurations(request): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " saveSpamAssassinConfigs --tempConfigPath " + tempConfigPath output = ProcessUtilities.outputExecutioner(execPath) diff --git a/firewall/firewallManager.py b/firewall/firewallManager.py index 9641325c4..442e10db0 100755 --- a/firewall/firewallManager.py +++ b/firewall/firewallManager.py @@ -371,7 +371,7 @@ def saveSSHConfigs(self, userID = None, data = None): else: rootLogin = "0" - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/firewallUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/firewallUtilities.py" execPath = execPath + " saveSSHConfigs --type " + str(type) + " --sshPort " + sshPort + " --rootLogin " + rootLogin output = ProcessUtilities.outputExecutioner(execPath) @@ -418,7 +418,7 @@ def deleteSSHKey(self, userID = None, data = None): key = data['key'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/firewallUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/firewallUtilities.py" execPath = execPath + " deleteSSHKey --key '" + key + "'" output = ProcessUtilities.outputExecutioner(execPath) @@ -512,7 +512,7 @@ def installModSec(self, userID = None, data = None): else: return ACLManager.loadErrorJson('installModSec', 0) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " installModSec" ProcessUtilities.popenExecutioner(execPath) @@ -535,7 +535,7 @@ def installStatusModSec(self, userID = None, data = None): if installStatus.find("[200]") > -1: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " installModSecConfigs" @@ -781,7 +781,7 @@ def saveModSecConfigurations(self, userID = None, data = None): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath @@ -836,7 +836,7 @@ def saveModSecConfigurations(self, userID = None, data = None): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " saveModSecConfigs --tempConfigPath " + tempConfigPath @@ -962,7 +962,7 @@ def saveModSecRules(self, userID = None, data = None): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " saveModSecRules" output = ProcessUtilities.outputExecutioner(execPath) @@ -1107,7 +1107,7 @@ def installModSecRulesPack(self, userID = None, data = None): if ProcessUtilities.decideServer() == ProcessUtilities.OLS: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " " + packName output = ProcessUtilities.outputExecutioner(execPath) @@ -1125,7 +1125,7 @@ def installModSecRulesPack(self, userID = None, data = None): final_json = json.dumps({'installStatus': 0, 'error_message': "OWASP will be available later.", }) return HttpResponse(final_json) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " " + packName output = ProcessUtilities.outputExecutioner(execPath) @@ -1265,7 +1265,7 @@ def enableDisableRuleFile(self, userID = None, data = None): else: functionName = 'enableRuleFile' - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/modSec.py" execPath = execPath + " " + functionName + ' --packName ' + packName + ' --fileName ' + fileName diff --git a/mailServer/mailserverManager.py b/mailServer/mailserverManager.py index 8fd7fd010..7a35dc5a0 100755 --- a/mailServer/mailserverManager.py +++ b/mailServer/mailserverManager.py @@ -566,7 +566,7 @@ def generateDKIMKeys(self): else: return ACLManager.loadErrorJson() - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " generateKeys --domain " + domainName output = ProcessUtilities.outputExecutioner(execPath) @@ -636,7 +636,7 @@ def installStatusOpenDKIM(self): if installStatus.find("[200]") > -1: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py" execPath = execPath + " configureOpenDKIM" output = ProcessUtilities.outputExecutioner(execPath) diff --git a/managePHP/views.py b/managePHP/views.py index 175e08c42..5870349c4 100755 --- a/managePHP/views.py +++ b/managePHP/views.py @@ -1275,10 +1275,10 @@ def submitExtensionRequest(request): type = data['type'] if type == "install": - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" execPath = execPath + " installPHPExtension --extension " + extensionName else: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" execPath = execPath + " unInstallPHPExtension --extension " + extensionName ProcessUtilities.popenExecutioner(execPath) @@ -1698,7 +1698,7 @@ def savePHPConfigBasic(request): ## - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" execPath = execPath + " savePHPConfigBasic --phpVers " + phpVers + " --allow_url_fopen '" + allow_url_fopen + "' --display_errors '" + display_errors + "' --file_uploads '" + file_uploads + "' --allow_url_include '" + allow_url_include + "' --memory_limit " + memory_limit + " --max_execution_time " + max_execution_time + " --upload_max_filesize " + upload_max_filesize + " --max_input_time " + max_input_time + " --post_max_size " + post_max_size output = ProcessUtilities.outputExecutioner(execPath) @@ -1796,7 +1796,7 @@ def savePHPConfigAdvance(request): vhost.write(data['configData']) vhost.close() - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/phpUtilities.py" execPath = execPath + " savePHPConfigAdvance --phpVers " + path + " --tempPath " + tempPath output = ProcessUtilities.outputExecutioner(execPath) diff --git a/manageSSL/views.py b/manageSSL/views.py index 9dbcc24e2..e6051d40e 100755 --- a/manageSSL/views.py +++ b/manageSSL/views.py @@ -80,7 +80,7 @@ def issueSSL(request): ## ssl issue - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " issueSSL --virtualHostName " + virtualHost + " --administratorEmail " + adminEmail + " --path " + path output = ProcessUtilities.outputExecutioner(execPath) @@ -161,7 +161,7 @@ def obtainHostNameSSL(request): ## ssl issue - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " issueSSLForHostName --virtualHostName " + virtualHost + " --path " + path output = ProcessUtilities.outputExecutioner(execPath) @@ -236,7 +236,7 @@ def obtainMailServerSSL(request): ## ssl issue - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " issueSSLForMailServer --virtualHostName " + virtualHost + " --path " + path output = ProcessUtilities.outputExecutioner(execPath) diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index e0af0e68e..a8b039068 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -1064,7 +1064,7 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, status) ProcessUtilities.executioner(command) - execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " startBackup --tempStoragePath " + tempStoragePath + " --backupName " \ + backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % (result[2]) @@ -1093,7 +1093,7 @@ def submitBackupCreation(tempStoragePath, backupName, backupPath, backupDomain): output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) if output.find('1,None') > -1: - execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " BackupRoot --tempStoragePath " + tempStoragePath + " --backupName " \ + backupName + " --backupPath " + backupPath + ' --backupDomain ' + backupDomain + ' --metaPath %s' % ( result[2]) diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index d076e8674..88c179582 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -272,7 +272,7 @@ def popenExecutioner(command, user=None): @staticmethod def BuildCommand(path, functionName, parameters): - execPath = "python %s %s " % (path, functionName) + execPath = "/usr/local/CyberCP/bin/python2 %s %s " % (path, functionName) for key, value in parameters.iteritems(): execPath = execPath + ' --%s %s' % (key, value) diff --git a/plogical/remoteTransferUtilities.py b/plogical/remoteTransferUtilities.py index 4225c517c..8b76faa0b 100755 --- a/plogical/remoteTransferUtilities.py +++ b/plogical/remoteTransferUtilities.py @@ -263,7 +263,7 @@ def startRestore(backupDir, backupLogPath, dir): writeToFile.close() backupFile = backup - execPath = "sudo nice -n 10 python " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" + execPath = "sudo nice -n 10 /usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/backupUtilities.py" execPath = execPath + " submitRestore --backupFile " + backupFile + " --dir " + dir subprocess.Popen(shlex.split(execPath)) time.sleep(4) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 900270c9f..c726f34cc 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -344,7 +344,9 @@ def downoad_and_install_raindloop(): break ###### - path = "/usr/local/CyberCP/public/rainloop/rainloop/v/1.12.1/include.php" + iPath = os.listdir('/usr/local/CyberCP/public/rainloop/rainloop/v/') + + path = "/usr/local/CyberCP/public/rainloop/rainloop/v/%s/include.php" % (iPath[0]) data = open(path, 'r').readlines() writeToFile = open(path, 'w') @@ -356,6 +358,8 @@ def downoad_and_install_raindloop(): else: writeToFile.writelines(items) + writeToFile.close() + os.chdir(cwd) except BaseException, msg: @@ -1259,7 +1263,7 @@ def downloadAndUpgrade(versionNumbring): if csrfCheck == 1: writeToFile.writelines(" 'django.middleware.csrf.CsrfViewMiddleware',\n") - if items.find("'filemanager',") > -1: + elif items.find("'filemanager',") > -1: writeToFile.writelines(items) if pluginCheck == 1: writeToFile.writelines(" 'pluginHolder',\n") diff --git a/pluginInstaller/pluginInstaller.py b/pluginInstaller/pluginInstaller.py index a9cb7a2fe..ceb44d5f3 100755 --- a/pluginInstaller/pluginInstaller.py +++ b/pluginInstaller/pluginInstaller.py @@ -93,7 +93,7 @@ def staticContent(): os.chdir('/usr/local/CyberCP') - command = "python manage.py collectstatic --noinput" + command = "/usr/local/CyberCP/bin/python2 manage.py collectstatic --noinput" subprocess.call(shlex.split(command)) command = "mv /usr/local/CyberCP/static /usr/local/lscp/cyberpanel" diff --git a/serverLogs/views.py b/serverLogs/views.py index f2908544d..7bffba1a0 100755 --- a/serverLogs/views.py +++ b/serverLogs/views.py @@ -172,7 +172,7 @@ def clearLogFile(request): fileName = data['fileName'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/serverLogs.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/serverLogs.py" execPath = execPath + " cleanLogFile --fileName " + fileName output = ProcessUtilities.outputExecutioner(execPath) diff --git a/tuning/tuning.py b/tuning/tuning.py index 4bac5143d..66776372f 100755 --- a/tuning/tuning.py +++ b/tuning/tuning.py @@ -124,7 +124,7 @@ def tuneLitespeed(self, userID, data): inMemCache = data['inMemCache'] gzipCompression = data['gzipCompression'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/tuning.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/tuning.py" execPath = execPath + " saveTuningDetails --maxConn " + maxConn + " --maxSSLConn " + maxSSLConn + " --connTime " + connTime + " --keepAlive " + keepAlive + " --inMemCache '" + inMemCache + "' --gzipCompression " + gzipCompression output = ProcessUtilities.outputExecutioner(execPath) @@ -175,7 +175,7 @@ def tunePHP(self, userID, data): procHardLimit = str(data['procHardLimit']) persistConn = data['persistConn'] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/tuning.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/tuning.py" execPath = execPath + " tunePHP --virtualHost " + domainSelection + " --initTimeout " + initTimeout + " --maxConns " + maxConns + " --memSoftLimit " + memSoftLimit + " --memHardLimit '" + memHardLimit + "' --procSoftLimit " + procSoftLimit + " --procHardLimit " + procHardLimit + " --persistConn " + persistConn output = ProcessUtilities.outputExecutioner(execPath) diff --git a/websiteFunctions/StagingSetup.py b/websiteFunctions/StagingSetup.py index 8bba3f230..11391732a 100644 --- a/websiteFunctions/StagingSetup.py +++ b/websiteFunctions/StagingSetup.py @@ -41,7 +41,7 @@ def startCloning(self): logging.statusWriter(tempStatusPath, 'Creating domain for staging environment..,5') phpSelection = 'PHP 7.1' - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \ " --phpVersion '" + phpSelection + "' --ssl 0 --dkimCheck 0 --openBasedir 0 --path " + path + ' --websiteOwner ' \ diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d9f83b34e..5006fa5fb 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -255,7 +255,7 @@ def submitDomainCreation(self, userID=None, data=None): except: apacheBackend = "0" - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " createDomain --masterDomain " + masterDomain + " --virtualHostName " + domain + \ " --phpVersion '" + phpSelection + "' --ssl " + str(data['ssl']) + " --dkimCheck " + str( @@ -431,7 +431,7 @@ def submitWebsiteDeletion(self, userID=None, data=None): ## Deleting master domain - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " deleteVirtualHostConfigurations --virtualHostName " + websiteName ProcessUtilities.popenExecutioner(execPath) @@ -456,7 +456,7 @@ def submitDomainDeletion(self, userID=None, data=None): else: return ACLManager.loadErrorJson('websiteDeleteStatus', 0) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " deleteDomain --virtualHostName " + websiteName ProcessUtilities.outputExecutioner(execPath) @@ -650,7 +650,7 @@ def saveWebsiteChanges(self, userID=None, data=None): confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + domain completePathToConfigFile = confPath + "/vhost.conf" - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile ProcessUtilities.popenExecutioner(execPath) @@ -708,7 +708,7 @@ def loadDomainHome(self, request=None, userID=None, data=None): ## bw usage calculation try: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str( website.package.bandwidth) @@ -785,7 +785,7 @@ def launchChild(self, request=None, userID=None, data=None): ## bw usage calculation try: - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " findDomainBW --virtualHostName " + self.domain + " --bandwidth " + str( website.package.bandwidth) @@ -854,7 +854,7 @@ def getDataFromLogFile(self, userID=None, data=None): ## get Logs website = Websites.objects.get(domain=self.domain) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " getAccessLogs --path " + fileName + " --page " + str(page) output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -914,7 +914,7 @@ def fetchErrorLogs(self, userID=None, data=None): ## get Logs website = Websites.objects.get(domain=self.domain) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " getErrorLogs --path " + fileName + " --page " + str(page) output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -981,7 +981,7 @@ def saveConfigsToFile(self, userID=None, data=None): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " saveVHostConfigs --path " + filePath + " --tempPath " + tempPath output = ProcessUtilities.outputExecutioner(execPath) @@ -1066,7 +1066,7 @@ def saveRewriteRules(self, userID=None, data=None): ## save configuration data - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " saveRewriteRules --virtualHostName " + self.domain + " --path " + filePath + " --tempPath " + tempPath output = ProcessUtilities.outputExecutioner(execPath, externalApp) @@ -1110,7 +1110,7 @@ def saveSSL(self, userID=None, data=None): ## writing data temporary to file - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " saveSSL --virtualHostName " + self.domain + " --tempKeyPath " + tempKeyPath + " --tempCertPath " + tempCertPath output = ProcessUtilities.outputExecutioner(execPath) @@ -1140,7 +1140,7 @@ def changePHP(self, userID=None, data=None): confPath = virtualHostUtilities.Server_root + "/conf/vhosts/" + self.domain completePathToConfigFile = confPath + "/vhost.conf" - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " changePHP --phpVersion '" + phpVersion + "' --path " + completePathToConfigFile ProcessUtilities.popenExecutioner(execPath) @@ -1173,7 +1173,7 @@ def getWebsiteCron(self, userID=None, data=None): crons = [] - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" execPath = execPath + " getWebsiteCron --externalApp " + website.externalApp f = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -1234,7 +1234,7 @@ def getCronbyLine(self, userID=None, data=None): try: CronUtil.CronPrem(1) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" execPath = execPath + " getWebsiteCron --externalApp " + website.externalApp f = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -1299,7 +1299,7 @@ def saveCronChanges(self, userID=None, data=None): CronUtil.CronPrem(1) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" execPath = execPath + " saveCronChanges --externalApp " + website.externalApp + " --line " + str( line) + " --finalCron '" + finalCron + "'" output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -1339,7 +1339,7 @@ def remCronbyLine(self, userID=None, data=None): CronUtil.CronPrem(1) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" execPath = execPath + " remCronbyLine --externalApp " + website.externalApp + " --line " + str( line) output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -1396,7 +1396,7 @@ def addNewCron(self, userID=None, data=None): finalCron = "%s %s %s %s %s %s" % (minute, hour, monthday, month, weekday, command) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/cronUtil.py" execPath = execPath + " addNewCron --externalApp " + website.externalApp + " --finalCron '" + finalCron + "'" output = ProcessUtilities.outputExecutioner(execPath, website.externalApp) @@ -1445,7 +1445,7 @@ def submitAliasCreation(self, userID=None, data=None): ## Create Configurations - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " createAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --ssl " + str( ssl) + " --sslPath " + sslpath + " --administratorEmail " + admin.email + ' --websiteOwner ' + admin.userName @@ -1490,7 +1490,7 @@ def issueAliasSSL(self, userID=None, data=None): ## Create Configurations - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " issueAliasSSL --masterDomain " + self.domain + " --aliasDomain " + aliasDomain + " --sslPath " + sslpath + " --administratorEmail " + admin.email output = ProcessUtilities.outputExecutioner(execPath) @@ -1525,7 +1525,7 @@ def delateAlias(self, userID=None, data=None): ## Create Configurations - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " deleteAlias --masterDomain " + self.domain + " --aliasDomain " + aliasDomain output = ProcessUtilities.outputExecutioner(execPath) @@ -1557,7 +1557,7 @@ def changeOpenBasedir(self, userID=None, data=None): else: return ACLManager.loadErrorJson('changeOpenBasedir', 0) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " changeOpenBasedir --virtualHostName '" + self.domain + "' --openBasedirValue " + openBasedirValue output = ProcessUtilities.popenExecutioner(execPath) @@ -1801,7 +1801,7 @@ def installJoomla(self, userID=None, data=None): statusFile.writelines('Downloading Joomla Core..,20') statusFile.close() - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " installJoomla --virtualHostName " + domainName + \ " --virtualHostUser " + externalApp + " --path " + finalPath + " --dbName " + dbName + \ @@ -2285,7 +2285,7 @@ def switchServer(self, userID=None, data=None): tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) - execPath = "sudo python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" + execPath = "/usr/local/CyberCP/bin/python2 " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py" execPath = execPath + " switchServer --phpVersion '" + phpVersion + "' --server " + str( server) + " --virtualHostName " + domainName + " --tempStatusPath " + tempStatusPath ProcessUtilities.popenExecutioner(execPath)