From 5098b1c6962863eab0003a2770f73279d46a1d03 Mon Sep 17 00:00:00 2001 From: liuzheng712 Date: Fri, 26 Feb 2016 22:48:07 +0800 Subject: [PATCH 1/2] fix(run_websocket.py): remote IP get bug when use nginx self.request.headers.get(X-Real-IP) will get real remote IP, self.request.remote_ip will get 127.0.0.1 ; if not it will git null, so need to use self.request.remote_ip for get the ip --- run_websocket.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run_websocket.py b/run_websocket.py index ddd724697..25a264b19 100755 --- a/run_websocket.py +++ b/run_websocket.py @@ -317,6 +317,8 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler): self.term = WebTty(self.user, asset, login_role, login_type='web') # self.term.remote_ip = self.request.remote_ip self.term.remote_ip = self.request.headers.get("X-Real-IP") + if not self.term.remote_ip: + self.term.remote_ip = self.request.remote_ip self.ssh = self.term.get_connection() self.channel = self.ssh.invoke_shell(term='xterm') WebTerminalHandler.tasks.append(MyThread(target=self.forward_outbound)) From ba8d808cd90741ee2305cbc6003f464bd80fb7c4 Mon Sep 17 00:00:00 2001 From: liuzheng712 Date: Fri, 26 Feb 2016 23:09:19 +0800 Subject: [PATCH 2/2] fix(service.sh): annotate django runserver --- service.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service.sh b/service.sh index d2a9d06c0..202096642 100755 --- a/service.sh +++ b/service.sh @@ -30,7 +30,7 @@ start() { echo "jumpserver is running..." success "$jump_start" else - daemon python $base_dir/manage.py runserver 0.0.0.0:80 &>> /tmp/jumpserver.log 2>&1 & +# daemon python $base_dir/manage.py runserver 0.0.0.0:80 &>> /tmp/jumpserver.log 2>&1 & daemon python $base_dir/manage.py crontab add &>> /tmp/jumpserver.log 2>&1 daemon python $base_dir/run_websocket.py &> /dev/null 2>&1 & sleep 4