diff options
-rw-r--r-- | network/xinetd/README | 22 | ||||
-rw-r--r-- | network/xinetd/doinst.sh | 34 | ||||
-rw-r--r-- | network/xinetd/rc.xinetd | 103 | ||||
-rw-r--r-- | network/xinetd/slack-desc | 19 | ||||
-rw-r--r-- | network/xinetd/xinetd-2.3.14-add_destdir.patch | 48 | ||||
-rw-r--r-- | network/xinetd/xinetd.SlackBuild | 125 | ||||
-rw-r--r-- | network/xinetd/xinetd.info | 10 |
7 files changed, 361 insertions, 0 deletions
diff --git a/network/xinetd/README b/network/xinetd/README new file mode 100644 index 0000000000..8c50f8775b --- /dev/null +++ b/network/xinetd/README @@ -0,0 +1,22 @@ +Xinetd is a powerful inetd replacement. Xinetd has access control mechanisms, +extensive logging capabilities, the ability to make services available based +on time, can place limits on the number of servers that can be started, +and has a configurable defence mechanisms to protect against port scanners, +among other things. + +Before starting xinetd, you may wish to switch inetd off if it is running. +To do this: + +Do a "ps x" as root and look up the pid of inetd. Then do "kill <pid of inetd>" + +Stop inetd from starting at boot: chmod 0644 /etc/rc.d/rc.inetd +Start xinetd on boot by adding the following lines to /etc/rc.d/rc.local: + + if [ ! -x /etc/rc.d/rc.inetd ] && [ -x /etc/rc.d/rc.xinetd ]; then + /etc/rc.d/rc.xinetd start + fi +Ensure that /etc/rc.d/{rc.local,rc.xinetd} have executable permissions. + +Alternatively, you can avoid all of the edits to rc.local: +mv /etc/rc.d/rc.xinetd /etc/rc.d/rc.inetd + diff --git a/network/xinetd/doinst.sh b/network/xinetd/doinst.sh new file mode 100644 index 0000000000..1f9319c35c --- /dev/null +++ b/network/xinetd/doinst.sh @@ -0,0 +1,34 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} +config etc/xinetd.conf.new +config etc/xinetd.d/chargen-dgram.new +config etc/xinetd.d/chargen-stream.new +config etc/xinetd.d/daytime-dgram.new +config etc/xinetd.d/daytime-stream.new +config etc/xinetd.d/discard-dgram.new +config etc/xinetd.d/discard-stream.new +config etc/xinetd.d/echo-dgram.new +config etc/xinetd.d/echo-stream.new +config etc/xinetd.d/ftp-sensor.new +config etc/xinetd.d/tcpmux-server.new +config etc/xinetd.d/time-dgram.new +config etc/xinetd.d/time-stream.new +preserve_perms etc/rc.d/rc.xinetd.new + diff --git a/network/xinetd/rc.xinetd b/network/xinetd/rc.xinetd new file mode 100644 index 0000000000..44f153b1ba --- /dev/null +++ b/network/xinetd/rc.xinetd @@ -0,0 +1,103 @@ +#!/bin/sh + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +RETVAL=0 + +start(){ + echo "Starting xinetd: /usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid " + # Need to get rid of localization for external services - + # it doesn't make much sense to have i18n on the server side here + LANG=en_US + LC_TIME=en_US + LC_ALL=en_US + LC_MESSAGES=en_US + LC_NUMERIC=en_US + LC_MONETARY=en_US + LC_COLLATE=en_US + export LANG LC_TIME LC_ALL LC_MESSAGES LC_NUMERIC LC_MONETARY LC_COLLATE + unset HOME MAIL USER USERNAME + /usr/sbin/xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid + RETVAL=$? + [ "$RETVAL" = 0 ] && touch /var/lock/subsys/xinetd + return $RETVAL +} + +stop(){ + echo "Stopping xinetd... " + killall xinetd 2>/dev/null + RETVAL=$? + rm -f /var/lock/subsys/xinetd + return $RETVAL +} + +restart(){ + stop + sleep 1 + start +} + +reload(){ + echo "Reloading xinetd configuration..." + killall -HUP xinetd 2>/dev/null + return $? +} + +dump(){ + echo -n $"Dumping configuration: " + killall -USR1 xinetd + RETVAL=$? + echo + return $RETVAL +} + +check(){ + echo $"Performing Consistency Check: " + /bin/kill -s IOT xinetd + RETVAL=$? + return $RETVAL +} + +status(){ + echo -n $"Checking xinetd: " + /bin/kill -s IOT xinetd 2>/dev/null + RETVAL=$? + if [ $RETVAL = 0 ]; then + echo "xinetd is running" + else + echo "xinetd is not running" + fi + return $RETVAL +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + reload) + reload + ;; + dump) + dump + ;; + check) + check + ;; + status) + status + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|dump|check|status}" + RETVAL=1 +esac + +exit $RETVAL + + diff --git a/network/xinetd/slack-desc b/network/xinetd/slack-desc new file mode 100644 index 0000000000..96239399df --- /dev/null +++ b/network/xinetd/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 ':' except on otherwise blank lines. + + |------handy-ruler------------------------------------------------------| +xinetd: xinetd -- A better inetd +xinetd: +xinetd: Xinetd is a powerful inetd replacement. Xinetd has access control +xinetd: mechanisms, extensive logging capabilities, the ability to make +xinetd: services available based on time, can place limits on the number of +xinetd: servers that can be started, and has a configurable defence mechanisms +xinetd: to protect against port scanners, among other things. +xinetd: +xinetd: Homepage: http://xinetd.org +xinetd: + diff --git a/network/xinetd/xinetd-2.3.14-add_destdir.patch b/network/xinetd/xinetd-2.3.14-add_destdir.patch new file mode 100644 index 0000000000..6504ef07d6 --- /dev/null +++ b/network/xinetd/xinetd-2.3.14-add_destdir.patch @@ -0,0 +1,48 @@ +diff -Nur xinetd-2.3.14.orig//Makefile.in xinetd-2.3.14/Makefile.in +--- xinetd-2.3.14.orig//Makefile.in 2003-08-15 09:00:45.000000000 -0500 ++++ xinetd-2.3.14/Makefile.in 2010-11-24 23:45:57.615587280 -0600 +@@ -75,27 +75,27 @@ + + install: build + for i in $(DAEMONDIR) $(BINDIR) $(MANDIR)/man5 $(MANDIR)/man8 ; do \ +- test -d $$i || mkdir -p $$i ; done +- $(INSTALL_CMD) -m 755 xinetd/xinetd $(DAEMONDIR) +- $(INSTALL_CMD) -m 755 xinetd/itox $(DAEMONDIR) +- $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DAEMONDIR) +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(MANDIR)/man5/xinetd.conf.5 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(MANDIR)/man8/xinetd.log.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(MANDIR)/man8/xinetd.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(MANDIR)/man8/itox.8 +- $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(MANDIR)/man8/xconv.pl.8 ++ test -d $(DESTDIR)/$$i || mkdir -p $(DESTDIR)/$$i ; done ++ $(INSTALL_CMD) -m 755 xinetd/xinetd $(DESTDIR)/$(DAEMONDIR) ++ $(INSTALL_CMD) -m 755 xinetd/itox $(DESTDIR)/$(DAEMONDIR) ++ $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DESTDIR)/$(DAEMONDIR) ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(DESTDIR)/$(MANDIR)/man5/xinetd.conf.5 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(DESTDIR)/$(MANDIR)/man8/xinetd.log.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(DESTDIR)/$(MANDIR)/man8/xinetd.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(DESTDIR)/$(MANDIR)/man8/itox.8 ++ $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(DESTDIR)/$(MANDIR)/man8/xconv.pl.8 + @echo "You must put your xinetd.conf in /etc/xinetd.conf" + @echo "There is a sample config file in xinetd/sample.conf and you can" + @echo "use xconv.pl to convert your old inetd.conf file to an xinetd format" + + uninstall: +- rm -f $(DAEMONDIR)/xinetd +- rm -f $(DAEMONDIR)/itox +- rm -f $(DAEMONDIR)/xconv.pl +- rm -f $(MANDIR)/man5/xinetd.conf.5 +- rm -f $(MANDIR)/man8/xinetd.log.8 +- rm -f $(MANDIR)/man8/xinetd.8 +- rm -f $(MANDIR)/man8/itox.8 ++ rm -f $(DESTDIR)/$(DAEMONDIR)/xinetd ++ rm -f $(DESTDIR)/$(DAEMONDIR)/itox ++ rm -f $(DESTDIR)/$(DAEMONDIR)/xconv.pl ++ rm -f $(DESTDIR)/$(MANDIR)/man5/xinetd.conf.5 ++ rm -f $(DESTDIR)/$(MANDIR)/man8/xinetd.log.8 ++ rm -f $(DESTDIR)/$(MANDIR)/man8/xinetd.8 ++ rm -f $(DESTDIR)/$(MANDIR)/man8/itox.8 + + distclean: clean + rm -f config.cache config.log Makefile config.status xinetd/itox + diff --git a/network/xinetd/xinetd.SlackBuild b/network/xinetd/xinetd.SlackBuild new file mode 100644 index 0000000000..7298ba7179 --- /dev/null +++ b/network/xinetd/xinetd.SlackBuild @@ -0,0 +1,125 @@ +#!/bin/sh + +# Slackware build script for xinetd + +# Copyright 2010 Chris Abela <chris.abela@maltats.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=xinetd +VERSION=${VERSION:-2.3.14} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +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 {} \; + +# Add DESTDIR support +patch -p1 < $CWD/xinetd-2.3.14-add_destdir.patch + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --with-libwrap \ + --with-loadavg \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +# Install config files +mkdir -p $PKG/etc/xinetd.d/ +cat contrib/xinetd.conf > $PKG/etc/xinetd.conf.new +for file in contrib/xinetd.d/* ; do + cat $file > $PKG/etc/xinetd.d/$(basename $file).new ; +done + +# Install the Slackware init script +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.xinetd > $PKG/etc/rc.d/rc.xinetd.new +chmod 0755 $PKG/etc/rc.d/rc.xinetd.new + +# Make sure /var/lock/subsys exists and keeps correct permissions +mkdir -p $PKG/var/lock/subsys +chmod 1777 $PKG/var/lock + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + AUDIT CHANGELOG COPYRIGHT INSTALL README TODO contrib \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +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.${PKGTYPE:-tgz} + diff --git a/network/xinetd/xinetd.info b/network/xinetd/xinetd.info new file mode 100644 index 0000000000..34fea9b675 --- /dev/null +++ b/network/xinetd/xinetd.info @@ -0,0 +1,10 @@ +PRGNAM="xinetd" +VERSION="2.3.14" +HOMEPAGE="http://xinetd.org" +DOWNLOAD="http://xinetd.org/xinetd-2.3.14.tar.gz" +MD5SUM="567382d7972613090215c6c54f9b82d9" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Chris Abela" +EMAIL="chris.abela@maltats.com" +APPROVED="rworkman" |