Commit 6682b5aa authored by ibuler's avatar ibuler

[Update] 修改deny逻辑

parent c7b9474a
......@@ -187,9 +187,6 @@ class BaseServer:
rules = app_service.get_system_user_cmd_filter_rules(
self.system_user.id
)
print(rules)
rules = sorted(rules, key=lambda x: (x.priority, x.action['value']))
print(rules)
return rules
def set_session(self, session):
......@@ -241,10 +238,10 @@ class BaseServer:
return data
for rule in self._cmd_filter_rules:
action, cmd = rule.match(self._input)
if action == rule.ACCEPT:
if action == rule.ALLOW:
break
elif action == rule.DENY:
data = char.CLEAR_LINE_CHAR + b'\r'
data = char.CLEAR_LINE_CHAR + b'\r\n'
msg = _("Command `{}` is forbidden ........").format(cmd)
msg = wr(warning(msg.encode()), before=1, after=1)
self.output_data.append(msg)
......
......@@ -19,7 +19,7 @@ itsdangerous==0.24
Jinja2==2.10
jmespath==0.9.3
jms-storage==0.0.18
jumpserver-python-sdk==0.0.49
jumpserver-python-sdk==0.0.50
MarkupSafe==1.0
oss2==2.4.0
paramiko==2.4.1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment