#!/bin/bash -e
# =============================================================================
# (c) Copyright Hewlett-Packard Development Company, L.P., 2005
# Written by Aron Griffis <aron@hp.com>
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of version 2 the GNU General Public License as
#   published by the Free Software Foundation.
#   
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
# =============================================================================
#
# PURPOSE:
# Verify auditd restart generates appropriate audit records

set -x

export AUDIT_SEEK=$(stat -c %s /var/log/audit/audit.log)

service auditd restart
npid=$(pidof auditd)

auid=$(</proc/$$/loginuid)

augrok -m1 type=DAEMON_END auid=$auid res=success
augrok -m1 type=DAEMON_START auid=$auid pid=$npid res=success

