diff --git a/apache2/apache2_config.c b/apache2/apache2_config.c index 3ab618a9..ce97950f 100644 --- a/apache2/apache2_config.c +++ b/apache2/apache2_config.c @@ -799,7 +799,8 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, int type, return my_error_msg; } - /* Rules must have uniq ID */ +#ifndef ALLOW_ID_NOT_UNIQUE + /* Rules must have uniq ID */ type_rule = (dcfg->tmp_chain_starter == NULL); #if defined(WITH_LUA) type_rule = (type != RULE_TYPE_LUA && type_rule); @@ -831,6 +832,7 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, int type, // return "ModSecurity: Found another rule with the same id"; } } +#endif /* Create default actionset if one does not already exist. */ if (dcfg->tmp_default_actionset == NULL) { diff --git a/configure.ac b/configure.ac index 0f32b01b..fd576e6e 100644 --- a/configure.ac +++ b/configure.ac @@ -411,6 +411,22 @@ AC_ARG_ENABLE(request-early, request_early='-DREQUEST_EARLY' ]) +# Enable duplicate rules id +AC_ARG_ENABLE(rule-id-validation, + AS_HELP_STRING([--enable-rule-id-validation], + [Forbid duplicate rule ids and missing ones. This is the default]), +[ + if test "$enableval" != "no"; then + unique_id= + else + unique_id="-DALLOW_ID_NOT_UNIQUE" + MODSEC_EXTRA_CFLAGS="$MODSEC_EXTRA_CFLAGS $unique_id" + fi +], +[ + unique_id='' +]) + # Ignore configure errors AC_ARG_ENABLE(errors, AS_HELP_STRING([--disable-errors],