blob: 97d21c43c95724b6097b57457b9a1a1622e76261 (
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
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/honeyd/files/honeyd.initd,v 1.2 2005/06/30 14:45:51 ka0ttic Exp $
depend() {
need net
}
start() {
local options
ebegin "Starting honeyd"
if [[ -z "${HONEYD_NET}" ]] ; then
eerror "HONEYD_NET variable must be set in /etc/conf.d/honeyd"
eend 1
return 1
fi
# add route
if ! netstat -arn | egrep "^${HONEYD_NET}[[:space:]]*127.0.0.1" ; then
route add -net ${HONEYD_NET} gw 127.0.0.1
fi
if [[ -n "${HONEYD_LOG}" ]] ; then
options="${options} -l ${HONEYD_LOG}"
# create logdir if it doesn't exist
[[ ! -d "${HONEYD_LOG%/*}" ]] && mkdir ${HONEYD_LOG%/*}
fi
# supports webserver feature?
if [[ "$(/usr/sbin/honeyd --help 2>&1 | grep webserver)" != "" ]] ; then
# run webserver?
if [[ ${HONEYD_HTTPD} -eq 1 ]] ; then
options="${options} --webserver-port ${HONEYD_HTTPD_PORT} \
--webserver-root ${HONEYD_HTTPD_ROOT} --fix-webserver-permissions"
else
options="${options} --disable-webserver"
fi
fi
options="${options} -i ${HONEYD_IF:-lo} ${HONEYD_OPTS}"
start-stop-daemon --start --quiet --exec /usr/sbin/honeyd \
-- ${options} ${HONEYD_NET} >/dev/null 2>&1
eend $?
}
stop() {
ebegin "Stopping honeyd"
start-stop-daemon --stop --quiet --retry 5 --exec /usr/sbin/honeyd
route del -net ${HONEYD_NET} gw 127.0.0.1
eend $?
}
|