[5/5] ids-functions.pl: Do not longer call any log message as "ERROR".

Message ID 20220323040452.2609-5-stefan.schantl@ipfire.org
State Superseded
Headers
Series [1/5] ids-functions.pl: Drop downloader code for sourcefire based ruleset. |

Commit Message

Stefan Schantl March 23, 2022, 4:04 a.m. UTC
  Fixes #12805.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 config/cfgroot/ids-functions.pl | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
  

Patch

diff --git a/config/cfgroot/ids-functions.pl b/config/cfgroot/ids-functions.pl
index d7df41dd1..9eb375bc9 100644
--- a/config/cfgroot/ids-functions.pl
+++ b/config/cfgroot/ids-functions.pl
@@ -226,7 +226,7 @@  sub checkdiskspace () {
 			# Check if the available disk space is more than 300MB.
 			if ($available < 300) {
 				# Log error to syslog.
-				&_log_to_syslog("Not enough free disk space on /var. Only $available MB from 300 MB available.");
+				&_log_to_syslog("<ERROR> Not enough free disk space on /var. Only $available MB from 300 MB available.");
 
 				# Exit function and return "1" - False.
 				return 1;
@@ -270,7 +270,7 @@  sub downloadruleset ($) {
 	# Check if a ruleset has been configured.
 	unless(%used_providers) {
 		# Log that no ruleset has been configured and abort.
-		&_log_to_syslog("No ruleset provider has been configured.");
+		&_log_to_syslog("<ERROR> No ruleset provider has been configured.");
 
 		# Return "1".
 		return 1;
@@ -333,7 +333,7 @@  sub downloadruleset ($) {
 	# Loop through the hash of sheduled providers.
 	foreach my $provider ( keys %sheduled_providers) {
 		# Log download/update of the ruleset.
-		&_log_to_syslog("Downloading ruleset for provider: $provider.");
+		&_log_to_syslog("<INFO> Downloading ruleset for provider: $provider.");
 
 		# Grab the download url for the provider.
 		my $url = $IDS::Ruleset::Providers{$provider}{'dl_url'};
@@ -354,7 +354,7 @@  sub downloadruleset ($) {
 		# Abort if no url could be determined for the provider.
 		unless ($url) {
 			# Log error and abort.
-			&_log_to_syslog("Unable to gather a download URL for the selected ruleset provider.");
+			&_log_to_syslog("<ERROR> Unable to gather a download URL for the selected ruleset provider.");
 			return 1;
 		}
 
@@ -400,7 +400,7 @@  sub downloadruleset ($) {
 			# Check if the server responds with 304 (Not Modified).
 			} elsif ($response->code == 304) {
 				# Log to syslog.
-				&_log_to_syslog("Ruleset is up-to-date, no update required.");
+				&_log_to_syslog("<INFO> Ruleset is up-to-date, no update required.");
 
 				# Nothing to be done, the ruleset is up-to-date.
 				return;
@@ -411,7 +411,7 @@  sub downloadruleset ($) {
 				my $error = $response->content;
 
 				# Log error message.
-				&_log_to_syslog("Unable to download the ruleset. \($error\)");
+				&_log_to_syslog("<ERROR> Unable to download the ruleset. \($error\)");
 
 				# Return "1" - false.
 				return 1;
@@ -446,8 +446,8 @@  sub downloadruleset ($) {
 		# Check if both file sizes match.
 		if (($remote_filesize) && ($remote_filesize ne $local_filesize)) {
 			# Log error message.
-			&_log_to_syslog("Unable to completely download the ruleset. ");
-			&_log_to_syslog("Only got $local_filesize Bytes instead of $remote_filesize Bytes. ");
+			&_log_to_syslog("<ERROR> Unable to completely download the ruleset. ");
+			&_log_to_syslog("<ERROR> Only got $local_filesize Bytes instead of $remote_filesize Bytes. ");
 
 			# Delete temporary file.
 			unlink("$tmpfile");
@@ -459,7 +459,7 @@  sub downloadruleset ($) {
 		# Check if a file name could be obtained.
 		unless ($dl_rulesfile) {
 			# Log error message.
-			&_log_to_syslog("Unable to store the downloaded rules file. ");
+			&_log_to_syslog("<ERROR> Unable to store the downloaded rules file. ");
 
 			# Delete downloaded temporary file.
 			unlink("$tmpfile");
@@ -518,7 +518,7 @@  sub extractruleset ($) {
 
 	# Check if the file exists.
 	unless (-f $tarball) {
-		&_log_to_syslog("Could not find ruleset file: $tarball");
+		&_log_to_syslog("<ERROR> Could not find ruleset file: $tarball");
 
 		# Return nothing.
 		return;
@@ -897,7 +897,7 @@  sub _log_to_syslog ($) {
 
 	# The syslog function works best with an array based input,
 	# so generate one before passing the message details to syslog.
-	my @syslog = ("ERR", "<ERROR> $message");
+	my @syslog = ("ERR", "$message");
 
 	# Establish the connection to the syslog service.
 	openlog('oinkmaster', 'cons,pid', 'user');