diff options
-rw-r--r-- | network/mod_evasive/README | 27 | ||||
-rw-r--r-- | network/mod_evasive/doinst.sh | 15 | ||||
-rw-r--r-- | network/mod_evasive/mod_evasive.SlackBuild | 24 | ||||
-rw-r--r-- | network/mod_evasive/mod_evasive.conf | 13 | ||||
-rw-r--r-- | network/mod_evasive/mod_evasive.info | 2 | ||||
-rw-r--r-- | network/mod_evasive/slack-desc | 2 |
6 files changed, 52 insertions, 31 deletions
diff --git a/network/mod_evasive/README b/network/mod_evasive/README index 5cebd45147..30c89f0697 100644 --- a/network/mod_evasive/README +++ b/network/mod_evasive/README @@ -7,33 +7,16 @@ reports abuses via email and syslog facilities. Detection is performed by creating an internal dynamic hash table of IP Addresses and URIs, and denying any single IP address from any of the following: - - * Requesting the same page more than a few times per second * Making more than 50 concurrent requests on the same child per second * Making any requests while temporarily blacklisted (on a blocking list) - -To enable it edit /etc/httpd/httpd.conf to have like the following: - -LoadModule evasive20_module lib/httpd/modules/mod_evasive20.so - -<IfModule mod_evasive20.c> - DOSHashTableSize 3097 - DOSPageCount 2 - DOSSiteCount 50 - DOSPageInterval 1 - DOSSiteInterval 1 - DOSBlockingPeriod 10 -</IfModule> - +You'll need to add the following line to your /etc/httpd/httpd.conf file: + Include /etc/httpd/mod_evasive.conf To test enter the following command: - - perl /usr/doc/mod_evasive-$VERSION/test.pl | more - -Which should output some HTTP/1.1 200 OK lines; then HTTP/1.1 403 Forbidden + perl /usr/doc/mod_evasive-$VERSION/test.pl | more +which should output some HTTP/1.1 200 OK lines; then HTTP/1.1 403 Forbidden mod_evasive is fully tweakable through the Apache configuration file, see -the READE file in /usr/doc/mod_evasive-$VERSION for configuration details. - +the README file in the package's documentation directory. diff --git a/network/mod_evasive/doinst.sh b/network/mod_evasive/doinst.sh new file mode 100644 index 0000000000..5077bf363e --- /dev/null +++ b/network/mod_evasive/doinst.sh @@ -0,0 +1,15 @@ +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... +} + +config etc/httpd/mod_evasive.conf.new + diff --git a/network/mod_evasive/mod_evasive.SlackBuild b/network/mod_evasive/mod_evasive.SlackBuild index 607e2e5e58..5e80a3e41f 100644 --- a/network/mod_evasive/mod_evasive.SlackBuild +++ b/network/mod_evasive/mod_evasive.SlackBuild @@ -8,24 +8,26 @@ # Granted WTFPL, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. -# Modified by SlackBuilds.org - PRGNAM=mod_evasive VERSION=1.10.1 ARCH=${ARCH:-i486} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -CWD=`pwd` + +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" fi set -e # exit on most errors @@ -34,23 +36,28 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM -tar -xzvf $CWD/${PRGNAM}_${VERSION}.tar.gz +tar xvf $CWD/${PRGNAM}_${VERSION}.tar.gz cd $PRGNAM chown -R root:root . chmod -R a-s,u+w,go+r-w . # Create target dir -mkdir -p $PKG/usr/lib/httpd/modules +mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules # Compile module as DSO (dynmically shared object) CFLAGS="$SLACKFLAGS" \ apxs -ca mod_evasive20.c # copy into place -cp -v .libs/mod_evasive20.so $PKG/usr/lib/httpd/modules +cp -v .libs/mod_evasive20.so $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules + +mkdir -p $PKG/etc/httpd/ +sed "s%@baselibdir@%lib${LIBDIRSUFFIX}%" $CWD/mod_evasive.conf > \ + $PKG/etc/httpd/mod_evasive.conf.new ( cd $PKG || exit 1 - find . -type f | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . -type f | xargs file | grep -e "executable" -e "shared object" | \ + grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION @@ -60,6 +67,7 @@ find $PKG/usr/doc -type f -exec chmod 0644 {} \; 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 +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/mod_evasive/mod_evasive.conf b/network/mod_evasive/mod_evasive.conf new file mode 100644 index 0000000000..db5b0f31b3 --- /dev/null +++ b/network/mod_evasive/mod_evasive.conf @@ -0,0 +1,13 @@ +# Apache config for mod_evasive + +LoadModule evasive20_module @baselibdir@/httpd/modules/mod_evasive20.so + +<IfModule mod_evasive20.c> + DOSHashTableSize 3097 + DOSPageCount 2 + DOSSiteCount 50 + DOSPageInterval 1 + DOSSiteInterval 1 + DOSBlockingPeriod 10 +</IfModule> + diff --git a/network/mod_evasive/mod_evasive.info b/network/mod_evasive/mod_evasive.info index f8e629f3e8..f1dc8e88c2 100644 --- a/network/mod_evasive/mod_evasive.info +++ b/network/mod_evasive/mod_evasive.info @@ -3,6 +3,8 @@ VERSION="1.10.1" HOMEPAGE="http://www.zdziarski.com/projects/mod_evasive/" DOWNLOAD="http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz" MD5SUM="784fca4a124f25ccff5b48c7a69a65e5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" MAINTAINER="Menno E. Duursma" EMAIL="druiloor@zonnet.nl" APPROVED="Erik Hanson" diff --git a/network/mod_evasive/slack-desc b/network/mod_evasive/slack-desc index 054e67d7be..e370813556 100644 --- a/network/mod_evasive/slack-desc +++ b/network/mod_evasive/slack-desc @@ -5,7 +5,7 @@ # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. - |-----handy-ruler------------------------------------------------------| + |-----handy-ruler------------------------------------------------------| mod_evasive: mod_evasive (an Apache anti-DoS module) mod_evasive: mod_evasive: mod_evasive is an evasive maneuvers module for Apache to |