mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-09 03:09:34 +00:00
feat: 系统设置-安全设置 支持配置 作业中心命令黑名单
This commit is contained in:
committed by
Jiangjie.Bai
parent
51d6090fdc
commit
a0bb25e558
@@ -9,9 +9,6 @@ from .callback import DefaultCallback
|
||||
|
||||
class AdHocRunner:
|
||||
cmd_modules_choices = ('shell', 'raw', 'command', 'script', 'win_shell')
|
||||
cmd_blacklist = [
|
||||
"reboot", 'shutdown', 'poweroff', 'halt', 'dd', 'half', 'top'
|
||||
]
|
||||
|
||||
def __init__(self, inventory, module, module_args='', pattern='*', project_dir='/tmp/', extra_vars={},
|
||||
dry_run=False, timeout=-1):
|
||||
@@ -30,7 +27,7 @@ class AdHocRunner:
|
||||
def check_module(self):
|
||||
if self.module not in self.cmd_modules_choices:
|
||||
return
|
||||
if self.module_args and self.module_args.split()[0] in self.cmd_blacklist:
|
||||
if self.module_args and self.module_args.split()[0] in settings.SECURITY_COMMAND_BLACKLIST:
|
||||
raise Exception("command not allowed: {}".format(self.module_args[0]))
|
||||
|
||||
def run(self, verbosity=0, **kwargs):
|
||||
|
Reference in New Issue
Block a user