[Pkg-ossec-devel] [SCM] Git repository for pkg-ossec branch, master, updated. 710f41cee3d9556ef7c3bc08d98979e11ac6a10b

Javier Fernandez-Sanguino jfs at debian.org
Mon Jul 25 21:42:52 UTC 2011


The following commit has been merged in the master branch:
commit 3b4a96ca98bc08c4dd4fceb47cb45ba673d1b0b5
Author: Javier Fernandez-Sanguino <jfs at debian.org>
Date:   Mon Jul 25 23:30:16 2011 +0200

    First version of the preinstallation file for the OSSEC server

diff --git a/debian/ossec-hids-server.preinst b/debian/ossec-hids-server.preinst
new file mode 100644
index 0000000..ba63eb3
--- /dev/null
+++ b/debian/ossec-hids-server.preinst
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+
+# Initialise variables
+OSSECUSER="ossec"
+OSSECGROUP="ossec"
+LOGDIR="/var/log/ossec"
+HOMEDIR="/var/ossec"
+
+case "$1" in
+    install|upgrade)
+	# create ossec user to avoid running daemon as root
+	# 1. create group if not existing
+	if ! getent group | grep -q "^$OSSECGROUP:" ; then
+		addgroup --quiet --system $OSSECGROUP 2>/dev/null || true
+	fi
+	# 2. create homedir if not existing
+	test -d $HOMEDIR || mkdir $HOMEDIR
+
+	# 3. create users if not existing
+
+        for create_user in ${OSSECUSER} ${OSSECUSER}m ${OSSECUSER}r; do
+	    if ! getent passwd | grep -q "^$create_user:"; then
+       	        adduser --quiet \
+                    --system \
+                    --ingroup $OSSECGROUP \
+                    --no-create-home \
+                    --disabled-password \
+                    $create_user 2>/dev/null || true
+    	    fi
+        done
+        
+	# 4. adjust passwd entry
+	usermod -c "Ossec IDS" \
+		-d $HOMEDIR \
+		-g $OSSECGROUP \
+		$OSSECUSER >/dev/null
+
+	usermod -c "Ossec IDS Email alerter" \
+		-d $HOMEDIR \
+		-g $OSSECGROUP \
+		${OSSECUSER}m >/dev/null
+
+	usermod -c "Ossec IDS Remote Commmunication" \
+		-d $HOMEDIR \
+		-g $OSSECGROUP \
+		${OSSECUSER}r >/dev/null
+
+	# 5. adjust file and directory permissions
+	if ! dpkg-statoverride --list $LOGDIR >/dev/null
+	then
+		chown -R $OSSECUSER:adm $LOGDIR
+		chmod u=rwx,g=rxs,o= $LOGDIR
+	fi
+    ;;
+    configure)
+    ;;
+    abort-upgrade)
+    ;;
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 0
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0

-- 
Git repository for pkg-ossec



More information about the Pkg-ossec-devel mailing list