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
52eb1c4f
Commit
52eb1c4f
authored
Jul 02, 2019
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 命令过滤异常添加warning日志;优化sftp action校验
parent
6143be4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
models.py
coco/models.py
+9
-0
sftp.py
coco/sftp.py
+1
-2
No files found.
coco/models.py
View file @
52eb1c4f
...
...
@@ -261,6 +261,15 @@ class BaseServer(object):
msg
=
_
(
"Command `{}` is forbidden ........"
)
.
format
(
cmd
)
data
=
self
.
command_forbidden
(
msg
)
break
elif
action
==
rule
.
ERROR
:
msg
=
"Command filter check exceptions "
\
"(for safety, check for consistency of rule type "
\
"and content in command filter)"
logger
.
warning
(
msg
)
_filter
=
"Command filter rule: {}"
.
format
(
rule
.
content
.
replace
(
'
\r\n
'
,
' '
)
)
logger
.
warning
(
_filter
)
return
data
def
command_forbidden
(
self
,
msg
):
...
...
coco/sftp.py
View file @
52eb1c4f
...
...
@@ -13,7 +13,6 @@ from .service import app_service
from
.connection
import
SSHConnection
from
.const
import
(
PERMS_ACTION_NAME_DOWNLOAD_FILE
,
PERMS_ACTION_NAME_UPLOAD_FILE
,
PERMS_ACTION_NAME_ALL
,
)
CURRENT_DIR
=
os
.
path
.
dirname
(
__file__
)
...
...
@@ -267,7 +266,7 @@ class SFTPServer(paramiko.SFTPServerInterface):
@staticmethod
def
validate_permission
(
system_user
,
action
):
check_actions
=
[
PERMS_ACTION_NAME_ALL
,
action
]
check_actions
=
[
action
]
granted_actions
=
getattr
(
system_user
,
'actions'
,
[])
actions
=
list
(
set
(
granted_actions
)
.
intersection
(
set
(
check_actions
)))
return
bool
(
actions
)
...
...
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