aboutsummaryrefslogtreecommitdiffstats
path: root/main/snort/APKBUILD
blob: e95a5e87e1daf4ad55c593ea67f947bd620b78d8 (plain) (blame)
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
79
80
81
# Contributor: Karim Kanso <kaz.kanso@gmail.com>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=snort
pkgver=2.9.13
pkgrel=3
pkgdesc="An open source network intrusion prevention and detection system"
url="https://www.snort.org/"
arch="all"
license="GPL-2.0-only"
makedepends="pcre-dev libpcap-dev libnet-dev libdnet-dev daq-dev daq-static
	bison flex zlib-dev libtirpc-dev xz-dev
	libnfnetlink-dev libnetfilter_queue-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-dev $pkgname-openrc"
source="https://www.snort.org/downloads/snort/snort-$pkgver.tar.gz
        snort.initd
        snort.confd
	"
pkgusers="snort"
pkggroups="snort"

prepare() {
	default_prepare
	cd "$builddir"
	# fix parallel builds
#	sed -i -e 's/^all-local:.*/all-local: $(LTLIBRARIES)/' \
#		src/dynamic-preprocessors/*/Makefile.am || return 1
	# correct paths in default config file
	sed -i -e 's|/usr/local|/usr|' etc/snort.conf
	sed -i -e 's|\.\./|/var/lib/snort/|' etc/snort.conf
}

build() {
        cd "$builddir"
	export CFLAGS="$CFLAGS `pkgconf --cflags libtirpc`"
	export LDFLAGS="$LDFLAGS `pkgconf --libs libtirpc`"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-ipv6 \
		--enable-gre \
		--enable-non-ether-decoders \
		--disable-open-appid
        make
}

check() {
	cd "$builddir"
	./src/snort --version > /dev/null
}

package() {
        cd "$builddir"
        make -j1 DESTDIR="$pkgdir" install

        install -D -m 755 ../snort.initd "$pkgdir"/etc/init.d/snort
        install -D -m 644 ../snort.confd "$pkgdir"/etc/conf.d/snort
        install -D -m 644 etc/snort.conf "$pkgdir"/etc/snort/snort.conf
        install -D -m 644 etc/gen-msg.map "$pkgdir"/etc/snort/gen-msg.map
        install -D -m 644 rpm/snort.logrotate "$pkgdir"/etc/logrotate.d/snort
	mkdir -p "$pkgdir"/usr/lib/snort_dynamicrules
	mkdir -p "$pkgdir"/var/lib/snort/rules
	mkdir -m 770 -p "$pkgdir"/var/log/snort && chown snort.snort "$pkgdir"/var/log/snort
	for file in classification.config reference.config threshold.conf \
		unicode.map sid-msg.map
	do
		ln -s /var/lib/snort/etc/$file "$pkgdir"/etc/snort/$file
	done
	touch "$pkgdir"/var/lib/snort/rules/white_list.rules
	touch "$pkgdir"/var/lib/snort/rules/black_list.rules
}

sha512sums="3bc90d3753b01f779e587d8f6a514a18ea446732b0a41809df028b60eacc93fca2c158030c0743a9662958220a98757629eb1d11e7d4d709bf3b76b807b935bd  snort-2.9.13.tar.gz
c71d11f4cde4aba432641d3915faec8070e9fea5b33c71f6b2872b2208871180b3c7dbbadd2ddaebe5f3280adf7c5c9daf1585afd331fe552486a675ff676e52  snort.initd
b21491ba5798a5ce3a03a61ada391a667f1684aaf86e7536abb9dd975f6acefe75688c60b8ce28cbfb0c4e66ec19078e468792289d26f1f2e2d401609fd22771  snort.confd"