Subject: [alpine-devel] [PATCH] Patch for PSAD to fix sending mail & service starting.

From: IT Offshore <[email-masked]>
Date: Mon, 18 Nov 2013 22:40:23 +0000

Added start() to /etc/init.d/psad - it was not starting without it.

Added a dependency for mailx to APKBUILD & fixed /etc/psad/psad.conf setting for mail (ssmtp on it's own was not enough - mail was
incorrectly formed).

Tested on a live server - scans are detected, blocked & email notifications sent.
---
 testing/psad/APKBUILD   | 12 +++++++-----
 testing/psad/psad.initd |  6 ++++++
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/testing/psad/APKBUILD b/testing/psad/APKBUILD
index 85c1530..0e899eb 100644
--- a/testing/psad/APKBUILD
+++ b/testing/psad/APKBUILD
@@ -7,8 +7,7 @@ pkgdesc="3 lightweight system daemons that analyze iptables log messages to dete
 url="http://cipherdyne.org/psad/"
 arch="all"
 license="GPL"
-depends="perl iptables ip6tables ssmtp psmisc perl-bit-vector perl-date-calc perl-iptables-chainmgr perl-iptables-parse perl-net-ipv4addr perl-unix-syslog net-tools"
-install=""
+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"
 subpackages="$pkgname-doc"
 source="http://cipherdyne.org/psad/download/$pkgname-nodeps-$pkgver.tar.gz
 	psad.initd
@@ -37,6 +36,9 @@ build() {
       -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)
@@ -96,11 +98,11 @@ package() {
 }
 
 md5sums="ee600d9b6b4b915b026370c9a3726b5f  psad-nodeps-2.2.1.tar.gz
-a1add105866af03e44c64129f2cf38ab  psad.initd
+e079dfcd533bc9bcf6f32525868fdd9b  psad.initd
 bc07efebb41cc23c4be129bbbacc874b  psad.confd"
 sha256sums="0422cdd1a37d4c8fcc1a4ce6e7c4a6974e58fdde82242f45b83eb6beb85708b5  psad-nodeps-2.2.1.tar.gz
-e196bc469e711b322351c60f3ac646997b123b402a3a3c6a0135273510e9b762  psad.initd
+f1570450fd5e4e6a6e044b52ecd342d8f2bc2034ec8699c244b9f1a79d38026c  psad.initd
 74c72225fa37c367a458321b737050cacaf262f32b0cc13babc54468ff1988b9  psad.confd"
 sha512sums="9e3f475376c3c7b753e71676f5c9d639e9fffd93caf864faa130f8030e37f9a6c57ba59c9519d2bd8dde945f7ff7a014ca2a710bd4b7be9721ca7f13f879b970  psad-nodeps-2.2.1.tar.gz
-10ebd44adfe124242883d4904926f164b89f9037fb28dadd938198904c1a35b08dbcae9284d21db8ea50baa7621d3d365926c95b56ffc263adb1c8194ad767de  psad.initd
+e4daea5c93b72d9818388435dd90d24360336cc3a46c698feb01162e40b78a0f96241054368303b3093e64f1cd517db08de4b6e128a8e0ec77e6b9770e10cec9  psad.initd
 a80666f59356cc6157a9f5dca132991d4f1e0afda8f673d602de2557219d5521bec9ae148330e98d9483175d14d96e4cc2ccd11541d8b187b0e47f44ba4ada54  psad.confd"
diff --git a/testing/psad/psad.initd b/testing/psad/psad.initd
index 4b3df09..dfe4c3d 100644
--- a/testing/psad/psad.initd
+++ b/testing/psad/psad.initd
@@ -26,6 +26,12 @@ start_pre() {
 	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"
-- 
1.8.4.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---