suricata: Force Suricata to write a PID file again

The PID file does not get written when Suricata is not being started in
daemon mode and therefore we need to pass it as a command line
parameter.

The initscript should not deal with the PID file when starting but needs
it to terminate the process and to check the process status.

The web UI can use the PID file again.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2024-09-10 23:23:38 +02:00
parent 63f4b3a7bc
commit 8b73307b15
3 changed files with 8 additions and 4 deletions

View File

@@ -24,9 +24,12 @@ PIDFILE="/var/run/suricata.pid"
main() {
local ret
# Suricata becomes unhappy if the PID file exists
unlink "${PIDFILE}" &>/dev/null
while :; do
# Launch suricata
/usr/bin/suricata "$@" &>/dev/null
/usr/bin/suricata --pidfile "${PIDFILE}" "$@" &>/dev/null
# Wait until suricata is done
ret=$?

View File

@@ -1011,7 +1011,7 @@ sub show_mainpage() {
&Header::ServiceStatus({
$Lang::tr{'intrusion prevention system'} => {
"process" => "Suricata-Main",
"pidfile" => "/var/run/suricata.pid",
},
});

View File

@@ -159,7 +159,7 @@ case "$1" in
stop)
boot_mesg "Stopping Intrusion Detection System..."
killproc /usr/bin/suricata
killproc -p /var/run/suricata.pid /usr/bin/suricata
# Flush firewall chain.
flush_fw_chain
@@ -169,13 +169,14 @@ case "$1" in
;;
status)
statusproc /usr/bin/suricata
PIDFILE="/var/run/suricata.pid" statusproc /usr/bin/suricata
;;
restart)
$0 stop
$0 start
;;
reload)
# Send SIGUSR2 to the suricata process to perform a reload
# of the ruleset.