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# See the License for the specific language governing permissions 2N/A# and limitations under the License. 2N/A# When distributing Covered Code, include this CDDL HEADER in each 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# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A# The labeled_parseNet function is used by functions in this file 2N/A# and by txzonemgr. So changes must be verified in both places. 2N/A# The function takes either a zonecfg net or anet resource, passed in 2N/A# via $net. It parses the keywords, and sets the following variables: 2N/A# ipaddr - the IP address, including the cidr suffix if present 2N/A# defaultrouter -if present 2N/A# physical - the corresponding global zone interface 2N/A while (( $# > 1)) do 2N/A if [ $2 != "..." ]; then 2N/A if [ $2 != "..." ]; then 2N/A# If address is a hostname, return IP address 2N/A# The _getIPconfig function is only used in this file. 2N/A# It is used to determine the hostname and IP address 2N/A# of the labeled zone. In addition to the variables set 2N/A# by labeled_parseNet, it also sets the variable $hostname. 2N/A # remove the optional cidr suffix 2N/A # which is input to getNetmask() 2N/A# The labeled_unsharePasswed function removes the passwd and shadow 2N/A# lofs mounts that are part of the shared name service configuration. 2N/A# This function is also called by txzonemgr so changes must be 2N/A# verified in both files. 2N/A# The labeled_sharePasswed function sets the passwd and shadow 2N/A# lofs mounts that are part of the shared name service configuration. 2N/A# This function is also called by txzonemgr so changes must be 2N/A# verified in both files. 2N/A# The _auto_home function automates NFS sharing of the minimum labeled 2N/A# home directory with higher lableled zones. Reading the lowest 2N/A# labeled home directory is required by updatehome(1). 2N/A# An auto_home_<zonename> automap entry is created and stored in 2N/A# Although zone administrators can configure their own automount 2N/A# entries, it is done automatically here to make things easier. 2N/A # Find the labeled zone corresponding to the minimum label 2N/A # If the current zone has the minimum label, 2N/A # check if its home directories can be shared. 2N/A # An explicit IP address assignment is required 2N/A # for a zone to be a multilevel NFS server. 2N/A # Save the automount entry for other zones to import 2N/A # Configure multilevel NFS ports if 2N/A # this hasn't been done already. 2N/A add mlp_private=111/udp;\ 2N/A # If an automount map exists, then copy it into the higher 2N/A # Add map to auto_master if necessary 2N/A if [ $? != 0 ] ;then 2N/A# The labeled_printsysconfig function generates a custom 2N/A# SC profile for a labeled zone using properies from the 2N/A# zone's configuration file and global zone settings. 2N/A typeset fmtsvc='<service name="%s" version="1" type="service">\n<instance name="%s" enabled="true">\n' 2N/A typeset fmtgrp='<property_group name="%s" type="%s">\n' 2N/A typeset fmtval='<propval name="%s" type="%s" value="%s"/>\n' 2N/A typeset fmtendsvc='</property_group>\n</instance>\n</service>\n' 2N/A print '<service_bundle type="profile" name="system configuration">' 2N/A print '</property_group>' 2N/A print '</property_group>' 2N/A print '</service_bundle>' 2N/A# The labeled_reconfigure function is used to generate a 2N/A# a customized SC profile for a cloned zone, and to setup 2N/A# some nameservice-specific properties for the user account. 2N/A# It is called by the common clone code when the user runs zoneadm 2N/A# without specifying a SC profile for a labeled zone. 2N/A# $1 specifies how much to configure. 2N/A# possible values are "system,identity,network,location,users" 2N/A# $2 specifies if the unconfiguration should be destructive 2N/A# possible values are --destructive and null 2N/A# Returns 0 if successful, and 1 if mount failure 2N/A # change "system" to "users" when partial 2N/A # reconfiguration is supported 2N/A # A zone can't be unconfigured until it is configured 2N/A # so if the config service has no log file yet we assume 2N/A # if has never been configured, and we can just place 2N/A # the profile in the site directory. 2N/A# The labeled_configure function is used to setup the 2N/A# some nameservice-specific properties for the user account. 2N/A# It is called by common pkgcreatezone code after a labeled zone 2N/A# has been installed, to set up user account properties 2N/A# The labeled_makeSCprofile() function is used to create 2N/A# a customized SC profile for a new labeled zone. 2N/A# It is called by the common pkgcreatezone code when user runs 2N/A# zoneadm without specifying a SC profile for a labeled zone. 2N/A# The pathname of the new SC profile is set in 2N/A# the variable $temp_scprofile which is then passed to 2N/A# auto-install in the common pkgcreatezone code.