]> git.ipfire.org Git - ipfire-2.x.git/blob - config/suricata/convert-ids-modifysids-file
adcc10577479b297cf8f0d3e1a66f3e842e5630f
[ipfire-2.x.git] / config / suricata / convert-ids-modifysids-file
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
27 exit unless(-f $IDS::ids_settings_file and -f $IDS::rules_settings_file);
28
29 #
30 ## Step 1: Re-generate and write the file to modify the ruleset.
31 #
32
33 # Call subfunction and pass the desired IDS action.
34 &IDS::write_modify_sids_file();
35
36 # Set correct ownership.
37 &IDS::set_ownership("$IDS::modify_sids_file");
38
39 #
40 ## Step 2: Call oinkmaster to extract and setup the rules structures.
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 #
53 ## Step 3: Reload the IDS ruleset if running.
54 #
55
56 # Check if the IDS should be started.
57 if($idssettings{"ENABLE_IDS"} eq "on") {
58 # Call suricatactrl and reload the rules.
59 &IDS::call_suricatactrl("reload");
60 }