From 8876733ea6f004244472cff76bd964dc8cc5aedf Mon Sep 17 00:00:00 2001 From: Nishant Limbachia Date: Tue, 11 May 2010 22:25:16 +0200 Subject: network/fail2ban: Updated for version 0.8.3 --- network/fail2ban/README | 2 +- network/fail2ban/README.SBo | 2 +- network/fail2ban/doinst.sh | 5 +++ network/fail2ban/fail2ban.SlackBuild | 61 ++++++++++++++++++++++-------------- network/fail2ban/fail2ban.info | 8 ++--- network/fail2ban/rc.fail2ban | 45 ++++++++++++++------------ network/fail2ban/slack-desc | 20 ++++-------- 7 files changed, 79 insertions(+), 64 deletions(-) diff --git a/network/fail2ban/README b/network/fail2ban/README index 5993d3c304..d497303935 100644 --- a/network/fail2ban/README +++ b/network/fail2ban/README @@ -7,4 +7,4 @@ fail2ban has following dependencies which are offical Slackware packages: 1. Python >= 2.3 Required 2. gamin >= 0.0.21 Optional -Also see README.SBo for configuration and upgrade help. +Also see README.SBo for configuration and upgrade help. \ No newline at end of file diff --git a/network/fail2ban/README.SBo b/network/fail2ban/README.SBo index 8395a086da..b5e083cd8b 100644 --- a/network/fail2ban/README.SBo +++ b/network/fail2ban/README.SBo @@ -33,4 +33,4 @@ Changelog: become standard. - minor fix in slackbuild. - doinst.sh now makes /var/run/fail2ban to house pid and socket files. - +08/03/2008 upgraded to fail2ban version 0.8.3, added restart option to rc script diff --git a/network/fail2ban/doinst.sh b/network/fail2ban/doinst.sh index de511378bf..485e843f8e 100644 --- a/network/fail2ban/doinst.sh +++ b/network/fail2ban/doinst.sh @@ -18,5 +18,10 @@ if [ -e etc/rc.d/rc.fail2ban ]; then mv etc/rc.d/rc.fail2ban.new.incoming etc/rc.d/rc.fail2ban.new fi +# make directory for socket and pid file +if [ ! -d var/run/fail2ban ]; then + mkdir -p var/run/fail2ban +fi + config etc/rc.d/rc.fail2ban.new config etc/logrotate.d/fail2ban.new diff --git a/network/fail2ban/fail2ban.SlackBuild b/network/fail2ban/fail2ban.SlackBuild index 64764b9d4e..b65d44ef60 100644 --- a/network/fail2ban/fail2ban.SlackBuild +++ b/network/fail2ban/fail2ban.SlackBuild @@ -1,16 +1,20 @@ #!/bin/sh +################################################################################# + # Slackware Package Build Script for fail2ban +# +# Home Page http://www.fail2ban.org/wiki/index.php/Main_Page # Copyright (c) 2007, Nishant Limbachia (nishant@mnspace.net) # 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 script must retain the above copyright notice, # this list of conditions and the following disclaimer. -# + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -22,59 +26,68 @@ # 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=fail2ban -VERSION=0.8.2 +VERSION=0.8.3 ARCH=${ARCH:-noarch} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} +CWD=$(pwd) -set -e # Exit on most errors +# exit on most errors +set -e +### clean up from previous builds rm -fr $PKG $TMP/$PRGNAM-$VERSION mkdir -p $PKG $TMP $OUTPUT + +### Extracting the source tarballs cd $TMP -tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +tar xjvf $CWD/$PRGNAM-$VERSION.tar.bz2 cd $TMP/$PRGNAM-$VERSION + chown -R root.root . find . \ - \( -perm 777 -o -perm 775 -o -perm 771 -o -perm 711 -o -perm 555 -o -perm 551 -o -perm 511 \) \ - -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 660 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ - -exec chmod 644 {} \; +\( -perm 777 -o -perm 775 -o -perm 771 -o -perm 711 -o -perm 555 -o -perm 551 -o -perm 511 \) \ +-exec chmod 755 {} \; -o \ +\( -perm 666 -o -perm 664 -o -perm 660 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ +-exec chmod 644 {} \; python setup.py install --root=$PKG -install -D -m 0644 $CWD/README.SBo $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a COPYING ChangeLog PKG-INFO README TODO $PKG/usr/doc/$PRGNAM-$VERSION -# Installing man pages +### installing man pages mkdir -p $PKG/usr/man/man1 -install -m 0644 man/*.1 $PKG/usr/man/man1 -# Find and compress man pages -( cd $PKG/usr/man +install -m 0644 man/fail2ban-client.1 man/fail2ban-regex.1 \ +man/fail2ban-server.1 $PKG/usr/man/man1 + +# find and compress man pages +if [ -d $PKG/usr/man ]; then + ( 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 -) + ) +fi -# Install startup script +# install startup script install -D -m 0644 $CWD/rc.fail2ban $PKG/etc/rc.d/rc.fail2ban.new -# Install logrotate script +# install logrotate script install -D -m 0644 $CWD/fail2ban.logrotate $PKG/etc/logrotate.d/fail2ban.new -# Make directory for socket and pid file -mkdir -p $PKG/var/run/fail2ban - +### building package mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh - +cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz + diff --git a/network/fail2ban/fail2ban.info b/network/fail2ban/fail2ban.info index 653a959fa5..2ed2408fc4 100644 --- a/network/fail2ban/fail2ban.info +++ b/network/fail2ban/fail2ban.info @@ -1,8 +1,8 @@ PRGNAM="fail2ban" -VERSION="0.8.2" +VERSION="0.8.3" HOMEPAGE="http://www.fail2ban.org/wiki/index.php/Main_Page" -DOWNLOAD="http://downloads.sourceforge.net/fail2ban/fail2ban-0.8.2.tar.bz2" -MD5SUM="48c82a8b79cf6275d557571003eddbb1" +DOWNLOAD="http://internap.dl.sourceforge.net/sourceforge/fail2ban/fail2ban-0.8.3.tar.bz2" +MD5SUM="b438d7e2ce77a469fb0cca2a5cc0b81c" MAINTAINER="Nishant Limbachia" EMAIL="nishant@mnspace.net" -APPROVED="David Somero" +APPROVED="David Somero" \ No newline at end of file diff --git a/network/fail2ban/rc.fail2ban b/network/fail2ban/rc.fail2ban index 5f34cdb1ef..681e86bcad 100644 --- a/network/fail2ban/rc.fail2ban +++ b/network/fail2ban/rc.fail2ban @@ -9,56 +9,61 @@ # you must also add this file to rc.local in the appropriate # order # +SOCKET="/var/run/fail2ban/fail2ban.socket" fail2ban_start() { if [ -x /etc/rc.d/rc.fail2ban ]; then - echo "Starting fail2ban: " - /usr/bin/fail2ban-client start + echo "Starting fail2ban: " + /usr/bin/fail2ban-client -x -s ${SOCKET} start else - echo "rc.fail2ban is not executable or you don't have enough permissions" - exit 1 + echo "rc.fail2ban is not executable or you don't have enough permissions" + exit 1 fi } fail2ban_stop() { - echo "Stopping fail2ban" - /usr/bin/fail2ban-client stop + echo "Stopping fail2ban" + /usr/bin/fail2ban-client -x -s ${SOCKET} stop } fail2ban_reload() { - echo "Reloading fail2ban" - /usr/bin/fail2ban-client reload + echo "Reloading fail2ban" + /usr/bin/fail2ban-client -x -s ${SOCKET} reload } fail2ban_status() { - echo "Status: fail2ban" - /usr/bin/fail2ban-client status + echo "Status: fail2ban" + /usr/bin/fail2ban-client -s ${SOCKET} status } fail2ban_ping() { - echo "Pinging fail2ban" - /usr/bin/fail2ban-client ping + echo "Pinging fail2ban" + /usr/bin/fail2ban-client -s ${SOCKET} ping } case "$1" in 'start') - fail2ban_start + fail2ban_start ;; 'stop') - fail2ban_stop + fail2ban_stop ;; +'restart') + fail2ban_stop + sleep 2 + fail2ban_start +;; 'reload') - fail2ban_reload + fail2ban_reload ;; 'status') - fail2ban_status + fail2ban_status ;; 'ping') - fail2ban_ping + fail2ban_ping ;; '*') - echo "USAGE: $0 start|stop|reload|status|ping" - exit 1 + echo "USAGE: $0 start|stop|restart|reload|status|ping" + exit 1 ;; esac - diff --git a/network/fail2ban/slack-desc b/network/fail2ban/slack-desc index cfb24f5525..43e537dbf3 100644 --- a/network/fail2ban/slack-desc +++ b/network/fail2ban/slack-desc @@ -1,19 +1,11 @@ -# 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------------------------------------------------------| -fail2ban: Fail2Ban (Fialed login attempt scanner) +fail2ban: Fail2Ban (bans IP that makes too many password failures) fail2ban: -fail2ban: Fail2Ban scans log files and bans IP addresses that make -fail2ban: too many password failures by modifying firewall rules. -fail2ban: Fail2Ban can read multiple log files such as sshd, apache, -fail2ban: postfix, and others. +fail2ban: Fail2Ban scans log files like /var/log/pwdfail and bans IP +fail2ban: that makes too many password failures. It updates firewall +fail2ban: rules to reject the IP address. These rules can be defined by +fail2ban: the user. Fail2Ban can read multiple log files such as sshd, +fail2ban: Apache web server, postfix and others. fail2ban: fail2ban: Home Page: http://www.fail2ban.org/wiki/index.php/Main_Page fail2ban: fail2ban: -fail2ban: -- cgit v1.2.3