svc-rbac revision 2
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen#! /usr/bin/sh
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen#
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# CDDL HEADER START
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen#
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# The contents of this file are subject to the terms of the
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# Common Development and Distribution License (the "License").
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# You may not use this file except in compliance with the License.
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen#
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# or http://www.opensolaris.org/os/licensing.
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# See the License for the specific language governing permissions
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# and limitations under the License.
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen#
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# When distributing Covered Code, include this CDDL HEADER in each
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# If applicable, add the following below this CDDL HEADER, with the
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# fields enclosed by brackets "[]" replaced with your own identifying
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# information: Portions Copyright [yyyy] [name of copyright owner]
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen#
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen# CDDL HEADER END
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen#
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen#
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen#
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen. /lib/svc/share/smf_include.sh
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenfiles='/etc/user_attr /etc/security/auth_attr /etc/security/exec_attr
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen /etc/security/prof_attr'
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo SirainenPKGINST=
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenexport PKGINST
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo SirainenPATH=/usr/bin
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenexport PATH
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainenirbac=/usr/sadm/install/scripts/i.rbac
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenif [[ ! -x $irbac ]]; then
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen echo "${irbac}: not found."
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen exit $SMF_EXIT_ERR_FATAL
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenfi
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Siraineneval $(grep '^phrase=' $irbac)
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainenif [[ -z "$phrase" ]]; then
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen echo "${irbac}: can't determine \$phrase."
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen exit $SMF_EXIT_ERR_FATAL
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenfi
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainenfor f in $files; do
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen #
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen # The current library reads the fragments directly for all databases;
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen # in order to make upgrades possible, we need to run i.rbac only once
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen # to remove the older entries.
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen #
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen if ! grep -s "$phrase" $f > /dev/null 2>&1; then
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen echo /dev/null $f | $irbac
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen chown root:sys $f
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen else
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen #
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen # When we find one updated file, then the rest is also
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen # updated and we bail out.
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen #
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen break
83b2368e64ca53712d80abcae9579bd22ef43c9eTimo Sirainen fi
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainendone
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainenexit $SMF_EXIT_OK
aef538e8e43f1aaf3d44c18de5c74afa08b960f8Timo Sirainen