Lines 3-20
Link Here
|
3 |
# $FreeBSD$ |
3 |
# $FreeBSD$ |
4 |
# |
4 |
# |
5 |
# PROVIDE: honeytrap |
5 |
# PROVIDE: honeytrap |
6 |
# REQUIRE: LOGIN |
6 |
# REQUIRE: NETWORKING SERVERS DAEMON |
7 |
# KEYWORD: shutdown |
7 |
# KEYWORD: shutdown |
|
|
8 |
|
9 |
# Add honeytrap_enable="YES" to /etc/rc.conf to enable Honeytrap |
10 |
|
11 |
# Additional variables you can define are: |
12 |
|
13 |
# honeytrap_config (path): Config file path. |
14 |
# Set to %%ETCDIR%%/honeytrap.toml by default. |
15 |
# honeytrap_datadir (dir): Set dir to store honeytrap data in. |
16 |
# Default is "%%HONEYTRAP_DBDIR%%" |
17 |
# honeytrap_logdir (dir): Set dir to store honeytrap logs in. |
18 |
# Default is "/var/log/honeytrap" |
19 |
# honeytrap_user (string): Set user to run honeytrap. |
20 |
# Default is "%%USER%%". |
21 |
# honeytrap_group (string): Set group to run honeytrap. |
22 |
# Default is "%%GROUP%%". |
23 |
# honeytrap_pidfile (string): Set full path to pid file |
24 |
# Default is "/var/run/honeytrap.pid" |
25 |
# honeytrap_syslog_output_enable (bool): Set to YES to enable syslog output |
26 |
# Default is "NO". See daemon(8). |
27 |
# honeytrap_syslog_output_tag (str): Set syslog tag if syslog enabled. |
28 |
# Default is "honeytrap". See daemon(8). |
29 |
# honeytrap_syslog_output_priority (str): Set syslog priority if syslog enabled. |
30 |
# Default is "info". See daemon(8). |
31 |
# honeytrap_syslog_output_facility (str): Set syslog facility if syslog enabled. |
32 |
# Default is "daemon". See daemon(8). |
8 |
# |
33 |
# |
9 |
# Add these lines to /etc/rc.conf.local or /etc/rc.conf |
|
|
10 |
# to enable this service: |
11 |
# |
12 |
# honeytrap_enable (bool): Set to NO by default. |
13 |
# Set it to YES to enable honeytrap. |
14 |
# honeytrap_datadir (path): Set to %%PREFIX%%/libdata/honeytrap |
15 |
# by default. |
16 |
# honeytrap_config (path): Set to %%PREFIX%%/etc/honeytrap.toml |
17 |
# by default. |
18 |
|
34 |
|
19 |
. /etc/rc.subr |
35 |
. /etc/rc.subr |
20 |
|
36 |
|
Lines 24-41
rcvar=honeytrap_enable
Link Here
|
24 |
load_rc_config $name |
40 |
load_rc_config $name |
25 |
|
41 |
|
26 |
: ${honeytrap_enable:="NO"} |
42 |
: ${honeytrap_enable:="NO"} |
27 |
: ${honeytrap_datadir="%%PREFIX%%/libdata/honeytrap"} |
43 |
: ${honeytrap_config="%%ETCDIR%%/honeytrap.toml"} |
28 |
: ${honeytrap_config="%%PREFIX%%/etc/honeytrap.toml"} |
44 |
: ${honeytrap_datadir:="%%HONEYTRAP_DBDIR%%"} |
|
|
45 |
: ${honeytrap_logdir:="/var/log/honeytrap"} |
46 |
: ${honeytrap_user:="%%USER%%"} |
47 |
: ${honeytrap_group:="%%GROUP%%"} |
48 |
: ${honeytrap_pidfile:="/var/run/${name}.pid"} |
49 |
: ${honeytrap_syslog_output_enable:="NO"} |
50 |
|
51 |
pidfile=${honeytrap_pidfile} |
52 |
procname="%%PREFIX%%/bin/honeytrap" |
53 |
command="/usr/sbin/daemon" |
29 |
|
54 |
|
30 |
start_cmd="${name}_start" |
55 |
start_precmd="honeytrap_start_precmd" |
31 |
|
56 |
|
32 |
honeytrap_program="%%PREFIX%%/bin/honeytrap" |
57 |
if checkyesno honeytrap_syslog_output_enable; then |
33 |
honeytrap_flags="--data $honeytrap_datadir --config $honeytrap_config" |
58 |
if [ -n "${honeytrap_syslog_output_tag}" ]; then |
34 |
pidfile=/var/run/${name}.pid |
59 |
honeytrap_syslog_output_flags="-T ${honeytrap_syslog_output_tag}" |
|
|
60 |
else |
61 |
honeytrap_syslog_output_flags="-T ${name}" |
62 |
fi |
63 |
if [ -n "${honeytrap_syslog_output_priority}" ]; then |
64 |
honeytrap_syslog_output_flags="${honeytrap_syslog_output_flags} -s ${honeytrap_syslog_output_priority}" |
65 |
fi |
35 |
|
66 |
|
36 |
honeytrap_start() |
67 |
if [ -n "${honeytrap_syslog_output_facility}" ]; then |
|
|
68 |
honeytrap_syslog_output_flags="${honeytrap_syslog_output_flags} -l ${honeytrap_syslog_output_facility}" |
69 |
fi |
70 |
fi |
71 |
|
72 |
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}" |
73 |
|
74 |
honeytrap_start_precmd() |
37 |
{ |
75 |
{ |
38 |
daemon -o /var/log/honeytrap/service.log -p $pidfile -u $name $honeytrap_program $honeytrap_flags |
76 |
if [ ! -e ${pidfile} ]; then |
39 |
} |
77 |
install -o ${honeytrap_user} -g ${honeytrap_group} /dev/null ${pidfile} |
|
|
78 |
fi |
40 |
|
79 |
|
|
|
80 |
if [ ! -d ${honeytrap_datadir} ]; then |
81 |
install -d -m 0750 -o ${honeytrap_user} -g ${honeytrap_group} ${honeytrap_datadir} |
82 |
fi |
83 |
if [ ! -d ${honeytrap_logdir} ]; then |
84 |
install -d -m 0750 -o ${honeytrap_user} -g ${honeytrap_group} ${honeytrap_logdir} |
85 |
fi |
86 |
} |
87 |
|
41 |
run_rc_command "$@" |
88 |
run_rc_command "$@" |