]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/networking/red.up/23-suricata
Merge branch 'next'
[ipfire-2.x.git] / src / initscripts / networking / red.up / 23-suricata
CommitLineData
8117fff8
SS
1#!/usr/bin/perl
2#
3# Helper script to regenerate the file which contains the HOME_NET declaration
4# including the assigned IP-address of red and any configured aliases.
5
6use strict;
7
8require '/var/ipfire/general-functions.pl';
9require "${General::swroot}/ids-functions.pl";
10
11# Hash to store the IDS settings.
12my %ids_settings = ();
13
14# Read-in IDS settings.
15&General::readhash("$IDS::ids_settings_file", \%ids_settings);
16
17# Check if suricata is enabled.
18if($ids_settings{'ENABLE_IDS'} eq "on") {
19 # Regenerate the file with HOME_NET details.
20 &IDS::generate_home_net_file();
21
c8b068a2
SS
22 # Regenerate the file with DNS_SERVERS details.
23 &IDS::generate_dns_servers_file();
24
25 # Set correct ownerships.
8117fff8 26 &IDS::set_ownership("$IDS::homenet_file");
c8b068a2 27 &IDS::set_ownership("$IDS::dns_servers_file");
8117fff8
SS
28
29 # Check if suricata is running.
30 if(&IDS::ids_is_running()) {
31 # Call suricatactrl to perform a restart of suricata.
32 &IDS::call_suricatactrl("restart");
77c07352
SS
33 } else {
34 # Call suricatactrl to start suricata.
35 &IDS::call_suricatactrl("start");
8117fff8
SS
36 }
37}