aboutsummaryrefslogtreecommitdiffstats
path: root/community/psad
diff options
context:
space:
mode:
authorStuart Cardall <developer@it-offshore.co.uk>2016-08-18 20:46:53 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2016-08-21 22:24:04 +0200
commit5c9f3ca3e307be53b45beeed2ce1626f38008625 (patch)
tree919836fe454e953f46685adf8228b0401280d4b6 /community/psad
parent6a00a953ba02bab6440a2c784e7db37c6eaeace1 (diff)
downloadaports-5c9f3ca3e307be53b45beeed2ce1626f38008625.tar.bz2
aports-5c9f3ca3e307be53b45beeed2ce1626f38008625.tar.xz
testing/[various]: move to community
albatross-themes apk-post-messages autossh bitcoin btrbk entr ffmpegthumbnailer firejail firetools fwsnort gnome-colors imapsync inetutils-syslogd inotify-tools-inc isync junit ktsuss letsencrypt-nosudo libmbim libndp libqmi libteam mini-sendmail modemmanager namecoin networkmanager nginx-naxsi numix-themes nxapi opencl-headers opencl-icd-loader opus-tools perl-authen-ntlm perl-bit-vector perl-data-uniqid perl-file-copy-recursive perl-getopt-argvfile perl-io-tee perl-iptables-chainmgr perl-iptables-parse perl-module-scandeps perl-par-dist perl-par-packer perl-par perl-uri-escape psad py-crcmod py-graphviz py-lz4 py-opencl py-opengl-accelerate runit secpwgen secure-delete socklog spacefm tinyssh udevil virt-viewer virtualbricks whois wrk xpra zram-init
Diffstat (limited to 'community/psad')
-rw-r--r--community/psad/APKBUILD109
-rw-r--r--community/psad/psad.confd8
-rw-r--r--community/psad/psad.initd51
3 files changed, 168 insertions, 0 deletions
diff --git a/community/psad/APKBUILD b/community/psad/APKBUILD
new file mode 100644
index 0000000000..9feaf89eb2
--- /dev/null
+++ b/community/psad/APKBUILD
@@ -0,0 +1,109 @@
+# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
+# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
+pkgname=psad
+pkgver=2.4.3
+pkgrel=0
+pkgdesc="3 lightweight system daemons that analyze iptables log messages to detect port scans and other suspicious traffic"
+url="http://cipherdyne.org/psad/"
+arch="all"
+license="GPL"
+depends="perl iptables ip6tables 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"
+source="http://cipherdyne.org/psad/download/$pkgname-nodeps-$pkgver.tar.gz
+ psad.initd
+ psad.confd
+ "
+
+_builddir="$srcdir"/$pkgname-nodeps-$pkgver
+
+build() {
+ cd "$_builddir"
+
+ #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\";|" \
+ ./install.pl -i
+ #/usr/sbin/psadwatchd set with last cmd
+ sed -e "s|/var/log/psad|$pkgdir&|" \
+ -e "s|/var/run/psad|$pkgdir&|" \
+ -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&|" \
+ ./psad.conf -i
+
+ # set mail command to mailx
+ sed -e 's|/bin/mail;|/usr/bin/mail;|g' -i ./psad.conf
+
+ #Disable install of generic init script & setting numeric run level
+ START=$(sed -n '/if ($init_dir and &is_root()) {/=' ./install.pl)
+ END=$(expr $START + 7)
+ #Busybox sed does not support +7d
+ sed -e ''$START','$END'd' ./install.pl -i
+
+ #populate install.answers so build does not wait for them
+ echo -e "Would you like to merge the config from the existing psad installation:\t y;" > ./install.answers
+ echo -e "Preserve any user modfications in etc psad signatures:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad icmp_types:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad icmp6_types:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad posf:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad auto_dl:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad snort_rule_dl:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad pf os:\t y;" >> ./install.answers
+ echo -e "Preserve any user modfications in etc psad ip_options:\t y;" >> ./install.answers
+ echo -e "Would you like alerts sent to a different address:\t y;" >> ./install.answers
+ echo -e "Email addresses:\t root@localhost;" >> ./install.answers
+ echo -e "Would you like psad to only parse specific strings in iptables messages:\t n;" >> ./install.answers
+ echo -e "First is it ok to leave the HOME_NET setting as any:\t y;" >> ./install.answers
+ echo -e "Would you like to enable DShield alerts:\t n;" >> ./install.answers
+ echo -e "Would you like to install the latest signatures from http www cipherdyne org psad signatures:\t n;" >> ./install.answers
+ echo -e "Enable psad at boot time:\t n;" >> ./install.answers
+}
+
+package() {
+ cd "$_builddir"
+
+ mkdir -p $pkgdir/etc/psad \
+ $pkgdir/usr/bin \
+ $pkgdir/usr/sbin \
+ $pkgdir/usr/share/man/man8 \
+ $pkgdir/var/lib/psad \
+ $pkgdir/var/log/psad \
+ $pkgdir/var/run/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
+
+ #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 -e "s|$pkgdir||" $pkgdir/etc/psad/psad.conf -i
+ sed -e "s|$pkgdir||" $pkgdir/var/log/psad/install.log -i
+
+ #install init script & config defaults
+ install -m755 -D "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname || return 1
+ install -m644 -D "$srcdir"/$pkgname.confd \
+ "$pkgdir"/etc/conf.d/$pkgname || return 1
+}
+
+md5sums="644e6094c5142f54cdca6e7429825307 psad-nodeps-2.4.3.tar.gz
+b7d0fa3ee0b711a92f25ff8188dbf75b psad.initd
+bc07efebb41cc23c4be129bbbacc874b psad.confd"
+sha256sums="c5a90f4c284c0eda3b24c5fcd9d0fd0e464ad8bf0fe7559ac6ecc41bb81e0b65 psad-nodeps-2.4.3.tar.gz
+1a5b8f1b014a9f78b43cd6e4e1006d6901a654fc51dcbe2c405d509b4a950a78 psad.initd
+74c72225fa37c367a458321b737050cacaf262f32b0cc13babc54468ff1988b9 psad.confd"
+sha512sums="9234a2ed534f571fb46d7566313802813076b9a3f2011695288b7b1a5c4f3f22cefc6ea99e087cbeb1072d61c278c11a28b5aaa4e4024d8bb459dda4873840d2 psad-nodeps-2.4.3.tar.gz
+f9f7e5e9da9de2f2258ae1b36e22e59faf950c7110de869c3581f7a89cd6dfdc96aa4db06a4ceca0ac016e8adbeb1e3bca3da66a565aec8a1ddf2808e93897c2 psad.initd
+a80666f59356cc6157a9f5dca132991d4f1e0afda8f673d602de2557219d5521bec9ae148330e98d9483175d14d96e4cc2ccd11541d8b187b0e47f44ba4ada54 psad.confd"
diff --git a/community/psad/psad.confd b/community/psad/psad.confd
new file mode 100644
index 0000000000..27ce228e92
--- /dev/null
+++ b/community/psad/psad.confd
@@ -0,0 +1,8 @@
+# Default settings for psad.
+
+# Add any options you would like to pass to the daemon when started
+# For example if you would like to add an override file for your setup, this
+# can be achived this way:
+#
+# command_args="--Override-config /root/psad.override.conf"
+command_args=""
diff --git a/community/psad/psad.initd b/community/psad/psad.initd
new file mode 100644
index 0000000000..4a78c701c6
--- /dev/null
+++ b/community/psad/psad.initd
@@ -0,0 +1,51 @@
+#!/sbin/openrc-run
+
+# This file is part of PSAD (Port Scan Attack Detector)
+# Adapted for Alpine Linux by IT Offshore <developer@it-offshore.co.uk>
+
+command="/usr/sbin/psad"
+pidfile="/var/run/psad/psad.pid"
+config_file="/etc/psad/psad.conf"
+
+depend() {
+ need net
+ need logger
+ after iptables
+}
+
+# allow override config_file location from conf.d
+: ${config_file:="/etc/psad/psad.conf"}
+
+check_config() {
+ [ -f "$config_file" ] || error "$config_file is missing"
+}
+
+start_pre() {
+ check_config || return 1
+ # make sure dir for pidfile exists. /var/run is tmpfs...
+ checkpath --directory ${pidfile%/*}
+}
+
+start() {
+ ebegin "Starting PSAD (Port Scan Attack Detector)"
+ start-stop-daemon --start $command --pidfile $pidfile
+ eend $?
+}
+
+stop() {
+ local piddir=${pidfile%/*}
+ ebegin "Stopping psadwatchd"
+ start-stop-daemon --stop --quiet --pidfile $piddir/psadwatchd.pid
+ eend $? "Failed to stop psadwatchd"
+
+ if [ -f $piddir/kmsgsd.pid ] ; then
+ ebegin "Stopping kmsgsd"
+ start-stop-daemon --stop --quiet --pidfile $piddir/kmsgsd.pid
+ eend $? "Failed to stop kmsgsd"
+ fi
+
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --quiet --pidfile $piddir/psad.pid
+ eend $? "Failed to stop ${SVCNAME}"
+}
+