aboutsummaryrefslogtreecommitdiff
path: root/security/snort2pfcd/files/snort2pfcd.in
blob: 35c4ac81e2f8c1acfeb4bd3039e68e5040fc5fec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# PROVIDE: snort2pfcd
# REQUIRE: DAEMON pf snort
# KEYWORD: shutdown

. /etc/rc.subr

name="snort2pfcd"
rcvar=${name}_enable
pidfile="/var/run/${name}.pid"
command="%%PREFIX%%/sbin/${name}"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
required_modules="pf"

snort2pfcd_start()
{
	echo "Starting ${name}..."
	if [ $(sysctl -n kern.securelevel) != "3" ]; then
		${command} ${snort2pfcd_flags}
	else
		echo "${name} cannot operate on pf at securelevel 3"
	fi

	if [ -f ${pidfile} ]; then
		echo "${name} successfully started"
	else
		echo "${name} statup failed"
	fi
}

snort2pfcd_stop()
{
	if [ -f ${pidfile} ]; then
		echo "Stopping ${name}..."
		kill $(cat ${pidfile})
	else
		echo "${name} is not running?"
	fi
}

load_rc_config ${name}
run_rc_command "$1"