aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ossec-hids/APKBUILD
blob: eecbd19c625376e0dd9c7290ca903a4938dd7e2a (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
82
83
84
85
86
87
88
89
90
91
92
93
94
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ossec-hids
pkgver=3.3.0
pkgrel=3
pkgdesc="Open Source Host-based Intrusion Detection System"
url="https://www.ossec.net/"
arch="all !aarch64 !armhf !armv7"
license="GPL-2.0-only WITH openssl-exception"
depends="inotify-tools procps"
makedepends="linux-headers inotify-tools-dev findutils file zlib-dev pcre2-dev
sqlite-dev lua5.3-dev"
install="$pkgname.pre-install"
options="!check"
subpackages="$pkgname-doc $pkgname-contrib::noarch $pkgname-openrc"
pkgusers="ossec ossecm ossecr"
pkggroups="ossec"
source="$pkgname-$pkgver.tar.gz::https://github.com/ossec/$pkgname/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.logrotate
	musl_lack_of_a_out_h.patch
	makefile.patch
	config"

prepare() {
	default_prepare
	export USER_NO_STOP=yes
	export USER_DIR=/var/ossec
	export USER_BINARYINSTALL=x
	export PCRE2_SYSTEM=yes
}

build() {
	cd "$builddir"/src
	for t in server agent; do
		make clean
		make TARGET=$t \
			USE_INOTIFY=yes \
			USE_SQLITE=yes \
			LUA_ENABLE=yes \
			V=1
	done
}

package() {
	install -D -m755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname

	mkdir -p "$pkgdir"/var/ossec/etc
    cat << EOF > "$pkgdir"/var/ossec/etc/ossec-init.conf
DIRECTORY="/var/ossec"
VERSION="$(cat src/VERSION)"
DATE="$(date)"
TYPE="server"
EOF

	set -- $pkgusers
	cd "$builddir"/src
	find "$pkgdir" -user nobody -exec chown 524 '{}' ';'
	find "$pkgdir" -user mail -exec chown 525 '{}' ';'
	find "$pkgdir" -user daemon -exec chown 526 '{}' ';'
	find "$pkgdir" -group nobody -exec chgrp 525 '{}' ';'

	mkdir -p "$pkgdir"/var/ossec

	for t in server agent; do
		make TARGET="$t" PREFIX="$pkgdir"/var/ossec install
	done
}

doc() {
	cd "$builddir"
	pkgdesc="Documentation for $pkgname"
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
	cp -a doc/* \
	  "$subpkgdir"/usr/share/doc/$pkgname
}

contrib() {
	pkgdesc="Contrib files for $pkgname"
	mkdir -p "$subpkgdir"/usr/share/$pkgname
	cp -a "$builddir"/contrib/* "$subpkgdir"/usr/share/$pkgname
	for r in selinux debian-packages specs; do
		rm -rf "$subpkgdir"/usr/share/$pkgname/$r
	done
}

sha512sums="97c7e7b21ce88a3f1c89b79ff74b0c13804ba313cf3f30b98bcb4011f422ca050876e780c30624812d399d6b5c59629e52f6772b9ee0cd7cead1d66044dca627  ossec-hids-3.3.0.tar.gz
62f52d91de3751c149b1c354ebb87c0a8c4a81129403b80a8448c5e6542a67b4aa9e132aab2429781913eb909320b431b381828e414d44235bb8e9a8959e0d8b  ossec-hids.initd
6cdf4852feabfdd043405e2570bb9a3013eb11c1865e9178fb67a019717d44fb0fedba05ab74c4334a1bae0a0c45912213dd7d6c7e1eab31853d40beea7596a0  ossec-hids.logrotate
4e076581cc3977c527f30da6c43552db18bc35ea7b745c1504f4d15ebfbcef42c9604804af28fc90744a85f847a0f0c5bf991476cae71e3d860adb7cfa33a63b  musl_lack_of_a_out_h.patch
cf747dce1b9b744faed55a7c7df30c203286bcbec7ea97c0b34c5c3c2db7dd7793f88335fa4d2e2c37c0ec60f8140e875bfe1fb40f77266b121335c24e4ef257  makefile.patch
be6d503defc03bb1f39dbeeba793ed552243630403def629b35ced46b0441ffa34455ee942ca018c8ec33ca4661901b569eed8dc52e96951312814e492e94eb3  config"