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
93f247c0
Unverified
Commit
93f247c0
authored
Mar 27, 2019
by
老广
Committed by
GitHub
Mar 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #202 from jumpserver/dev
[Bugfix] 修复使用网关失败的bug
parents
5b631ad1
23a5574a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
connection.py
coco/connection.py
+8
-4
No files found.
coco/connection.py
View file @
93f247c0
...
@@ -129,17 +129,21 @@ class SSHConnection:
...
@@ -129,17 +129,21 @@ class SSHConnection:
password
=
gateway
.
password
,
password
=
gateway
.
password
,
pkey
=
gateway
.
private_key_obj
,
pkey
=
gateway
.
private_key_obj
,
timeout
=
config
[
'SSH_TIMEOUT'
])
timeout
=
config
[
'SSH_TIMEOUT'
])
except
:
except
Exception
as
e
:
logger
.
error
(
"Connect gateway error"
)
logger
.
error
(
e
,
exc_info
=
True
)
continue
continue
try
:
try
:
transport
=
ssh
.
get_transport
()
transport
=
ssh
.
get_transport
()
transport
.
set_keep
_
alive
(
20
)
transport
.
set_keepalive
(
20
)
sock
=
transport
.
open_channel
(
sock
=
transport
.
open_channel
(
'direct-tcpip'
,
(
asset
.
ip
,
asset
.
port
),
(
'127.0.0.1'
,
0
)
'direct-tcpip'
,
(
asset
.
ip
,
asset
.
port
),
(
'127.0.0.1'
,
0
)
)
)
break
break
except
:
except
Exception
as
e
:
return
None
logger
.
error
(
"Open gateway channel error"
)
logger
.
error
(
e
,
exc_info
=
True
)
continue
return
sock
return
sock
...
...
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