svc-auditd revision 8523fda3525b37e02f4d11efc8cf763bf08204ec
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# CDDL HEADER START
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# The contents of this file are subject to the terms of the
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# Common Development and Distribution License (the "License").
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# You may not use this file except in compliance with the License.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# See the License for the specific language governing permissions
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# and limitations under the License.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# When distributing Covered Code, include this CDDL HEADER in each
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# If applicable, add the following below this CDDL HEADER, with the
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# fields enclosed by brackets "[]" replaced with your own identifying
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# information: Portions Copyright [yyyy] [name of copyright owner]
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# CDDL HEADER END
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# Use is subject to license terms.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# main - the execution starts there.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # Do the basic argument inspection and take the appropriate action.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# do_common - executes all the code common to all supported service methods.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # If the audit state is "disabled" auditconfig returns non-zero exit
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # status unless the c2audit module is loaded; if c2audit is loaded,
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # "disabled" becomes "noaudit" early in the boot cycle and "auditing"
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi if [ $? -ne 0 ]; then
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # auditing is driven by bsmconv(1M) / bsmunconv(1M)
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Unable to get current kernel auditing condition."
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # In a non-global zone, auditd is started/refreshed only if the
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi if [ $? -eq 1 ]; then
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: auditd is not configured to run in a local"
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# do_start - service start method helper.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # The transition of the audit_startup(1M) has to be performed.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Transition of audit_startup(1M) started."
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi if [ $? -ne 0 ]; then
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # Refreshing service to make the newly created properties
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi if [ $? -ne 0 ]; then
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Refresh of $AUDITD_FMRI configuration failed."
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Transition of audit_startup(1M) finished."
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # Daemon forks, parent exits when child says it's ready.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# do_refresh - service refresh method helper.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # The refresh capability is available only for those systems
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # with already transformed audit_startup(1M) into $AUDITD_FMRI
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi # service properties. See do_start() for more information.
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Service $AUDITD_FMRI has no associated" \
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi if [ $? -ne 0 ]; then
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: SIGHUP was not successfully delivered to" \
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi echo "$0: Service refresh method not supported on systems" \
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi "without converted audit_startup(1M) into auditd service" \
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi "SMF configuration. Clear the service (svcadm(1M))."
316cbe323513a0f20d1cf519fe9405e231d633e2Aki Tuomi# Call main() to start the own script execution.