package IDS;
require '/var/ipfire/general-functions.pl';
-require "${General::swroot}/lang.pl";
# Location where all config and settings files are stored.
our $settingsdir = "${General::swroot}/snort";
# Check if the available disk space is more than 300MB.
if ($available < 300) {
- # If there is not enough space, print out an error message.
- my $errormessage = "$Lang::tr{'not enough disk space'} < 300MB, /var $available MB";
+ # Log error to syslog.
+ &_log_to_syslog("Not enough free disk space on /var. Only $available MB from 300 MB available.");
- # Exit function and return the error message.
- return $errormessage;
+ # Exit function and return "1" - False.
+ return 1;
}
}
}
# Add proxy server address and port.
$proxy_url .= "$peer\:$peerport";
} else {
- # Break and return error message.
- return "$Lang::tr{'could not download latest updates'}";
+ # Log error message and break.
+ &_log_to_syslog("Could not proper configure the proxy server access.");
+
+ # Return "1" - false.
+ return 1;
}
# Setup proxy settings.
# Abort if no url could be determined for the vendor.
unless ($url) {
- # Abort and return errormessage.
- return "$Lang::tr{'could not download latest updates'}";
+ # Log error and abort.
+ &_log_to_syslog("Unable to gather a download URL for the selected ruleset.");
+ return 1;
}
# Pass the requested url to the downloader.
# Check if there was any error.
unless ($response->is_success) {
- # Return error message.
- return "$response->status_line";
+ # Log error message.
+ &_log_to_syslog("Unable to download the ruleset. $response->status_line");
+
+ # Return "1" - false.
+ return 1;
}
# If we got here, everything worked fine. Return nothing.
}
# Check if enought free disk space is availabe.
- $errormessage = &IDS::checkdiskspace();
+ if(&IDS::checkdiskspace()) {
+ $errormessage = "$Lang::tr{'not enough disk space'}";
+ }
# Check if any errors happend.
unless ($errormessage) {
&working_notice("$Lang::tr{'snort working'}");
# Call subfunction to download the ruleset.
- $errormessage = &IDS::downloadruleset();
+ if(&IDS::downloadruleset()) {
+ $errormessage = $Lang::tr{'could not download latest updates'};
- # Check if the downloader returned an error.
- if ($errormessage) {
# Call function to store the errormessage.
- &IDS::log_error($errormessage);
+ &IDS::_store_error_message($errormessage);
# Preform a reload of the page.
&reload();