]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/scripts/update-ids-ruleset
956c3a1f5d406f436fb6955643b66c608aae30c0
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2018 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 require '/var/ipfire/general-functions.pl';
25 require "${General::swroot}/ids-functions.pl";
26 require "${General::swroot}/lang.pl";
28 # Check if the red device is active.
29 unless (-e
"${General::swroot}/red/active") {
30 # Store notice in the syslog.
31 &IDS
::_log_to_syslog
("The system is offline.");
33 # Store error message for displaying in the WUI.
34 &IDS
::_store_error_message
("$Lang::tr{'could not download latest updates'} - $Lang::tr{'system is offline'}");
40 # Check if enought free disk space is availabe.
41 if(&IDS
::checkdiskspace
()) {
42 # Store the error message for displaying in the WUI.
43 &IDS
::_store_error_message
("$Lang::tr{'not enough disk space'}");
50 &IDS
::lock_ids_page
();
52 # Call the download function and gather the new ruleset.
53 if(&IDS
::downloadruleset
()) {
54 # Store error message for displaying in the WUI.
55 &IDS
::_store_error_message
("$Lang::tr{'could not download latest updates'}");
57 # Unlock the IDS page.
58 &IDS
::unlock_ids_page
();
64 # Set correct ownership for the downloaded tarball.
65 &IDS
::set_ownership
("$IDS::rulestarball");
67 # Call oinkmaster to alter the ruleset.
70 # Set correct ownership for the rulesdir and files.
71 &IDS
::set_ownership
("$IDS::rulespath");
73 # Unlock the IDS page.
74 &IDS
::unlock_ids_page
();
76 # Check if the IDS is running.
77 if(&IDS
::ids_is_running
()) {
78 # Call suricatactrl to perform a reload.
79 &IDS
::call_suricatactrl
("reload");