]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids.cgi: Regenerate ruleset if a provider get re-enabled.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 13 Apr 2021 18:18:46 +0000 (20:18 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 19 Dec 2021 12:23:45 +0000 (13:23 +0100)
Otherwise it could happen, that there are no rules files for this
specific provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index 77293c02018a4dc5301e74bcb88fafdc38c4e186..b793ecd2f56fb8911a17d0240d433533618b9138 100644 (file)
@@ -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.