]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/ids-functions.pl
ids-functions.pl: Introduce function write_modify_sids_file()
[ipfire-2.x.git] / config / cfgroot / ids-functions.pl
index 1b445ab24f6adfe0c5e15a2c3d334be197908ec6..55786c157c80695c2f40cf5735c5912be79b08e2 100644 (file)
@@ -687,4 +687,26 @@ sub write_used_rulefiles_file(@) {
        close(FILE);
 }
 
+#
+## Function to generate and write the file for modify the ruleset.
+#
+sub write_modify_sids_file($) {
+       my ($ruleaction) = @_;
+
+       # Open modify sid's file for writing.
+       open(FILE, ">$IDS::modify_sids_file") or die "Could not write to $IDS::modify_sids_file. $!\n";
+
+       # Write file header.
+       print FILE "#Autogenerated file. Any custom changes will be overwritten!\n";
+
+       # Check if the traffic only should be monitored.
+       unless($ruleaction eq "alert") {
+               # Tell oinkmaster to switch all rules from alert to drop.
+               print FILE "modifysid \* \"alert\" \| \"drop\"\n";
+       }
+
+       # Close file handle.
+       close(FILE);
+}
+
 1;