(ids) add reloadRules action to api

This commit is contained in:
Ad Schellevis 2016-02-10 18:50:52 +01:00
parent 1e1aae8b57
commit 54f0787c23

View File

@ -205,6 +205,28 @@ class ServiceController extends ApiControllerBase
return array("status" => $status);
}
/**
* flush rule configuration to config and reload suricata ruleset (graceful restart)
* @return array
*/
public function reloadRulesAction()
{
$status = "failed";
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$backend = new Backend();
// flush rule configuration
$bckresult = trim($backend->configdRun("template reload OPNsense.IDS"));
if ($bckresult == "OK") {
$status = $backend->configdRun("ids reload", $detach);
} else {
$status = "template error";
}
}
return array("status" => $status);
}
/**
* query suricata alerts
* @return array