fix(run_websocket.py): get real ip from headers

pull/87/head
liuzheng712 2016-02-25 22:43:52 +08:00
parent 5fb5c1bb40
commit 1816723f16
1 changed files with 2 additions and 1 deletions

View File

@ -315,7 +315,8 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
logger.debug('Websocket: request web terminal Host: %s User: %s Role: %s' % (asset.hostname, self.user.username,
login_role.name))
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.remote_ip
self.term.remote_ip = self.request.headers.get("X-Real_IP")
self.ssh = self.term.get_connection()
self.channel = self.ssh.invoke_shell(term='xterm')
WebTerminalHandler.tasks.append(MyThread(target=self.forward_outbound))