From c48ed354c7621f6cea86f9acbf77c079b5411c6f Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Tue, 13 Apr 2021 20:18:46 +0200 Subject: [PATCH] ids.cgi: Regenerate ruleset if a provider get re-enabled. Otherwise it could happen, that there are no rules files for this specific provider. Signed-off-by: Stefan Schantl --- html/cgi-bin/ids.cgi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index cb79f66d2d..65e2a77f5b 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -849,6 +849,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) { my %used_providers = (); my $provider_includes_action; + # Value if oinkmaster has to be executed. + my $oinkmaster = "False"; + # Only go further, if an ID has been passed. if ($cgiparams{'ID'}) { # Assign the given ID. @@ -877,6 +880,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) { # Set the provider includes action to "add". $provider_includes_action = "add"; + + # This operation requires to launch oinkmaster. + $oinkmaster = "True"; } # Modify the status of the existing entry. @@ -895,6 +901,15 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) { # add or remove the provider. &IDS::alter_oinkmaster_provider_includes_file($provider_includes_action, $provider_handle); + # Check if oinkmaster has to be executed. + if ($oinkmaster eq "True") { + # Lock the webpage and print message. + &working_notice("$Lang::tr{'ids apply ruleset changes'}"); + + # Launch oinkmaster. + &IDS::oinkmaster(); + } + # Check if the IDS is running. if(&IDS::ids_is_running()) { # Gather the amount of enabled providers (elements in the array). @@ -914,6 +929,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) { # Undefine providers flag. undef($cgiparams{'PROVIDERS'}); + + # Reload page. + &reload(); } ## Remove provider from the list of used providers. -- 2.39.5