blob: 21b1ad12d678f83d8cfbc115a949687a7d24c9e4 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: honeytrap
# REQUIRE: NETWORKING SERVERS DAEMON
# KEYWORD: shutdown
# Add honeytrap_enable="YES" to /etc/rc.conf to enable Honeytrap
# Additional variables you can define are:
# honeytrap_config (path): Config file path.
# Set to %%ETCDIR%%/honeytrap.toml by default.
# honeytrap_datadir (dir): Set dir to store honeytrap data in.
# Default is "%%HONEYTRAP_DBDIR%%"
# honeytrap_logdir (dir): Set dir to store honeytrap logs in.
# Default is "/var/log/honeytrap"
# honeytrap_user (string): Set user to run honeytrap.
# Default is "%%USER%%".
# honeytrap_group (string): Set group to run honeytrap.
# Default is "%%GROUP%%".
# honeytrap_pidfile (string): Set full path to pid file
# Default is "/var/run/honeytrap.pid"
# honeytrap_syslog_output_enable (bool): Set to YES to enable syslog output
# Default is "NO". See daemon(8).
# honeytrap_syslog_output_tag (str): Set syslog tag if syslog enabled.
# Default is "honeytrap". See daemon(8).
# honeytrap_syslog_output_priority (str): Set syslog priority if syslog enabled.
# Default is "info". See daemon(8).
# honeytrap_syslog_output_facility (str): Set syslog facility if syslog enabled.
# Default is "daemon". See daemon(8).
#
. /etc/rc.subr
name=honeytrap
rcvar=honeytrap_enable
load_rc_config $name
: ${honeytrap_enable:="NO"}
: ${honeytrap_config="%%ETCDIR%%/honeytrap.toml"}
: ${honeytrap_datadir:="%%HONEYTRAP_DBDIR%%"}
: ${honeytrap_logdir:="/var/log/honeytrap"}
: ${honeytrap_user:="%%USER%%"}
: ${honeytrap_group:="%%GROUP%%"}
: ${honeytrap_pidfile:="/var/run/${name}.pid"}
: ${honeytrap_syslog_output_enable:="NO"}
pidfile=${honeytrap_pidfile}
procname="%%PREFIX%%/bin/honeytrap"
command="/usr/sbin/daemon"
start_precmd="honeytrap_start_precmd"
if checkyesno honeytrap_syslog_output_enable; then
if [ -n "${honeytrap_syslog_output_tag}" ]; then
honeytrap_syslog_output_flags="-T ${honeytrap_syslog_output_tag}"
else
honeytrap_syslog_output_flags="-T ${name}"
fi
if [ -n "${honeytrap_syslog_output_priority}" ]; then
honeytrap_syslog_output_flags="${honeytrap_syslog_output_flags} -s ${honeytrap_syslog_output_priority}"
fi
if [ -n "${honeytrap_syslog_output_facility}" ]; then
honeytrap_syslog_output_flags="${honeytrap_syslog_output_flags} -l ${honeytrap_syslog_output_facility}"
fi
fi
command_args="-f -t ${name} ${honeytrap_syslog_output_flags} -p ${pidfile} /usr/bin/env ${honeytrap_env} ${procname} --data ${honeytrap_datadir} --config ${honeytrap_config} ${honeytrap_flags}"
honeytrap_start_precmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${honeytrap_user} -g ${honeytrap_group} /dev/null ${pidfile}
fi
if [ ! -d ${honeytrap_datadir} ]; then
install -d -m 0750 -o ${honeytrap_user} -g ${honeytrap_group} ${honeytrap_datadir}
fi
if [ ! -d ${honeytrap_logdir} ]; then
install -d -m 0750 -o ${honeytrap_user} -g ${honeytrap_group} ${honeytrap_logdir}
fi
}
run_rc_command "$@"
|