Informs problems and successfully loaded external resources during reload

Resources load mechanism as the SecRemoteRuels were not showing information
about the loaded rules while Apache was reloaded. This patch add such
information to reload in the same way that it was showing on restart.
This commit is contained in:
Felipe Zimmerle 2014-11-28 13:39:46 -08:00
parent fe22446bdd
commit dc81e4f852
3 changed files with 22 additions and 8 deletions

View File

@ -1,6 +1,8 @@
DD mmm YYYY - 2.9.????? (To be released) DD mmm YYYY - 2.9.????? (To be released)
----------------------- -----------------------
* Informs about external resources loaded/failed while reloading Apache.
[ModSecurity team]
* Adds missing 'ModSecurity:' prefix in some warnings messages. * Adds missing 'ModSecurity:' prefix in some warnings messages.
[Walter Hop and ModSecurity team] [Walter Hop and ModSecurity team]
* Refactoring external resources download warn messages. Holding the message * Refactoring external resources download warn messages. Holding the message

View File

@ -762,14 +762,15 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
"it by set SecStatusEngine to On."); "it by set SecStatusEngine to On.");
} }
#endif #endif
if (remote_rules_fail_message != NULL)
{
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: " \
"Problems loading external resources: %s",
remote_rules_fail_message);
} }
/**
* Checking if it is not the first time that we are in this very function.
* We want to show the messages below during the start and the reload.
*
*/
if (first_time != 1)
{
#ifdef WITH_REMOTE_RULES #ifdef WITH_REMOTE_RULES
if (remote_rules_server != NULL) if (remote_rules_server != NULL)
{ {
@ -789,6 +790,12 @@ static int hook_post_config(apr_pool_t *mp, apr_pool_t *mp_log, apr_pool_t *mp_t
} }
} }
#endif #endif
if (remote_rules_fail_message != NULL)
{
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, NULL, "ModSecurity: " \
"Problems loading external resources: %s",
remote_rules_fail_message);
}
} }
srand((unsigned int)(time(NULL) * getpid())); srand((unsigned int)(time(NULL) * getpid()));

View File

@ -1293,7 +1293,12 @@ static int msre_op_pmFromFile_param_init(msre_rule *rule, char **error_msg) {
res = msc_remote_download_content(rule->ruleset->mp, fn, NULL, res = msc_remote_download_content(rule->ruleset->mp, fn, NULL,
&chunk, error_msg); &chunk, error_msg);
if (res == -1) if (res == -2)
{
/* If download failed but SecRemoteRulesFailAction is set to Warn. */
return 1;
}
else if (res < 0)
{ {
return 0; return 0;
} }