summaryrefslogtreecommitdiff
blob: 3b8e69869c22107d1ad4a75657b1a858ca66793c (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
#!/sbin/openrc-run
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

# NB: Config is in /etc/conf.d/portsentry

depend() {
	need net
}

checkconfig() {
	if [ ! -e /etc/portsentry/portsentry.conf ] ; then
		eerror "You need an /etc/portsentry/portsentry.conf file"
		eerror "There is  a  sample in /usr/share/doc/portsentry"
		return 1
	fi
	if [ -z "$PORTSENTRY_MODES" ] ; then
		eerror "You need to setup your PORTSENTRY_MODES first"
		eerror "Check /etc/conf.d/portsentry that you've enabled some or all of them"
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting portsentry"
	for mode in $PORTSENTRY_MODES ; do
		/usr/bin/portsentry -$mode
		result=$(( $result + $? ))
	done
	eend $result
}

stop() {
	ebegin "Stopping portsentry"
	killall portsentry
	eend $?
}