Merge pull request #95 from jumpserver/IP_get_bug

修复使用反向代理还不使用反向代理获取 remote_ip异常wen问题
pull/99/head
ibuler 2016-02-27 00:23:00 +08:00
commit bf3fb24c3a
2 changed files with 3 additions and 1 deletions

View File

@ -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))

View File

@ -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