i.devpolicy revision eae72b5b807baa9116e64502cbb278edf15f3146
431N/A#!/bin/sh
431N/A#
431N/A# CDDL HEADER START
431N/A#
431N/A# The contents of this file are subject to the terms of the
431N/A# Common Development and Distribution License (the "License").
431N/A# You may not use this file except in compliance with the License.
431N/A#
431N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
431N/A# or http://www.opensolaris.org/os/licensing.
431N/A# See the License for the specific language governing permissions
431N/A# and limitations under the License.
431N/A#
431N/A# When distributing Covered Code, include this CDDL HEADER in each
431N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
431N/A# If applicable, add the following below this CDDL HEADER, with the
431N/A# fields enclosed by brackets "[]" replaced with your own identifying
431N/A# information: Portions Copyright [yyyy] [name of copyright owner]
431N/A#
431N/A# CDDL HEADER END
844N/A#
431N/A#
431N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
431N/A# Use is subject to license terms.
431N/A#
431N/A# NOTE: When a change is made to the source file for
618N/A# /etc/security/device_policy a corresponding change must be made to
431N/A# this class-action script.
431N/A#
844N/Awhile read src dest
844N/Ado
618N/A if [ ! -f $dest ] ; then
431N/A cp $src $dest
431N/A continue
431N/A fi
431N/A
431N/A # changes
431N/A cp $dest $dest.$$
431N/A sed < $dest.$$ > $dest \
431N/A -e '/md:admin/s/read_priv_set=sys_config/ /' \
431N/A -e '/^icmp[ ]*read_priv_set=net_rawaccess[ ]*write_priv_set=net_rawaccess$/d' \
431N/A -e '/^icmp6[ ]*read_priv_set=net_rawaccess[ ]*write_priv_set=net_rawaccess$/d' \
431N/A -e '/^keysock[ ]*read_priv_set=sys_net_config[ ]*write_priv_set=sys_net_config$/d' \
431N/A -e '/^ipsecah[ ]*read_priv_set=sys_net_config[ ]*write_priv_set=sys_net_config$/d' \
431N/A -e '/^ipsecesp[ ]*read_priv_set=sys_net_config[ ]*write_priv_set=sys_net_config$/d' \
431N/A -e '/^spdsock[ ]*read_priv_set=sys_net_config[ ]*write_priv_set=sys_net_config$/d' \
431N/A -e '/^ipf[ ]*read_priv_set=sys_net_config[ ]*write_priv_set=sys_net_config$/d' \
431N/A -e '/^sad:admin[ ]*read_priv_set=sys_config[ ]*write_priv_set=sys_config$/d'
431N/A
431N/A rm -f $dest.$$
431N/A
431N/A # potential additions
431N/A additions="aggr bge dnet keysock ibd icmp icmp6 ipsecah ipsecesp openeepr random spdsock vni ipf pfil scsi_vhci"
431N/A
for dev in $additions
do
# if an entry for this driver exists in the source
# file...
grep "^$dev[ ]" $src > /dev/null 2>&1
if [ $? = 0 ] ; then
# ...and no entry exists in the destination
# file...
grep "^$dev[ ]" $dest > /dev/null 2>&1
if [ $? != 0 ] ; then
# ...then add the entry from
# the source file to the
# destination file.
grep "^$dev[ ]" $src >> $dest
fi
fi
done
# potential deletions
deletions="elx dld dld:ctl aggr:ctl vnic:ctl le"
for dev in $deletions
do
# if an entry for this driver exists in the destination
# file...
grep "^$dev[ ]" $dest > /dev/null 2>&1
if [ $? = 0 ] ; then
# ...and no entry exists in the source
# file...
grep "$dev[ ]" $src > /dev/null 2>&1
if [ $? != 0 ] ; then
# ...then remove the entry from
# the destination file.
cp $dest $dest.$$
grep -v "^$dev[ ]" $dest.$$ > $dest
rm -f $dest.$$
fi
fi
done
done
exit 0