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
beea715b
Unverified
Commit
beea715b
authored
Dec 12, 2018
by
老广
Committed by
GitHub
Dec 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #135 from jumpserver/dev
Dev
parents
572e8551
42fbefd0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
connection.py
coco/connection.py
+9
-5
connector.py
coco/httpd/elfinder/connector.py
+1
-0
No files found.
coco/connection.py
View file @
beea715b
...
...
@@ -37,12 +37,16 @@ class SSHConnection:
ssh
=
paramiko
.
SSHClient
()
ssh
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
sock
=
None
error
=
''
if
not
system_user
.
password
and
not
system_user
.
private_key
:
self
.
get_system_user_auth
(
system_user
)
if
asset
.
domain
:
sock
=
self
.
get_proxy_sock_v2
(
asset
)
if
not
sock
:
error
=
'Connect gateway failed;'
logger
.
error
(
error
)
try
:
try
:
...
...
@@ -81,9 +85,9 @@ class SSHConnection:
system_user
.
username
,
asset
.
ip
,
asset
.
port
,
password_short
,
key_fingerprint
,
))
return
None
,
None
,
str
(
e
)
return
None
,
None
,
error
+
'
\n
'
+
str
(
e
)
except
(
socket
.
error
,
TimeoutError
)
as
e
:
return
None
,
None
,
str
(
e
)
return
None
,
None
,
error
+
'
\n
'
+
str
(
e
)
return
ssh
,
sock
,
None
def
get_transport
(
self
,
asset
,
system_user
):
...
...
@@ -126,9 +130,9 @@ class SSHConnection:
password
=
gateway
.
password
,
pkey
=
gateway
.
private_key_obj
,
timeout
=
config
[
'SSH_TIMEOUT'
])
except
(
paramiko
.
AuthenticationException
,
paramiko
.
BadAuthenticationType
,
SSHException
):
except
(
paramiko
.
AuthenticationException
,
paramiko
.
BadAuthenticationType
,
SSHException
,
socket
.
error
):
continue
sock
=
ssh
.
get_transport
()
.
open_channel
(
'direct-tcpip'
,
(
asset
.
ip
,
asset
.
port
),
(
'127.0.0.1'
,
0
)
...
...
coco/httpd/elfinder/connector.py
View file @
beea715b
...
...
@@ -136,6 +136,7 @@ class ElFinderConnector:
return
cmd
else
:
self
.
response
[
'error'
]
=
'No valid command found'
return
None
,
None
def
run
(
self
,
request
):
""" Main entry point for running commands. Attemps to run a command
...
...
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