#!/bin/sh # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Modified by Matteo Bernardini for Slackware # The options below refer to commandline arguments (all in lowercase) # of portsentry. Use only one tcp and udp mode at a time. # See the portsentry.8 manpage for details. #PORTSENTRY_MODES="udp tcp" #PORTSENTRY_MODES="stcp sudp" #PORTSENTRY_MODES="atcp audp" portsentry_checkconfig() { if [ ! -e /etc/portsentry/portsentry.conf ] ; then echo echo "You need an /etc/portsentry/portsentry.conf file" echo "There is a sample in /usr/doc/portsentry-@VERSION@" echo "or in /etc/portsentry" echo exit 1 fi if [ -z "$PORTSENTRY_MODES" ] ; then echo echo "You need to setup your PORTSENTRY_MODES first" echo "Check that you've enabled some or all of them on top of rc.portsentry" echo exit 1 fi } portsentry_start() { portsentry_checkconfig echo "Starting portsentry" for mode in $PORTSENTRY_MODES ; do /usr/bin/portsentry -$mode result=$(( $result + $? )) done echo $result } portsentry_stop() { echo "Stopping portsentry" killall portsentry echo $? } case $1 in 'start') portsentry_start ;; 'stop') portsentry_stop ;; 'restart') portsentry_stop sleep 2 portsentry_start ;; *) echo "usage: `basename $0` {start|stop|restart}" esac