wok-4.x diff fail2ban/receipt @ rev 11341

fail2ban: enable ssh filter
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Nov 26 15:38:48 2011 +0100 (2011-11-26)
parents 59009b1c6878
children ad0b23f0fdd8
line diff
     1.1 --- a/fail2ban/receipt	Tue Mar 01 17:06:27 2011 +0100
     1.2 +++ b/fail2ban/receipt	Sat Nov 26 15:38:48 2011 +0100
     1.3 @@ -3,24 +3,50 @@
     1.4  PACKAGE="fail2ban"
     1.5  VERSION="0.8.4"
     1.6  CATEGORY="network"
     1.7 -SHORT_DESC="Scans log files to bans IP that makes too many password failures.."
     1.8 +SHORT_DESC="Scans log files to bans IP that makes too many password failures."
     1.9  MAINTAINER="pascal.bellard@slitaz.org"
    1.10  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    1.11  WEB_SITE="http://www.fail2ban.org/wiki/index.php/Main_Page"
    1.12 +DEPENDS="iptables"
    1.13  BUILD_DEPENDS="python"
    1.14  WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.15  TAGS="monitor network"
    1.16 +CONFIG_FILES="/etc/fail2ban"
    1.17  
    1.18  # Rules to configure and make the package.
    1.19  compile_rules()
    1.20  {
    1.21  	cd $src
    1.22 -	python setup.py install --root=$PWD/_pkg
    1.23 +	python setup.py install --root=$DESTDIR
    1.24  }
    1.25  
    1.26  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.27  genpkg_rules()
    1.28  {
    1.29 +	mkdir -p $fs/etc/logrotate.d
    1.30  	cp -a $_pkg/* $fs
    1.31 +	sed -i -e 's|127.0.01|& 192.168.0.0/16|;s|sshd.log|messages|' \
    1.32 +		-e '/ssh-iptables/{nn;s/false/true/}' $fs/etc/fail2ban/jail.conf
    1.33 +	cat >> $fs/etc/fail2ban/jail.conf <<EOT
    1.34 +[ssh-ddos]
    1.35 +
    1.36 +enabled  = true
    1.37 +port     = ssh,sftp
    1.38 +filter   = sshd-ddos
    1.39 +action   = iptables-allports[name=SSHDDOS]
    1.40 +logpath  = /var/log/messages
    1.41 +maxretry = 2
    1.42 +
    1.43 +EOT
    1.44 +	ln -s /usr/bin/fail2ban-client $fs/etc/init.d/fail2ban
    1.45 +	cat > $fs/etc/logrotate.d/fail2ban <<EOT
    1.46 +/var/log/fail2ban.log {
    1.47 +	weekly
    1.48 +	rotate 10
    1.49 +	compress
    1.50 +	postrotate
    1.51 +	/etc/init.d/fail2ban reload >/dev/null || true
    1.52 +	endscript
    1.53  }
    1.54 -
    1.55 +EOT
    1.56 +}