net-nwam revision 6ba597c56d749c61b4f783157f63196d7b2445f0
5260N/A# The contents of this file are subject to the terms of the 5260N/A# Common Development and Distribution License (the "License"). 5260N/A# You may not use this file except in compliance with the License. 5260N/A# See the License for the specific language governing permissions 5260N/A# and limitations under the License. 5260N/A# When distributing Covered Code, include this CDDL HEADER in each 5260N/A# If applicable, add the following below this CDDL HEADER, with the 5260N/A# fields enclosed by brackets "[]" replaced with your own identifying 5260N/A# information: Portions Copyright [yyyy] [name of copyright owner] 5260N/A# Copyright 2010 Sun Microsystems, Inc. All rights reserved. 5260N/A# Use is subject to license terms. 5260N/A# Set appropriate config SMF property to these files when NWAM is stopped 5260N/A# and corresponding config properties in the Legacy location are emtpy 5260N/A# Copies the file to the Legacy location directory 5260N/A# copy_from_legacy_loc <destination file> 5260N/A# Copies file with the same name from Legacy location to the given 5260N/A # Make destination directory if needed # write_loc_prop <property> <value> <file> # Appends to <file> a nwamcfg command to set <property> to <value> if non-empty # set_smf_prop <fmri> <property name> <property value> # get_smf_prop <fmri> <property name> # Creates Legacy location from the current configuration # Write nwamcfg commands to create Legacy location to # $CREATE_LOC_LEGACY_FILE as values for properties are determined # Note that some of the *_CONFIG_FILE variables point at copies of # files we've made and others indicate where those copies should be # if we are enabling the location. # Gather NIS info from appropriate file if present. $NAWK '{ printf "%s,", $1 }'` # Gather LDAP info via ldapclient(1M). $NAWK '$1 == "preferredServerList:" { print $2 }'` # Now, write nwamcfg commands for nameservices # If the firewall policy is "custom", simply copy the # custom_policy_file. If the firewall policy is "none", "allow" or # "deny", save the value as "/<value>". When reverting back to the # Legacy location, these values will have to be treated as special. # For all configuration files, copy them to the Legacy directory. # Use the respective properties to remember the original locations # of the files so that they can be copied back there when NWAM is # save value as /none, /allow, or /deny # Undoes the effects of the Legacy location creation 'FS="," { for (i = 1; i <= NF; i++) print $i }' \ # IPFilter, IPsec, and IKE # change /none, /allow, and /deny to firewall policy # no need to clear custom_policy_file as it isn't "custom" # Remove the Legacy directory and location # Arguments to net-nwam are # method ( start | refresh | stop | -u | -c ) # The real daemon is not started in a shared stack zone. But we need to # create a dummy background process to preserve contract lifetime. # Update PVID on interfaces configured with VLAN 1 # Upgrade handling. The upgrade file consists of a series # of dladm(1M) commands. Note that after we are done, we # cannot rename the upgrade script file as the file system # is still read-only at this point. Defer this to the # manifest-import service. if [ -f
"${upgrade_script}" ];
then # Bring up simnet instances # Initialize security objects. # Initialize VNICs, VLANs and flows. Though they are brought # up here, NWAM will not automatically manage VNICs and VLANs. # manifest-import has not yet run for the first boot after upgrade. # We wouldn't need to do that if manifest-import ran earlier in # boot, since there is an explicit dependency between # We also need to create the Legacy location, which is used # to restore non-NWAM settings that are overwritten when # start nwamd in foreground; it will daemonize itself # We need to make the dummy process we created above stop. # Restore the non-NWAM settings. echo "No Legacy location to revert to!" # remove the location property group # After we run this part of the script upon the next reboot # There are various other parts of the system (nscd, nfs) that # depend on continuing to have a working network. For this # reason we don't change the network configuration immediately. # If nwam is online then make sure that it's temporarily enabled. # Set nwam so that it won't be enabled upon reboot. # Nothing to do for sysidtool echo "Usage: $0 { start | stop | refresh }"