From: Stefan Schantl Date: Wed, 30 Jan 2019 12:43:38 +0000 (+0100) Subject: initscripts/suricata: Generate firewall rules on start and reload X-Git-Tag: v2.23-core131~117^2~81 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=c9b07d6a0cdb54c71d5aef4a75c40d505585a0fe initscripts/suricata: Generate firewall rules on start and reload Fixes #11978 Signed-off-by: Stefan Schantl --- diff --git a/src/initscripts/system/suricata b/src/initscripts/system/suricata index 99097a8e3a..b406b920ab 100644 --- a/src/initscripts/system/suricata +++ b/src/initscripts/system/suricata @@ -35,52 +35,81 @@ MASK="0x2" # PID file of suricata. PID_FILE="/var/run/suricata.pid" +# Function to get the amount of CPU cores of the system. +function get_cpu_count { + CPUCOUNT=0 + + # Loop through "/proc/cpuinfo" and count the amount of CPU cores. + while read line; do + [ "$line" ] && [ -z "${line%processor*}" ] && ((CPUCOUNT++)) + done /dev/null 2>/dev/null @@ -117,6 +152,12 @@ case "$1" in # Send SIGUSR2 to the suricata process to perform a reload # of the ruleset. kill -USR2 $(pidof suricata) + + # Flush the firewall chain. + flush_fw_chain + + # Generate firewall rules. + generate_fw_rules ;; *)