net-nwam revision 1cfa752f4e24c34133009b0f6c139127a5c461de
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# CDDL HEADER START
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# The contents of this file are subject to the terms of the
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg# Common Development and Distribution License (the "License").
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# You may not use this file except in compliance with the License.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# See the License for the specific language governing permissions
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# and limitations under the License.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# When distributing Covered Code, include this CDDL HEADER in each
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# If applicable, add the following below this CDDL HEADER, with the
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# fields enclosed by brackets "[]" replaced with your own identifying
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# information: Portions Copyright [yyyy] [name of copyright owner]
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# CDDL HEADER END
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# FMRI constants
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Default *.conf files
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Set appropriate config SMF property to these files when NWAM is stopped
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# and corresponding config properties in the Legacy location are emtpy
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholesIPSEC_POLICY_DEFAULT_CONFIG_FILE=/etc/inet/ipsecinit.conf
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Path to directories
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# We don't have a writable file system so we write to /etc/svc/volatile and
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# then later copy anything interesting to /etc/nwam.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# copy_to_legacy_loc <file>
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Copies the file to the Legacy location directory
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# copy_from_legacy_loc <destination file>
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Copies file with the same name from Legacy location to the given
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# destination file
d3fc1a9aec53a772142e2909441b213f3ae8102abnicholes# write_loc_prop <property> <value> <file>
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Appends to <file> a nwamcfg command to set <property> to <value> if non-empty
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# set_smf_prop <fmri> <property name> <property value>
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes $SVCCFG -s $1 setprop $2 = astring: "$3" && return
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# get_smf_prop <fmri> <property name>
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes# Creates Legacy location from the current configuration
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes CREATE_LOC_LEGACY_FILE=/etc/svc/volatile/nwam/create_loc_legacy
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes # Write nwamcfg commands to create Legacy location to
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes # $CREATE_LOC_LEGACY_FILE as values for properties are determined
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes # Note that some of the *_CONFIG_FILE variables point at copies of
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg # files we've made and others indicate where those copies should be
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "activation-mode" "system" $CREATE_LOC_LEGACY_FILE
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes NAMESERVICES_CONFIG_FILE="$LEGACY_PATH/nsswitch.conf"
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes if [ -f /etc/resolv.conf ]; then
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes $GREP -i "added by dhcp" /etc/nsswitch.conf >/dev/null
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes if [ $? -eq 0 ]; then
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes DNS_NAMESERVICE_SERVERS=`$NAWK '$1 == "nameserver" \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes # Gather NIS info from appropriate file if present.
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes NIS_NAMESERVICE_SERVERS="${NIS_NAMESERVICE_SERVERS}$addr"
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes if [ -f /var/ldap/ldap_client_file ]; then
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg LDAP_NAMESERVICE_SERVERS=`$LDAPCLIENT list 2>/dev/null | \
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg write_loc_prop "nameservices" $NAMESERVICES $CREATE_LOC_LEGACY_FILE
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg write_loc_prop "nameservices-config-file" $NAMESERVICES_CONFIG_FILE \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "dns-nameservice-configsrc" $DNS_NAMESERVICE_CONFIGSRC \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "dns-nameservice-domain" $DNS_NAMESERVICE_DOMAIN \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "dns-nameservice-servers" $DNS_NAMESERVICE_SERVERS \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "dns-nameservice-search" $DNS_NAMESERVICE_SEARCH \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "nis-nameservice-configsrc" $NIS_NAMESERVICE_CONFIGSRC \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "nis-nameservice-servers" $NIS_NAMESERVICE_SERVERS \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "ldap-nameservice-configsrc" $LDAP_NAMESERVICE_CONFIGSRC\
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg write_loc_prop "ldap-nameservice-servers" $LDAP_NAMESERVICE_SERVERS \
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes write_loc_prop "default-domain" $DEFAULT_DOMAIN $CREATE_LOC_LEGACY_FILE
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes if [ -f /etc/default/nfs ]; then
c9ce2b84cc0bf2caa39be615eb06f7a9b68378d5bnicholes NFS_DOMAIN=`$NAWK '/^NFSMAPID_DOMAIN.*/ { FS="=" ; print $2 }' \
if service_is_enabled $IPFILTER_FMRI; then
if service_is_enabled $IPSEC_IKE_FMRI:default; then
if service_is_enabled $IPSEC_POLICY_FMRI:default; then
refresh_ipf=false
refresh_ipf=true
refresh_ipf=true
refresh_ipf=true
refresh_ipf=true
exit $SMF_EXIT_OK
if smf_is_globalzone; then
# ibd/ibd_upgraded property to "true" as the file system is
# NWAM is enabled (e.g. resolv.conf, nsswitch.conf, etc.).
exit $SMF_EXIT_OK
exit $SMF_EXIT_ERR_FATAL
exit $SMF_EXIT_OK
exit $SMF_EXIT_OK
set -- $nwam_online
exit $SMF_EXIT_ERR_FATAL
exit $SMF_EXIT_OK