]>
Commit | Line | Data |
---|---|---|
82979dec SS |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2018 IPFire Team <info@ipfire.org> # | |
6 | # # | |
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. # | |
11 | # # | |
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. # | |
16 | # # | |
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/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | use strict; | |
23 | ||
24 | require '/var/ipfire/general-functions.pl'; | |
25 | require "${General::swroot}/ids-functions.pl"; | |
26 | require "${General::swroot}/lang.pl"; | |
27 | ||
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."); | |
32 | ||
33 | # Store error message for displaying in the WUI. | |
d6f725e1 | 34 | &IDS::_store_error_message("$Lang::tr{'could not download latest updates'} - $Lang::tr{'system is offline'}"); |
82979dec SS |
35 | |
36 | # Exit. | |
37 | exit 0; | |
38 | } | |
39 | ||
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'}"); | |
44 | ||
45 | # Exit. | |
46 | exit 0; | |
47 | } | |
48 | ||
5206a335 SS |
49 | # Lock the IDS page. |
50 | &IDS::lock_ids_page(); | |
51 | ||
82979dec SS |
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'}"); | |
56 | ||
57 | # Exit. | |
58 | exit 0; | |
59 | } | |
60 | ||
50b35e0f SS |
61 | # Set correct ownership for the downloaded tarball. |
62 | &IDS::set_ownership("$IDS::rulestarball"); | |
63 | ||
82979dec SS |
64 | # Call oinkmaster to alter the ruleset. |
65 | &IDS::oinkmaster(); | |
66 | ||
ca8c9210 SS |
67 | # Set correct ownership for the rulesdir and files. |
68 | &IDS::set_ownership("$IDS::rulespath"); | |
69 | ||
5206a335 SS |
70 | # Unlock the IDS page. |
71 | &IDS::unlock_ids_page(); | |
72 | ||
82979dec SS |
73 | # Check if the IDS is running. |
74 | if(&IDS::ids_is_running()) { | |
75 | # Call suricatactrl to perform a reload. | |
76 | &IDS::call_suricatactrl("reload"); | |
77 | } | |
78 | ||
79 | 1; |