]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ids-functions.pl: Load additional services rules files.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 24 Jul 2022 12:15:19 +0000 (14:15 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 24 Jul 2022 12:15:19 +0000 (14:15 +0200)
Load additional rule files for various services in case they
are available.

Those rules files are service related and mostly will be used
to silence to noisy rules or are not tracked by a ruleset provider yet.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index dc1720267d0b49f267d16d40ef53d5f1d9c46192..7d7cf6e5abe732188d9592b09de1dad40f63cf33 100644 (file)
@@ -1519,6 +1519,23 @@ sub write_used_rulefiles_file (@) {
                }
        }
 
+       print FILE "\n#Load additional service related rules to avoid log flooding.\n";
+
+       # Loop through the array of supported port helper services.
+       foreach my $service (@IDS::Ports::Helper::services) {
+               # Skip non available services (addons).
+               next unless (-f "/opt/pakfire/db/installed/meta-$service");
+
+               # Generate name of the rulesfile.
+               my $rulesfile = "$default_rulespath/ipfire-$service.rules";
+
+               # Skip services which does not own rules files.
+               next unless (-f $rulesfile);
+
+               # Write the rulesfile name to the list of rulesfiles to use.
+               print FILE " - $rulesfile\n";
+       }
+
        # Loop through the array of enabled providers.
        foreach my $provider (@providers) {
                # Skip unsupported providers.