network/mod_evasive: Updated for version 1.10.1

This commit is contained in:
Menno E. Duursma 2010-05-13 00:37:13 +02:00 committed by Erik Hanson
parent 6dd98402af
commit c34de5f8e2
6 changed files with 52 additions and 31 deletions

View file

@ -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.

View file

@ -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

View file

@ -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}

View file

@ -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>

View file

@ -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"

View file

@ -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