#!/bin/sh # postinst script for bind9-cn # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * `configure' # * `abort-upgrade' # * `abort-remove' `in-favour' # # * `abort-deconfigure' `in-favour' # `removing' # # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package # case "$1" in configure|reconfigure) # continue below ;; *) exit 0 ;; esac # import CN-functions . /usr/share/carnet-tools/functions.sh # get installation directory if [ -e /etc/ossec-init.conf ]; then . /etc/ossec-init.conf fi if [ "X${DIRECTORY}" = "X" ]; then DIRECTORY="/var/ossec" fi # sanity check if [ ! -d "$DIRECTORY/rules" ]; then echo "CN: There is no "$DIRECTORY/rules" directory, exiting..." echo "CN: Please reinstall ossec-hids package" exit 1 fi # find first available sid local_rules="$DIRECTORY/rules/local_rules.xml" script=' BEGIN { FS = "\"" } // { if (max < $2) max = $2 } END { print max }; ' if [ -e "$local_rules" ]; then sid=$(awk "$script" "$local_rules") fi if [ -z "$sid" ]; then sid=100000 fi # update local rules with our policy if [ -e "$local_rules" ]; then cp "$local_rules" "$local_rules.$$" else touch "$local_rules.$$" fi cp-update --comment '' \ ossec-hids-cn "$local_rules.$$" < 1002 rsync Events ignored 1002 ^sophie|^smartd Ignore Sophie/SMARTd 3303 Events ignored 3356 Ignore blacklisted mail 1002 cache ^named Ignore BIND cache warnings 2933 Updated timestamp for job ^anacron Ignore Anacron warnings EOF cp_mv "$local_rules.$$" "$local_rules" # and restart the service service ossec-hids restart || true # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0