Commit 38cae93c authored by liuzheng712's avatar liuzheng712

Merge branch 'dev' of github.com:jumpserver/coco into dev

parents 3b277ec4 aa72fc59
...@@ -280,6 +280,8 @@ class Coco: ...@@ -280,6 +280,8 @@ class Coco:
def put_command_queue(self, session, _input, _output): def put_command_queue(self, session, _input, _output):
logger.debug("Put command data: {} {} {}".format(session, _input, _output)) logger.debug("Put command data: {} {} {}".format(session, _input, _output))
if not _input:
return
self._command_queue.put({ self._command_queue.put({
"session": session.id, "session": session.id,
"input": _input[:128], "input": _input[:128],
......
...@@ -64,7 +64,7 @@ class SSHInterface(paramiko.ServerInterface): ...@@ -64,7 +64,7 @@ class SSHInterface(paramiko.ServerInterface):
def check_auth_publickey(self, username, key): def check_auth_publickey(self, username, key):
key = key.get_base64() key = key.get_base64()
valid = self.validate_auth(username, key=key) valid = self.validate_auth(username, public_key=key)
if not valid: if not valid:
logger.debug("Public key auth <%s> failed, try to password" % username) logger.debug("Public key auth <%s> failed, try to password" % username)
return paramiko.AUTH_FAILED return paramiko.AUTH_FAILED
...@@ -72,10 +72,10 @@ class SSHInterface(paramiko.ServerInterface): ...@@ -72,10 +72,10 @@ class SSHInterface(paramiko.ServerInterface):
logger.debug("Public key auth <%s> success" % username) logger.debug("Public key auth <%s> success" % username)
return paramiko.AUTH_SUCCESSFUL return paramiko.AUTH_SUCCESSFUL
def validate_auth(self, username, password="", key=""): def validate_auth(self, username, password="", public_key=""):
user, _ = self.app.service.authenticate( user, _ = self.app.service.authenticate(
username, password=password, pubkey=key, username, password=password, public_key=public_key,
remote_addr=self.request.remote_ip, login_type="ST" remote_addr=self.request.remote_ip,
) )
if user: if user:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment