mirror of https://github.com/jumpserver/jumpserver
fix 加密bug
parent
a7a030fedd
commit
17ccac92ee
|
@ -104,6 +104,7 @@ def log_record(request):
|
|||
return HttpResponse('无日志记录!')
|
||||
|
||||
|
||||
@require_role('user')
|
||||
def get_role_name(request):
|
||||
asset_id = request.GET.get('id', 9999)
|
||||
asset = get_object(Asset, id=asset_id)
|
||||
|
@ -113,9 +114,10 @@ def get_role_name(request):
|
|||
return HttpResponse('error')
|
||||
|
||||
|
||||
@require_role()
|
||||
@require_role('user')
|
||||
def web_terminal(request):
|
||||
asset_id = request.GET.get('id')
|
||||
web_terminal_uri = 'ws://%s/terminal?id=%s&role=dev' % (WEB_SOCKET_HOST, asset_id)
|
||||
role_name = request.GET.get('role')
|
||||
web_terminal_uri = 'ws://%s/terminal?id=%s&role=%s' % (WEB_SOCKET_HOST, asset_id, role_name)
|
||||
return render_to_response('jlog/web_terminal.html', locals())
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ def get_asset_info(asset):
|
|||
else:
|
||||
info['port'] = asset.port
|
||||
info['username'] = asset.username
|
||||
info['password'] = asset.password
|
||||
info['password'] = CRYPTOR.decrypt(asset.password)
|
||||
|
||||
return info
|
||||
|
||||
|
|
|
@ -257,12 +257,16 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
|
|||
login_role = role
|
||||
break
|
||||
if not login_role:
|
||||
logger.warning('Websocket: Not that Role %s for Host: %s User: %s ' % (role_name, asset.name,
|
||||
logger.warning('Websocket: Not that Role %s for Host: %s User: %s ' % (role_name, asset.hostname,
|
||||
self.user.username))
|
||||
self.close()
|
||||
return
|
||||
logger.debug('Websocket: request web terminal Host: %s User: %s Role: %s' % ())
|
||||
# Todo: 判断
|
||||
else:
|
||||
logger.warning('Websocket: No that Host: %s User: %s ' % (asset_id, self.user.username))
|
||||
self.close()
|
||||
return
|
||||
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, self.asset, login_role)
|
||||
self.term.get_connection()
|
||||
self.term.channel = self.term.ssh.invoke_shell(term='xterm')
|
||||
|
|
Loading…
Reference in New Issue