mirror of https://github.com/jumpserver/jumpserver
fix: adhoc execute alert msg
parent
96eadf060c
commit
63824d3491
|
@ -39,9 +39,10 @@ class AdHocRunner:
|
||||||
def check_module(self):
|
def check_module(self):
|
||||||
if self.module not in self.cmd_modules_choices:
|
if self.module not in self.cmd_modules_choices:
|
||||||
return
|
return
|
||||||
if self.module_args and self.module_args.split()[0] in settings.SECURITY_COMMAND_BLACKLIST:
|
command = self.module_args
|
||||||
|
if command and set(command.split()).intersection(set(settings.SECURITY_COMMAND_BLACKLIST)):
|
||||||
raise CommandInBlackListException(
|
raise CommandInBlackListException(
|
||||||
"Command is rejected by black list: {}".format(self.module_args.split()[0]))
|
"Command is rejected by black list: {}".format(self.module_args))
|
||||||
|
|
||||||
def set_local_connection(self):
|
def set_local_connection(self):
|
||||||
if self.job_module in self.need_local_connection_modules_choices:
|
if self.job_module in self.need_local_connection_modules_choices:
|
||||||
|
|
|
@ -478,6 +478,16 @@ class JobExecution(JMSOrgBaseModel):
|
||||||
for acl in acls:
|
for acl in acls:
|
||||||
if self.match_command_group(acl, asset):
|
if self.match_command_group(acl, asset):
|
||||||
break
|
break
|
||||||
|
command = self.current_job.args
|
||||||
|
if command and set(command.split()).intersection(set(settings.SECURITY_COMMAND_BLACKLIST)):
|
||||||
|
CommandExecutionAlert({
|
||||||
|
"assets": self.current_job.assets.all(),
|
||||||
|
"input": self.material,
|
||||||
|
"risk_level": RiskLevelChoices.reject,
|
||||||
|
"user": self.creator,
|
||||||
|
}).publish_async()
|
||||||
|
raise CommandInBlackListException(
|
||||||
|
"Command is rejected by black list: {}".format(self.current_job.args))
|
||||||
|
|
||||||
def check_danger_keywords(self):
|
def check_danger_keywords(self):
|
||||||
lines = self.job.playbook.check_dangerous_keywords()
|
lines = self.job.playbook.check_dangerous_keywords()
|
||||||
|
|
Loading…
Reference in New Issue