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
f6ca83c2
Commit
f6ca83c2
authored
Jul 02, 2018
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/jumpserver/coco
into dev
parents
639f8786
f46cd8cd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
connection.py
coco/connection.py
+2
-1
httpd.py
coco/httpd.py
+16
-9
requirements.txt
requirements/requirements.txt
+1
-1
No files found.
coco/connection.py
View file @
f6ca83c2
...
...
@@ -110,7 +110,8 @@ class SSHConnection:
ssh
.
connect
(
gateway
.
ip
,
port
=
gateway
.
port
,
username
=
gateway
.
username
,
password
=
gateway
.
password
,
pkey
=
gateway
.
private_key_obj
)
pkey
=
gateway
.
private_key_obj
,
timeout
=
TIMEOUT
)
except
(
paramiko
.
AuthenticationException
,
paramiko
.
BadAuthenticationType
,
SSHException
):
...
...
coco/httpd.py
View file @
f6ca83c2
...
...
@@ -34,6 +34,10 @@ class BaseNamespace(Namespace):
user
=
app_service
.
check_user_cookie
(
session_id
,
csrf_token
)
if
token
:
user
=
app_service
.
check_user_with_token
(
token
)
msg
=
"Get current user: session_id<{}> token<{}> => {}"
.
format
(
session_id
,
token
,
user
)
logger
.
debug
(
msg
)
return
user
...
...
@@ -149,27 +153,30 @@ class ProxyNamespace(BaseNamespace):
token
=
message
.
get
(
'token'
,
None
)
secret
=
message
.
get
(
'secret'
,
None
)
win_size
=
message
.
get
(
'size'
,
(
80
,
24
))
room
=
self
.
new_room
()
self
.
emit
(
'room'
,
{
'room'
:
room
[
"id"
],
'secret'
:
secret
})
join_room
(
room
[
'id'
])
if
not
token
or
not
secret
:
logger
.
debug
(
"Token or secret is None: {}"
.
format
(
token
,
secret
)
)
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
room
[
"id"
]}
)
msg
=
"Token or secret is None: {} {}"
.
format
(
token
,
secret
)
logger
.
error
(
msg
)
self
.
emit
(
'data'
,
{
'data'
:
msg
,
'room'
:
room
[
'id'
]},
room
=
room
[
'id'
]
)
self
.
emit
(
'disconnect'
)
return
None
return
info
=
app_service
.
get_token_asset
(
token
)
logger
.
debug
(
info
)
if
not
info
:
logger
.
debug
(
"Token info is None"
)
self
.
emit
(
'data'
,
{
'data'
:
"
\n
Operation not permitted!"
,
'room'
:
room
[
"id"
]}
)
msg
=
"Token info is none, maybe token expired"
logger
.
error
(
msg
)
self
.
emit
(
'data'
,
{
'data'
:
msg
,
'room'
:
room
[
'id'
]},
room
=
room
[
'id'
]
)
self
.
emit
(
'disconnect'
)
return
None
user_id
=
info
.
get
(
'user'
,
None
)
self
.
current_user
=
app_service
.
get_user_profile
(
user_id
)
room
[
"request"
]
.
user
=
self
.
current_user
#
room["request"].user = self.current_user
self
.
on_host
({
'secret'
:
secret
,
'uuid'
:
info
[
'asset'
],
...
...
@@ -203,7 +210,7 @@ class ProxyNamespace(BaseNamespace):
def
on_logout
(
self
,
room_id
):
room
=
self
.
connections
.
get
(
request
.
sid
,
{})
.
get
(
room_id
)
if
room
:
room
[
"proxy"
]
.
close
()
room
.
get
(
"proxy"
)
and
room
[
"proxy"
]
.
close
()
self
.
close_room
(
room_id
)
del
self
.
connections
[
request
.
sid
][
room_id
]
del
room
...
...
requirements/requirements.txt
View file @
f6ca83c2
...
...
@@ -18,7 +18,7 @@ idna==2.6
itsdangerous==0.24
Jinja2==2.10
jmespath==0.9.3
jms-storage==0.0.1
7
jms-storage==0.0.1
8
jumpserver-python-sdk==0.0.43
MarkupSafe==1.0
oss2==2.4.0
...
...
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