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
fd0f6f45
Commit
fd0f6f45
authored
Dec 12, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 统一arg为public_key
parent
74e8c91e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
app.py
coco/app.py
+2
-0
interface.py
coco/interface.py
+4
-4
No files found.
coco/app.py
View file @
fd0f6f45
...
...
@@ -280,6 +280,8 @@ class Coco:
def
put_command_queue
(
self
,
session
,
_input
,
_output
):
logger
.
debug
(
"Put command data: {} {} {}"
.
format
(
session
,
_input
,
_output
))
if
not
_input
:
return
self
.
_command_queue
.
put
({
"session"
:
session
.
id
,
"input"
:
_input
[:
128
],
...
...
coco/interface.py
View file @
fd0f6f45
...
...
@@ -64,7 +64,7 @@ class SSHInterface(paramiko.ServerInterface):
def
check_auth_publickey
(
self
,
username
,
key
):
key
=
key
.
get_base64
()
valid
=
self
.
validate_auth
(
username
,
key
=
key
)
valid
=
self
.
validate_auth
(
username
,
public_
key
=
key
)
if
not
valid
:
logger
.
debug
(
"Public key auth <
%
s> failed, try to password"
%
username
)
return
paramiko
.
AUTH_FAILED
...
...
@@ -72,10 +72,10 @@ class SSHInterface(paramiko.ServerInterface):
logger
.
debug
(
"Public key auth <
%
s> success"
%
username
)
return
paramiko
.
AUTH_SUCCESSFUL
def
validate_auth
(
self
,
username
,
password
=
""
,
key
=
""
):
def
validate_auth
(
self
,
username
,
password
=
""
,
public_
key
=
""
):
user
,
_
=
self
.
app
.
service
.
authenticate
(
username
,
password
=
password
,
pub
key
=
key
,
remote_addr
=
self
.
request
.
remote_ip
,
login_type
=
"ST"
username
,
password
=
password
,
pub
lic_key
=
public_
key
,
remote_addr
=
self
.
request
.
remote_ip
,
)
if
user
:
...
...
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