]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids.cgi: Add code to start/stop/reload the IDS when neccessary
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 11 Aug 2018 20:11:18 +0000 (22:11 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 11 Aug 2018 20:11:18 +0000 (22:11 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ids.cgi

index bd22b0865ebf980de60d33eadb859a5e0dccfb54..0daf7903eef04db977e47c6e784a7c4a7099232e 100644 (file)
@@ -255,6 +255,12 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) {
        # Call oinkmaster to alter the ruleset.
        &IDS::oinkmaster();
 
+       # Check if the IDS is running.
+       if(&IDS::is_ids_running()) {
+               # Call suricatactrl to perform a reload.
+               &IDS::call_suricatactrl("reload");
+       }
+
        # Reload page.
        &reload();
 
@@ -289,6 +295,12 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) {
                        # Call subfunction to launch oinkmaster.
                        &IDS::oinkmaster();
 
+                       # Check if the IDS is running.
+                       if(&IDS::is_ids_running()) {
+                               # Call suricatactrl to perform a reload.
+                               &IDS::call_suricatactrl("reload");
+                       }
+
                        # Perform a reload of the page.
                        &reload();
                }
@@ -314,6 +326,21 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'update'}) {
 
        # Generate file to store the home net.
        &generate_home_net_file();
+
+       # Check if the IDS currently is running.
+       if(&IDS::ids_is_running()) {
+               # Check if ENABLE_IDS is set to on.
+               if($cgiparams{'ENABLE_IDS'} eq "on") {
+                       # Call suricatactrl to perform a reload of suricata.
+                       &IDS::call_suricatactrl("reload");
+               } else {
+                       # Call suricatactrl to stop suricata.
+                       &IDS::call_suricatactrl("stop");
+               }
+       } else {
+               # Call suricatactrl to start suricata.
+               &IDS::call_suricatactrl("start");
+       }
 }
 
 # Read-in idssettings