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