#!/bin/bash

cd  /etc/security

echo "Making backups ..."
cp audit_control audit_control.org
cp audit_user audit_user.org
cp /etc/syslog.conf /etc/syslog.conf.org

cat /etc/syslog.conf |sed s'/mark.none.*@subdomain.domain.com/mark.none;audit.notice	@subdomain.domain.com/' > /tmp/syslog.conf ;mv /tmp/syslog.conf /etc/syslog.conf
chmod 640 /etc/syslog.conf; chown root:sys /etc/syslog.conf

echo '#
# Copyright (c) 1988 by Sun Microsystems, Inc.
#
# ident "@(#)audit_control.txt  1.4     00/07/17 SMI"
#
#dir:/var/audit
flags:
root:lo,ex,ad,am:yes
minfree:20
naflags:lo
plugin: name=audit_syslog.so; p_flags=all' > audit_control

echo '#
# Copyright (c) 1988 by Sun Microsystems, Inc.
#
# ident "@(#)audit_user.txt     1.6     00/07/17 SMI"
#
#
# User Level Audit User File
#
# File Format
#
#       username:always:never
#
root:lo,ex,ad,am:no' >audit_user

echo -e "y\n" |/etc/security/bsmconv
