]>
Commit | Line | Data |
---|---|---|
a5ba473c TF |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2019 IPFire Development 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 | ||
a5ba473c TF |
27 | exit unless(-f $IDS::ids_settings_file and -f $IDS::rules_settings_file); |
28 | ||
a5ba473c | 29 | # |
3c91ee80 | 30 | ## Step 1: Re-generate and write the file to modify the ruleset. |
a5ba473c TF |
31 | # |
32 | ||
a5ba473c | 33 | # Call subfunction and pass the desired IDS action. |
3c91ee80 | 34 | &IDS::write_modify_sids_file(); |
a5ba473c TF |
35 | |
36 | # Set correct ownership. | |
37 | &IDS::set_ownership("$IDS::modify_sids_file"); | |
38 | ||
39 | # | |
3c91ee80 | 40 | ## Step 2: Call oinkmaster to extract and setup the rules structures. |
a5ba473c TF |
41 | # |
42 | ||
43 | # Check if a rulestarball is present. | |
44 | if (-f $IDS::rulestarball) { | |
45 | # Launch oinkmaster by calling the subfunction. | |
46 | &IDS::oinkmaster(); | |
47 | ||
48 | # Set correct ownership for the rulesdir and files. | |
49 | &IDS::set_ownership("$IDS::rulespath"); | |
50 | } | |
51 | ||
52 | # | |
3c91ee80 | 53 | ## Step 3: Reload the IDS ruleset if running. |
a5ba473c TF |
54 | # |
55 | ||
56 | # Check if the IDS should be started. | |
33afb068 | 57 | if(&IDS::ids_is_running()) { |
a5ba473c TF |
58 | # Call suricatactrl and reload the rules. |
59 | &IDS::call_suricatactrl("reload"); | |
60 | } |