Lines 19-31
Link Here
|
19 |
# Default: 8000 |
19 |
# Default: 8000 |
20 |
# suricata_netmap (str): Set to YES to enable netmap (Inline Mode) |
20 |
# suricata_netmap (str): Set to YES to enable netmap (Inline Mode) |
21 |
# Default: NO |
21 |
# Default: NO |
|
|
22 |
# suricata_user (str): Set the user to run suricata as |
23 |
# Default: root |
24 |
# suricata_pidfile (str): Pidfile to store pid of suricata process |
25 |
# Default: /var/run/suricata.pid |
22 |
|
26 |
|
23 |
|
|
|
24 |
. /etc/rc.subr |
27 |
. /etc/rc.subr |
25 |
|
28 |
|
26 |
name="suricata" |
29 |
name="suricata" |
27 |
rcvar=suricata_enable |
30 |
rcvar=suricata_enable |
28 |
|
31 |
|
|
|
32 |
start_precmd="suricata_check_pid" |
29 |
command="%%PREFIX%%/bin/suricata" |
33 |
command="%%PREFIX%%/bin/suricata" |
30 |
|
34 |
|
31 |
load_rc_config $name |
35 |
load_rc_config $name |
Lines 35-40
Link Here
|
35 |
[ -z "$suricata_flags" ] && suricata_flags="-D" |
39 |
[ -z "$suricata_flags" ] && suricata_flags="-D" |
36 |
[ -z "$suricata_divertport" ] && suricata_divertport="8000" |
40 |
[ -z "$suricata_divertport" ] && suricata_divertport="8000" |
37 |
[ -z "$suricata_netmap" ] && suricata_netmap="NO" |
41 |
[ -z "$suricata_netmap" ] && suricata_netmap="NO" |
|
|
42 |
[ -z "$suricata_user" ] && suricata_user="root" |
43 |
[ -z "$suricata_pidfile" ] && suricata_pidfile="/var/run/suricata.pid" |
38 |
|
44 |
|
39 |
if [ -n "$suricata_interface" ]; then |
45 |
if [ -n "$suricata_interface" ]; then |
40 |
for interface in $suricata_interface; do |
46 |
for interface in $suricata_interface; do |
Lines 47-55
Link Here
|
47 |
info "Inline Mode on divert port $suricata_divertport (suricata_interface not defined)" |
53 |
info "Inline Mode on divert port $suricata_divertport (suricata_interface not defined)" |
48 |
fi |
54 |
fi |
49 |
|
55 |
|
50 |
pidfile="/var/run/suricata.pid" |
56 |
pidfile=$suricata_pidfile |
51 |
suricata_flags="$suricata_flags --pidfile $pidfile" |
57 |
suricata_flags="$suricata_flags --pidfile $pidfile" |
52 |
|
58 |
|
53 |
[ -n "$suricata_conf" ] && suricata_flags="$suricata_flags -c $suricata_conf" |
59 |
[ -n "$suricata_conf" ] && suricata_flags="$suricata_flags -c $suricata_conf" |
54 |
|
60 |
|
|
|
61 |
suricata_check_pid() |
62 |
{ |
63 |
run_rc_command status > /dev/null 2>&1 |
64 |
status=$? |
65 |
if [ "$status" == "1" ] |
66 |
then |
67 |
if [ -e $pidfile ] |
68 |
then |
69 |
echo "Stale pid file detected, cleaning up" |
70 |
rm $pidfile |
71 |
fi |
72 |
fi |
73 |
} |
74 |
|
55 |
run_rc_command "$1" |
75 |
run_rc_command "$1" |