From 66c16a712b160f10ddd1676ec993b37b92a903a7 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 6 Nov 2019 14:02:30 +0500 Subject: [PATCH] fix csf menu while upgrade --- CyberCP/secMiddleware.py | 7 +++-- .../IncBackups/restoreRemoteBackups.html | 2 +- WebTerminal/CPWebSocket.py | 29 +++++++++++-------- plogical/upgrade.py | 3 ++ 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/CyberCP/secMiddleware.py b/CyberCP/secMiddleware.py index 518c06b05..7616412a5 100755 --- a/CyberCP/secMiddleware.py +++ b/CyberCP/secMiddleware.py @@ -95,9 +95,10 @@ class secMiddleware: response = self.get_response(request) - + + #response['Strict-Transport-Security'] = "max-age=31536000; includeSubDomains; preload" response['X-XSS-Protection'] = "1; mode=block" - response['Strict-Transport-Security'] = "max-age=31536000; includeSubDomains; preload" - response['X-Frame-Options'] = "DENY" + response['X-Frame-Options'] = "sameorigin" + response['Content-Security-Policy'] = "frame-ancestors jsdelivr.com" return response diff --git a/IncBackups/templates/IncBackups/restoreRemoteBackups.html b/IncBackups/templates/IncBackups/restoreRemoteBackups.html index 4a9f75a5a..b9e6b9228 100755 --- a/IncBackups/templates/IncBackups/restoreRemoteBackups.html +++ b/IncBackups/templates/IncBackups/restoreRemoteBackups.html @@ -11,7 +11,7 @@

{% trans "Restore Remote Incremental Backups" %} - {% trans "Backup Docs" %} diff --git a/WebTerminal/CPWebSocket.py b/WebTerminal/CPWebSocket.py index 934af19ea..42f30fdb9 100644 --- a/WebTerminal/CPWebSocket.py +++ b/WebTerminal/CPWebSocket.py @@ -51,18 +51,21 @@ class SSHServer(multi.Thread): def recvData(self): while True: try: - if os.path.exists(self.websocket.verifyPath): - if self.websocket.filePassword == self.websocket.filePassword: - if self.shell.recv_ready(): - if self.color == 0: - text = '%sEnjoy your accelerated Internet by CyberPanel and LiteSpeed%s' % (SSHServer.OKGREEN, SSHServer.ENDC) - nText = 'Enjoy your accelerated Internet by CyberPanel' - self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8").replace(nText, text)) - self.color = 1 + if self.websocket.running: + if os.path.exists(self.websocket.verifyPath): + if self.websocket.filePassword == self.websocket.password: + if self.shell.recv_ready(): + if self.color == 0: + text = '%sEnjoy your accelerated Internet by CyberPanel and LiteSpeed%s' % (SSHServer.OKGREEN, SSHServer.ENDC) + nText = 'Enjoy your accelerated Internet by CyberPanel' + self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8").replace(nText, text)) + self.color = 1 + else: + self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8")) else: - self.websocket.sendMessage(self.shell.recv(9000).decode("utf-8")) - else: - time.sleep(0.01) + time.sleep(0.01) + else: + return 0 except BaseException, msg: time.sleep(0.1) @@ -84,12 +87,13 @@ class WebTerminalServer(WebSocket): self.filePassword = open(self.verifyPath, 'r').read() else: if os.path.exists(self.verifyPath): - if self.filePassword == self.filePassword: + if self.filePassword == self.password: self.shell.send(str(data['data'])) except: pass def handleConnected(self): + self.running = 1 self.sh = SSHServer(self) self.shell = self.sh.shell self.sh.start() @@ -97,6 +101,7 @@ class WebTerminalServer(WebSocket): def handleClose(self): try: os.remove(self.verifyPath) + self.running = 0 except: pass diff --git a/plogical/upgrade.py b/plogical/upgrade.py index b099e6209..7ba931315 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2011,6 +2011,9 @@ failovermethod=priority except: pass + command = 'csf -uf' + Upgrade.executioner(command, 'fix csf if there', 0) + Upgrade.stdOut("Upgrade Completed.")