Unverified Commit 134dc0cc authored by 老广's avatar 老广 Committed by GitHub

Merge pull request #96 from jumpserver/dev

Dev
parents 8a60c4eb 5bc3638f
......@@ -44,13 +44,22 @@ class SSHConnection:
sock = self.get_proxy_sock_v2(asset)
try:
ssh.connect(
asset.ip, port=asset.port, username=system_user.username,
password=system_user.password, pkey=system_user.private_key,
timeout=config['SSH_TIMEOUT'],
compress=True, auth_timeout=config['SSH_TIMEOUT'],
look_for_keys=False, sock=sock
)
try:
ssh.connect(
asset.ip, port=asset.port, username=system_user.username,
password=system_user.password, pkey=system_user.private_key,
timeout=config['SSH_TIMEOUT'],
compress=True, auth_timeout=config['SSH_TIMEOUT'],
look_for_keys=False, sock=sock
)
except paramiko.AuthenticationException:
# 思科设备不支持秘钥登陆,提供秘钥,必然失败
ssh.connect(
asset.ip, port=asset.port, username=system_user.username,
password=system_user.password, timeout=config['SSH_TIMEOUT'],
compress=True, auth_timeout=config['SSH_TIMEOUT'],
look_for_keys=False, sock=sock, allow_agent=False,
)
transport = ssh.get_transport()
transport.set_keepalive(300)
except (paramiko.AuthenticationException,
......
......@@ -98,11 +98,11 @@ class SFTPServer(paramiko.SFTPServerInterface):
asset = self.hosts.get(host)
date_start = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") + " +0000",
data = {
"user": self.server.request.user.username,
"user": self.server.connection.user.username,
"asset": host,
"org_id": asset.org_id,
"system_user": su,
"remote_addr": self.server.request.addr[0],
"remote_addr": self.server.connection.addr[0],
"operate": operate,
"filename": filename or rpath,
"date_start": date_start,
......
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