aboutsummaryrefslogtreecommitdiffstats
path: root/community/fwsnort/APKBUILD
blob: 9f4c1277314124e9f579e35e5d6e42b393ff4fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=fwsnort
pkgver=1.6.6
pkgrel=0
pkgdesc="Application layer IDS/IPS by translating snort rules into iptables"
url="http://www.cipherdyne.org/fwsnort/"
arch="noarch"
license="GPL"
depends="perl perl-netaddr-ip perl-iptables-parse iptables ip6tables net-tools wget"
install="$pkgname.post-install"
source="http://www.cipherdyne.org/$pkgname/download/$pkgname-nodeps-$pkgver.tar.gz
	fwsnort.up
	fwsnort.update
	periodic.daily"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"

	# Disable Root requirement to build.
	local start=$(sed -n '/die "You need to be root (or equivalent UID 0"/=' ./install.pl)
	local end=$(expr $start + 1)
	# Busybox sed does not support +1d.
	sed "$start,${end}d" ./install.pl -i

	# Prevent chmod 0500 halting the build.
	sed "s|0500|0755|" ./install.pl -i

	# Change MAN path so package builds.
	sed "s|/usr/share/man/man8|$pkgdir&|" ./install.pl -i

	# --install-test-dir sets the INSTALL_ROOT to $src/../test/fwsnort-test
	# avoids installation attempted into /etc /usr /var
	# -S disables dependency installs (we also build with the nodep sources)
	./install.pl -S --install-test-dir
}

package() {
	cd "$builddir"

	mkdir -p "$pkgdir"/etc "$pkgdir"/usr
	cp -rf "$srcdir"/fwsnort-$pkgver/test/fwsnort-install/* "$pkgdir"/ || return 1

	# Delete references to $pkgdir made by the installer.
	cp -f "$srcdir"/fwsnort-$pkgver/fwsnort.conf \
		"$pkgdir"/etc/fwsnort/fwsnort.conf || return 1

	# Fix permissions.
	chmod 0500 "$pkgdir"/etc/fwsnort "$pkgdir"/etc/fwsnort/snort_rules || return 1
	chmod 0500 "$pkgdir"/usr/sbin/fwsnort || return 1
	chmod 0600 "$pkgdir"/etc/fwsnort/fwsnort.conf || return 1

	# Install rule / signature update script.
	install -Dm755 "$srcdir"/fwsnort.update \
		"$pkgdir"/usr/bin/update-fwsnort || return 1

	# Install iptables rule splicing script.
	install -Dm755 "$srcdir"/fwsnort.up \
		"$pkgdir"/etc/network/if-pre-up.d/fwsnort || return 1

	# Install daily cron.
	install -Dm755 "$srcdir"/periodic.daily \
		"$pkgdir"/etc/periodic/daily/fwsnort
}

md5sums="7c34730c93c6ef42f79c478538c499e9  fwsnort-nodeps-1.6.6.tar.gz
442039bc04d553c7c5f9d3fc4269cc71  fwsnort.up
ab969dd4b3154f8ce663e51473eda6c7  fwsnort.update
80bd0a7b0c1392e8a279d95e06120ca4  periodic.daily"
sha256sums="910a770305932b903229315332cbbcdb853a2d1f3828982303693ea162b99c03  fwsnort-nodeps-1.6.6.tar.gz
8caf113ff779a02fe97288d545f029111151fac9f342be9b40aa9f80e49dd359  fwsnort.up
a015a512ba9c7b3de7a8da42b33fd1eace25544b4d8b25c3a5f465c8d765a384  fwsnort.update
f080f4cb0b8e915a5d3af798b46b13fee0d2258d9c8c9dffafa4ecc0b9e1bbe6  periodic.daily"
sha512sums="ee3152c555f59dd09c1068af6fafb7afc28ce02d38f81df5645c50b1e6829876469a9fccdc184303ad45e7be5d4bd21a4777f6989d3c972a5aec64cbc6ea6765  fwsnort-nodeps-1.6.6.tar.gz
3c97b5f4bb922086acd62305baae4ba1d91e6e627d063f131f98e08da3f57b607b35558eae2cf292b3997d25f09147039f95123161f8f29c5b97b71c80811e9f  fwsnort.up
2a1e7ca6dc1c4a6e59907175c3483736f0efe1dcd8035dae2b903cd22fe953d29333939ad9e0a6f446480eda55370f4b11a77016932bef73e769b5e5401e92c0  fwsnort.update
763b459d43319e9b6678a5addd96b3542c629379f9f11095bc158b1ef08b039cd776ceedd6207953ab01000804d7580a3a8223b352b407d3cc6a05c27d96fcb0  periodic.daily"