From 4ef2004abd8c2f8ac4769cb15750b2c68dc17a18 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Tue, 8 Mar 2022 19:26:11 +0500 Subject: [PATCH] bug fix: issues --- WebTerminal/CPWebSocket.py | 38 +++++++++---------- .../baseTemplate/custom-js/system-status.js | 3 +- .../templates/baseTemplate/index.html | 30 +++++++-------- baseTemplate/views.py | 1 + emailMarketing/emailMarketingManager.py | 4 +- filemanager/filemanager.py | 30 ++++----------- plogical/upgrade.py | 2 +- .../baseTemplate/custom-js/system-status.js | 3 +- 8 files changed, 49 insertions(+), 62 deletions(-) diff --git a/WebTerminal/CPWebSocket.py b/WebTerminal/CPWebSocket.py index f7496c359..71f025388 100644 --- a/WebTerminal/CPWebSocket.py +++ b/WebTerminal/CPWebSocket.py @@ -145,22 +145,22 @@ if __name__ == "__main__": writeToFile.write(str(os.getpid())) writeToFile.close() - SSHServer.findSSHPort() - - http_server = tornado.httpserver.HTTPServer(application, ssl_options={ - "certfile": "/usr/local/lscp/conf/cert.pem", - "keyfile": "/usr/local/lscp/conf/key.pem", - }, ) - - ADDR = '0.0.0.0' - http_server.listen(5678, ADDR) - print('*** Websocket Server Started at %s***' % ADDR) - - import signal - def close_sig_handler(signal, frame): - http_server.stop() - sys.exit() - - signal.signal(signal.SIGINT, close_sig_handler) - - tornado.ioloop.IOLoop.instance().start() \ No newline at end of file + # SSHServer.findSSHPort() + # + # http_server = tornado.httpserver.HTTPServer(application, ssl_options={ + # "certfile": "/usr/local/lscp/conf/cert.pem", + # "keyfile": "/usr/local/lscp/conf/key.pem", + # }, ) + # + # ADDR = '0.0.0.0' + # http_server.listen(5678, ADDR) + # print('*** Websocket Server Started at %s***' % ADDR) + # + # import signal + # def close_sig_handler(signal, frame): + # http_server.stop() + # sys.exit() + # + # signal.signal(signal.SIGINT, close_sig_handler) + # + # tornado.ioloop.IOLoop.instance().start() \ No newline at end of file diff --git a/baseTemplate/static/baseTemplate/custom-js/system-status.js b/baseTemplate/static/baseTemplate/custom-js/system-status.js index 26e282dde..b24357fb4 100644 --- a/baseTemplate/static/baseTemplate/custom-js/system-status.js +++ b/baseTemplate/static/baseTemplate/custom-js/system-status.js @@ -653,4 +653,5 @@ app.controller('versionManagment', function ($scope, $http, $timeout) { }; -}); \ No newline at end of file +}); + diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 18c90e470..3af0772fd 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -736,21 +736,21 @@
  • {% trans "Server" %}
  • -
  • - - - {% trans "Web Terminal" %} - {% trans "NEW" %} - - -
  • +{#
  • #} +{# #} +{# #} +{# {% trans "Web Terminal" %}#} +{# {% trans "NEW" %}#} +{# #} +{# #} +{#
  • #}
  • diff --git a/baseTemplate/views.py b/baseTemplate/views.py index e7adc0a61..432fe70ee 100755 --- a/baseTemplate/views.py +++ b/baseTemplate/views.py @@ -34,6 +34,7 @@ def getAdminStatus(request): val = request.session['userID'] currentACL = ACLManager.loadedACL(val) + if os.path.exists('/home/cyberpanel/postfix'): currentACL['emailAsWhole'] = 1 else: diff --git a/emailMarketing/emailMarketingManager.py b/emailMarketing/emailMarketingManager.py index c5c623a30..78df0e06a 100755 --- a/emailMarketing/emailMarketingManager.py +++ b/emailMarketing/emailMarketingManager.py @@ -141,8 +141,8 @@ class EmailMarketingManager: if emACL.checkIfEMEnabled(admin.userName) == 0: return ACLManager.loadErrorJson() - em = EM('createEmailList', extraArgs) - em.start() + # em = EM('createEmailList', extraArgs) + # em.start() time.sleep(2) diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index a0a002a03..df8195510 100755 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -546,9 +546,11 @@ class FileManager: finalData = {} finalData['status'] = 1 - tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) self.data['home'] = '/home/%s' % (self.data['domainName']) + ACLManager.CreateSecureDir() + tempPath = '%s/%s' % ('/usr/local/CyberCP/tmp', str(randint(1000, 9999))) + domainName = self.data['domainName'] website = Websites.objects.get(domain=domainName) @@ -556,31 +558,13 @@ class FileManager: writeToFile.write(self.data['fileContent'].encode('utf-8')) writeToFile.close() - command = 'ls -la %s' % (self.data['fileName']) - output = ProcessUtilities.outputExecutioner(command) - - if output.find('lrwxrwxrwx') > -1 and output.find('->') > -1: - return self.ajaxPre(0, 'File exists and is symlink.') - - if ACLManager.commandInjectionCheck(self.data['fileName']) == 1: - return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!') - - if self.data['fileName'].find(self.data['home']) == -1 or self.data['fileName'].find('..') > -1: - return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!') - - command = 'stat -c "%%a" %s' % (self.returnPathEnclosed(self.data['fileName'])) - currentMode = ProcessUtilities.outputExecutioner(command).strip('\n') - - command = 'mv ' + tempPath + ' ' + self.returnPathEnclosed(self.data['fileName']) + command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, tempPath) ProcessUtilities.executioner(command) - command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, self.data['fileName']) - ProcessUtilities.executioner(command) + command = 'cp %s %s' % (tempPath, self.returnPathEnclosed(self.data['fileName'])) + ProcessUtilities.executioner(command, website.externalApp) - command = 'chmod %s %s' % (currentMode, self.returnPathEnclosed(self.data['fileName'])) - ProcessUtilities.executioner(command) - - self.changeOwner(self.data['fileName']) + os.remove(tempPath) json_data = json.dumps(finalData) return HttpResponse(json_data) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index 2afe39a29..a103c14ac 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2660,7 +2660,7 @@ vmail command = 'csf -uf' Upgrade.executioner(command, 'fix csf if there', 0) - command = 'systemctl start cpssh' + command = 'systemctl stop cpssh' Upgrade.executioner(command, 'fix csf if there', 0) Upgrade.AutoUpgradeAcme() Upgrade.installCLScripts() diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index 26e282dde..b24357fb4 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -653,4 +653,5 @@ app.controller('versionManagment', function ($scope, $http, $timeout) { }; -}); \ No newline at end of file +}); +