wok annotate fail2ban/receipt @ rev 11844

vanessa_socket: fix genpkg_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 27 08:25:39 2012 +0100 (2012-02-27)
parents 5d8d4ed26dc6
children fb8f84758977
rev   line source
pascal@1809 1 # SliTaz package receipt.
pascal@1809 2
pascal@1809 3 PACKAGE="fail2ban"
slaxemulator@7152 4 VERSION="0.8.4"
pascal@1809 5 CATEGORY="network"
pascal@11341 6 SHORT_DESC="Scans log files to bans IP that makes too many password failures."
pascal@1809 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@1809 8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pascal@1809 9 WEB_SITE="http://www.fail2ban.org/wiki/index.php/Main_Page"
pascal@11341 10 DEPENDS="iptables"
pascal@8940 11 BUILD_DEPENDS="python"
pascal@1809 12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
jozee@4936 13 TAGS="monitor network"
pascal@11341 14 CONFIG_FILES="/etc/fail2ban"
pascal@1809 15
pascal@1809 16 # Rules to configure and make the package.
pascal@1809 17 compile_rules()
pascal@1809 18 {
pascal@1809 19 cd $src
pascal@11341 20 python setup.py install --root=$DESTDIR
pascal@1809 21 }
pascal@1809 22
pascal@1809 23 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@1809 24 genpkg_rules()
pascal@1809 25 {
pascal@11341 26 mkdir -p $fs/etc/logrotate.d
pascal@1809 27 cp -a $_pkg/* $fs
slaxemulator@11345 28 sed -i -e 's|127.0.0.1|& 192.168.0.0/16|;s|sshd.log|messages|' \
pascal@11341 29 -e '/ssh-iptables/{nn;s/false/true/}' $fs/etc/fail2ban/jail.conf
pascal@11341 30 cat >> $fs/etc/fail2ban/jail.conf <<EOT
pascal@11341 31 [ssh-ddos]
pascal@11341 32
pascal@11341 33 enabled = true
pascal@11341 34 port = ssh,sftp
pascal@11341 35 filter = sshd-ddos
pascal@11341 36 action = iptables-allports[name=SSHDDOS]
pascal@11341 37 logpath = /var/log/messages
pascal@11341 38 maxretry = 2
pascal@11341 39
pascal@11341 40 EOT
pascal@11341 41 ln -s /usr/bin/fail2ban-client $fs/etc/init.d/fail2ban
pascal@11341 42 cat > $fs/etc/logrotate.d/fail2ban <<EOT
pascal@11341 43 /var/log/fail2ban.log {
pascal@11341 44 weekly
pascal@11341 45 rotate 10
pascal@11341 46 compress
pascal@11341 47 postrotate
pascal@11341 48 /etc/init.d/fail2ban reload >/dev/null || true
pascal@11341 49 endscript
pascal@1809 50 }
pascal@11341 51 EOT
pascal@11341 52 }