mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-21 00:12:58 +02:00
ids.cgi: Only perform actions when saving ruleset settings, if there are no error messages
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
@@ -315,53 +315,53 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'save'}) {
|
||||
if (!$errormessage) {
|
||||
# Store settings into settings file.
|
||||
&General::writehash("$IDS::rules_settings_file", \%cgiparams);
|
||||
}
|
||||
|
||||
# Check if the the automatic rule update hass been touched.
|
||||
if($cgiparams{'AUTOUPDATE_INTERVAL'} ne $oldsettings{'AUTOUPDATE_INTERVAL'}) {
|
||||
# Call suricatactrl to set the new interval.
|
||||
&IDS::call_suricatactrl("cron", $cgiparams{'AUTOUPDATE_INTERVAL'});
|
||||
}
|
||||
|
||||
# Check if a ruleset is present - if not or the source has been changed download it.
|
||||
if((! %idsrules) || ($oldsettings{'RULES'} ne $cgiparams{'RULES'})) {
|
||||
# Check if the red device is active.
|
||||
unless (-e "${General::swroot}/red/active") {
|
||||
$errormessage = "$Lang::tr{'could not download latest updates'} - $Lang::tr{'system is offline'}";
|
||||
# Check if the the automatic rule update hass been touched.
|
||||
if($cgiparams{'AUTOUPDATE_INTERVAL'} ne $oldsettings{'AUTOUPDATE_INTERVAL'}) {
|
||||
# Call suricatactrl to set the new interval.
|
||||
&IDS::call_suricatactrl("cron", $cgiparams{'AUTOUPDATE_INTERVAL'});
|
||||
}
|
||||
|
||||
# Check if enought free disk space is availabe.
|
||||
if(&IDS::checkdiskspace()) {
|
||||
$errormessage = "$Lang::tr{'not enough disk space'}";
|
||||
}
|
||||
|
||||
# Check if any errors happend.
|
||||
unless ($errormessage) {
|
||||
# Lock the webpage and print notice about downloading
|
||||
# a new ruleset.
|
||||
&working_notice("$Lang::tr{'snort working'}");
|
||||
|
||||
# Call subfunction to download the ruleset.
|
||||
if(&IDS::downloadruleset()) {
|
||||
$errormessage = $Lang::tr{'could not download latest updates'};
|
||||
|
||||
# Call function to store the errormessage.
|
||||
&IDS::_store_error_message($errormessage);
|
||||
} else {
|
||||
# Call subfunction to launch oinkmaster.
|
||||
&IDS::oinkmaster();
|
||||
# Check if a ruleset is present - if not or the source has been changed download it.
|
||||
if((! %idsrules) || ($oldsettings{'RULES'} ne $cgiparams{'RULES'})) {
|
||||
# Check if the red device is active.
|
||||
unless (-e "${General::swroot}/red/active") {
|
||||
$errormessage = "$Lang::tr{'could not download latest updates'} - $Lang::tr{'system is offline'}";
|
||||
}
|
||||
|
||||
# Check if the IDS is running.
|
||||
if(&IDS::ids_is_running()) {
|
||||
# Call suricatactrl to stop the IDS - because of the changed
|
||||
# ruleset - the use has to configure it before suricata can be
|
||||
# used again.
|
||||
&IDS::call_suricatactrl("stop");
|
||||
# Check if enought free disk space is availabe.
|
||||
if(&IDS::checkdiskspace()) {
|
||||
$errormessage = "$Lang::tr{'not enough disk space'}";
|
||||
}
|
||||
|
||||
# Perform a reload of the page.
|
||||
&reload();
|
||||
# Check if any errors happend.
|
||||
unless ($errormessage) {
|
||||
# Lock the webpage and print notice about downloading
|
||||
# a new ruleset.
|
||||
&working_notice("$Lang::tr{'snort working'}");
|
||||
|
||||
# Call subfunction to download the ruleset.
|
||||
if(&IDS::downloadruleset()) {
|
||||
$errormessage = $Lang::tr{'could not download latest updates'};
|
||||
|
||||
# Call function to store the errormessage.
|
||||
&IDS::_store_error_message($errormessage);
|
||||
} else {
|
||||
# Call subfunction to launch oinkmaster.
|
||||
&IDS::oinkmaster();
|
||||
}
|
||||
|
||||
# Check if the IDS is running.
|
||||
if(&IDS::ids_is_running()) {
|
||||
# Call suricatactrl to stop the IDS - because of the changed
|
||||
# ruleset - the use has to configure it before suricata can be
|
||||
# used again.
|
||||
&IDS::call_suricatactrl("stop");
|
||||
}
|
||||
|
||||
# Perform a reload of the page.
|
||||
&reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user