diff options
Diffstat (limited to 'network')
-rw-r--r-- | network/knock/README | 10 | ||||
-rw-r--r-- | network/knock/doinst.sh | 26 | ||||
-rw-r--r-- | network/knock/knock.SlackBuild | 78 | ||||
-rw-r--r-- | network/knock/knock.info | 8 | ||||
-rw-r--r-- | network/knock/rc.knockd.new | 41 | ||||
-rw-r--r-- | network/knock/slack-desc | 19 |
6 files changed, 182 insertions, 0 deletions
diff --git a/network/knock/README b/network/knock/README new file mode 100644 index 0000000000000..1af140baead25 --- /dev/null +++ b/network/knock/README @@ -0,0 +1,10 @@ +Knockd and knock are a port-knock server and client, respectively. Knockd +listens to all traffic on an ethernet (or PPP) interface, looking for +special "knock" sequences of port-hits. A client makes these port-hits +by sending a TCP (or UDP) packet to a port on the server. This port +need not be open -- since knockd listens at the link-layer level, it +sees all traffic even if it's destined for a closed port. When the +server detects a specific sequence of port-hits, it runs a command +defined in its configuration file. This can be used to open up holes in +a firewall for quick access. + diff --git a/network/knock/doinst.sh b/network/knock/doinst.sh new file mode 100644 index 0000000000000..9a247a060bc43 --- /dev/null +++ b/network/knock/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same permissions on rc.knockd.new as an existing rc.knockd: +if [ -e etc/rc.d/rc.knockd ]; then + cp -a etc/rc.d/rc.knockd etc/rc.d/rc.knockd.new.incoming + cat etc/rc.d/rc.knockd.new > etc/rc.d/rc.knockd.new.incoming + mv etc/rc.d/rc.knockd.new.incoming etc/rc.d/rc.knockd.new +else + # If rc.knockd does not exist, make the new one executable by default, + # which won't matter unless it's called from rc.local anyway + chmod 0755 etc/rc.d/rc.knockd.new +fi + +config etc/rc.d/rc.knockd.new +config etc/knockd.conf.new diff --git a/network/knock/knock.SlackBuild b/network/knock/knock.SlackBuild new file mode 100644 index 0000000000000..0e174d967105c --- /dev/null +++ b/network/knock/knock.SlackBuild @@ -0,0 +1,78 @@ +#!/bin/sh + +# Slackware build script for knock(d) + +# Written by Joey Trungale joey@trungale.net + +PRGNAM=knock +VERSION=${VERSION:-0.5} +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +fi + +set -e # Exit on most errors + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man + +make +make install DESTDIR=$PKG + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null +) + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +) + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING README ChangeLog TODO $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $PKG/etc/knockd.conf > $PKG/usr/doc/$PRGNAM-$VERSION/knockd.conf +mv $PKG/etc/knockd.conf $PKG/etc/knockd.conf.new + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.knockd.new > $PKG/etc/rc.d/rc.knockd.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/knock/knock.info b/network/knock/knock.info new file mode 100644 index 0000000000000..c8cb983cb3085 --- /dev/null +++ b/network/knock/knock.info @@ -0,0 +1,8 @@ +PRGNAM="knock" +VERSION=".0.5" +HOMEPAGE="http://www.zeroflux.org" +DOWNLOAD="http://www.zeroflux.org/proj/knock/files/knock-0.5.tar.gz" +MD5SUM="ca09d61458974cff90a700aba6120891" +MAINTAINER="Joey Trungale" +EMAIL="joey@trungale.net" +APPROVED="dsomero" diff --git a/network/knock/rc.knockd.new b/network/knock/rc.knockd.new new file mode 100644 index 0000000000000..5198603ffbc76 --- /dev/null +++ b/network/knock/rc.knockd.new @@ -0,0 +1,41 @@ +#!/bin/sh +# Start/stop/restart knockd. + +# Start knockd: +knockd_start() { + CMDLINE="/usr/sbin/knockd -d" + echo -n "Starting knock daemon: $CMDLINE " + $CMDLINE + echo +} + +# Stop knockd: +knockd_stop() { + echo -n "Stopping knock daemon..." + kill `cat /var/run/knockd.pid` + echo + sleep 1 + rm -f /var/run/knockd.pid + killall knockd 2> /dev/null +} + +# Restart knockd: +knockd_restart() { + knockd_stop + sleep 1 + knockd_start +} + +case "$1" in +'start') + knockd_start + ;; +'stop') + knockd_stop + ;; +'restart') + knockd_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/network/knock/slack-desc b/network/knock/slack-desc new file mode 100644 index 0000000000000..1ba1ec04207b7 --- /dev/null +++ b/network/knock/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +knock: knock (a port-knock server) +knock: +knock: This is a port-knocking server/client. Port-knocking is a method +knock: where a server can sniff one of its interfaces for a special "knock" +knock: sequence of port-hits. When detected, it will run a specified event +knock: bound to that port knock sequence. These port-hits need not be on +knock: open ports, since we use libpcap to sniff the raw interface traffic. +knock: +knock: +knock: http://www.zeroflux.org/cgi-bin/cvstrac.cgi/knock/wiki +knock: |