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