From: Stefan Schantl Date: Sat, 11 Aug 2018 20:11:18 +0000 (+0200) Subject: ids.cgi: Add code to start/stop/reload the IDS when neccessary X-Git-Tag: suricata-beta3~33^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2e7880dc73fc98aa7409b2de2384e5c9e436f29;p=people%2Fstevee%2Fipfire-2.x.git ids.cgi: Add code to start/stop/reload the IDS when neccessary Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi index bd22b0865e..0daf7903ee 100644 --- a/html/cgi-bin/ids.cgi +++ b/html/cgi-bin/ids.cgi @@ -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