]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
guardian: Only monitor existing files.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 16 Jan 2015 18:03:41 +0000 (19:03 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 16 Jan 2015 18:03:41 +0000 (19:03 +0100)
config/guardian/guardian

index 87f98b05da1d65495d3eeadc5d65571d673cf7a9..bfede37955e0cb4de7aef47d2c6605bf427af7e4 100644 (file)
@@ -641,6 +641,7 @@ sub load_conf {
 ## Function to generate the array for files to monitor.
 #
 sub generate_monitored_files {
+       my @monitored = ();
        my @files = ();
 
        # Add snort alert file if enabled.
@@ -658,8 +659,20 @@ sub generate_monitored_files {
                push(@files, $httpdlog_file);
        }
 
-       # Return our array.
-       return @files
+       # Check for and drop non existing files.
+       foreach my $file (@files) {
+               # Check if given file exist.
+               if ( -e "$file" ) {
+                       # Add file to final array.
+                       push(@monitored, $file);
+               } else {
+                       # Print out log message.
+                       &logger("info", "Ignoring non exising file ($file).\n");
+               }
+       }
+
+       # Return our final array.
+       return @monitored;
 }
 
 #