Adds the SecRemoteRulesFailAction directive

This directive allows the user to set a default action whenever the
SecRemoteRules failed to download a set of rules. Current the supported
values are: Warn and Abort. By default `Abort' is selected.
This commit is contained in:
Felipe Zimmerle
2014-11-11 14:02:00 -08:00
parent 9b836b652a
commit 38b9924705
4 changed files with 61 additions and 3 deletions

View File

@@ -2213,6 +2213,28 @@ static const char *cmd_rule_engine(cmd_parms *cmd, void *_dcfg, const char *p1)
return NULL;
}
static const char *cmd_remote_rules_fail(cmd_parms *cmd, void *_dcfg, const char *p1)
{
directory_config *dcfg = (directory_config *)_dcfg;
if (dcfg == NULL) return NULL;
if (strncasecmp(p1, "warn", 4) == 0)
{
remote_rules_fail_action = REMOTE_RULES_WARN_ON_FAIL;
}
else if (strncasecmp(p1, "abort", 5) == 0)
{
remote_rules_fail_action = REMOTE_RULES_ABORT_ON_FAIL;
}
else
{
return apr_psprintf(cmd->pool, "ModSecurity: Invalid value for " \
"SecRemoteRulesFailAction, expected: Abort or Warn.");
}
return NULL;
}
static const char *cmd_remote_rules(cmd_parms *cmd, void *_dcfg, const char *p1,
const char *p2)
{
@@ -3552,6 +3574,15 @@ const command_rec module_directives[] = {
"key and URI to the remote rules"
),
AP_INIT_TAKE1 (
"SecRemoteRulesFailAction",
cmd_remote_rules_fail,
NULL,
CMD_SCOPE_ANY,
"Abort or Warn"
),
AP_INIT_TAKE1 (
"SecXmlExternalEntity",
cmd_xml_external_entity,