/etc/init.d/portsentry is in portsentry 1.2-13.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #! /bin/sh
### BEGIN INIT INFO
# Provides: portsentry
# Required-Start: $remote_fs $syslog $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: # start and stop portsentry
### END INIT INFO
#
# $Id: init.d,v 1.7 2002/01/05 14:52:14 agx Exp $
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/portsentry
CONFIG=/etc/default/portsentry
BUILDSCRIPT=/usr/lib/portsentry/portsentry-build-ignore-file
test -f $DAEMON || exit 0
test -f $CONFIG || exit 0
test -f $BUILDSCRIPT || exit 0
# source the config file
. $CONFIG
startup () {
if [ \( ! "$TCP_MODE" \) -a \( ! "$UDP_MODE" \) ]; then
echo "Not starting anti portscan daemon (no modes in $CONFIG)."
exit 0
fi
echo -n "Starting anti portscan daemon: "
# populate portsentry.ignore first
$BUILDSCRIPT
case "$TCP_MODE" in
"tcp"|"stcp"|"atcp")
# Make sure we're not already listening for tcp scans
if ! ps awx | grep -q "$DAEMON -[as]*tcp"
then
$DAEMON -$TCP_MODE
echo -n "portsentry in $TCP_MODE"
else
TCP_MODE=""
fi
;;
# do nothing if TCP_MODE is not set
"")
;;
*)
echo "$TCP_MODE is not a valid mode."
exit 1;
;;
esac
case "$UDP_MODE" in
"udp"|"sudp"|"audp")
if ! ps awx | grep -q "$DAEMON -[as]*udp"
then
$DAEMON -$UDP_MODE
if [ "$TCP_MODE" ]; then
echo -n " &"
else
echo -n "portsentry in"
fi
echo -n " $UDP_MODE"
else
UDP_MODE=""
fi
;;
# do nothing if UDP_MODE is not set
"")
;;
*)
echo "$UDP_MODE is not a valid mode."
exit 1;
;;
esac
if [ "$TCP_MODE" -o "$UDP_MODE" ]; then
echo " mode."
fi
}
case "$1" in
start)
startup
;;
stop)
echo -n "Stopping anti portscan daemon: portsentry"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
echo "."
;;
restart|force-reload)
echo -n "Stopping anti portscan daemon: portsentry"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
echo "."
startup
;;
*)
echo "Usage: /etc/init.d/portsentry {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
|