Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
134dc0cc
Unverified
Commit
134dc0cc
authored
Sep 04, 2018
by
老广
Committed by
GitHub
Sep 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #96 from jumpserver/dev
Dev
parents
8a60c4eb
5bc3638f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
connection.py
coco/connection.py
+9
-0
sftp.py
coco/sftp.py
+2
-2
No files found.
coco/connection.py
View file @
134dc0cc
...
...
@@ -43,6 +43,7 @@ class SSHConnection:
if
asset
.
domain
:
sock
=
self
.
get_proxy_sock_v2
(
asset
)
try
:
try
:
ssh
.
connect
(
asset
.
ip
,
port
=
asset
.
port
,
username
=
system_user
.
username
,
...
...
@@ -51,6 +52,14 @@ class SSHConnection:
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
,
...
...
coco/sftp.py
View file @
134dc0cc
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment