diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-20 16:44:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-04-20 16:44:53 +0000 |
commit | 2db6c6cae02eeead53b9ad09da0087c928bc29de (patch) | |
tree | 249de5e9389f53108dba33b750ef60c1000978a3 | |
parent | 7585763f3d3a6ac3f52b8fe4a526da45100ea7ea (diff) | |
download | alpine_aports-2db6c6cae02eeead53b9ad09da0087c928bc29de.tar.bz2 alpine_aports-2db6c6cae02eeead53b9ad09da0087c928bc29de.tar.xz alpine_aports-2db6c6cae02eeead53b9ad09da0087c928bc29de.zip |
testing/fail2ban: add init.d script and logrotate
fixes #583
-rw-r--r-- | testing/fail2ban/APKBUILD | 21 | ||||
-rw-r--r-- | testing/fail2ban/fail2ban.confd | 8 | ||||
-rw-r--r-- | testing/fail2ban/fail2ban.logrotate | 9 | ||||
-rw-r--r-- | testing/fail2ban/gentoo-initd_create_run_dir.patch | 19 |
4 files changed, 53 insertions, 4 deletions
diff --git a/testing/fail2ban/APKBUILD b/testing/fail2ban/APKBUILD index 7a20ad4c2d..8a770f60ef 100644 --- a/testing/fail2ban/APKBUILD +++ b/testing/fail2ban/APKBUILD | |||
@@ -2,15 +2,19 @@ | |||
2 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> | 2 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> |
3 | pkgname=fail2ban | 3 | pkgname=fail2ban |
4 | pkgver=0.8.4 | 4 | pkgver=0.8.4 |
5 | pkgrel=0 | 5 | pkgrel=1 |
6 | pkgdesc="Scans log files for login failures then updates iptables to reject originating ip address" | 6 | pkgdesc="Scans log files for login failures then updates iptables to reject originating ip address" |
7 | url="http://www.fail2ban.org" | 7 | url="http://www.fail2ban.org" |
8 | arch="noarch" | 8 | arch="noarch" |
9 | license="GPLv2" | 9 | license="GPLv2" |
10 | depends="python iptables" | 10 | depends="python iptables logrotate" |
11 | makedepends="python-dev" | 11 | makedepends="python-dev" |
12 | install="" | 12 | install="" |
13 | source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2" | 13 | source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2 |
14 | gentoo-initd_create_run_dir.patch | ||
15 | fail2ban.confd | ||
16 | fail2ban.logrotate | ||
17 | " | ||
14 | 18 | ||
15 | _builddir="$srcdir/$pkgname-$pkgver" | 19 | _builddir="$srcdir/$pkgname-$pkgver" |
16 | prepare() { | 20 | prepare() { |
@@ -30,6 +34,15 @@ build() { | |||
30 | package() { | 34 | package() { |
31 | cd "$_builddir" | 35 | cd "$_builddir" |
32 | python setup.py install --root "$pkgdir" || return 1 | 36 | python setup.py install --root "$pkgdir" || return 1 |
37 | install -Dm755 files/gentoo-initd "$pkgdir"/etc/init.d/fail2ban \ | ||
38 | || return 1 | ||
39 | install -Dm644 "$srcdir"/fail2ban.confd "$pkgdir"/etc/conf.d/fail2ban \ | ||
40 | || return 1 | ||
41 | install -Dm644 "$srcdir"/fail2ban.logrotate \ | ||
42 | "$pkgdir"/etc/logrotate.d/fail2ban || return 1 | ||
33 | } | 43 | } |
34 | 44 | ||
35 | md5sums="df94335a5d12b4750869e5fe350073fa fail2ban-0.8.4.tar.bz2" | 45 | md5sums="df94335a5d12b4750869e5fe350073fa fail2ban-0.8.4.tar.bz2 |
46 | 61580eb6d8d9a4d187e97bc27f2fcb1e gentoo-initd_create_run_dir.patch | ||
47 | b209a04f9314dd064a4aa0ee505c8a4d fail2ban.confd | ||
48 | 6d1af6ceebd15c8ae3938bc675efe553 fail2ban.logrotate" | ||
diff --git a/testing/fail2ban/fail2ban.confd b/testing/fail2ban/fail2ban.confd new file mode 100644 index 0000000000..3c957b9221 --- /dev/null +++ b/testing/fail2ban/fail2ban.confd | |||
@@ -0,0 +1,8 @@ | |||
1 | # Config file for /etc/init.d/fail2ban | ||
2 | |||
3 | # For information on options, see "/usr/bin/fail2ban-client -h". | ||
4 | |||
5 | FAIL2BAN_OPTIONS="" | ||
6 | |||
7 | # Force execution of the server even if the socket already exists: | ||
8 | #FAIL2BAN_OPTIONS="-x" | ||
diff --git a/testing/fail2ban/fail2ban.logrotate b/testing/fail2ban/fail2ban.logrotate new file mode 100644 index 0000000000..5d22bd0395 --- /dev/null +++ b/testing/fail2ban/fail2ban.logrotate | |||
@@ -0,0 +1,9 @@ | |||
1 | /var/log/fail2ban.log { | ||
2 | daily | ||
3 | rotate 7 | ||
4 | missingok | ||
5 | compress | ||
6 | postrotate | ||
7 | /usr/bin/fail2ban-client set logtarget /var/log/fail2ban.log 1>/dev/null || true | ||
8 | endscript | ||
9 | } | ||
diff --git a/testing/fail2ban/gentoo-initd_create_run_dir.patch b/testing/fail2ban/gentoo-initd_create_run_dir.patch new file mode 100644 index 0000000000..79a947956e --- /dev/null +++ b/testing/fail2ban/gentoo-initd_create_run_dir.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | Index: fail2ban-0.8.4/files/gentoo-initd | ||
2 | =================================================================== | ||
3 | --- fail2ban-0.8.4.orig/files/gentoo-initd | ||
4 | +++ fail2ban-0.8.4/files/gentoo-initd | ||
5 | @@ -31,6 +31,14 @@ depend() { | ||
6 | |||
7 | start() { | ||
8 | ebegin "Starting fail2ban" | ||
9 | + if [ ! -d /var/run/fail2ban ]; then | ||
10 | + mkdir /var/run/fail2ban || return 1 | ||
11 | + fi | ||
12 | + if [ -e /var/run/fail2ban/fail2ban.sock ]; then | ||
13 | + # remove stalled sock file after system crash | ||
14 | + # bug 347477 | ||
15 | + rm -rf /var/run/fail2ban/fail2ban.sock || return 1 | ||
16 | + fi | ||
17 | ${FAIL2BAN} start &> /dev/null | ||
18 | eend $? "Failed to start fail2ban" | ||
19 | } | ||