[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:51 UTC 2011


The following commit has been merged in the master branch:
commit 62634e3a56b744a4e447602adb3304eb4e82dcf6
Author: Javier Fernandez-Sanguino <jfs at debian.org>
Date:   Mon Jul 25 23:09:55 2011 +0200

    First draft of the postinst file for the server

diff --git a/debian/ossec-hids-server.postinst b/debian/ossec-hids-server.postinst
new file mode 100644
index 0000000..87824cc
--- /dev/null
+++ b/debian/ossec-hids-server.postinst
@@ -0,0 +1,79 @@
+#!/bin/sh -e
+
+. /usr/share/debconf/confmodule
+test $DEBIAN_SCRIPT_DEBUG && set -v -x
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see /usr/doc/packaging-manual/
+#
+# quoting from the policy:
+#     Any necessary prompting should almost always be confined to the
+#     post-installation script, and should be protected with a conditional
+#     so that unnecessary prompting doesn't happen if a package's
+#     installation fails and the `postinst' is called with `abort-upgrade',
+#     `abort-remove' or `abort-deconfigure'.
+
+case "$1" in
+    install)
+	;;
+    upgrade)
+	;;
+    configure)
+        # TODO 
+        #  - configure the results in the configuration file
+        #  - setup active response (firewall response, whitelist, etc.)
+	db_get ossec-hids-server/enable_email || true;	EMAIL="$RET"
+	db_get ossec-hids-server/email_to     || true;	EMAIL_TO="$RET"
+	db_get ossec-hids-server/email_server || true;	EMAIL_SERVER="$RET"
+	db_get ossec-hids-server/enable_syslog ||  true; SYSLOG="$RET"
+
+	# Failsafe in case the values above are blank (jfs)
+	[ -z "$EMAIL" ] && EMAIL="no"
+	[ -z "$EMAIL_TO" ] && EMAIL_TO="root at localhost"
+	[ -z "$EMAIL_SERVER" ] && EMAIL_SERVER="127.0.0.1"
+	[ -z "$SYSLOG" ] && SYSLOG="no"
+
+        # TODO - configure the configuration file
+
+        CONF_FILE=/etc/ossec/ossec-init.conf
+        if ! dpkg-statoverride --list ${CONF_FILE} >/dev/null && [ -e ${CONF_FILE} ] 
+        then
+            chown ossec:ossec ${CONF_FILE}
+            chmod 640 ${CONF_FILE}
+            fi
+	fi
+
+	db_stop
+
+	# Update the rc.d's
+	update-rc.d ossec-hids-server defaults >/dev/null
+
+	# in the case we reconfigure we have to restart and not just to start.
+	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
+		invoke-rc.d ossec-hids-server stop || exit $?
+	else
+		/etc/init.d/ossec-hids-server stop || exit $?
+	fi
+	;;
+    abort-upgrade)
+	;;
+    *)
+	echo "postinst 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