mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-06-04 08:55:20 +02:00
103 lines
4 KiB
Text
103 lines
4 KiB
Text
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
|
|
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
|
|
pkgname=psad
|
|
pkgver=2.4.6
|
|
pkgrel=4
|
|
pkgdesc="3 lightweight system daemons that analyze iptables log messages to detect port scans and other suspicious traffic"
|
|
url="https://cipherdyne.org/psad/"
|
|
arch="all"
|
|
license="GPL-2.0-or-later"
|
|
options="!check" # tests require a built pkg
|
|
depends="perl iptables ssmtp mailx psmisc perl-bit-vector
|
|
perl-date-calc perl-iptables-chainmgr perl-iptables-parse perl-net-ipv4addr
|
|
perl-unix-syslog net-tools whois"
|
|
subpackages="$pkgname-doc $pkgname-openrc"
|
|
source="http://cipherdyne.org/psad/download/$pkgname-nodeps-$pkgver.tar.gz
|
|
psad.initd
|
|
psad.confd
|
|
01-no-init-autodetection.patch
|
|
"
|
|
|
|
build() {
|
|
# Set the config dirs.
|
|
sed -e "s|'/usr/sbin'|'$pkgdir/usr/sbin'|" \
|
|
-e "s|'/usr/bin'|'$pkgdir/usr/bin'|" \
|
|
-e "s|my \$mpath = \"/usr/share/man/man\$section\";|my \$mpath = \"$pkgdir/usr/share/man/man\$section\";|" \
|
|
-i ./install.pl
|
|
|
|
# /usr/sbin/psadwatchd set with last cmd
|
|
sed -e "s|/var/log/psad|$pkgdir&|" \
|
|
-e "s|/var/run/psad|$pkgdir/run/psad|" \
|
|
-e "s|/var/lib/psad|$pkgdir&|" \
|
|
-e "s|/usr/lib/psad|$pkgdir&|" \
|
|
-e "s|/etc/psad|$pkgdir&|" \
|
|
-e "s|/usr/bin/whois_psad|$pkgdir/usr/bin/whois|" \
|
|
-e "s|/usr/sbin/fwcheck_psad|$pkgdir&|" \
|
|
-e "s|/usr/sbin/kmsgsd|$pkgdir&|" \
|
|
-e "s|/usr/sbin/psad|$pkgdir&|" \
|
|
-i ./psad.conf
|
|
|
|
# Set mail command to mailx.
|
|
sed -e 's|/bin/mail;|/usr/bin/mail;|g' -i ./psad.conf
|
|
|
|
# Populate install.answers so build does not wait for them.
|
|
cat >./install.answers <<-EOF
|
|
Would you like to merge the config from the existing psad installation: y;
|
|
Preserve any user modfications in etc psad signatures: y;
|
|
Preserve any user modfications in etc psad icmp_types: y;
|
|
Preserve any user modfications in etc psad icmp6_types: y;
|
|
Preserve any user modfications in etc psad posf: y;
|
|
Preserve any user modfications in etc psad auto_dl: y;
|
|
Preserve any user modfications in etc psad snort_rule_dl: y;
|
|
Preserve any user modfications in etc psad pf os: y;
|
|
Preserve any user modfications in etc psad ip_options: y;
|
|
Would you like alerts sent to a different address: y;
|
|
Email addresses: root@localhost;
|
|
Would you like psad to only parse specific strings in iptables messages: n;
|
|
First is it ok to leave the HOME_NET setting as any: y;
|
|
Would you like to enable DShield alerts: n;
|
|
Would you like to install the latest signatures from http www cipherdyne org psad signatures: n;
|
|
Enable psad at boot time:\t n;
|
|
EOF
|
|
}
|
|
|
|
package() {
|
|
mkdir -p "$pkgdir"/etc/psad \
|
|
"$pkgdir"/usr/bin \
|
|
"$pkgdir"/usr/sbin \
|
|
"$pkgdir"/usr/share/man/man8 \
|
|
"$pkgdir"/var/lib/psad \
|
|
"$pkgdir"/var/log/psad
|
|
|
|
# Add dummy whois so build completes.
|
|
ln -s /bin/busybox "$pkgdir"/usr/bin/whois
|
|
|
|
# Dummy runlevel 1 / skip perl module installation.
|
|
./install.pl --runlevel 1 --Use-answers --Skip-mod-install --init-dir ''
|
|
rm -Rf "$pkgdir"/var/run
|
|
|
|
# Set correct permissions.
|
|
chmod -R o+r "$pkgdir"/etc/psad
|
|
chmod -R o+r "$pkgdir"/usr/sbin/*
|
|
chmod 0700 "$pkgdir"/var/lib/psad
|
|
|
|
# Remove whois symbolic link.
|
|
rm -f "$pkgdir"/usr/bin/whois
|
|
|
|
# Fix the config.
|
|
sed "s|$pkgdir||" -i "$pkgdir"/etc/psad/psad.conf
|
|
sed "s|$pkgdir||" -i "$pkgdir"/var/log/psad/install.log
|
|
|
|
# Install init script & config defaults.
|
|
install -m755 -D "$srcdir"/$pkgname.initd \
|
|
"$pkgdir"/etc/init.d/$pkgname
|
|
install -m644 -D "$srcdir"/$pkgname.confd \
|
|
"$pkgdir"/etc/conf.d/$pkgname
|
|
}
|
|
|
|
sha512sums="
|
|
95ddd18da2b9c6703b0d156873622740517cad62fda8d69ddb0686c43c4e306155dd646965cd52081dbd0d6c235bd3c794f6b004e3ee3bfa3e6150eb5f617c56 psad-nodeps-2.4.6.tar.gz
|
|
ec709b1ba1df36dad5c1c2cfb5fc45765ac4ccdd6fc7a3e2f23c972c7dfb8e5910aeb1ba42437abd0d2c766bb99bcb790301c7b8ba3ee7e6593dcae13e9efc3a psad.initd
|
|
a80666f59356cc6157a9f5dca132991d4f1e0afda8f673d602de2557219d5521bec9ae148330e98d9483175d14d96e4cc2ccd11541d8b187b0e47f44ba4ada54 psad.confd
|
|
4af22981092d5dee7a9227780fa53013c46fe07decb9a2ce2bbf2040fe71454a7ed8258cfa675cff30329bead1abb98dabc49c4bbea597cfd926c0c759c5e675 01-no-init-autodetection.patch
|
|
"
|