10Sstevel@tonic-gate#!/bin/sh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 61676Sjpk# Common Development and Distribution License (the "License"). 71676Sjpk# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 220Sstevel@tonic-gate# 2310870SMilan.Jurik@Sun.COM# idsconfig -- script to setup iDS 5.x/6.x/7.x for Native LDAP II. 240Sstevel@tonic-gate# 25*12788Sgary.winiger@oracle.com# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 260Sstevel@tonic-gate# 270Sstevel@tonic-gate 280Sstevel@tonic-gate# 290Sstevel@tonic-gate# display_msg(): Displays message corresponding to the tag passed in. 300Sstevel@tonic-gate# 310Sstevel@tonic-gatedisplay_msg() 320Sstevel@tonic-gate{ 330Sstevel@tonic-gate case "$1" in 340Sstevel@tonic-gate usage) cat <<EOF 350Sstevel@tonic-gate $PROG: [ -v ] [ -i input file ] [ -o output file ] 360Sstevel@tonic-gate i <input file> Get setup info from input file. 370Sstevel@tonic-gate o <output file> Generate a server configuration output file. 380Sstevel@tonic-gate v Verbose mode 390Sstevel@tonic-gateEOF 400Sstevel@tonic-gate ;; 410Sstevel@tonic-gate backup_server) cat <<EOF 420Sstevel@tonic-gateIt is strongly recommended that you BACKUP the directory server 430Sstevel@tonic-gatebefore running $PROG. 440Sstevel@tonic-gate 450Sstevel@tonic-gateHit Ctrl-C at any time before the final confirmation to exit. 460Sstevel@tonic-gate 470Sstevel@tonic-gateEOF 480Sstevel@tonic-gate ;; 490Sstevel@tonic-gate setup_complete) cat <<EOF 500Sstevel@tonic-gate 510Sstevel@tonic-gate$PROG: Setup of iDS server ${IDS_SERVER} is complete. 520Sstevel@tonic-gate 530Sstevel@tonic-gateEOF 540Sstevel@tonic-gate ;; 550Sstevel@tonic-gate display_vlv_list) cat <<EOF 560Sstevel@tonic-gate 576842Sth160488Note: idsconfig has created entries for VLV indexes. 586842Sth160488 596842Sth160488 For DS5.x, use the directoryserver(1m) script on ${IDS_SERVER} 606842Sth160488 to stop the server. Then, using directoryserver, follow the 616842Sth160488 directoryserver examples below to create the actual VLV indexes. 626842Sth160488 6310870SMilan.Jurik@Sun.COM For DS6.x or later, use dsadm command delivered with DS on ${IDS_SERVER} 646842Sth160488 to stop the server. Then, using dsadm, follow the 656842Sth160488 dsadm examples below to create the actual VLV indexes. 660Sstevel@tonic-gate 670Sstevel@tonic-gateEOF 680Sstevel@tonic-gate ;; 690Sstevel@tonic-gate cred_level_menu) cat <<EOF 700Sstevel@tonic-gateThe following are the supported credential levels: 710Sstevel@tonic-gate 1 anonymous 720Sstevel@tonic-gate 2 proxy 730Sstevel@tonic-gate 3 proxy anonymous 742830Sdjl 4 self 750Sstevel@tonic-gateEOF 760Sstevel@tonic-gate ;; 770Sstevel@tonic-gate auth_method_menu) cat <<EOF 780Sstevel@tonic-gateThe following are the supported Authentication Methods: 790Sstevel@tonic-gate 1 none 800Sstevel@tonic-gate 2 simple 810Sstevel@tonic-gate 3 sasl/DIGEST-MD5 820Sstevel@tonic-gate 4 tls:simple 830Sstevel@tonic-gate 5 tls:sasl/DIGEST-MD5 842830Sdjl 6 sasl/GSSAPI 850Sstevel@tonic-gateEOF 860Sstevel@tonic-gate ;; 870Sstevel@tonic-gate srvauth_method_menu) cat <<EOF 880Sstevel@tonic-gateThe following are the supported Authentication Methods: 890Sstevel@tonic-gate 1 simple 900Sstevel@tonic-gate 2 sasl/DIGEST-MD5 910Sstevel@tonic-gate 3 tls:simple 920Sstevel@tonic-gate 4 tls:sasl/DIGEST-MD5 932830Sdjl 5 sasl/GSSAPI 940Sstevel@tonic-gateEOF 950Sstevel@tonic-gate ;; 960Sstevel@tonic-gate prompt_ssd_menu) cat <<EOF 970Sstevel@tonic-gate A Add a Service Search Descriptor 980Sstevel@tonic-gate D Delete a SSD 990Sstevel@tonic-gate M Modify a SSD 1000Sstevel@tonic-gate P Display all SSD's 1010Sstevel@tonic-gate H Help 1020Sstevel@tonic-gate X Clear all SSD's 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate Q Exit menu 1050Sstevel@tonic-gateEOF 1060Sstevel@tonic-gate ;; 1072672Svl199446 summary_menu) 1082672Svl199446 1092672Svl199446 SUFFIX_INFO= 1102672Svl199446 DB_INFO= 1112672Svl199446 1122672Svl199446 [ -n "${NEED_CREATE_SUFFIX}" ] && 1132672Svl199446 { 1142672Svl199446 SUFFIX_INFO=`cat <<EOF 1152672Svl199446 1162672Svl199446 Suffix to create : $LDAP_SUFFIX 1172672Svl199446EOF 1182672Svl199446` 1192672Svl199446 [ -n "${NEED_CREATE_BACKEND}" ] && 1202672Svl199446 DB_INFO=`cat <<EOF 1212672Svl199446 1222672Svl199446 Database to create : $IDS_DATABASE 1232672Svl199446EOF 1242672Svl199446` 1252672Svl199446 } 1262672Svl199446 1272672Svl199446 cat <<EOF 1280Sstevel@tonic-gate Summary of Configuration 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate 1 Domain to serve : $LDAP_DOMAIN 1312672Svl199446 2 Base DN to setup : $LDAP_BASEDN$SUFFIX_INFO$DB_INFO 1320Sstevel@tonic-gate 3 Profile name to create : $LDAP_PROFILE_NAME 1330Sstevel@tonic-gate 4 Default Server List : $LDAP_SERVER_LIST 1340Sstevel@tonic-gate 5 Preferred Server List : $LDAP_PREF_SRVLIST 1350Sstevel@tonic-gate 6 Default Search Scope : $LDAP_SEARCH_SCOPE 1360Sstevel@tonic-gate 7 Credential Level : $LDAP_CRED_LEVEL 1370Sstevel@tonic-gate 8 Authentication Method : $LDAP_AUTHMETHOD 1380Sstevel@tonic-gate 9 Enable Follow Referrals : $LDAP_FOLLOWREF 1390Sstevel@tonic-gate 10 iDS Time Limit : $IDS_TIMELIMIT 1400Sstevel@tonic-gate 11 iDS Size Limit : $IDS_SIZELIMIT 1410Sstevel@tonic-gate 12 Enable crypt password storage : $NEED_CRYPT 1420Sstevel@tonic-gate 13 Service Auth Method pam_ldap : $LDAP_SRV_AUTHMETHOD_PAM 1430Sstevel@tonic-gate 14 Service Auth Method keyserv : $LDAP_SRV_AUTHMETHOD_KEY 1440Sstevel@tonic-gate 15 Service Auth Method passwd-cmd: $LDAP_SRV_AUTHMETHOD_CMD 1450Sstevel@tonic-gate 16 Search Time Limit : $LDAP_SEARCH_TIME_LIMIT 1460Sstevel@tonic-gate 17 Profile Time to Live : $LDAP_PROFILE_TTL 1470Sstevel@tonic-gate 18 Bind Limit : $LDAP_BIND_LIMIT 1488821SMichen.Chang@Sun.COM 19 Enable shadow update : $LDAP_ENABLE_SHADOW_UPDATE 1498821SMichen.Chang@Sun.COM 20 Service Search Descriptors Menu 1500Sstevel@tonic-gate 1510Sstevel@tonic-gateEOF 1520Sstevel@tonic-gate ;; 1532672Svl199446 sfx_not_suitable) cat <<EOF 1542672Svl199446 1552672Svl199446Sorry, suffix ${LDAP_SUFFIX} is not suitable for Base DN ${LDAP_BASEDN} 1562672Svl199446 1572672Svl199446EOF 1582672Svl199446 ;; 1592672Svl199446 obj_not_found) cat <<EOF 1602672Svl199446 1612672Svl199446Sorry, ${PROG} can't find an objectclass for "$_ATT" attribute 1622672Svl199446 1632672Svl199446EOF 1642672Svl199446 ;; 1652672Svl199446 sfx_config_incons) cat <<EOF 1662672Svl199446 1672672Svl199446Sorry, there is no suffix mapping for ${LDAP_SUFFIX}, 1682672Svl199446while ldbm database exists, server configuration needs to be fixed manually, 1692672Svl199446look at cn=mapping tree,cn=config and cn=ldbm database,cn=plugins,cn=config 1702672Svl199446 1712672Svl199446EOF 1722672Svl199446 ;; 1732672Svl199446 ldbm_db_exist) cat <<EOF 1742672Svl199446 1752672Svl199446Database "${IDS_DATABASE}" already exists, 1762672Svl199446however "${IDS_DATABASE_AVAIL}" name is available 1772672Svl199446 1782672Svl199446EOF 1792672Svl199446 ;; 1802672Svl199446 unable_find_db_name) cat <<EOF 1812672Svl199446 1822672Svl199446Unable to find any available database name close to "${IDS_DATABASE}" 1832672Svl199446 1842672Svl199446EOF 1852672Svl199446 ;; 1862672Svl199446 create_ldbm_db_error) cat <<EOF 1872672Svl199446 1882672Svl199446ERROR: unable to create suffix ${LDAP_SUFFIX} 1892672Svl199446 due to server error that occurred during creation of ldbm database 1902672Svl199446 1912672Svl199446EOF 1922672Svl199446 ;; 1932672Svl199446 create_suffix_entry_error) cat <<EOF 1942672Svl199446 1952672Svl199446ERROR: unable to create entry ${LDAP_SUFFIX} of ${LDAP_SUFFIX_OBJ} class 1962672Svl199446 1972672Svl199446EOF 1982672Svl199446 ;; 1990Sstevel@tonic-gate ldap_suffix_list) cat <<EOF 2000Sstevel@tonic-gate 2010Sstevel@tonic-gateNo valid suffixes (naming contexts) were found for LDAP base DN: 2020Sstevel@tonic-gate${LDAP_BASEDN} 2030Sstevel@tonic-gate 2040Sstevel@tonic-gateAvailable suffixes are: 2050Sstevel@tonic-gate${LDAP_SUFFIX_LIST} 2060Sstevel@tonic-gate 2070Sstevel@tonic-gateEOF 2080Sstevel@tonic-gate ;; 2090Sstevel@tonic-gate sorry) cat <<EOF 2100Sstevel@tonic-gate 2110Sstevel@tonic-gateHELP - No help is available for this topic. 2120Sstevel@tonic-gate 2130Sstevel@tonic-gateEOF 2140Sstevel@tonic-gate ;; 2152672Svl199446 create_suffix_help) cat <<EOF 2162672Svl199446 2172672Svl199446HELP - Our Base DN is ${LDAP_BASEDN} 2182672Svl199446 and we need to create a Directory Suffix, 2192672Svl199446 which can be equal to Base DN itself or be any of Base DN parents. 2202672Svl199446 All intermediate entries up to suffix will be created on demand. 2212672Svl199446 2222672Svl199446EOF 2232672Svl199446 ;; 2242672Svl199446 enter_ldbm_db_help) cat <<EOF 2252672Svl199446 2262672Svl199446HELP - ldbm database is an internal database for storage of our suffix data. 2272672Svl199446 Database name must be alphanumeric due to Directory Server restriction. 2282672Svl199446 2292672Svl199446EOF 2302672Svl199446 ;; 2310Sstevel@tonic-gate backup_help) cat <<EOF 2320Sstevel@tonic-gate 2330Sstevel@tonic-gateHELP - Since idsconfig modifies the directory server configuration, 2340Sstevel@tonic-gate it is strongly recommended that you backup the server prior 2350Sstevel@tonic-gate to running this utility. This is especially true if the server 2360Sstevel@tonic-gate being configured is a production server. 2370Sstevel@tonic-gate 2380Sstevel@tonic-gateEOF 2390Sstevel@tonic-gate ;; 2400Sstevel@tonic-gate port_help) cat <<EOF 2410Sstevel@tonic-gate 2420Sstevel@tonic-gateHELP - Enter the port number the directory server is configured to 2430Sstevel@tonic-gate use for LDAP. 2440Sstevel@tonic-gate 2450Sstevel@tonic-gateEOF 2460Sstevel@tonic-gate ;; 2470Sstevel@tonic-gate domain_help) cat <<EOF 2480Sstevel@tonic-gate 2490Sstevel@tonic-gateHELP - This is the DNS domain name this server will be serving. You 2500Sstevel@tonic-gate must provide this name even if the server is not going to be populated 2510Sstevel@tonic-gate with hostnames. Any unqualified hostname stored in the directory 2520Sstevel@tonic-gate will be fully qualified using this DNS domain name. 2530Sstevel@tonic-gate 2540Sstevel@tonic-gateEOF 2550Sstevel@tonic-gate ;; 2560Sstevel@tonic-gate basedn_help) cat <<EOF 2570Sstevel@tonic-gate 2580Sstevel@tonic-gateHELP - This parameter defines the default location in the directory tree for 2590Sstevel@tonic-gate the naming services entries. You can override this default by using 2600Sstevel@tonic-gate serviceSearchDescriptors (SSD). You will be given the option to set up 2610Sstevel@tonic-gate an SSD later on in the setup. 2620Sstevel@tonic-gate 2630Sstevel@tonic-gateEOF 2640Sstevel@tonic-gate ;; 2650Sstevel@tonic-gate profile_help) cat <<EOF 2660Sstevel@tonic-gate 2670Sstevel@tonic-gateHELP - Name of the configuration profile with which the clients will be 2680Sstevel@tonic-gate configured. A directory server can store various profiles for multiple 2690Sstevel@tonic-gate groups of clients. The initialization tool, (ldapclient(1M)), assumes 2700Sstevel@tonic-gate "default" unless another is specified. 2710Sstevel@tonic-gate 2720Sstevel@tonic-gateEOF 2730Sstevel@tonic-gate ;; 2740Sstevel@tonic-gate def_srvlist_help) cat <<EOF 2750Sstevel@tonic-gate 2760Sstevel@tonic-gateHELP - Provide a list of directory servers to serve clients using this profile. 2770Sstevel@tonic-gate All these servers should contain consistent data and provide similar 2780Sstevel@tonic-gate functionality. This list is not ordered, and clients might change the 2790Sstevel@tonic-gate order given in this list. Note that this is a space separated list of 2800Sstevel@tonic-gate *IP addresses* (not host names). Providing port numbers is optional. 2810Sstevel@tonic-gate 2820Sstevel@tonic-gateEOF 2830Sstevel@tonic-gate ;; 2840Sstevel@tonic-gate pref_srvlist_help) cat <<EOF 2850Sstevel@tonic-gate 2860Sstevel@tonic-gateHELP - Provide a list of directory servers to serve this client profile. 2870Sstevel@tonic-gate Unlike the default server list, which is not ordered, the preferred 2880Sstevel@tonic-gate servers must be entered IN THE ORDER you wish to have them contacted. 2890Sstevel@tonic-gate If you do specify a preferred server list, clients will always contact 2900Sstevel@tonic-gate them before attempting to contact any of the servers on the default 2910Sstevel@tonic-gate server list. Note that you must enter the preferred server list as a 2920Sstevel@tonic-gate space-separated list of *IP addresses* (not host names). Providing port 2930Sstevel@tonic-gate numbers is optional. 2940Sstevel@tonic-gate 2950Sstevel@tonic-gateEOF 2960Sstevel@tonic-gate ;; 2970Sstevel@tonic-gate srch_scope_help) cat <<EOF 2980Sstevel@tonic-gate 2990Sstevel@tonic-gateHELP - Default search scope to be used for all searches unless they are 3000Sstevel@tonic-gate overwritten using serviceSearchDescriptors. The valid options 3010Sstevel@tonic-gate are "one", which would specify the search will only be performed 3020Sstevel@tonic-gate at the base DN for the given service, or "sub", which would specify 3030Sstevel@tonic-gate the search will be performed through *all* levels below the base DN 3040Sstevel@tonic-gate for the given service. 3050Sstevel@tonic-gate 3060Sstevel@tonic-gateEOF 3070Sstevel@tonic-gate ;; 3080Sstevel@tonic-gate cred_lvl_help) cat <<EOF 3090Sstevel@tonic-gate 3100Sstevel@tonic-gateHELP - This parameter defines what credentials the clients use to 3110Sstevel@tonic-gate authenticate to the directory server. This list might contain 3120Sstevel@tonic-gate multiple credential levels and is ordered. If a proxy level 3130Sstevel@tonic-gate is configured, you will also be prompted to enter a bind DN 3140Sstevel@tonic-gate for the proxy agent along with a password. This proxy agent 3150Sstevel@tonic-gate will be created if it does not exist. 3160Sstevel@tonic-gate 3170Sstevel@tonic-gateEOF 3180Sstevel@tonic-gate ;; 3190Sstevel@tonic-gate auth_help) cat <<EOF 3200Sstevel@tonic-gate 3210Sstevel@tonic-gateHELP - The default authentication method(s) to be used by all services 3220Sstevel@tonic-gate in the client using this profile. This is a ordered list of 3230Sstevel@tonic-gate authentication methods separated by a ';'. The supported methods 3240Sstevel@tonic-gate are provided in a menu. Note that sasl/DIGEST-MD5 binds require 3250Sstevel@tonic-gate passwords to be stored un-encrypted on the server. 3260Sstevel@tonic-gate 3270Sstevel@tonic-gateEOF 3280Sstevel@tonic-gate ;; 3290Sstevel@tonic-gate srvauth_help) cat <<EOF 3300Sstevel@tonic-gate 3310Sstevel@tonic-gateHELP - The authentication methods to be used by a given service. Currently 3320Sstevel@tonic-gate 3 services support this feature: pam_ldap, keyserv, and passwd-cmd. 3330Sstevel@tonic-gate The authentication method specified in this attribute overrides 3340Sstevel@tonic-gate the default authentication method defined in the profile. This 3350Sstevel@tonic-gate feature can be used to select stronger authentication methods for 3360Sstevel@tonic-gate services which require increased security. 3370Sstevel@tonic-gate 3380Sstevel@tonic-gateEOF 3390Sstevel@tonic-gate ;; 3400Sstevel@tonic-gate pam_ldap_help) cat <<EOF 3410Sstevel@tonic-gate 3420Sstevel@tonic-gateHELP - The authentication method(s) to be used by pam_ldap when contacting 3430Sstevel@tonic-gate the directory server. This is a ordered list, and, if provided, will 3440Sstevel@tonic-gate override the default authentication method parameter. 3450Sstevel@tonic-gate 3460Sstevel@tonic-gateEOF 3470Sstevel@tonic-gate ;; 3480Sstevel@tonic-gate keyserv_help) cat <<EOF 3490Sstevel@tonic-gate 3500Sstevel@tonic-gateHELP - The authentication method(s) to be used by newkey(1M) and chkey(1) 3510Sstevel@tonic-gate when contacting the directory server. This is a ordered list and 3520Sstevel@tonic-gate if provided will override the default authentication method 3530Sstevel@tonic-gate parameter. 3540Sstevel@tonic-gate 3550Sstevel@tonic-gateEOF 3560Sstevel@tonic-gate ;; 3570Sstevel@tonic-gate passwd-cmd_help) cat <<EOF 3580Sstevel@tonic-gate 3590Sstevel@tonic-gateHELP - The authentication method(s) to be used by passwd(1) command when 3600Sstevel@tonic-gate contacting the directory server. This is a ordered list and if 3610Sstevel@tonic-gate provided will override the default authentication method parameter. 3620Sstevel@tonic-gate 3630Sstevel@tonic-gateEOF 3640Sstevel@tonic-gate ;; 3650Sstevel@tonic-gate referrals_help) cat <<EOF 3660Sstevel@tonic-gate 3670Sstevel@tonic-gateHELP - This parameter indicates whether the client should follow 3680Sstevel@tonic-gate ldap referrals if it encounters one during naming lookups. 3690Sstevel@tonic-gate 3700Sstevel@tonic-gateEOF 3710Sstevel@tonic-gate ;; 3720Sstevel@tonic-gate tlim_help) cat <<EOF 3730Sstevel@tonic-gate 3740Sstevel@tonic-gateHELP - The server time limit value indicates the maximum amount of time the 3750Sstevel@tonic-gate server would spend on a query from the client before abandoning it. 3760Sstevel@tonic-gate A value of '-1' indicates no limit. 3770Sstevel@tonic-gate 3780Sstevel@tonic-gateEOF 3790Sstevel@tonic-gate ;; 3800Sstevel@tonic-gate slim_help) cat <<EOF 3810Sstevel@tonic-gate 3820Sstevel@tonic-gateHELP - The server sizelimit value indicates the maximum number of entries 3830Sstevel@tonic-gate the server would return in respond to a query from the client. A 3840Sstevel@tonic-gate value of '-1' indicates no limit. 3850Sstevel@tonic-gate 3860Sstevel@tonic-gateEOF 3870Sstevel@tonic-gate ;; 3880Sstevel@tonic-gate crypt_help) cat <<EOF 3890Sstevel@tonic-gate 3900Sstevel@tonic-gateHELP - By default iDS does not store userPassword attribute values using 3910Sstevel@tonic-gate unix "crypt" format. If you need to keep your passwords in the crypt 3920Sstevel@tonic-gate format for NIS/NIS+ and pam_unix compatibility, choose 'yes'. If 3930Sstevel@tonic-gate passwords are stored using any other format than crypt, pam_ldap 3940Sstevel@tonic-gate MUST be used by clients to authenticate users to the system. Note 3950Sstevel@tonic-gate that if you wish to use sasl/DIGEST-MD5 in conjunction with pam_ldap, 3960Sstevel@tonic-gate user passwords must be stored in the clear format. 3970Sstevel@tonic-gate 3980Sstevel@tonic-gateEOF 3990Sstevel@tonic-gate ;; 4000Sstevel@tonic-gate srchtime_help) cat <<EOF 4010Sstevel@tonic-gate 4020Sstevel@tonic-gateHELP - The search time limit the client will enforce for directory 4030Sstevel@tonic-gate lookups. 4040Sstevel@tonic-gate 4050Sstevel@tonic-gateEOF 4060Sstevel@tonic-gate ;; 4070Sstevel@tonic-gate profttl_help) cat <<EOF 4080Sstevel@tonic-gate 4090Sstevel@tonic-gateHELP - The time to live value for profile. The client will refresh its 4100Sstevel@tonic-gate cached version of the configuration profile at this TTL interval. 4110Sstevel@tonic-gate 4120Sstevel@tonic-gateEOF 4130Sstevel@tonic-gate ;; 4140Sstevel@tonic-gate bindlim_help) cat <<EOF 4150Sstevel@tonic-gate 4160Sstevel@tonic-gateHELP - The time limit for the bind operation to the directory. This 4170Sstevel@tonic-gate value controls the responsiveness of the client in case a server 4180Sstevel@tonic-gate becomes unavailable. The smallest timeout value for a given 4190Sstevel@tonic-gate network architecture/conditions would work best. This is very 4200Sstevel@tonic-gate similar to setting TCP timeout, but only for LDAP bind operation. 4210Sstevel@tonic-gate 4220Sstevel@tonic-gateEOF 4230Sstevel@tonic-gate ;; 4240Sstevel@tonic-gate ssd_help) cat <<EOF 4250Sstevel@tonic-gate 4260Sstevel@tonic-gateHELP - Using Service Search Descriptors (SSD), you can override the 4270Sstevel@tonic-gate default configuration for a given service. The SSD can be 4280Sstevel@tonic-gate used to override the default search base DN, the default search 4290Sstevel@tonic-gate scope, and the default search filter to be used for directory 4300Sstevel@tonic-gate lookups. SSD are supported for all services (databases) 4310Sstevel@tonic-gate defined in nsswitch.conf(4). The default base DN is defined 4320Sstevel@tonic-gate in ldap(1). 4330Sstevel@tonic-gate 4340Sstevel@tonic-gate Note: SSD are powerful tools in defining configuration profiles 4350Sstevel@tonic-gate and provide a great deal of flexibility. However, care 4360Sstevel@tonic-gate must be taken in creating them. If you decide to make use 4370Sstevel@tonic-gate of SSDs, consult the documentation first. 4380Sstevel@tonic-gate 4390Sstevel@tonic-gateEOF 4400Sstevel@tonic-gate ;; 4410Sstevel@tonic-gate ssd_menu_help) cat <<EOF 4420Sstevel@tonic-gate 4430Sstevel@tonic-gateHELP - Using this menu SSD can be added, updated, or deleted from 4440Sstevel@tonic-gate the profile. 4450Sstevel@tonic-gate 4460Sstevel@tonic-gate A - This option creates a new SSD by prompting for the 4470Sstevel@tonic-gate service name, base DN, and scope. Service name is 4480Sstevel@tonic-gate any valid service as defined in ldap(1). base is 4490Sstevel@tonic-gate either the distinguished name to the container where 4500Sstevel@tonic-gate this service will use, or a relative DN followed 4510Sstevel@tonic-gate by a ','. 4520Sstevel@tonic-gate D - Delete a previously created SSD. 4530Sstevel@tonic-gate M - Modify a previously created SSD. 4540Sstevel@tonic-gate P - Display a list of all the previously created SSD. 4550Sstevel@tonic-gate X - Delete all of the previously created SSD. 4560Sstevel@tonic-gate 4570Sstevel@tonic-gate Q - Exit the menu and continue with the server configuration. 4580Sstevel@tonic-gate 4590Sstevel@tonic-gateEOF 4600Sstevel@tonic-gate ;; 4610Sstevel@tonic-gate ldap_suffix_list_help) cat <<EOF 4620Sstevel@tonic-gate 4630Sstevel@tonic-gateHELP - No valid suffixes (naming contexts) are available on server 4640Sstevel@tonic-gate ${IDS_SERVER}:${IDS_PORT}. 4650Sstevel@tonic-gate You must set an LDAP Base DN that can be contained in 4660Sstevel@tonic-gate an existing suffix. 4670Sstevel@tonic-gate 4680Sstevel@tonic-gateEOF 4690Sstevel@tonic-gate ;; 4708821SMichen.Chang@Sun.COM enable_shadow_update_help) cat <<EOF 4718821SMichen.Chang@Sun.COM 4728821SMichen.Chang@Sun.COMHELP - Enter 'y' to set up the LDAP server for shadow update. 4738821SMichen.Chang@Sun.COM The setup will add an administrator identity/credential 4748821SMichen.Chang@Sun.COM and modify the necessary access controls for the client 4758821SMichen.Chang@Sun.COM to update shadow(4) data on the LDAP server. If sasl/GSSAPI 4768821SMichen.Chang@Sun.COM is in use, the Kerberos host principal will be used as the 4778821SMichen.Chang@Sun.COM administrator identity. 4788821SMichen.Chang@Sun.COM 4798821SMichen.Chang@Sun.COM Shadow data is used for password aging and account locking. 4808821SMichen.Chang@Sun.COM Please refer to the shadow(4) manual page for details. 4818821SMichen.Chang@Sun.COM 4828821SMichen.Chang@Sun.COMEOF 4838821SMichen.Chang@Sun.COM ;; 4848821SMichen.Chang@Sun.COM add_admin_cred_help) cat <<EOF 4858821SMichen.Chang@Sun.COM 4868821SMichen.Chang@Sun.COMHELP - Start the setup to add an administrator identity/credential 4878821SMichen.Chang@Sun.COM and to modify access controls for the client to update 4888821SMichen.Chang@Sun.COM shadow(4) data on the LDAP server. 4898821SMichen.Chang@Sun.COM 4908821SMichen.Chang@Sun.COM Shadow data is used for password aging and account locking. 4918821SMichen.Chang@Sun.COM Please refer to the shadow(4) manual page for details. 4928821SMichen.Chang@Sun.COM 4938821SMichen.Chang@Sun.COMEOF 4948821SMichen.Chang@Sun.COM ;; 4958821SMichen.Chang@Sun.COM use_host_principal_help) cat <<EOF 4968821SMichen.Chang@Sun.COM 4978821SMichen.Chang@Sun.COMHELP - A profile with a 'sasl/GSSAPI' authentication method and a 'self' 4988821SMichen.Chang@Sun.COM credential level is detected, enter 'y' to modify the necessary 4998821SMichen.Chang@Sun.COM access controls for allowing the client to update shadow(4) data 5008821SMichen.Chang@Sun.COM on the LDAP server. 5018821SMichen.Chang@Sun.COM 5028821SMichen.Chang@Sun.COM Shadow data is used for password aging and account locking. 5038821SMichen.Chang@Sun.COM Please refer to the shadow(4) manual page for details. 5048821SMichen.Chang@Sun.COM 5058821SMichen.Chang@Sun.COMEOF 5068821SMichen.Chang@Sun.COM ;; 5070Sstevel@tonic-gate esac 5080Sstevel@tonic-gate} 5090Sstevel@tonic-gate 5100Sstevel@tonic-gate 5110Sstevel@tonic-gate# 5120Sstevel@tonic-gate# get_ans(): gets an answer from the user. 5130Sstevel@tonic-gate# $1 instruction/comment/description/question 5140Sstevel@tonic-gate# $2 default value 5150Sstevel@tonic-gate# 5160Sstevel@tonic-gateget_ans() 5170Sstevel@tonic-gate{ 5180Sstevel@tonic-gate if [ -z "$2" ] 5190Sstevel@tonic-gate then 5200Sstevel@tonic-gate ${ECHO} "$1 \c" 5210Sstevel@tonic-gate else 5220Sstevel@tonic-gate ${ECHO} "$1 [$2] \c" 5230Sstevel@tonic-gate fi 5240Sstevel@tonic-gate 5250Sstevel@tonic-gate read ANS 5260Sstevel@tonic-gate if [ -z "$ANS" ] 5270Sstevel@tonic-gate then 5280Sstevel@tonic-gate ANS=$2 5290Sstevel@tonic-gate fi 5300Sstevel@tonic-gate} 5310Sstevel@tonic-gate 5320Sstevel@tonic-gate 5330Sstevel@tonic-gate# 5340Sstevel@tonic-gate# get_ans_req(): gets an answer (required) from the user, NULL value not allowed. 5350Sstevel@tonic-gate# $@ instruction/comment/description/question 5360Sstevel@tonic-gate# 5370Sstevel@tonic-gateget_ans_req() 5380Sstevel@tonic-gate{ 5390Sstevel@tonic-gate ANS="" # Set ANS to NULL. 5400Sstevel@tonic-gate while [ "$ANS" = "" ] 5410Sstevel@tonic-gate do 5420Sstevel@tonic-gate get_ans "$@" 5430Sstevel@tonic-gate [ "$ANS" = "" ] && ${ECHO} "NULL value not allowed!" 5440Sstevel@tonic-gate done 5450Sstevel@tonic-gate} 5460Sstevel@tonic-gate 5470Sstevel@tonic-gate 5480Sstevel@tonic-gate# 5490Sstevel@tonic-gate# get_number(): Querys and verifies that number entered is numeric. 5500Sstevel@tonic-gate# Function will repeat prompt user for number value. 5510Sstevel@tonic-gate# $1 Message text. 5520Sstevel@tonic-gate# $2 default value. 5530Sstevel@tonic-gate# $3 Help argument. 5540Sstevel@tonic-gate# 5550Sstevel@tonic-gateget_number() 5560Sstevel@tonic-gate{ 5570Sstevel@tonic-gate ANS="" # Set ANS to NULL. 5580Sstevel@tonic-gate NUM="" 5590Sstevel@tonic-gate 5600Sstevel@tonic-gate get_ans "$1" "$2" 5610Sstevel@tonic-gate 5620Sstevel@tonic-gate # Verify that value is numeric. 5630Sstevel@tonic-gate while not_numeric $ANS 5640Sstevel@tonic-gate do 5650Sstevel@tonic-gate case "$ANS" in 5660Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry} ;; 5670Sstevel@tonic-gate * ) ${ECHO} "Invalid value: \"${ANS}\". \c" 5680Sstevel@tonic-gate ;; 5690Sstevel@tonic-gate esac 5700Sstevel@tonic-gate # Get a new value. 5710Sstevel@tonic-gate get_ans "Enter a numeric value:" "$2" 5720Sstevel@tonic-gate done 5730Sstevel@tonic-gate NUM=$ANS 5740Sstevel@tonic-gate} 5750Sstevel@tonic-gate 5760Sstevel@tonic-gate 5770Sstevel@tonic-gate# 5780Sstevel@tonic-gate# get_negone_num(): Only allows a -1 or positive integer. 5790Sstevel@tonic-gate# Used for values where -1 has special meaning. 5800Sstevel@tonic-gate# 5810Sstevel@tonic-gate# $1 - Prompt message. 5820Sstevel@tonic-gate# $2 - Default value (require). 5830Sstevel@tonic-gate# $3 - Optional help argument. 5840Sstevel@tonic-gateget_negone_num() 5850Sstevel@tonic-gate{ 5860Sstevel@tonic-gate while : 5870Sstevel@tonic-gate do 5880Sstevel@tonic-gate get_number "$1" "$2" "$3" 5890Sstevel@tonic-gate if is_negative $ANS 5900Sstevel@tonic-gate then 5910Sstevel@tonic-gate if [ "$ANS" = "-1" ]; then 5920Sstevel@tonic-gate break # -1 is OK, so break. 5930Sstevel@tonic-gate else # Need to re-enter number. 5940Sstevel@tonic-gate ${ECHO} "Invalid number: please enter -1 or positive number." 5950Sstevel@tonic-gate fi 5960Sstevel@tonic-gate else 5970Sstevel@tonic-gate break # Positive number 5980Sstevel@tonic-gate fi 5990Sstevel@tonic-gate done 6000Sstevel@tonic-gate} 6010Sstevel@tonic-gate 6020Sstevel@tonic-gate 6030Sstevel@tonic-gate# 6040Sstevel@tonic-gate# get_passwd(): Reads a password from the user and verify with second. 6050Sstevel@tonic-gate# $@ instruction/comment/description/question 6060Sstevel@tonic-gate# 6070Sstevel@tonic-gateget_passwd() 6080Sstevel@tonic-gate{ 6090Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_passwd()" 6100Sstevel@tonic-gate 6110Sstevel@tonic-gate # Temporary PASSWD variables 6120Sstevel@tonic-gate _PASS1="" 6130Sstevel@tonic-gate _PASS2="" 6140Sstevel@tonic-gate 6150Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 6160Sstevel@tonic-gate 6170Sstevel@tonic-gate # Endless loop that continues until passwd and re-entered passwd 6180Sstevel@tonic-gate # match. 6190Sstevel@tonic-gate while : 6200Sstevel@tonic-gate do 6210Sstevel@tonic-gate ANS="" # Set ANS to NULL. 6220Sstevel@tonic-gate 6230Sstevel@tonic-gate # Don't allow NULL for first try. 6240Sstevel@tonic-gate while [ "$ANS" = "" ] 6250Sstevel@tonic-gate do 6260Sstevel@tonic-gate get_ans "$@" 6270Sstevel@tonic-gate [ "$ANS" = "" ] && ${ECHO} "" && ${ECHO} "NULL passwd not allowed!" 6280Sstevel@tonic-gate done 6290Sstevel@tonic-gate _PASS1=$ANS # Store first try. 6300Sstevel@tonic-gate 6310Sstevel@tonic-gate # Get second try. 6320Sstevel@tonic-gate ${ECHO} "" 6330Sstevel@tonic-gate get_ans "Re-enter passwd:" 6340Sstevel@tonic-gate _PASS2=$ANS 6350Sstevel@tonic-gate 6360Sstevel@tonic-gate # Test if passwords are identical. 6370Sstevel@tonic-gate if [ "$_PASS1" = "$_PASS2" ]; then 6380Sstevel@tonic-gate break 6390Sstevel@tonic-gate fi 6400Sstevel@tonic-gate 6410Sstevel@tonic-gate # Move cursor down to next line and print ERROR message. 6420Sstevel@tonic-gate ${ECHO} "" 6430Sstevel@tonic-gate ${ECHO} "ERROR: passwords don't match; try again." 6440Sstevel@tonic-gate done 6450Sstevel@tonic-gate 6460Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 6470Sstevel@tonic-gate 6480Sstevel@tonic-gate ${ECHO} "" 6490Sstevel@tonic-gate} 6500Sstevel@tonic-gate 6510Sstevel@tonic-gate 6520Sstevel@tonic-gate# 6530Sstevel@tonic-gate# get_passwd_nochk(): Reads a password from the user w/o check. 6540Sstevel@tonic-gate# $@ instruction/comment/description/question 6550Sstevel@tonic-gate# 6560Sstevel@tonic-gateget_passwd_nochk() 6570Sstevel@tonic-gate{ 6580Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_passwd_nochk()" 6590Sstevel@tonic-gate 6600Sstevel@tonic-gate /usr/bin/stty -echo # Turn echo OFF 6610Sstevel@tonic-gate 6620Sstevel@tonic-gate get_ans "$@" 6630Sstevel@tonic-gate 6640Sstevel@tonic-gate /usr/bin/stty echo # Turn echo ON 6650Sstevel@tonic-gate 6660Sstevel@tonic-gate ${ECHO} "" 6670Sstevel@tonic-gate} 6680Sstevel@tonic-gate 6690Sstevel@tonic-gate 6700Sstevel@tonic-gate# 6710Sstevel@tonic-gate# get_menu_choice(): Get a menu choice from user. Continue prompting 6720Sstevel@tonic-gate# till the choice is in required range. 6730Sstevel@tonic-gate# $1 .. Message text. 6740Sstevel@tonic-gate# $2 .. min value 6750Sstevel@tonic-gate# $3 .. max value 6760Sstevel@tonic-gate# $4 .. OPTIONAL: default value 6770Sstevel@tonic-gate# 6780Sstevel@tonic-gate# Return value: 6790Sstevel@tonic-gate# MN_CH will contain the value selected. 6800Sstevel@tonic-gate# 6810Sstevel@tonic-gateget_menu_choice() 6820Sstevel@tonic-gate{ 6830Sstevel@tonic-gate # Check for req parameter. 6840Sstevel@tonic-gate if [ $# -lt 3 ]; then 6850Sstevel@tonic-gate ${ECHO} "get_menu_choice(): Did not get required parameters." 6860Sstevel@tonic-gate return 1 6870Sstevel@tonic-gate fi 6880Sstevel@tonic-gate 6890Sstevel@tonic-gate while : 6900Sstevel@tonic-gate do 6910Sstevel@tonic-gate get_ans "$1" "$4" 6920Sstevel@tonic-gate MN_CH=$ANS 6930Sstevel@tonic-gate is_negative $MN_CH 6940Sstevel@tonic-gate if [ $? -eq 1 ]; then 6950Sstevel@tonic-gate if [ $MN_CH -ge $2 ]; then 6960Sstevel@tonic-gate if [ $MN_CH -le $3 ]; then 6970Sstevel@tonic-gate return 6980Sstevel@tonic-gate fi 6990Sstevel@tonic-gate fi 7000Sstevel@tonic-gate fi 7010Sstevel@tonic-gate ${ECHO} "Invalid choice: $MN_CH" 7020Sstevel@tonic-gate done 7030Sstevel@tonic-gate} 7040Sstevel@tonic-gate 7050Sstevel@tonic-gate 7060Sstevel@tonic-gate# 7070Sstevel@tonic-gate# get_confirm(): Get confirmation from the user. (Y/Yes or N/No) 7080Sstevel@tonic-gate# $1 - Message 7090Sstevel@tonic-gate# $2 - default value. 7100Sstevel@tonic-gate# 7110Sstevel@tonic-gateget_confirm() 7120Sstevel@tonic-gate{ 7130Sstevel@tonic-gate _ANSWER= 7140Sstevel@tonic-gate 7150Sstevel@tonic-gate while : 7160Sstevel@tonic-gate do 7170Sstevel@tonic-gate # Display Internal ERROR if $2 not set. 7180Sstevel@tonic-gate if [ -z "$2" ] 7190Sstevel@tonic-gate then 7200Sstevel@tonic-gate ${ECHO} "INTERNAL ERROR: get_confirm requires 2 args, 3rd is optional." 7210Sstevel@tonic-gate exit 2 7220Sstevel@tonic-gate fi 7230Sstevel@tonic-gate 7240Sstevel@tonic-gate # Display prompt. 7250Sstevel@tonic-gate ${ECHO} "$1 [$2] \c" 7260Sstevel@tonic-gate 7270Sstevel@tonic-gate # Get the ANSWER. 7280Sstevel@tonic-gate read _ANSWER 7290Sstevel@tonic-gate if [ "$_ANSWER" = "" ] && [ -n "$2" ] ; then 7300Sstevel@tonic-gate _ANSWER=$2 7310Sstevel@tonic-gate fi 7320Sstevel@tonic-gate case "$_ANSWER" in 7330Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 7340Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 7350Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${3:-sorry};; 7360Sstevel@tonic-gate * ) ${ECHO} "Please enter y or n." ;; 7370Sstevel@tonic-gate esac 7380Sstevel@tonic-gate done 7390Sstevel@tonic-gate} 7400Sstevel@tonic-gate 7410Sstevel@tonic-gate 7420Sstevel@tonic-gate# 7430Sstevel@tonic-gate# get_confirm_nodef(): Get confirmation from the user. (Y/Yes or N/No) 7440Sstevel@tonic-gate# No default value supported. 7450Sstevel@tonic-gate# 7460Sstevel@tonic-gateget_confirm_nodef() 7470Sstevel@tonic-gate{ 7480Sstevel@tonic-gate _ANSWER= 7490Sstevel@tonic-gate 7500Sstevel@tonic-gate while : 7510Sstevel@tonic-gate do 7520Sstevel@tonic-gate ${ECHO} "$@ \c" 7530Sstevel@tonic-gate read _ANSWER 7540Sstevel@tonic-gate case "$_ANSWER" in 7550Sstevel@tonic-gate [Yy] | yes | Yes | YES) return 1 ;; 7560Sstevel@tonic-gate [Nn] | no | No | NO) return 0 ;; 7570Sstevel@tonic-gate * ) ${ECHO} "Please enter y or n." ;; 7580Sstevel@tonic-gate esac 7590Sstevel@tonic-gate done 7600Sstevel@tonic-gate} 7610Sstevel@tonic-gate 7620Sstevel@tonic-gate 7630Sstevel@tonic-gate# 7640Sstevel@tonic-gate# is_numeric(): Tells is a string is numeric. 7650Sstevel@tonic-gate# 0 = Numeric 7660Sstevel@tonic-gate# 1 = NOT Numeric 7670Sstevel@tonic-gate# 7680Sstevel@tonic-gateis_numeric() 7690Sstevel@tonic-gate{ 7700Sstevel@tonic-gate # Check for parameter. 7710Sstevel@tonic-gate if [ $# -ne 1 ]; then 7720Sstevel@tonic-gate return 1 7730Sstevel@tonic-gate fi 7740Sstevel@tonic-gate 7750Sstevel@tonic-gate # Determine if numeric. 7760Sstevel@tonic-gate expr "$1" + 1 > /dev/null 2>&1 7770Sstevel@tonic-gate if [ $? -ge 2 ]; then 7780Sstevel@tonic-gate return 1 7790Sstevel@tonic-gate fi 7800Sstevel@tonic-gate 7810Sstevel@tonic-gate # Made it here, it's Numeric. 7820Sstevel@tonic-gate return 0 7830Sstevel@tonic-gate} 7840Sstevel@tonic-gate 7850Sstevel@tonic-gate 7860Sstevel@tonic-gate# 7870Sstevel@tonic-gate# not_numeric(): Reverses the return values of is_numeric. Useful 7880Sstevel@tonic-gate# for if and while statements that want to test for 7890Sstevel@tonic-gate# non-numeric data. 7900Sstevel@tonic-gate# 0 = NOT Numeric 7910Sstevel@tonic-gate# 1 = Numeric 7920Sstevel@tonic-gate# 7930Sstevel@tonic-gatenot_numeric() 7940Sstevel@tonic-gate{ 7950Sstevel@tonic-gate is_numeric $1 7960Sstevel@tonic-gate if [ $? -eq 0 ]; then 7970Sstevel@tonic-gate return 1 7980Sstevel@tonic-gate else 7990Sstevel@tonic-gate return 0 8000Sstevel@tonic-gate fi 8010Sstevel@tonic-gate} 8020Sstevel@tonic-gate 8030Sstevel@tonic-gate 8040Sstevel@tonic-gate# 8050Sstevel@tonic-gate# is_negative(): Tells is a Numeric value is less than zero. 8060Sstevel@tonic-gate# 0 = Negative Numeric 8070Sstevel@tonic-gate# 1 = Positive Numeric 8080Sstevel@tonic-gate# 2 = NOT Numeric 8090Sstevel@tonic-gate# 8100Sstevel@tonic-gateis_negative() 8110Sstevel@tonic-gate{ 8120Sstevel@tonic-gate # Check for parameter. 8130Sstevel@tonic-gate if [ $# -ne 1 ]; then 8140Sstevel@tonic-gate return 1 8150Sstevel@tonic-gate fi 8160Sstevel@tonic-gate 8170Sstevel@tonic-gate # Determine if numeric. Can't use expr because -0 is 8180Sstevel@tonic-gate # considered positive?? 8190Sstevel@tonic-gate if is_numeric $1; then 8200Sstevel@tonic-gate case "$1" in 8210Sstevel@tonic-gate -*) return 0 ;; # Negative Numeric 8220Sstevel@tonic-gate *) return 1 ;; # Positive Numeric 8230Sstevel@tonic-gate esac 8240Sstevel@tonic-gate else 8250Sstevel@tonic-gate return 2 8260Sstevel@tonic-gate fi 8270Sstevel@tonic-gate} 8280Sstevel@tonic-gate 8290Sstevel@tonic-gate 8300Sstevel@tonic-gate# 8310Sstevel@tonic-gate# check_domainname(): check validity of a domain name. Currently we check 8320Sstevel@tonic-gate# that it has at least two components. 8330Sstevel@tonic-gate# $1 the domain name to be checked 8340Sstevel@tonic-gate# 8350Sstevel@tonic-gatecheck_domainname() 8360Sstevel@tonic-gate{ 8370Sstevel@tonic-gate if [ ! -z "$1" ] 8380Sstevel@tonic-gate then 8390Sstevel@tonic-gate t=`expr "$1" : '[^.]\{1,\}[.][^.]\{1,\}'` 8400Sstevel@tonic-gate if [ "$t" = 0 ] 8410Sstevel@tonic-gate then 8420Sstevel@tonic-gate return 1 8430Sstevel@tonic-gate fi 8440Sstevel@tonic-gate fi 8450Sstevel@tonic-gate return 0 8460Sstevel@tonic-gate} 8470Sstevel@tonic-gate 8480Sstevel@tonic-gate 8490Sstevel@tonic-gate# 8500Sstevel@tonic-gate# check_baseDN(): check validity of the baseDN name. 8510Sstevel@tonic-gate# $1 the baseDN name to be checked 8520Sstevel@tonic-gate# 8530Sstevel@tonic-gate# NOTE: The check_baseDN function does not catch all invalid DN's. 8540Sstevel@tonic-gate# Its purpose is to reduce the number of invalid DN's to 8550Sstevel@tonic-gate# get past the input routine. The invalid DN's will be 8560Sstevel@tonic-gate# caught by the LDAP server when they are attempted to be 8570Sstevel@tonic-gate# created. 8580Sstevel@tonic-gate# 8590Sstevel@tonic-gatecheck_baseDN() 8600Sstevel@tonic-gate{ 8610Sstevel@tonic-gate ck_DN=$1 8620Sstevel@tonic-gate ${ECHO} " Checking LDAP Base DN ..." 8630Sstevel@tonic-gate if [ ! -z "$ck_DN" ]; then 8640Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "Checking baseDN: $ck_DN" 8650Sstevel@tonic-gate # Check for = (assignment operator) 8660Sstevel@tonic-gate ${ECHO} "$ck_DN" | ${GREP} "=" > /dev/null 2>&1 8670Sstevel@tonic-gate if [ $? -ne 0 ]; then 8680Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "check_baseDN: No '=' in baseDN." 8690Sstevel@tonic-gate return 1 8700Sstevel@tonic-gate fi 8710Sstevel@tonic-gate 8720Sstevel@tonic-gate # Check all keys. 8730Sstevel@tonic-gate while : 8740Sstevel@tonic-gate do 8750Sstevel@tonic-gate # Get first key. 8760Sstevel@tonic-gate dkey=`${ECHO} $ck_DN | cut -d'=' -f1` 8770Sstevel@tonic-gate 8780Sstevel@tonic-gate # Check that the key string is valid 8790Sstevel@tonic-gate check_attrName $dkey 8800Sstevel@tonic-gate if [ $? -ne 0 ]; then 8810Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "check_baseDN: invalid key=${dkey}" 8820Sstevel@tonic-gate return 1 8830Sstevel@tonic-gate fi 8840Sstevel@tonic-gate 8850Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "check_baseDN: valid key=${dkey}" 8860Sstevel@tonic-gate 8870Sstevel@tonic-gate # Remove first key from DN 8880Sstevel@tonic-gate ck_DN=`${ECHO} $ck_DN | cut -s -d',' -f2-` 8890Sstevel@tonic-gate 8900Sstevel@tonic-gate # Break loop if nothing left. 8910Sstevel@tonic-gate if [ "$ck_DN" = "" ]; then 8920Sstevel@tonic-gate break 8930Sstevel@tonic-gate fi 8940Sstevel@tonic-gate done 8950Sstevel@tonic-gate fi 8960Sstevel@tonic-gate return 0 8970Sstevel@tonic-gate} 8980Sstevel@tonic-gate 8990Sstevel@tonic-gate 9000Sstevel@tonic-gate# 9010Sstevel@tonic-gate# domain_2_dc(): Convert a domain name into dc string. 9020Sstevel@tonic-gate# $1 .. Domain name. 9030Sstevel@tonic-gate# 9040Sstevel@tonic-gatedomain_2_dc() 9050Sstevel@tonic-gate{ 9060Sstevel@tonic-gate _DOM=$1 # Domain parameter. 9070Sstevel@tonic-gate _DOM_2_DC="" # Return value from function. 9080Sstevel@tonic-gate _FIRST=1 # Flag for first time. 9090Sstevel@tonic-gate 9100Sstevel@tonic-gate export _DOM_2_DC # Make visible for others. 9110Sstevel@tonic-gate 9120Sstevel@tonic-gate # Convert "."'s to spaces for "for" loop. 9130Sstevel@tonic-gate domtmp="`${ECHO} ${_DOM} | tr '.' ' '`" 9140Sstevel@tonic-gate for i in $domtmp; do 9150Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 9160Sstevel@tonic-gate _DOM_2_DC="dc=${i}" 9170Sstevel@tonic-gate _FIRST=0 9180Sstevel@tonic-gate else 9190Sstevel@tonic-gate _DOM_2_DC="${_DOM_2_DC},dc=${i}" 9200Sstevel@tonic-gate fi 9210Sstevel@tonic-gate done 9220Sstevel@tonic-gate} 9230Sstevel@tonic-gate 9240Sstevel@tonic-gate 9250Sstevel@tonic-gate# 9260Sstevel@tonic-gate# is_root_user(): Check to see if logged in as root user. 9270Sstevel@tonic-gate# 9280Sstevel@tonic-gateis_root_user() 9290Sstevel@tonic-gate{ 9300Sstevel@tonic-gate case `id` in 9310Sstevel@tonic-gate uid=0\(root\)*) return 0 ;; 9320Sstevel@tonic-gate * ) return 1 ;; 9330Sstevel@tonic-gate esac 9340Sstevel@tonic-gate} 9350Sstevel@tonic-gate 9360Sstevel@tonic-gate 9370Sstevel@tonic-gate# 9380Sstevel@tonic-gate# parse_arg(): Parses the command line arguments and sets the 9390Sstevel@tonic-gate# appropriate variables. 9400Sstevel@tonic-gate# 9410Sstevel@tonic-gateparse_arg() 9420Sstevel@tonic-gate{ 9430Sstevel@tonic-gate while getopts "dvhi:o:" ARG 9440Sstevel@tonic-gate do 9450Sstevel@tonic-gate case $ARG in 9460Sstevel@tonic-gate d) DEBUG=1;; 9470Sstevel@tonic-gate v) VERB="";; 9480Sstevel@tonic-gate i) INPUT_FILE=$OPTARG;; 9490Sstevel@tonic-gate o) OUTPUT_FILE=$OPTARG;; 9500Sstevel@tonic-gate \?) display_msg usage 9510Sstevel@tonic-gate exit 1;; 9520Sstevel@tonic-gate *) ${ECHO} "**ERROR: Supported option missing handler!" 9530Sstevel@tonic-gate display_msg usage 9540Sstevel@tonic-gate exit 1;; 9550Sstevel@tonic-gate esac 9560Sstevel@tonic-gate done 9570Sstevel@tonic-gate return `expr $OPTIND - 1` 9580Sstevel@tonic-gate} 9590Sstevel@tonic-gate 9600Sstevel@tonic-gate 9610Sstevel@tonic-gate# 9620Sstevel@tonic-gate# init(): initializes variables and options 9630Sstevel@tonic-gate# 9640Sstevel@tonic-gateinit() 9650Sstevel@tonic-gate{ 9660Sstevel@tonic-gate # General variables. 9670Sstevel@tonic-gate PROG=`basename $0` # Program name 9680Sstevel@tonic-gate PID=$$ # Program ID 9690Sstevel@tonic-gate VERB='> /dev/null 2>&1' # NULL or "> /dev/null" 9700Sstevel@tonic-gate ECHO="/bin/echo" # print message on screen 9710Sstevel@tonic-gate EVAL="eval" # eval or echo 9720Sstevel@tonic-gate EGREP="/usr/bin/egrep" 9730Sstevel@tonic-gate GREP="/usr/bin/grep" 9740Sstevel@tonic-gate DEBUG=0 # Set Debug OFF 9750Sstevel@tonic-gate BACKUP=no_ldap # backup suffix 9760Sstevel@tonic-gate HOST="" # NULL or <hostname> 9772830Sdjl NAWK="/usr/bin/nawk" 9788821SMichen.Chang@Sun.COM RM="/usr/bin/rm" 9799576SJulian.Pullen@Sun.COM WC="/usr/bin/wc" 9809576SJulian.Pullen@Sun.COM CAT="/usr/bin/cat" 9819576SJulian.Pullen@Sun.COM SED="/usr/bin/sed" 98210227SMilan.Jurik@Sun.COM MV="/usr/bin/mv" 9830Sstevel@tonic-gate 9840Sstevel@tonic-gate DOM="" # Set to NULL 9850Sstevel@tonic-gate # If DNS domain (resolv.conf) exists use that, otherwise use domainname. 9860Sstevel@tonic-gate if [ -f /etc/resolv.conf ]; then 9870Sstevel@tonic-gate DOM=`/usr/xpg4/bin/grep -i -E '^domain|^search' /etc/resolv.conf \ 9880Sstevel@tonic-gate | awk '{ print $2 }' | tail -1` 9890Sstevel@tonic-gate fi 9900Sstevel@tonic-gate 9910Sstevel@tonic-gate # If for any reason the DOM did not get set (error'd resolv.conf) set 9920Sstevel@tonic-gate # DOM to the domainname command's output. 9930Sstevel@tonic-gate if [ "$DOM" = "" ]; then 9940Sstevel@tonic-gate DOM=`domainname` # domain from domainname command. 9950Sstevel@tonic-gate fi 9960Sstevel@tonic-gate 9970Sstevel@tonic-gate STEP=1 9980Sstevel@tonic-gate INTERACTIVE=1 # 0 = on, 1 = off (For input file mode) 9990Sstevel@tonic-gate DEL_OLD_PROFILE=0 # 0 (default), 1 = delete old profile. 10000Sstevel@tonic-gate 10010Sstevel@tonic-gate # idsconfig specific variables. 10020Sstevel@tonic-gate INPUT_FILE="" 10030Sstevel@tonic-gate OUTPUT_FILE="" 10048821SMichen.Chang@Sun.COM LDAP_ENABLE_SHADOW_UPDATE="FALSE" 10058821SMichen.Chang@Sun.COM NEED_PROXY=0 # 0 = No Proxy, 1 = Create Proxy. 10068821SMichen.Chang@Sun.COM NEED_ADMIN=0 # 0 = No Admin, 1 = Create Admin. 10078821SMichen.Chang@Sun.COM NEED_HOSTACL=0 # 0 = No Host ACL, 1 = Create Host ACL. 10088821SMichen.Chang@Sun.COM EXISTING_PROFILE=0 10090Sstevel@tonic-gate LDAP_PROXYAGENT="" 10108821SMichen.Chang@Sun.COM LDAP_ADMINDN="" 10110Sstevel@tonic-gate LDAP_SUFFIX="" 10120Sstevel@tonic-gate LDAP_DOMAIN=$DOM # domainname on Server (default value) 10130Sstevel@tonic-gate GEN_CMD="" 10149576SJulian.Pullen@Sun.COM PROXY_ACI_NAME="LDAP_Naming_Services_proxy_password_read" 10150Sstevel@tonic-gate 10160Sstevel@tonic-gate # LDAP COMMANDS 10170Sstevel@tonic-gate LDAPSEARCH="/bin/ldapsearch -r" 10180Sstevel@tonic-gate LDAPMODIFY=/bin/ldapmodify 10190Sstevel@tonic-gate LDAPADD=/bin/ldapadd 10200Sstevel@tonic-gate LDAPDELETE=/bin/ldapdelete 10210Sstevel@tonic-gate LDAP_GEN_PROFILE=/usr/sbin/ldap_gen_profile 10220Sstevel@tonic-gate 10230Sstevel@tonic-gate # iDS specific information 10240Sstevel@tonic-gate IDS_SERVER="" 10250Sstevel@tonic-gate IDS_PORT=389 10260Sstevel@tonic-gate NEED_TIME=0 10270Sstevel@tonic-gate NEED_SIZE=0 10280Sstevel@tonic-gate NEED_SRVAUTH_PAM=0 10290Sstevel@tonic-gate NEED_SRVAUTH_KEY=0 10300Sstevel@tonic-gate NEED_SRVAUTH_CMD=0 10310Sstevel@tonic-gate IDS_TIMELIMIT="" 10320Sstevel@tonic-gate IDS_SIZELIMIT="" 10330Sstevel@tonic-gate 10340Sstevel@tonic-gate # LDAP PROFILE related defaults 10350Sstevel@tonic-gate LDAP_ROOTDN="cn=Directory Manager" # Provide common default. 10360Sstevel@tonic-gate LDAP_ROOTPWD="" # NULL passwd as default (i.e. invalid) 10370Sstevel@tonic-gate LDAP_PROFILE_NAME="default" 10380Sstevel@tonic-gate LDAP_BASEDN="" 10390Sstevel@tonic-gate LDAP_SERVER_LIST="" 10400Sstevel@tonic-gate LDAP_AUTHMETHOD="" 10410Sstevel@tonic-gate LDAP_FOLLOWREF="FALSE" 10420Sstevel@tonic-gate NEED_CRYPT="" 10430Sstevel@tonic-gate LDAP_SEARCH_SCOPE="one" 10440Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_PAM="" 10450Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_KEY="" 10460Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_CMD="" 10470Sstevel@tonic-gate LDAP_SEARCH_TIME_LIMIT=30 10480Sstevel@tonic-gate LDAP_PREF_SRVLIST="" 10490Sstevel@tonic-gate LDAP_PROFILE_TTL=43200 10500Sstevel@tonic-gate LDAP_CRED_LEVEL="proxy" 10510Sstevel@tonic-gate LDAP_BIND_LIMIT=10 10520Sstevel@tonic-gate 10530Sstevel@tonic-gate # Prevent new files from being read by group or others. 10540Sstevel@tonic-gate umask 077 10550Sstevel@tonic-gate 10560Sstevel@tonic-gate # Service Search Descriptors 10570Sstevel@tonic-gate LDAP_SERV_SRCH_DES="" 10580Sstevel@tonic-gate 10590Sstevel@tonic-gate # Set and create TMPDIR. 10600Sstevel@tonic-gate TMPDIR="/tmp/idsconfig.${PID}" 10610Sstevel@tonic-gate if mkdir -m 700 ${TMPDIR} 10620Sstevel@tonic-gate then 10630Sstevel@tonic-gate # Cleanup on exit. 10640Sstevel@tonic-gate trap 'rm -rf ${TMPDIR}; /usr/bin/stty echo; exit' 1 2 3 6 15 10650Sstevel@tonic-gate else 10660Sstevel@tonic-gate echo "ERROR: unable to create a safe temporary directory." 10670Sstevel@tonic-gate exit 1 10680Sstevel@tonic-gate fi 10690Sstevel@tonic-gate LDAP_ROOTPWF=${TMPDIR}/rootPWD 10700Sstevel@tonic-gate 10710Sstevel@tonic-gate # Set the SSD file name after setting TMPDIR. 10720Sstevel@tonic-gate SSD_FILE=${TMPDIR}/ssd_list 10732830Sdjl 10742830Sdjl # GSSAPI setup 107510870SMilan.Jurik@Sun.COM GSSAPI_ENABLE=0 10762830Sdjl LDAP_KRB_REALM="" 10772830Sdjl SCHEMA_UPDATED=0 10780Sstevel@tonic-gate 10790Sstevel@tonic-gate export DEBUG VERB ECHO EVAL EGREP GREP STEP TMPDIR 10800Sstevel@tonic-gate export IDS_SERVER IDS_PORT LDAP_ROOTDN LDAP_ROOTPWD LDAP_SERVER_LIST 10810Sstevel@tonic-gate export LDAP_BASEDN LDAP_ROOTPWF 10820Sstevel@tonic-gate export LDAP_DOMAIN LDAP_SUFFIX LDAP_PROXYAGENT LDAP_PROXYAGENT_CRED 10830Sstevel@tonic-gate export NEED_PROXY 10848821SMichen.Chang@Sun.COM export LDAP_ENABLE_SHADOW_UPDATE LDAP_ADMINDN LDAP_ADMIN_CRED 10858821SMichen.Chang@Sun.COM export NEED_ADMIN NEED_HOSTACL EXISTING_PROFILE 10860Sstevel@tonic-gate export LDAP_PROFILE_NAME LDAP_BASEDN LDAP_SERVER_LIST 10870Sstevel@tonic-gate export LDAP_AUTHMETHOD LDAP_FOLLOWREF LDAP_SEARCH_SCOPE LDAP_SEARCH_TIME_LIMIT 10880Sstevel@tonic-gate export LDAP_PREF_SRVLIST LDAP_PROFILE_TTL LDAP_CRED_LEVEL LDAP_BIND_LIMIT 10890Sstevel@tonic-gate export NEED_SRVAUTH_PAM NEED_SRVAUTH_KEY NEED_SRVAUTH_CMD 10900Sstevel@tonic-gate export LDAP_SRV_AUTHMETHOD_PAM LDAP_SRV_AUTHMETHOD_KEY LDAP_SRV_AUTHMETHOD_CMD 10910Sstevel@tonic-gate export LDAP_SERV_SRCH_DES SSD_FILE 109210870SMilan.Jurik@Sun.COM export GEN_CMD GSSAPI_ENABLE LDAP_KRB_REALM SCHEMA_UPDATED 10930Sstevel@tonic-gate} 10940Sstevel@tonic-gate 10950Sstevel@tonic-gate 10960Sstevel@tonic-gate# 10970Sstevel@tonic-gate# disp_full_debug(): List of all debug variables usually interested in. 10980Sstevel@tonic-gate# Grouped to avoid MASSIVE code duplication. 10990Sstevel@tonic-gate# 11000Sstevel@tonic-gatedisp_full_debug() 11010Sstevel@tonic-gate{ 11020Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " IDS_SERVER = $IDS_SERVER" 11030Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " IDS_PORT = $IDS_PORT" 11040Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_ROOTDN = $LDAP_ROOTDN" 11050Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_ROOTPWD = $LDAP_ROOTPWD" 11060Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_DOMAIN = $LDAP_DOMAIN" 11070Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SUFFIX = $LDAP_SUFFIX" 11080Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_BASEDN = $LDAP_BASEDN" 11090Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_PROFILE_NAME = $LDAP_PROFILE_NAME" 11100Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SERVER_LIST = $LDAP_SERVER_LIST" 11110Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_PREF_SRVLIST = $LDAP_PREF_SRVLIST" 11120Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SEARCH_SCOPE = $LDAP_SEARCH_SCOPE" 11130Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_CRED_LEVEL = $LDAP_CRED_LEVEL" 11140Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_AUTHMETHOD = $LDAP_AUTHMETHOD" 11150Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_FOLLOWREF = $LDAP_FOLLOWREF" 11160Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " IDS_TIMELIMIT = $IDS_TIMELIMIT" 11170Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " IDS_SIZELIMIT = $IDS_SIZELIMIT" 11180Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " NEED_CRYPT = $NEED_CRYPT" 11190Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " NEED_SRVAUTH_PAM = $NEED_SRVAUTH_PAM" 11200Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " NEED_SRVAUTH_KEY = $NEED_SRVAUTH_KEY" 11210Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " NEED_SRVAUTH_CMD = $NEED_SRVAUTH_CMD" 11220Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SRV_AUTHMETHOD_PAM = $LDAP_SRV_AUTHMETHOD_PAM" 11230Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SRV_AUTHMETHOD_KEY = $LDAP_SRV_AUTHMETHOD_KEY" 11240Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SRV_AUTHMETHOD_CMD = $LDAP_SRV_AUTHMETHOD_CMD" 11250Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SEARCH_TIME_LIMIT = $LDAP_SEARCH_TIME_LIMIT" 11260Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_PROFILE_TTL = $LDAP_PROFILE_TTL" 11270Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_BIND_LIMIT = $LDAP_BIND_LIMIT" 11288821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_ENABLE_SHADOW_UPDATE = $LDAP_ENABLE_SHADOW_UPDATE" 11290Sstevel@tonic-gate 11300Sstevel@tonic-gate # Only display proxy stuff if needed. 11318821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " NEED_PROXY = $NEED_PROXY" 11320Sstevel@tonic-gate if [ $NEED_PROXY -eq 1 ]; then 11330Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_PROXYAGENT = $LDAP_PROXYAGENT" 11340Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_PROXYAGENT_CRED = $LDAP_PROXYAGENT_CRED" 11358821SMichen.Chang@Sun.COM fi 11368821SMichen.Chang@Sun.COM 11378821SMichen.Chang@Sun.COM # Only display admin credential if needed. 11388821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " NEED_ADMIN = $NEED_ADMIN" 11398821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " NEED_HOSTACL = $NEED_HOSTACL" 11408821SMichen.Chang@Sun.COM if [ $NEED_ADMIN -eq 1 ]; then 11418821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_ADMINDN = $LDAP_ADMINDN" 11428821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_ADMIN_CRED = $LDAP_ADMIN_CRED" 11430Sstevel@tonic-gate fi 11440Sstevel@tonic-gate 11450Sstevel@tonic-gate # Service Search Descriptors are a special case. 11460Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SERV_SRCH_DES = $LDAP_SERV_SRCH_DES" 11470Sstevel@tonic-gate} 11480Sstevel@tonic-gate 11490Sstevel@tonic-gate 11500Sstevel@tonic-gate# 11510Sstevel@tonic-gate# load_config_file(): Loads the config file. 11520Sstevel@tonic-gate# 11530Sstevel@tonic-gateload_config_file() 11540Sstevel@tonic-gate{ 11550Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In load_config_file()" 11560Sstevel@tonic-gate 11570Sstevel@tonic-gate # Remove SSD lines from input file before sourcing. 11580Sstevel@tonic-gate # The SSD lines must be removed because some forms of the 11590Sstevel@tonic-gate # data could cause SHELL errors. 11600Sstevel@tonic-gate ${GREP} -v "LDAP_SERV_SRCH_DES=" ${INPUT_FILE} > ${TMPDIR}/inputfile.noSSD 11610Sstevel@tonic-gate 11620Sstevel@tonic-gate # Source the input file. 11630Sstevel@tonic-gate . ${TMPDIR}/inputfile.noSSD 11640Sstevel@tonic-gate 11650Sstevel@tonic-gate # If LDAP_SUFFIX is no set, try to utilize LDAP_TREETOP since older 11660Sstevel@tonic-gate # config files use LDAP_TREETOP 11670Sstevel@tonic-gate LDAP_SUFFIX="${LDAP_SUFFIX:-$LDAP_TREETOP}" 11680Sstevel@tonic-gate 11690Sstevel@tonic-gate # Save password to temporary file. 11700Sstevel@tonic-gate save_password 11710Sstevel@tonic-gate 11720Sstevel@tonic-gate # Create the SSD file. 11730Sstevel@tonic-gate create_ssd_file 11740Sstevel@tonic-gate 11750Sstevel@tonic-gate # Display FULL debugging info. 11760Sstevel@tonic-gate disp_full_debug 11770Sstevel@tonic-gate} 11780Sstevel@tonic-gate 11790Sstevel@tonic-gate# 11800Sstevel@tonic-gate# save_password(): Save password to temporary file. 11810Sstevel@tonic-gate# 11820Sstevel@tonic-gatesave_password() 11830Sstevel@tonic-gate{ 11840Sstevel@tonic-gate cat > ${LDAP_ROOTPWF} <<EOF 11850Sstevel@tonic-gate${LDAP_ROOTPWD} 11860Sstevel@tonic-gateEOF 11870Sstevel@tonic-gate} 11880Sstevel@tonic-gate 11890Sstevel@tonic-gate###################################################################### 11900Sstevel@tonic-gate# FUNCTIONS FOR prompt_config_info() START HERE. 11910Sstevel@tonic-gate###################################################################### 11920Sstevel@tonic-gate 11930Sstevel@tonic-gate# 11940Sstevel@tonic-gate# get_ids_server(): Prompt for iDS server name. 11950Sstevel@tonic-gate# 11960Sstevel@tonic-gateget_ids_server() 11970Sstevel@tonic-gate{ 11980Sstevel@tonic-gate while : 11990Sstevel@tonic-gate do 12000Sstevel@tonic-gate # Prompt for server name. 12012830Sdjl get_ans "Enter the JES Directory Server's hostname to setup:" "$IDS_SERVER" 12022830Sdjl IDS_SERVER="$ANS" 12030Sstevel@tonic-gate 12040Sstevel@tonic-gate # Ping server to see if live. If valid break out of loop. 12050Sstevel@tonic-gate ping $IDS_SERVER > /dev/null 2>&1 12060Sstevel@tonic-gate if [ $? -eq 0 ]; then 12070Sstevel@tonic-gate break 12080Sstevel@tonic-gate fi 12090Sstevel@tonic-gate 12100Sstevel@tonic-gate # Invalid server, enter a new name. 12110Sstevel@tonic-gate ${ECHO} "ERROR: Server '${IDS_SERVER}' is invalid or unreachable." 12120Sstevel@tonic-gate IDS_SERVER="" 12130Sstevel@tonic-gate done 12140Sstevel@tonic-gate 12150Sstevel@tonic-gate # Set SERVER_ARGS and LDAP_ARGS since values might of changed. 12160Sstevel@tonic-gate SERVER_ARGS="-h ${IDS_SERVER} -p ${IDS_PORT}" 12170Sstevel@tonic-gate LDAP_ARGS="${SERVER_ARGS} ${AUTH_ARGS}" 12180Sstevel@tonic-gate export SERVER_ARGS 12190Sstevel@tonic-gate 12200Sstevel@tonic-gate} 12210Sstevel@tonic-gate 12220Sstevel@tonic-gate# 12230Sstevel@tonic-gate# get_ids_port(): Prompt for iDS port number. 12240Sstevel@tonic-gate# 12250Sstevel@tonic-gateget_ids_port() 12260Sstevel@tonic-gate{ 12270Sstevel@tonic-gate # Get a valid iDS port number. 12280Sstevel@tonic-gate while : 12290Sstevel@tonic-gate do 12300Sstevel@tonic-gate # Enter port number. 12310Sstevel@tonic-gate get_number "Enter the port number for iDS (h=help):" "$IDS_PORT" "port_help" 12320Sstevel@tonic-gate IDS_PORT=$ANS 12330Sstevel@tonic-gate # Do a simple search to check hostname and port number. 12340Sstevel@tonic-gate # If search returns SUCCESS, break out, host and port must 12350Sstevel@tonic-gate # be valid. 12360Sstevel@tonic-gate ${LDAPSEARCH} -h ${IDS_SERVER} -p ${IDS_PORT} -b "" -s base "objectclass=*" > /dev/null 2>&1 12370Sstevel@tonic-gate if [ $? -eq 0 ]; then 12380Sstevel@tonic-gate break 12390Sstevel@tonic-gate fi 12400Sstevel@tonic-gate 12410Sstevel@tonic-gate # Invalid host/port pair, Re-enter. 12420Sstevel@tonic-gate ${ECHO} "ERROR: Invalid host or port: ${IDS_SERVER}:${IDS_PORT}, Please re-enter!" 12430Sstevel@tonic-gate get_ids_server 12440Sstevel@tonic-gate done 12450Sstevel@tonic-gate 12460Sstevel@tonic-gate # Set SERVER_ARGS and LDAP_ARGS since values might of changed. 12470Sstevel@tonic-gate SERVER_ARGS="-h ${IDS_SERVER} -p ${IDS_PORT}" 12480Sstevel@tonic-gate LDAP_ARGS="${SERVER_ARGS} ${AUTH_ARGS}" 12490Sstevel@tonic-gate export SERVER_ARGS 12500Sstevel@tonic-gate} 12510Sstevel@tonic-gate 12520Sstevel@tonic-gate 12530Sstevel@tonic-gate# 12540Sstevel@tonic-gate# chk_ids_version(): Read the slapd config file and set variables 12550Sstevel@tonic-gate# 12560Sstevel@tonic-gatechk_ids_version() 12570Sstevel@tonic-gate{ 12580Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In chk_ids_version()" 12590Sstevel@tonic-gate 12600Sstevel@tonic-gate # check iDS version number. 12610Sstevel@tonic-gate eval "${LDAPSEARCH} ${SERVER_ARGS} -b cn=monitor -s base \"objectclass=*\" version | ${GREP} \"^version=\" | cut -f2 -d'/' | cut -f1 -d' ' > ${TMPDIR}/checkDSver 2>&1" 12620Sstevel@tonic-gate if [ $? -ne 0 ]; then 12630Sstevel@tonic-gate ${ECHO} "ERROR: Can not determine the version number of iDS!" 12640Sstevel@tonic-gate exit 1 12650Sstevel@tonic-gate fi 12660Sstevel@tonic-gate IDS_VER=`cat ${TMPDIR}/checkDSver` 12670Sstevel@tonic-gate IDS_MAJVER=`${ECHO} ${IDS_VER} | cut -f1 -d.` 12680Sstevel@tonic-gate IDS_MINVER=`${ECHO} ${IDS_VER} | cut -f2 -d.` 126910870SMilan.Jurik@Sun.COM case "${IDS_MAJVER}" in 127010870SMilan.Jurik@Sun.COM 5|6|7) : ;; 127110870SMilan.Jurik@Sun.COM *) ${ECHO} "ERROR: $PROG only works with JES DS version 5.x, 6.x or 7.x, not ${IDS_VER}."; exit 1;; 127210870SMilan.Jurik@Sun.COM esac 127310870SMilan.Jurik@Sun.COM 12740Sstevel@tonic-gate if [ $DEBUG -eq 1 ]; then 12750Sstevel@tonic-gate ${ECHO} " IDS_MAJVER = $IDS_MAJVER" 12760Sstevel@tonic-gate ${ECHO} " IDS_MINVER = $IDS_MINVER" 12770Sstevel@tonic-gate fi 12780Sstevel@tonic-gate} 12790Sstevel@tonic-gate 12800Sstevel@tonic-gate 12810Sstevel@tonic-gate# 12820Sstevel@tonic-gate# get_dirmgr_dn(): Get the directory manger DN. 12830Sstevel@tonic-gate# 12840Sstevel@tonic-gateget_dirmgr_dn() 12850Sstevel@tonic-gate{ 12860Sstevel@tonic-gate get_ans "Enter the directory manager DN:" "$LDAP_ROOTDN" 12870Sstevel@tonic-gate LDAP_ROOTDN=$ANS 12880Sstevel@tonic-gate 12890Sstevel@tonic-gate # Update ENV variables using DN. 12900Sstevel@tonic-gate AUTH_ARGS="-D \"${LDAP_ROOTDN}\" -j ${LDAP_ROOTPWF}" 12910Sstevel@tonic-gate LDAP_ARGS="${SERVER_ARGS} ${AUTH_ARGS}" 12920Sstevel@tonic-gate export AUTH_ARGS LDAP_ARGS 12930Sstevel@tonic-gate} 12940Sstevel@tonic-gate 12950Sstevel@tonic-gate 12960Sstevel@tonic-gate# 12970Sstevel@tonic-gate# get_dirmgr_pw(): Get the Root DN passwd. (Root DN found in slapd.conf) 12980Sstevel@tonic-gate# 12990Sstevel@tonic-gateget_dirmgr_pw() 13000Sstevel@tonic-gate{ 13010Sstevel@tonic-gate while : 13020Sstevel@tonic-gate do 13030Sstevel@tonic-gate # Get passwd. 13040Sstevel@tonic-gate get_passwd_nochk "Enter passwd for ${LDAP_ROOTDN} :" 13050Sstevel@tonic-gate LDAP_ROOTPWD=$ANS 13060Sstevel@tonic-gate 13070Sstevel@tonic-gate # Store password in file. 13080Sstevel@tonic-gate save_password 13090Sstevel@tonic-gate 13100Sstevel@tonic-gate # Update ENV variables using DN's PW. 13110Sstevel@tonic-gate AUTH_ARGS="-D \"${LDAP_ROOTDN}\" -j ${LDAP_ROOTPWF}" 13120Sstevel@tonic-gate LDAP_ARGS="${SERVER_ARGS} ${AUTH_ARGS}" 13130Sstevel@tonic-gate export AUTH_ARGS LDAP_ARGS 13140Sstevel@tonic-gate 13150Sstevel@tonic-gate # Verify that ROOTDN and ROOTPWD are valid. 13160Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"\" -s base \"objectclass=*\" > ${TMPDIR}/checkDN 2>&1" 13170Sstevel@tonic-gate if [ $? -ne 0 ]; then 13180Sstevel@tonic-gate eval "${GREP} credential ${TMPDIR}/checkDN ${VERB}" 13190Sstevel@tonic-gate if [ $? -eq 0 ]; then 13200Sstevel@tonic-gate ${ECHO} "ERROR: Root DN passwd is invalid." 13210Sstevel@tonic-gate else 13220Sstevel@tonic-gate ${ECHO} "ERROR: Invalid Root DN <${LDAP_ROOTDN}>." 13230Sstevel@tonic-gate get_dirmgr_dn 13240Sstevel@tonic-gate fi 13250Sstevel@tonic-gate else 13260Sstevel@tonic-gate break # Both are valid. 13270Sstevel@tonic-gate fi 13280Sstevel@tonic-gate done 13290Sstevel@tonic-gate 13300Sstevel@tonic-gate 13310Sstevel@tonic-gate} 13320Sstevel@tonic-gate 13330Sstevel@tonic-gate 13340Sstevel@tonic-gate# 13350Sstevel@tonic-gate# get_domain(): Get the Domain that will be served by the LDAP server. 13360Sstevel@tonic-gate# $1 - Help argument. 13370Sstevel@tonic-gate# 13380Sstevel@tonic-gateget_domain() 13390Sstevel@tonic-gate{ 13400Sstevel@tonic-gate # Use LDAP_DOMAIN as default. 13410Sstevel@tonic-gate get_ans "Enter the domainname to be served (h=help):" $LDAP_DOMAIN 13420Sstevel@tonic-gate 13430Sstevel@tonic-gate # Check domainname, and have user re-enter if not valid. 13440Sstevel@tonic-gate check_domainname $ANS 13450Sstevel@tonic-gate while [ $? -ne 0 ] 13460Sstevel@tonic-gate do 13470Sstevel@tonic-gate case "$ANS" in 13480Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg ${1:-sorry} ;; 13490Sstevel@tonic-gate * ) ${ECHO} "Invalid domainname: \"${ANS}\"." 13500Sstevel@tonic-gate ;; 13510Sstevel@tonic-gate esac 13520Sstevel@tonic-gate get_ans "Enter domainname to be served (h=help):" $DOM 13530Sstevel@tonic-gate 13540Sstevel@tonic-gate check_domainname $ANS 13550Sstevel@tonic-gate done 13560Sstevel@tonic-gate 13570Sstevel@tonic-gate # Set the domainname to valid name. 13580Sstevel@tonic-gate LDAP_DOMAIN=$ANS 13590Sstevel@tonic-gate} 13600Sstevel@tonic-gate 13610Sstevel@tonic-gate 13620Sstevel@tonic-gate# 13630Sstevel@tonic-gate# get_basedn(): Query for the Base DN. 13640Sstevel@tonic-gate# 13650Sstevel@tonic-gateget_basedn() 13660Sstevel@tonic-gate{ 13670Sstevel@tonic-gate # Set the $_DOM_2_DC and assign to LDAP_BASEDN as default. 13680Sstevel@tonic-gate # Then call get_basedn(). This method remakes the default 13690Sstevel@tonic-gate # each time just in case the domain changed. 13700Sstevel@tonic-gate domain_2_dc $LDAP_DOMAIN 13710Sstevel@tonic-gate LDAP_BASEDN=$_DOM_2_DC 13720Sstevel@tonic-gate 13730Sstevel@tonic-gate # Get Base DN. 13740Sstevel@tonic-gate while : 13750Sstevel@tonic-gate do 13762672Svl199446 get_ans_req "Enter LDAP Base DN (h=help):" "${_DOM_2_DC}" 13770Sstevel@tonic-gate check_baseDN "$ANS" 13780Sstevel@tonic-gate while [ $? -ne 0 ] 13790Sstevel@tonic-gate do 13800Sstevel@tonic-gate case "$ANS" in 13810Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg basedn_help ;; 13820Sstevel@tonic-gate * ) ${ECHO} "Invalid base DN: \"${ANS}\"." 13830Sstevel@tonic-gate ;; 13840Sstevel@tonic-gate esac 13850Sstevel@tonic-gate 13860Sstevel@tonic-gate # Re-Enter the BaseDN 13872672Svl199446 get_ans_req "Enter LDAP Base DN (h=help):" "${_DOM_2_DC}" 13880Sstevel@tonic-gate check_baseDN "$ANS" 13890Sstevel@tonic-gate done 13900Sstevel@tonic-gate 13912672Svl199446 # Set base DN and check its suffix 13920Sstevel@tonic-gate LDAP_BASEDN=${ANS} 13932672Svl199446 check_basedn_suffix || 13942672Svl199446 { 13952672Svl199446 cleanup 13962672Svl199446 exit 1 13972672Svl199446 } 13982672Svl199446 13992672Svl199446 # suffix may need to be created, in that case get suffix from user 14002672Svl199446 [ -n "${NEED_CREATE_SUFFIX}" ] && 14012672Svl199446 { 14022672Svl199446 get_suffix || continue 14032672Svl199446 } 14042672Svl199446 14052672Svl199446 # suffix is ok, break out of the base dn inquire loop 14062672Svl199446 break 14070Sstevel@tonic-gate done 14080Sstevel@tonic-gate} 14090Sstevel@tonic-gate 14108821SMichen.Chang@Sun.COM# 14118821SMichen.Chang@Sun.COM# get_want_shadow_update(): Ask user if want to enable shadow update? 14128821SMichen.Chang@Sun.COM# 14138821SMichen.Chang@Sun.COMget_want_shadow_update() 14148821SMichen.Chang@Sun.COM{ 14158821SMichen.Chang@Sun.COM MSG="Do you want to enable shadow update (y/n/h)?" 14168821SMichen.Chang@Sun.COM get_confirm "$MSG" "n" "enable_shadow_update_help" 14178821SMichen.Chang@Sun.COM if [ $? -eq 1 ]; then 14188821SMichen.Chang@Sun.COM LDAP_ENABLE_SHADOW_UPDATE="TRUE" 14198821SMichen.Chang@Sun.COM else 14208821SMichen.Chang@Sun.COM LDAP_ENABLE_SHADOW_UPDATE="FALSE" 14218821SMichen.Chang@Sun.COM fi 14228821SMichen.Chang@Sun.COM} 14238821SMichen.Chang@Sun.COM 14242830Sdjlget_krb_realm() { 14252830Sdjl 14262830Sdjl # To upper cases 14272830Sdjl LDAP_KRB_REALM=`${ECHO} ${LDAP_DOMAIN} | ${NAWK} '{ print toupper($0) }'` 14282830Sdjl get_ans_req "Enter Kerberos Realm:" "$LDAP_KRB_REALM" 14292830Sdjl # To upper cases 14302830Sdjl LDAP_KRB_REALM=`${ECHO} ${ANS} | ${NAWK} '{ print toupper($0) }'` 14312830Sdjl} 14322830Sdjl 14332830Sdjl# $1: DN 14342830Sdjl# $2: ldif file 14352830Sdjladd_entry_by_DN() { 14362830Sdjl 14372830Sdjl ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"${1}\" -s base \"objectclass=*\" ${VERB}" 14382830Sdjl if [ $? -eq 0 ]; then 14392830Sdjl ${ECHO} " ${1} already exists" 14402830Sdjl return 0 14412830Sdjl else 14422830Sdjl ${EVAL} "${LDAPADD} ${LDAP_ARGS} -f ${2} ${VERB}" 14432830Sdjl if [ $? -eq 0 ]; then 14442830Sdjl ${ECHO} " ${1} is added" 14452830Sdjl return 0 14462830Sdjl else 14472830Sdjl ${ECHO} " ERROR: failed to add ${1}" 14482830Sdjl return 1 14492830Sdjl fi 14502830Sdjl fi 14512830Sdjl 14522830Sdjl} 14532830Sdjl# 14542830Sdjl# Kerberos princiapl to DN mapping rules 14552830Sdjl# 14562830Sdjl# Add rules for host credentails and user credentials 14572830Sdjl# 14582830Sdjladd_id_mapping_rules() { 14592830Sdjl 14602830Sdjl ${ECHO} " Adding Kerberos principal to DN mapping rules..." 14612830Sdjl 14622830Sdjl _C_DN="cn=GSSAPI,cn=identity mapping,cn=config" 14632830Sdjl ( cat << EOF 14642830Sdjldn: cn=GSSAPI,cn=identity mapping,cn=config 14652830SdjlobjectClass: top 14662830SdjlobjectClass: nsContainer 14672830Sdjlcn: GSSAPI 14682830SdjlEOF 14692830Sdjl) > ${TMPDIR}/GSSAPI_container.ldif 14702830Sdjl 14712830Sdjl add_entry_by_DN "${_C_DN}" "${TMPDIR}/GSSAPI_container.ldif" 14722830Sdjl if [ $? -ne 0 ]; 14732830Sdjl then 14742830Sdjl ${RM} ${TMPDIR}/GSSAPI_container.ldif 14752830Sdjl return 14762830Sdjl fi 14772830Sdjl 14782830Sdjl _H_CN="host_auth_${LDAP_KRB_REALM}" 14792830Sdjl _H_DN="cn=${_H_CN}, ${_C_DN}" 14802830Sdjl ( cat << EOF 14812830Sdjldn: ${_H_DN} 14822830SdjlobjectClass: top 14832830SdjlobjectClass: nsContainer 14842830SdjlobjectClass: dsIdentityMapping 14852830SdjlobjectClass: dsPatternMatching 14862830Sdjlcn: ${_H_CN} 14872830SdjldsMatching-pattern: \${Principal} 14882830SdjldsMatching-regexp: host\/(.*).${LDAP_DOMAIN}@${LDAP_KRB_REALM} 14892830SdjldsSearchBaseDN: ou=hosts,${LDAP_BASEDN} 14902830SdjldsSearchFilter: (&(objectClass=ipHost)(cn=\$1)) 14912830SdjldsSearchScope: one 14922830Sdjl 14932830SdjlEOF 14942830Sdjl) > ${TMPDIR}/${_H_CN}.ldif 14952830Sdjl 14962830Sdjl add_entry_by_DN "${_H_DN}" "${TMPDIR}/${_H_CN}.ldif" 14972830Sdjl 14982830Sdjl _U_CN="user_auth_${LDAP_KRB_REALM}" 14992830Sdjl _U_DN="cn=${_U_CN}, ${_C_DN}" 15002830Sdjl ( cat << EOF 15012830Sdjldn: ${_U_DN} 15022830SdjlobjectClass: top 15032830SdjlobjectClass: nsContainer 15042830SdjlobjectClass: dsIdentityMapping 15052830SdjlobjectClass: dsPatternMatching 15062830Sdjlcn: ${_U_CN} 15072830SdjldsMatching-pattern: \${Principal} 15082830SdjldsMatching-regexp: (.*)@${LDAP_KRB_REALM} 15092830SdjldsMappedDN: uid=\$1,ou=People,${LDAP_BASEDN} 15102830Sdjl 15112830SdjlEOF 15122830Sdjl) > ${TMPDIR}/${_U_CN}.ldif 15132830Sdjl 15142830Sdjl add_entry_by_DN "${_U_DN}" "${TMPDIR}/${_U_CN}.ldif" 15152830Sdjl 15162830Sdjl} 15172830Sdjl 15182830Sdjl 15192830Sdjl# 15202830Sdjl# Modify ACL to allow root to read all the password and only self can read 15212830Sdjl# its own password when sasl/GSSAPI bind is used 15222830Sdjl# 15232830Sdjlmodify_userpassword_acl_for_gssapi() { 15242830Sdjl 15252830Sdjl _P_DN="ou=People,${LDAP_BASEDN}" 15262830Sdjl _H_DN="ou=Hosts,${LDAP_BASEDN}" 15272830Sdjl _P_ACI="self-read-pwd" 15282830Sdjl 15292830Sdjl ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"${_P_DN}\" -s base \"objectclass=*\" > /dev/null 2>&1" 15302830Sdjl if [ $? -ne 0 ]; then 15312830Sdjl ${ECHO} " ${_P_DN} does not exist" 15322830Sdjl # Not Found. Create a new entry 15332830Sdjl ( cat << EOF 15342830Sdjldn: ${_P_DN} 15352830Sdjlou: People 15362830SdjlobjectClass: top 15372830SdjlobjectClass: organizationalUnit 15382830SdjlEOF 15392830Sdjl) > ${TMPDIR}/gssapi_people.ldif 15402830Sdjl 15412830Sdjl add_entry_by_DN "${_P_DN}" "${TMPDIR}/gssapi_people.ldif" 15422830Sdjl else 15432830Sdjl ${ECHO} " ${_P_DN} already exists" 15442830Sdjl fi 15452830Sdjl 15462830Sdjl ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"${_P_DN}\" -s base \"objectclass=*\" aci > ${TMPDIR}/chk_gssapi_aci 2>&1" 15472830Sdjl 15482830Sdjl if [ $? -eq 0 ]; then 15492830Sdjl ${EVAL} "${GREP} ${_P_ACI} ${TMPDIR}/chk_gssapi_aci > /dev/null 2>&1" 15502830Sdjl if [ $? -eq 0 ]; then 15512830Sdjl ${ECHO} " userpassword ACL ${_P_ACI} already exists." 15522830Sdjl return 15532830Sdjl else 15542830Sdjl ${ECHO} " userpassword ACL ${_P_ACI} not found. Create a new one." 15552830Sdjl fi 15562830Sdjl else 15572830Sdjl ${ECHO} " Error searching aci for ${_P_DN}" 15582830Sdjl cat ${TMPDIR}/chk_gssapi_aci 15592830Sdjl cleanup 15602830Sdjl exit 1 15612830Sdjl fi 15622830Sdjl ( cat << EOF 15632830Sdjldn: ${_P_DN} 15642830Sdjlchangetype: modify 15652830Sdjladd: aci 15662830Sdjlaci: (targetattr="userPassword")(version 3.0; acl self-read-pwd; allow (read,search) userdn="ldap:///self" and authmethod="sasl GSSAPI";) 15672830Sdjl- 15682830Sdjladd: aci 15692830Sdjlaci: (targetattr="userPassword")(version 3.0; acl host-read-pwd; allow (read,search) userdn="ldap:///cn=*+ipHostNumber=*,ou=Hosts,${LDAP_BASEDN}" and authmethod="sasl GSSAPI";) 15702830SdjlEOF 15712830Sdjl) > ${TMPDIR}/user_gssapi.ldif 15722830Sdjl LDAP_TYPE_OR_VALUE_EXISTS=20 15732830Sdjl ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/user_gssapi.ldif ${VERB}" 15742830Sdjl 15752830Sdjl case $? in 15762830Sdjl 0) 15772830Sdjl ${ECHO} " ${_P_DN} uaserpassword ACL is updated." 15782830Sdjl ;; 15792830Sdjl 20) 15802830Sdjl ${ECHO} " ${_P_DN} uaserpassword ACL already exists." 15812830Sdjl ;; 15822830Sdjl *) 15832830Sdjl ${ECHO} " ERROR: update of userpassword ACL for ${_P_DN} failed!" 15842830Sdjl cleanup 15852830Sdjl exit 1 15862830Sdjl ;; 15872830Sdjl esac 15882830Sdjl} 15892830Sdjl# 15902830Sdjl# $1: objectclass or attributetyp 15912830Sdjl# $2: name 15922830Sdjlsearch_update_schema() { 15932830Sdjl 15942830Sdjl ATTR="${1}es" 15952830Sdjl 15962830Sdjl ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b cn=schema -s base \"objectclass=*\" ${ATTR} | ${GREP} -i \"${2}\" ${VERB}" 15972830Sdjl if [ $? -ne 0 ]; then 15982830Sdjl ${ECHO} "${1} ${2} does not exist." 15992830Sdjl update_schema_attr 16002830Sdjl update_schema_obj 16012830Sdjl SCHEMA_UPDATED=1 16022830Sdjl else 16032830Sdjl ${ECHO} "${1} ${2} already exists. Schema has been updated" 16042830Sdjl fi 16052830Sdjl} 16062830Sdjl 16072830Sdjl# 16082830Sdjl# Set up GSSAPI if necessary 16092830Sdjl# 16102830Sdjlgssapi_setup() { 16112830Sdjl 161210870SMilan.Jurik@Sun.COM GSSAPI_ENABLE=0 161310870SMilan.Jurik@Sun.COM 16148821SMichen.Chang@Sun.COM # assume sasl/GSSAPI is supported by the ldap server and may be used 16158821SMichen.Chang@Sun.COM GSSAPI_AUTH_MAY_BE_USED=1 161610870SMilan.Jurik@Sun.COM 16172830Sdjl ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"\" -s base \"objectclass=*\" supportedSASLMechanisms | ${GREP} GSSAPI ${VERB}" 16182830Sdjl if [ $? -ne 0 ]; then 16198821SMichen.Chang@Sun.COM GSSAPI_AUTH_MAY_BE_USED=0 16202830Sdjl ${ECHO} " sasl/GSSAPI is not supported by this LDAP server" 16212830Sdjl return 16222830Sdjl fi 16232830Sdjl 16242830Sdjl get_confirm "GSSAPI is supported. Do you want to set up gssapi:(y/n)" "n" 16252830Sdjl if [ $? -eq 0 ]; then 162610870SMilan.Jurik@Sun.COM GSSAPI_ENABLE=0 16272830Sdjl ${ECHO} 16282830Sdjl ${ECHO} "GSSAPI is not set up." 16298821SMichen.Chang@Sun.COM ${ECHO} "sasl/GSSAPI bind may not work if it's not set up first." 16302830Sdjl else 163110870SMilan.Jurik@Sun.COM GSSAPI_ENABLE=1 16322830Sdjl get_krb_realm 16332830Sdjl fi 16342830Sdjl 16352830Sdjl} 163610870SMilan.Jurik@Sun.COM# 16370Sstevel@tonic-gate# get_profile_name(): Enter the profile name. 16380Sstevel@tonic-gate# 16390Sstevel@tonic-gateget_profile_name() 16400Sstevel@tonic-gate{ 16410Sstevel@tonic-gate # Reset Delete Old Profile since getting new profile name. 16420Sstevel@tonic-gate DEL_OLD_PROFILE=0 16430Sstevel@tonic-gate 16440Sstevel@tonic-gate # Loop until valid profile name, or replace. 16450Sstevel@tonic-gate while : 16460Sstevel@tonic-gate do 16470Sstevel@tonic-gate # Prompt for profile name. 16480Sstevel@tonic-gate get_ans "Enter the profile name (h=help):" "$LDAP_PROFILE_NAME" 16490Sstevel@tonic-gate 16500Sstevel@tonic-gate # Check for Help. 16510Sstevel@tonic-gate case "$ANS" in 16520Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg profile_help 16530Sstevel@tonic-gate continue ;; 16540Sstevel@tonic-gate * ) ;; 16550Sstevel@tonic-gate esac 16560Sstevel@tonic-gate 16570Sstevel@tonic-gate # Search to see if profile name already exists. 16580Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=${ANS},ou=profile,${LDAP_BASEDN}\" -s base \"objectclass=*\" ${VERB}" 16590Sstevel@tonic-gate if [ $? -eq 0 ]; then 16608821SMichen.Chang@Sun.COM 16618821SMichen.Chang@Sun.COM cat << EOF 16628821SMichen.Chang@Sun.COM 16638821SMichen.Chang@Sun.COMProfile '${ANS}' already exists, it is possible to enable 16648821SMichen.Chang@Sun.COMshadow update now. idsconfig will exit after shadow update 16658821SMichen.Chang@Sun.COMis enabled. You can also continue to overwrite the profile 16668821SMichen.Chang@Sun.COMor create a new one and be given the chance to enable 16678821SMichen.Chang@Sun.COMshadow update later. 16688821SMichen.Chang@Sun.COM 16698821SMichen.Chang@Sun.COMEOF 16708821SMichen.Chang@Sun.COM 16718821SMichen.Chang@Sun.COM MSG="Just enable shadow update (y/n/h)?" 16728821SMichen.Chang@Sun.COM get_confirm "$MSG" "n" "enable_shadow_update_help" 16738821SMichen.Chang@Sun.COM if [ $? -eq 1 ]; then 16748821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "set up shadow update" 16758821SMichen.Chang@Sun.COM LDAP_ENABLE_SHADOW_UPDATE=TRUE 16768821SMichen.Chang@Sun.COM # display alternate messages 16778821SMichen.Chang@Sun.COM EXISTING_PROFILE=1 16788821SMichen.Chang@Sun.COM # Set Profile Name. 16798821SMichen.Chang@Sun.COM LDAP_PROFILE_NAME=$ANS 16808821SMichen.Chang@Sun.COM return 0 # set up credentials for shadow update. 16818821SMichen.Chang@Sun.COM fi 16828821SMichen.Chang@Sun.COM 16838821SMichen.Chang@Sun.COM get_confirm_nodef "Are you sure you want to overwrite profile cn=${ANS}?" 16840Sstevel@tonic-gate if [ $? -eq 1 ]; then 16850Sstevel@tonic-gate DEL_OLD_PROFILE=1 16860Sstevel@tonic-gate return 0 # Replace old profile name. 16870Sstevel@tonic-gate else 16880Sstevel@tonic-gate ${ECHO} "Please re-enter a new profile name." 16890Sstevel@tonic-gate fi 16900Sstevel@tonic-gate else 16910Sstevel@tonic-gate break # Unique profile name. 16920Sstevel@tonic-gate fi 16930Sstevel@tonic-gate done 16940Sstevel@tonic-gate 16950Sstevel@tonic-gate # Set Profile Name. 16960Sstevel@tonic-gate LDAP_PROFILE_NAME=$ANS 16970Sstevel@tonic-gate} 16980Sstevel@tonic-gate 16990Sstevel@tonic-gate 17000Sstevel@tonic-gate# 17010Sstevel@tonic-gate# get_srv_list(): Get the default server list. 17020Sstevel@tonic-gate# 17030Sstevel@tonic-gateget_srv_list() 17040Sstevel@tonic-gate{ 17050Sstevel@tonic-gate # If LDAP_SERVER_LIST is NULL, then set, otherwise leave alone. 17060Sstevel@tonic-gate if [ -z "${LDAP_SERVER_LIST}" ]; then 17070Sstevel@tonic-gate LDAP_SERVER_LIST=`getent hosts ${IDS_SERVER} | awk '{print $1}'` 17080Sstevel@tonic-gate if [ ${IDS_PORT} -ne 389 ]; then 17090Sstevel@tonic-gate LDAP_SERVER_LIST="${LDAP_SERVER_LIST}:${IDS_PORT}" 17100Sstevel@tonic-gate fi 17110Sstevel@tonic-gate fi 17120Sstevel@tonic-gate 17130Sstevel@tonic-gate # Prompt for new LDAP_SERVER_LIST. 17140Sstevel@tonic-gate while : 17150Sstevel@tonic-gate do 17160Sstevel@tonic-gate get_ans "Default server list (h=help):" $LDAP_SERVER_LIST 17170Sstevel@tonic-gate 17180Sstevel@tonic-gate # If help continue, otherwise break. 17190Sstevel@tonic-gate case "$ANS" in 17200Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg def_srvlist_help ;; 17210Sstevel@tonic-gate * ) break ;; 17220Sstevel@tonic-gate esac 17230Sstevel@tonic-gate done 17240Sstevel@tonic-gate LDAP_SERVER_LIST=$ANS 17250Sstevel@tonic-gate} 17260Sstevel@tonic-gate 17270Sstevel@tonic-gate 17280Sstevel@tonic-gate# 17290Sstevel@tonic-gate# get_pref_srv(): The preferred server list (Overrides the server list) 17300Sstevel@tonic-gate# 17310Sstevel@tonic-gateget_pref_srv() 17320Sstevel@tonic-gate{ 17330Sstevel@tonic-gate while : 17340Sstevel@tonic-gate do 17350Sstevel@tonic-gate get_ans "Preferred server list (h=help):" $LDAP_PREF_SRVLIST 17360Sstevel@tonic-gate 17370Sstevel@tonic-gate # If help continue, otherwise break. 17380Sstevel@tonic-gate case "$ANS" in 17390Sstevel@tonic-gate [Hh] | help | Help | \?) display_msg pref_srvlist_help ;; 17400Sstevel@tonic-gate * ) break ;; 17410Sstevel@tonic-gate esac 17420Sstevel@tonic-gate done 17430Sstevel@tonic-gate LDAP_PREF_SRVLIST=$ANS 17440Sstevel@tonic-gate} 17450Sstevel@tonic-gate 17460Sstevel@tonic-gate 17470Sstevel@tonic-gate# 17480Sstevel@tonic-gate# get_search_scope(): Get the search scope from the user. 17490Sstevel@tonic-gate# 17500Sstevel@tonic-gateget_search_scope() 17510Sstevel@tonic-gate{ 17520Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_search_scope()" 17530Sstevel@tonic-gate 17540Sstevel@tonic-gate _MENU_CHOICE=0 17550Sstevel@tonic-gate while : 17560Sstevel@tonic-gate do 17570Sstevel@tonic-gate get_ans "Choose desired search scope (one, sub, h=help): " "one" 17580Sstevel@tonic-gate _MENU_CHOICE=$ANS 17590Sstevel@tonic-gate case "$_MENU_CHOICE" in 17600Sstevel@tonic-gate one) LDAP_SEARCH_SCOPE="one" 17610Sstevel@tonic-gate return 1 ;; 17620Sstevel@tonic-gate sub) LDAP_SEARCH_SCOPE="sub" 17630Sstevel@tonic-gate return 2 ;; 17640Sstevel@tonic-gate h) display_msg srch_scope_help ;; 17650Sstevel@tonic-gate *) ${ECHO} "Please enter \"one\", \"sub\", or \"h\"." ;; 17660Sstevel@tonic-gate esac 17670Sstevel@tonic-gate done 17680Sstevel@tonic-gate 17690Sstevel@tonic-gate} 17700Sstevel@tonic-gate 17710Sstevel@tonic-gate 17720Sstevel@tonic-gate# 17730Sstevel@tonic-gate# get_cred_level(): Function to display menu to user and get the 17740Sstevel@tonic-gate# credential level. 17750Sstevel@tonic-gate# 17760Sstevel@tonic-gateget_cred_level() 17770Sstevel@tonic-gate{ 17780Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_cred_level()" 17790Sstevel@tonic-gate 17800Sstevel@tonic-gate _MENU_CHOICE=0 17810Sstevel@tonic-gate display_msg cred_level_menu 17820Sstevel@tonic-gate while : 17830Sstevel@tonic-gate do 178410870SMilan.Jurik@Sun.COM if [ $GSSAPI_ENABLE -eq 1 ]; then 178510870SMilan.Jurik@Sun.COM ${ECHO} '"self" is needed for GSSAPI profile' 178610870SMilan.Jurik@Sun.COM fi 17870Sstevel@tonic-gate get_ans "Choose Credential level [h=help]:" "1" 17880Sstevel@tonic-gate _MENU_CHOICE=$ANS 17890Sstevel@tonic-gate case "$_MENU_CHOICE" in 17900Sstevel@tonic-gate 1) LDAP_CRED_LEVEL="anonymous" 17910Sstevel@tonic-gate return 1 ;; 17920Sstevel@tonic-gate 2) LDAP_CRED_LEVEL="proxy" 17930Sstevel@tonic-gate return 2 ;; 17940Sstevel@tonic-gate 3) LDAP_CRED_LEVEL="proxy anonymous" 17950Sstevel@tonic-gate return 3 ;; 17962830Sdjl 4) LDAP_CRED_LEVEL="self" 17972830Sdjl return 4 ;; 17980Sstevel@tonic-gate h) display_msg cred_lvl_help ;; 179910870SMilan.Jurik@Sun.COM *) ${ECHO} "Please enter 1, 2, 3 or 4." ;; 18000Sstevel@tonic-gate esac 18010Sstevel@tonic-gate done 18020Sstevel@tonic-gate} 18030Sstevel@tonic-gate 18040Sstevel@tonic-gate 18050Sstevel@tonic-gate# 18060Sstevel@tonic-gate# srvauth_menu_handler(): Enter the Service Authentication method. 18070Sstevel@tonic-gate# 18080Sstevel@tonic-gatesrvauth_menu_handler() 18090Sstevel@tonic-gate{ 18100Sstevel@tonic-gate # Display Auth menu 18110Sstevel@tonic-gate display_msg srvauth_method_menu 18120Sstevel@tonic-gate 18130Sstevel@tonic-gate # Get a Valid choice. 18140Sstevel@tonic-gate while : 18150Sstevel@tonic-gate do 18160Sstevel@tonic-gate # Display appropriate prompt and get answer. 18170Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 18180Sstevel@tonic-gate get_ans "Choose Service Authentication Method:" "1" 18190Sstevel@tonic-gate else 18200Sstevel@tonic-gate get_ans "Choose Service Authentication Method (0=reset):" 18210Sstevel@tonic-gate fi 18220Sstevel@tonic-gate 18230Sstevel@tonic-gate # Determine choice. 18240Sstevel@tonic-gate _MENU_CHOICE=$ANS 18250Sstevel@tonic-gate case "$_MENU_CHOICE" in 18260Sstevel@tonic-gate 1) _AUTHMETHOD="simple" 18270Sstevel@tonic-gate break ;; 18280Sstevel@tonic-gate 2) _AUTHMETHOD="sasl/DIGEST-MD5" 18290Sstevel@tonic-gate break ;; 18300Sstevel@tonic-gate 3) _AUTHMETHOD="tls:simple" 18310Sstevel@tonic-gate break ;; 18320Sstevel@tonic-gate 4) _AUTHMETHOD="tls:sasl/DIGEST-MD5" 18330Sstevel@tonic-gate break ;; 18342830Sdjl 5) _AUTHMETHOD="sasl/GSSAPI" 18352830Sdjl break ;; 18360Sstevel@tonic-gate 0) _AUTHMETHOD="" 18370Sstevel@tonic-gate _FIRST=1 18380Sstevel@tonic-gate break ;; 18392830Sdjl *) ${ECHO} "Please enter 1-5 or 0 to reset." ;; 18400Sstevel@tonic-gate esac 18410Sstevel@tonic-gate done 18420Sstevel@tonic-gate} 18430Sstevel@tonic-gate 18440Sstevel@tonic-gate 18450Sstevel@tonic-gate# 18460Sstevel@tonic-gate# auth_menu_handler(): Enter the Authentication method. 18470Sstevel@tonic-gate# 18480Sstevel@tonic-gateauth_menu_handler() 18490Sstevel@tonic-gate{ 18500Sstevel@tonic-gate # Display Auth menu 18510Sstevel@tonic-gate display_msg auth_method_menu 18520Sstevel@tonic-gate 18530Sstevel@tonic-gate # Get a Valid choice. 18540Sstevel@tonic-gate while : 18550Sstevel@tonic-gate do 185610870SMilan.Jurik@Sun.COM if [ $GSSAPI_ENABLE -eq 1 ]; then 185710870SMilan.Jurik@Sun.COM ${ECHO} '"sasl/GSSAPI" is needed for GSSAPI profile' 185810870SMilan.Jurik@Sun.COM fi 18590Sstevel@tonic-gate # Display appropriate prompt and get answer. 18600Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 18610Sstevel@tonic-gate get_ans "Choose Authentication Method (h=help):" "1" 18620Sstevel@tonic-gate else 18630Sstevel@tonic-gate get_ans "Choose Authentication Method (0=reset, h=help):" 18640Sstevel@tonic-gate fi 18650Sstevel@tonic-gate 18660Sstevel@tonic-gate # Determine choice. 18670Sstevel@tonic-gate _MENU_CHOICE=$ANS 18680Sstevel@tonic-gate case "$_MENU_CHOICE" in 18690Sstevel@tonic-gate 1) _AUTHMETHOD="none" 18700Sstevel@tonic-gate break ;; 18710Sstevel@tonic-gate 2) _AUTHMETHOD="simple" 18720Sstevel@tonic-gate break ;; 18730Sstevel@tonic-gate 3) _AUTHMETHOD="sasl/DIGEST-MD5" 18740Sstevel@tonic-gate break ;; 18750Sstevel@tonic-gate 4) _AUTHMETHOD="tls:simple" 18760Sstevel@tonic-gate break ;; 18770Sstevel@tonic-gate 5) _AUTHMETHOD="tls:sasl/DIGEST-MD5" 18780Sstevel@tonic-gate break ;; 18792830Sdjl 6) _AUTHMETHOD="sasl/GSSAPI" 18802830Sdjl break ;; 18810Sstevel@tonic-gate 0) _AUTHMETHOD="" 18820Sstevel@tonic-gate _FIRST=1 18830Sstevel@tonic-gate break ;; 18840Sstevel@tonic-gate h) display_msg auth_help ;; 18852830Sdjl *) ${ECHO} "Please enter 1-6, 0=reset, or h=help." ;; 18860Sstevel@tonic-gate esac 18870Sstevel@tonic-gate done 18880Sstevel@tonic-gate} 18890Sstevel@tonic-gate 18900Sstevel@tonic-gate 18910Sstevel@tonic-gate# 18920Sstevel@tonic-gate# get_auth(): Enter the Authentication method. 18930Sstevel@tonic-gate# 18940Sstevel@tonic-gateget_auth() 18950Sstevel@tonic-gate{ 18960Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_auth()" 18970Sstevel@tonic-gate 18980Sstevel@tonic-gate _FIRST=1 # Flag for first time. 18990Sstevel@tonic-gate _MENU_CHOICE=0 19000Sstevel@tonic-gate _AUTHMETHOD="" # Tmp method. 19010Sstevel@tonic-gate 19020Sstevel@tonic-gate while : 19030Sstevel@tonic-gate do 19040Sstevel@tonic-gate # Call Menu handler 19050Sstevel@tonic-gate auth_menu_handler 19060Sstevel@tonic-gate 19070Sstevel@tonic-gate # Add Auth Method to list. 19080Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 19090Sstevel@tonic-gate LDAP_AUTHMETHOD="${_AUTHMETHOD}" 19100Sstevel@tonic-gate _FIRST=0 19110Sstevel@tonic-gate else 19120Sstevel@tonic-gate LDAP_AUTHMETHOD="${LDAP_AUTHMETHOD};${_AUTHMETHOD}" 19130Sstevel@tonic-gate fi 19140Sstevel@tonic-gate 19150Sstevel@tonic-gate # Display current Authentication Method. 19160Sstevel@tonic-gate ${ECHO} "" 19170Sstevel@tonic-gate ${ECHO} "Current authenticationMethod: ${LDAP_AUTHMETHOD}" 19180Sstevel@tonic-gate ${ECHO} "" 19190Sstevel@tonic-gate 19200Sstevel@tonic-gate # Prompt for another Auth Method, or break out. 19210Sstevel@tonic-gate get_confirm_nodef "Do you want to add another Authentication Method?" 19220Sstevel@tonic-gate if [ $? -eq 0 ]; then 19230Sstevel@tonic-gate break; 19240Sstevel@tonic-gate fi 19250Sstevel@tonic-gate done 19260Sstevel@tonic-gate} 19270Sstevel@tonic-gate 19280Sstevel@tonic-gate 19290Sstevel@tonic-gate# 19300Sstevel@tonic-gate# get_followref(): Whether or not to follow referrals. 19310Sstevel@tonic-gate# 19320Sstevel@tonic-gateget_followref() 19330Sstevel@tonic-gate{ 19340Sstevel@tonic-gate get_confirm "Do you want the clients to follow referrals (y/n/h)?" "n" "referrals_help" 19350Sstevel@tonic-gate if [ $? -eq 1 ]; then 19360Sstevel@tonic-gate LDAP_FOLLOWREF="TRUE" 19370Sstevel@tonic-gate else 19380Sstevel@tonic-gate LDAP_FOLLOWREF="FALSE" 19390Sstevel@tonic-gate fi 19400Sstevel@tonic-gate} 19410Sstevel@tonic-gate 19420Sstevel@tonic-gate 19430Sstevel@tonic-gate# 19440Sstevel@tonic-gate# get_timelimit(): Set the time limit. -1 is max time. 19450Sstevel@tonic-gate# 19460Sstevel@tonic-gateget_timelimit() 19470Sstevel@tonic-gate{ 19480Sstevel@tonic-gate # Get current timeout value from cn=config. 19490Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=config\" -s base \"objectclass=*\" nsslapd-timelimit > ${TMPDIR}/chk_timeout 2>&1" 19500Sstevel@tonic-gate if [ $? -ne 0 ]; then 19510Sstevel@tonic-gate ${ECHO} " ERROR: Could not reach LDAP server to check current timeout!" 19520Sstevel@tonic-gate cleanup 19530Sstevel@tonic-gate exit 1 19540Sstevel@tonic-gate fi 19550Sstevel@tonic-gate CURR_TIMELIMIT=`${GREP} timelimit ${TMPDIR}/chk_timeout | cut -f2 -d=` 19560Sstevel@tonic-gate 19570Sstevel@tonic-gate get_negone_num "Enter the time limit for iDS (current=${CURR_TIMELIMIT}):" "-1" 19580Sstevel@tonic-gate IDS_TIMELIMIT=$NUM 19590Sstevel@tonic-gate} 19600Sstevel@tonic-gate 19610Sstevel@tonic-gate 19620Sstevel@tonic-gate# 19630Sstevel@tonic-gate# get_sizelimit(): Set the size limit. -1 is max size. 19640Sstevel@tonic-gate# 19650Sstevel@tonic-gateget_sizelimit() 19660Sstevel@tonic-gate{ 19670Sstevel@tonic-gate # Get current sizelimit value from cn=config. 19680Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=config\" -s base \"objectclass=*\" nsslapd-sizelimit > ${TMPDIR}/chk_sizelimit 2>&1" 19690Sstevel@tonic-gate if [ $? -ne 0 ]; then 19700Sstevel@tonic-gate ${ECHO} " ERROR: Could not reach LDAP server to check current sizelimit!" 19710Sstevel@tonic-gate cleanup 19720Sstevel@tonic-gate exit 1 19730Sstevel@tonic-gate fi 19740Sstevel@tonic-gate CURR_SIZELIMIT=`${GREP} sizelimit ${TMPDIR}/chk_sizelimit | cut -f2 -d=` 19750Sstevel@tonic-gate 19760Sstevel@tonic-gate get_negone_num "Enter the size limit for iDS (current=${CURR_SIZELIMIT}):" "-1" 19770Sstevel@tonic-gate IDS_SIZELIMIT=$NUM 19780Sstevel@tonic-gate} 19790Sstevel@tonic-gate 19800Sstevel@tonic-gate 19810Sstevel@tonic-gate# 19820Sstevel@tonic-gate# get_want_crypt(): Ask user if want to store passwords in crypt? 19830Sstevel@tonic-gate# 19840Sstevel@tonic-gateget_want_crypt() 19850Sstevel@tonic-gate{ 19860Sstevel@tonic-gate get_confirm "Do you want to store passwords in \"crypt\" format (y/n/h)?" "n" "crypt_help" 19870Sstevel@tonic-gate if [ $? -eq 1 ]; then 19880Sstevel@tonic-gate NEED_CRYPT="TRUE" 19890Sstevel@tonic-gate else 19900Sstevel@tonic-gate NEED_CRYPT="FALSE" 19910Sstevel@tonic-gate fi 19920Sstevel@tonic-gate} 19930Sstevel@tonic-gate 19940Sstevel@tonic-gate 19950Sstevel@tonic-gate# 19960Sstevel@tonic-gate# get_srv_authMethod_pam(): Get the Service Auth Method for pam_ldap from user. 19970Sstevel@tonic-gate# 19980Sstevel@tonic-gate# NOTE: This function is base on get_auth(). 19990Sstevel@tonic-gate# 20000Sstevel@tonic-gateget_srv_authMethod_pam() 20010Sstevel@tonic-gate{ 20020Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_srv_authMethod_pam()" 20030Sstevel@tonic-gate 20040Sstevel@tonic-gate _FIRST=1 # Flag for first time. 20050Sstevel@tonic-gate _MENU_CHOICE=0 20060Sstevel@tonic-gate _AUTHMETHOD="" # Tmp method. 20070Sstevel@tonic-gate 20080Sstevel@tonic-gate while : 20090Sstevel@tonic-gate do 20100Sstevel@tonic-gate # Call Menu handler 20110Sstevel@tonic-gate srvauth_menu_handler 20120Sstevel@tonic-gate 20130Sstevel@tonic-gate # Add Auth Method to list. 20140Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 20150Sstevel@tonic-gate if [ "$_AUTHMETHOD" = "" ]; then 20160Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_PAM="" 20170Sstevel@tonic-gate else 20180Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_PAM="pam_ldap:${_AUTHMETHOD}" 20190Sstevel@tonic-gate fi 20200Sstevel@tonic-gate _FIRST=0 20210Sstevel@tonic-gate else 20220Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_PAM="${LDAP_SRV_AUTHMETHOD_PAM};${_AUTHMETHOD}" 20230Sstevel@tonic-gate fi 20240Sstevel@tonic-gate 20250Sstevel@tonic-gate # Display current Authentication Method. 20260Sstevel@tonic-gate ${ECHO} "" 20270Sstevel@tonic-gate ${ECHO} "Current authenticationMethod: ${LDAP_SRV_AUTHMETHOD_PAM}" 20280Sstevel@tonic-gate ${ECHO} "" 20290Sstevel@tonic-gate 20300Sstevel@tonic-gate # Prompt for another Auth Method, or break out. 20310Sstevel@tonic-gate get_confirm_nodef "Do you want to add another Authentication Method?" 20320Sstevel@tonic-gate if [ $? -eq 0 ]; then 20330Sstevel@tonic-gate break; 20340Sstevel@tonic-gate fi 20350Sstevel@tonic-gate done 20360Sstevel@tonic-gate 20370Sstevel@tonic-gate # Check in case user reset string and exited loop. 20380Sstevel@tonic-gate if [ "$LDAP_SRV_AUTHMETHOD_PAM" = "" ]; then 20390Sstevel@tonic-gate NEED_SRVAUTH_PAM=0 20400Sstevel@tonic-gate fi 20410Sstevel@tonic-gate} 20420Sstevel@tonic-gate 20430Sstevel@tonic-gate 20440Sstevel@tonic-gate# 20450Sstevel@tonic-gate# get_srv_authMethod_key(): Get the Service Auth Method for keyserv from user. 20460Sstevel@tonic-gate# 20470Sstevel@tonic-gate# NOTE: This function is base on get_auth(). 20480Sstevel@tonic-gate# 20490Sstevel@tonic-gateget_srv_authMethod_key() 20500Sstevel@tonic-gate{ 20510Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_srv_authMethod_key()" 20520Sstevel@tonic-gate 20530Sstevel@tonic-gate _FIRST=1 # Flag for first time. 20540Sstevel@tonic-gate _MENU_CHOICE=0 20550Sstevel@tonic-gate _AUTHMETHOD="" # Tmp method. 20560Sstevel@tonic-gate 20570Sstevel@tonic-gate while : 20580Sstevel@tonic-gate do 20590Sstevel@tonic-gate # Call Menu handler 20600Sstevel@tonic-gate srvauth_menu_handler 20610Sstevel@tonic-gate 20620Sstevel@tonic-gate # Add Auth Method to list. 20630Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 20640Sstevel@tonic-gate if [ "$_AUTHMETHOD" = "" ]; then 20650Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_KEY="" 20660Sstevel@tonic-gate else 20670Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_KEY="keyserv:${_AUTHMETHOD}" 20680Sstevel@tonic-gate fi 20690Sstevel@tonic-gate _FIRST=0 20700Sstevel@tonic-gate else 20710Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_KEY="${LDAP_SRV_AUTHMETHOD_KEY};${_AUTHMETHOD}" 20720Sstevel@tonic-gate fi 20730Sstevel@tonic-gate 20740Sstevel@tonic-gate # Display current Authentication Method. 20750Sstevel@tonic-gate ${ECHO} "" 20760Sstevel@tonic-gate ${ECHO} "Current authenticationMethod: ${LDAP_SRV_AUTHMETHOD_KEY}" 20770Sstevel@tonic-gate ${ECHO} "" 20780Sstevel@tonic-gate 20790Sstevel@tonic-gate # Prompt for another Auth Method, or break out. 20800Sstevel@tonic-gate get_confirm_nodef "Do you want to add another Authentication Method?" 20810Sstevel@tonic-gate if [ $? -eq 0 ]; then 20820Sstevel@tonic-gate break; 20830Sstevel@tonic-gate fi 20840Sstevel@tonic-gate done 20850Sstevel@tonic-gate 20860Sstevel@tonic-gate # Check in case user reset string and exited loop. 20870Sstevel@tonic-gate if [ "$LDAP_SRV_AUTHMETHOD_KEY" = "" ]; then 20880Sstevel@tonic-gate NEED_SRVAUTH_KEY=0 20890Sstevel@tonic-gate fi 20900Sstevel@tonic-gate} 20910Sstevel@tonic-gate 20920Sstevel@tonic-gate 20930Sstevel@tonic-gate# 20940Sstevel@tonic-gate# get_srv_authMethod_cmd(): Get the Service Auth Method for passwd-cmd from user. 20950Sstevel@tonic-gate# 20960Sstevel@tonic-gate# NOTE: This function is base on get_auth(). 20970Sstevel@tonic-gate# 20980Sstevel@tonic-gateget_srv_authMethod_cmd() 20990Sstevel@tonic-gate{ 21000Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_srv_authMethod_cmd()" 21010Sstevel@tonic-gate 21020Sstevel@tonic-gate _FIRST=1 # Flag for first time. 21030Sstevel@tonic-gate _MENU_CHOICE=0 21040Sstevel@tonic-gate _AUTHMETHOD="" # Tmp method. 21050Sstevel@tonic-gate 21060Sstevel@tonic-gate while : 21070Sstevel@tonic-gate do 21080Sstevel@tonic-gate # Call Menu handler 21090Sstevel@tonic-gate srvauth_menu_handler 21100Sstevel@tonic-gate 21110Sstevel@tonic-gate # Add Auth Method to list. 21120Sstevel@tonic-gate if [ $_FIRST -eq 1 ]; then 21130Sstevel@tonic-gate if [ "$_AUTHMETHOD" = "" ]; then 21140Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_CMD="" 21150Sstevel@tonic-gate else 21160Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_CMD="passwd-cmd:${_AUTHMETHOD}" 21170Sstevel@tonic-gate fi 21180Sstevel@tonic-gate _FIRST=0 21190Sstevel@tonic-gate else 21200Sstevel@tonic-gate LDAP_SRV_AUTHMETHOD_CMD="${LDAP_SRV_AUTHMETHOD_CMD};${_AUTHMETHOD}" 21210Sstevel@tonic-gate fi 21220Sstevel@tonic-gate 21230Sstevel@tonic-gate # Display current Authentication Method. 21240Sstevel@tonic-gate ${ECHO} "" 21250Sstevel@tonic-gate ${ECHO} "Current authenticationMethod: ${LDAP_SRV_AUTHMETHOD_CMD}" 21260Sstevel@tonic-gate ${ECHO} "" 21270Sstevel@tonic-gate 21280Sstevel@tonic-gate # Prompt for another Auth Method, or break out. 21290Sstevel@tonic-gate get_confirm_nodef "Do you want to add another Authentication Method?" 21300Sstevel@tonic-gate if [ $? -eq 0 ]; then 21310Sstevel@tonic-gate break; 21320Sstevel@tonic-gate fi 21330Sstevel@tonic-gate done 21340Sstevel@tonic-gate 21350Sstevel@tonic-gate # Check in case user reset string and exited loop. 21360Sstevel@tonic-gate if [ "$LDAP_SRV_AUTHMETHOD_CMD" = "" ]; then 21370Sstevel@tonic-gate NEED_SRVAUTH_CMD=0 21380Sstevel@tonic-gate fi 21390Sstevel@tonic-gate} 21400Sstevel@tonic-gate 21410Sstevel@tonic-gate 21420Sstevel@tonic-gate# 21430Sstevel@tonic-gate# get_srch_time(): Amount of time to search. 21440Sstevel@tonic-gate# 21450Sstevel@tonic-gateget_srch_time() 21460Sstevel@tonic-gate{ 21470Sstevel@tonic-gate get_negone_num "Client search time limit in seconds (h=help):" "$LDAP_SEARCH_TIME_LIMIT" "srchtime_help" 21480Sstevel@tonic-gate LDAP_SEARCH_TIME_LIMIT=$NUM 21490Sstevel@tonic-gate} 21500Sstevel@tonic-gate 21510Sstevel@tonic-gate 21520Sstevel@tonic-gate# 21530Sstevel@tonic-gate# get_prof_ttl(): The profile time to live (TTL) 21540Sstevel@tonic-gate# 21550Sstevel@tonic-gateget_prof_ttl() 21560Sstevel@tonic-gate{ 21570Sstevel@tonic-gate get_negone_num "Profile Time To Live in seconds (h=help):" "$LDAP_PROFILE_TTL" "profttl_help" 21580Sstevel@tonic-gate LDAP_PROFILE_TTL=$NUM 21590Sstevel@tonic-gate} 21600Sstevel@tonic-gate 21610Sstevel@tonic-gate 21620Sstevel@tonic-gate# 21630Sstevel@tonic-gate# get_bind_limit(): Bind time limit 21640Sstevel@tonic-gate# 21650Sstevel@tonic-gateget_bind_limit() 21660Sstevel@tonic-gate{ 21670Sstevel@tonic-gate get_negone_num "Bind time limit in seconds (h=help):" "$LDAP_BIND_LIMIT" "bindlim_help" 21680Sstevel@tonic-gate LDAP_BIND_LIMIT=$NUM 21690Sstevel@tonic-gate} 21700Sstevel@tonic-gate 21710Sstevel@tonic-gate 21720Sstevel@tonic-gate###################################################################### 21730Sstevel@tonic-gate# FUNCTIONS FOR Service Search Descriptor's START HERE. 21740Sstevel@tonic-gate###################################################################### 21750Sstevel@tonic-gate 21760Sstevel@tonic-gate 21770Sstevel@tonic-gate# 21780Sstevel@tonic-gate# add_ssd(): Get SSD's from user and add to file. 21790Sstevel@tonic-gate# 21800Sstevel@tonic-gateadd_ssd() 21810Sstevel@tonic-gate{ 21820Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_ssd()" 21830Sstevel@tonic-gate 21840Sstevel@tonic-gate # Enter the service id. Loop til unique. 21850Sstevel@tonic-gate while : 21860Sstevel@tonic-gate do 21870Sstevel@tonic-gate get_ans "Enter the service id:" 21880Sstevel@tonic-gate _SERV_ID=$ANS 21890Sstevel@tonic-gate 21900Sstevel@tonic-gate # Grep for name existing. 21910Sstevel@tonic-gate ${GREP} -i "^$ANS:" ${SSD_FILE} > /dev/null 2>&1 21920Sstevel@tonic-gate if [ $? -eq 1 ]; then 21930Sstevel@tonic-gate break 21940Sstevel@tonic-gate fi 21950Sstevel@tonic-gate 21960Sstevel@tonic-gate # Name exists, print message, let user decide. 21970Sstevel@tonic-gate ${ECHO} "ERROR: Service id ${ANS} already exists." 21980Sstevel@tonic-gate done 21990Sstevel@tonic-gate 22000Sstevel@tonic-gate get_ans "Enter the base:" 22010Sstevel@tonic-gate _BASE=$ANS 22020Sstevel@tonic-gate 22030Sstevel@tonic-gate # Get the scope and verify that its one or sub. 22040Sstevel@tonic-gate while : 22050Sstevel@tonic-gate do 22060Sstevel@tonic-gate get_ans "Enter the scope:" 22070Sstevel@tonic-gate _SCOPE=$ANS 22080Sstevel@tonic-gate case `${ECHO} ${_SCOPE} | tr '[A-Z]' '[a-z]'` in 22090Sstevel@tonic-gate one) break ;; 22100Sstevel@tonic-gate sub) break ;; 22110Sstevel@tonic-gate *) ${ECHO} "${_SCOPE} is Not valid - Enter 'one' or 'sub'" ;; 22120Sstevel@tonic-gate esac 22130Sstevel@tonic-gate done 22140Sstevel@tonic-gate 22150Sstevel@tonic-gate # Build SSD to add to file. 22160Sstevel@tonic-gate _SSD="${_SERV_ID}:${_BASE}?${_SCOPE}" 22170Sstevel@tonic-gate 22180Sstevel@tonic-gate # Add the SSD to the file. 22190Sstevel@tonic-gate ${ECHO} "${_SSD}" >> ${SSD_FILE} 22200Sstevel@tonic-gate} 22210Sstevel@tonic-gate 22220Sstevel@tonic-gate 22230Sstevel@tonic-gate# 22240Sstevel@tonic-gate# delete_ssd(): Delete a SSD from the list. 22250Sstevel@tonic-gate# 22260Sstevel@tonic-gatedelete_ssd() 22270Sstevel@tonic-gate{ 22280Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In delete_ssd()" 22290Sstevel@tonic-gate 22300Sstevel@tonic-gate # Get service id name from user for SSD to delete. 22310Sstevel@tonic-gate get_ans_req "Enter service id to delete:" 22320Sstevel@tonic-gate 22330Sstevel@tonic-gate # Make sure service id exists. 22340Sstevel@tonic-gate ${GREP} "$ANS" ${SSD_FILE} > /dev/null 2>&1 22350Sstevel@tonic-gate if [ $? -eq 1 ]; then 22360Sstevel@tonic-gate ${ECHO} "Invalid service id: $ANS not present in list." 22370Sstevel@tonic-gate return 22380Sstevel@tonic-gate fi 22390Sstevel@tonic-gate 22400Sstevel@tonic-gate # Create temporary back SSD file. 22410Sstevel@tonic-gate cp ${SSD_FILE} ${SSD_FILE}.bak 22420Sstevel@tonic-gate if [ $? -eq 1 ]; then 22430Sstevel@tonic-gate ${ECHO} "ERROR: could not create file: ${SSD_FILE}.bak" 22440Sstevel@tonic-gate exit 1 22450Sstevel@tonic-gate fi 22460Sstevel@tonic-gate 22470Sstevel@tonic-gate # Use ${GREP} to remove the SSD. Read from temp file 22480Sstevel@tonic-gate # and write to the orig file. 22490Sstevel@tonic-gate ${GREP} -v "$ANS" ${SSD_FILE}.bak > ${SSD_FILE} 22500Sstevel@tonic-gate} 22510Sstevel@tonic-gate 22520Sstevel@tonic-gate 22530Sstevel@tonic-gate# 22540Sstevel@tonic-gate# modify_ssd(): Allow user to modify a SSD. 22550Sstevel@tonic-gate# 22560Sstevel@tonic-gatemodify_ssd() 22570Sstevel@tonic-gate{ 22580Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_ssd()" 22590Sstevel@tonic-gate 22600Sstevel@tonic-gate # Prompt user for service id. 22610Sstevel@tonic-gate get_ans_req "Enter service id to modify:" 22620Sstevel@tonic-gate 22630Sstevel@tonic-gate # Put into temp _LINE. 22640Sstevel@tonic-gate _LINE=`${GREP} "^$ANS:" ${SSD_FILE}` 22650Sstevel@tonic-gate if [ "$_LINE" = "" ]; then 22660Sstevel@tonic-gate ${ECHO} "Invalid service id: $ANS" 22670Sstevel@tonic-gate return 22680Sstevel@tonic-gate fi 22690Sstevel@tonic-gate 22700Sstevel@tonic-gate # Display current filter for user to see. 22710Sstevel@tonic-gate ${ECHO} "" 22720Sstevel@tonic-gate ${ECHO} "Current SSD: $_LINE" 22730Sstevel@tonic-gate ${ECHO} "" 22740Sstevel@tonic-gate 22750Sstevel@tonic-gate # Get the defaults. 22760Sstevel@tonic-gate _CURR_BASE=`${ECHO} $_LINE | cut -d: -f2 | cut -d'?' -f 1` 22770Sstevel@tonic-gate _CURR_SCOPE=`${ECHO} $_LINE | cut -d: -f2 | cut -d'?' -f 2` 22780Sstevel@tonic-gate 22790Sstevel@tonic-gate # Create temporary back SSD file. 22800Sstevel@tonic-gate cp ${SSD_FILE} ${SSD_FILE}.bak 22810Sstevel@tonic-gate if [ $? -eq 1 ]; then 22820Sstevel@tonic-gate ${ECHO} "ERROR: could not create file: ${SSD_FILE}.bak" 22830Sstevel@tonic-gate cleanup 22840Sstevel@tonic-gate exit 1 22850Sstevel@tonic-gate fi 22860Sstevel@tonic-gate 22870Sstevel@tonic-gate # Removed the old line. 22880Sstevel@tonic-gate ${GREP} -v "^$ANS:" ${SSD_FILE}.bak > ${SSD_FILE} 2>&1 22890Sstevel@tonic-gate 22900Sstevel@tonic-gate # New Entry 22910Sstevel@tonic-gate _SERV_ID=$ANS 22920Sstevel@tonic-gate get_ans_req "Enter the base:" "$_CURR_BASE" 22930Sstevel@tonic-gate _BASE=$ANS 22940Sstevel@tonic-gate get_ans_req "Enter the scope:" "$_CURR_SCOPE" 22950Sstevel@tonic-gate _SCOPE=$ANS 22960Sstevel@tonic-gate 22970Sstevel@tonic-gate # Build the new SSD. 22980Sstevel@tonic-gate _SSD="${_SERV_ID}:${_BASE}?${_SCOPE}" 22990Sstevel@tonic-gate 23000Sstevel@tonic-gate # Add the SSD to the file. 23010Sstevel@tonic-gate ${ECHO} "${_SSD}" >> ${SSD_FILE} 23020Sstevel@tonic-gate} 23030Sstevel@tonic-gate 23040Sstevel@tonic-gate 23050Sstevel@tonic-gate# 23060Sstevel@tonic-gate# display_ssd(): Display the current SSD list. 23070Sstevel@tonic-gate# 23080Sstevel@tonic-gatedisplay_ssd() 23090Sstevel@tonic-gate{ 23100Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In display_ssd()" 23110Sstevel@tonic-gate 23120Sstevel@tonic-gate ${ECHO} "" 23130Sstevel@tonic-gate ${ECHO} "Current Service Search Descriptors:" 23140Sstevel@tonic-gate ${ECHO} "==================================" 23150Sstevel@tonic-gate cat ${SSD_FILE} 23160Sstevel@tonic-gate ${ECHO} "" 23170Sstevel@tonic-gate ${ECHO} "Hit return to continue." 23180Sstevel@tonic-gate read __A 23190Sstevel@tonic-gate} 23200Sstevel@tonic-gate 23210Sstevel@tonic-gate 23220Sstevel@tonic-gate# 23230Sstevel@tonic-gate# prompt_ssd(): Get SSD's from user. 23240Sstevel@tonic-gate# 23250Sstevel@tonic-gateprompt_ssd() 23260Sstevel@tonic-gate{ 23270Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In prompt_ssd()" 23280Sstevel@tonic-gate # See if user wants SSD's? 23290Sstevel@tonic-gate get_confirm "Do you wish to setup Service Search Descriptors (y/n/h)?" "n" "ssd_help" 23300Sstevel@tonic-gate [ "$?" -eq 0 ] && return 23310Sstevel@tonic-gate 23320Sstevel@tonic-gate # Display menu for SSD choices. 23330Sstevel@tonic-gate while : 23340Sstevel@tonic-gate do 23350Sstevel@tonic-gate display_msg prompt_ssd_menu 23360Sstevel@tonic-gate get_ans "Enter menu choice:" "Quit" 23370Sstevel@tonic-gate case "$ANS" in 23380Sstevel@tonic-gate [Aa] | add) add_ssd ;; 23390Sstevel@tonic-gate [Dd] | delete) delete_ssd ;; 23400Sstevel@tonic-gate [Mm] | modify) modify_ssd ;; 23410Sstevel@tonic-gate [Pp] | print | display) display_ssd ;; 23420Sstevel@tonic-gate [Xx] | reset | clear) reset_ssd_file ;; 23430Sstevel@tonic-gate [Hh] | Help | help) display_msg ssd_menu_help 23440Sstevel@tonic-gate ${ECHO} " Press return to continue." 23450Sstevel@tonic-gate read __A ;; 23460Sstevel@tonic-gate [Qq] | Quit | quit) return ;; 23470Sstevel@tonic-gate *) ${ECHO} "Invalid choice: $ANS please re-enter from menu." ;; 23480Sstevel@tonic-gate esac 23490Sstevel@tonic-gate done 23500Sstevel@tonic-gate} 23510Sstevel@tonic-gate 23520Sstevel@tonic-gate 23530Sstevel@tonic-gate# 23540Sstevel@tonic-gate# reset_ssd_file(): Blank out current SSD file. 23550Sstevel@tonic-gate# 23560Sstevel@tonic-gatereset_ssd_file() 23570Sstevel@tonic-gate{ 23580Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In reset_ssd_file()" 23590Sstevel@tonic-gate 23600Sstevel@tonic-gate rm -f ${SSD_FILE} 23610Sstevel@tonic-gate touch ${SSD_FILE} 23620Sstevel@tonic-gate} 23630Sstevel@tonic-gate 23640Sstevel@tonic-gate 23650Sstevel@tonic-gate# 23660Sstevel@tonic-gate# create_ssd_file(): Create a temporary file for SSD's. 23670Sstevel@tonic-gate# 23680Sstevel@tonic-gatecreate_ssd_file() 23690Sstevel@tonic-gate{ 23700Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In create_ssd_file()" 23710Sstevel@tonic-gate 23720Sstevel@tonic-gate # Build a list of SSD's and store in temp file. 23730Sstevel@tonic-gate ${GREP} "LDAP_SERV_SRCH_DES=" ${INPUT_FILE} | \ 23740Sstevel@tonic-gate sed 's/LDAP_SERV_SRCH_DES=//' \ 23750Sstevel@tonic-gate > ${SSD_FILE} 23760Sstevel@tonic-gate} 23770Sstevel@tonic-gate 23780Sstevel@tonic-gate 23790Sstevel@tonic-gate# 23800Sstevel@tonic-gate# ssd_2_config(): Append the SSD file to the output file. 23810Sstevel@tonic-gate# 23820Sstevel@tonic-gatessd_2_config() 23830Sstevel@tonic-gate{ 23840Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In ssd_2_config()" 23850Sstevel@tonic-gate 23860Sstevel@tonic-gate # Convert to config file format using sed. 23870Sstevel@tonic-gate sed -e "s/^/LDAP_SERV_SRCH_DES=/" ${SSD_FILE} >> ${OUTPUT_FILE} 23880Sstevel@tonic-gate} 23890Sstevel@tonic-gate 23900Sstevel@tonic-gate 23910Sstevel@tonic-gate# 23920Sstevel@tonic-gate# ssd_2_profile(): Add SSD's to the GEN_CMD string. 23930Sstevel@tonic-gate# 23940Sstevel@tonic-gatessd_2_profile() 23950Sstevel@tonic-gate{ 23960Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In ssd_2_profile()" 23970Sstevel@tonic-gate 23980Sstevel@tonic-gate GEN_TMPFILE=${TMPDIR}/ssd_tmpfile 23990Sstevel@tonic-gate touch ${GEN_TMPFILE} 24000Sstevel@tonic-gate 24010Sstevel@tonic-gate # Add and convert each SSD to string. 24020Sstevel@tonic-gate while read SSD_LINE 24030Sstevel@tonic-gate do 24040Sstevel@tonic-gate ${ECHO} " -a \"serviceSearchDescriptor=${SSD_LINE}\"\c" >> ${GEN_TMPFILE} 24050Sstevel@tonic-gate done <${SSD_FILE} 24060Sstevel@tonic-gate 24070Sstevel@tonic-gate # Add SSD's to GEN_CMD. 24080Sstevel@tonic-gate GEN_CMD="${GEN_CMD} `cat ${GEN_TMPFILE}`" 24090Sstevel@tonic-gate} 24100Sstevel@tonic-gate 24118821SMichen.Chang@Sun.COM# 24128821SMichen.Chang@Sun.COM# get_adminDN(): Get the admin DN. 24138821SMichen.Chang@Sun.COM# 24148821SMichen.Chang@Sun.COMget_adminDN() 24158821SMichen.Chang@Sun.COM{ 24168821SMichen.Chang@Sun.COM LDAP_ADMINDN="cn=admin,ou=profile,${LDAP_BASEDN}" # default 24178821SMichen.Chang@Sun.COM get_ans "Enter DN for the administrator:" "$LDAP_ADMINDN" 24188821SMichen.Chang@Sun.COM LDAP_ADMINDN=$ANS 24198821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "LDAP_ADMINDN = $LDAP_ADMINDN" 24208821SMichen.Chang@Sun.COM} 24218821SMichen.Chang@Sun.COM 24228821SMichen.Chang@Sun.COM# 24238821SMichen.Chang@Sun.COM# get_admin_pw(): Get the admin passwd. 24248821SMichen.Chang@Sun.COM# 24258821SMichen.Chang@Sun.COMget_admin_pw() 24268821SMichen.Chang@Sun.COM{ 24278821SMichen.Chang@Sun.COM get_passwd "Enter passwd for the administrator:" 24288821SMichen.Chang@Sun.COM LDAP_ADMIN_CRED=$ANS 24298821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "LDAP_ADMIN_CRED = $LDAP_ADMIN_CRED" 24308821SMichen.Chang@Sun.COM} 24318821SMichen.Chang@Sun.COM 24328821SMichen.Chang@Sun.COM# 24338821SMichen.Chang@Sun.COM# add_admin(): Add an admin entry for nameservice for updating shadow data. 24348821SMichen.Chang@Sun.COM# 24358821SMichen.Chang@Sun.COMadd_admin() 24368821SMichen.Chang@Sun.COM{ 24378821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In add_admin()" 24388821SMichen.Chang@Sun.COM 24398821SMichen.Chang@Sun.COM # Check if the admin user already exists. 24408821SMichen.Chang@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_ADMINDN}\" -s base \"objectclass=*\" ${VERB}" 24418821SMichen.Chang@Sun.COM if [ $? -eq 0 ]; then 24428821SMichen.Chang@Sun.COM MSG="Administrator ${LDAP_ADMINDN} already exists." 24438821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 24448821SMichen.Chang@Sun.COM ${ECHO} " NOT ADDED: $MSG" 24458821SMichen.Chang@Sun.COM else 24468821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 24478821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 24488821SMichen.Chang@Sun.COM fi 24498821SMichen.Chang@Sun.COM return 0 24508821SMichen.Chang@Sun.COM fi 24518821SMichen.Chang@Sun.COM 24528821SMichen.Chang@Sun.COM # Get cn and sn names from LDAP_ADMINDN. 24538821SMichen.Chang@Sun.COM cn_tmp=`${ECHO} ${LDAP_ADMINDN} | cut -f1 -d, | cut -f2 -d=` 24548821SMichen.Chang@Sun.COM 24558821SMichen.Chang@Sun.COM # Create the tmp file to add. 24568821SMichen.Chang@Sun.COM ( cat <<EOF 24578821SMichen.Chang@Sun.COMdn: ${LDAP_ADMINDN} 24588821SMichen.Chang@Sun.COMcn: ${cn_tmp} 24598821SMichen.Chang@Sun.COMsn: ${cn_tmp} 24608821SMichen.Chang@Sun.COMobjectclass: top 24618821SMichen.Chang@Sun.COMobjectclass: person 24628821SMichen.Chang@Sun.COMuserpassword: ${LDAP_ADMIN_CRED} 24638821SMichen.Chang@Sun.COMEOF 24648821SMichen.Chang@Sun.COM) > ${TMPDIR}/admin 24658821SMichen.Chang@Sun.COM 24668821SMichen.Chang@Sun.COM # Add the entry. 24678821SMichen.Chang@Sun.COM ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/admin ${VERB}" 24688821SMichen.Chang@Sun.COM if [ $? -ne 0 ]; then 24698821SMichen.Chang@Sun.COM ${ECHO} " ERROR: Adding administrator identity failed!" 24708821SMichen.Chang@Sun.COM cleanup 24718821SMichen.Chang@Sun.COM exit 1 24728821SMichen.Chang@Sun.COM fi 24738821SMichen.Chang@Sun.COM 24748821SMichen.Chang@Sun.COM ${RM} -f ${TMPDIR}/admin 24758821SMichen.Chang@Sun.COM 24768821SMichen.Chang@Sun.COM # Display message that the administrator identity is added. 24778821SMichen.Chang@Sun.COM MSG="Administrator identity ${LDAP_ADMINDN}" 24788821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 24798821SMichen.Chang@Sun.COM ${ECHO} " ADDED: $MSG." 24808821SMichen.Chang@Sun.COM else 24818821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG added." 24828821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 24838821SMichen.Chang@Sun.COM fi 24848821SMichen.Chang@Sun.COM} 24858821SMichen.Chang@Sun.COM 24868821SMichen.Chang@Sun.COM# 24879576SJulian.Pullen@Sun.COM# allow_admin_read_write_shadow(): Give Admin read/write permission 24889576SJulian.Pullen@Sun.COM# to shadow data. 24899576SJulian.Pullen@Sun.COM# 24909576SJulian.Pullen@Sun.COMallow_admin_read_write_shadow() 24918821SMichen.Chang@Sun.COM{ 24929576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In allow_admin_read_write_shadow()" 24938821SMichen.Chang@Sun.COM 24948821SMichen.Chang@Sun.COM # Set ACI Name 24958821SMichen.Chang@Sun.COM ADMIN_ACI_NAME="LDAP_Naming_Services_admin_shadow_write" 24968821SMichen.Chang@Sun.COM 24978821SMichen.Chang@Sun.COM # Search for ACI_NAME 24988821SMichen.Chang@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" \ 24998821SMichen.Chang@Sun.COM -s base objectclass=* aci > ${TMPDIR}/chk_adminwrite_aci 2>&1" 25009576SJulian.Pullen@Sun.COM 25019576SJulian.Pullen@Sun.COM # if an ACI with ${ADMIN_ACI_NAME} and "write,compare,read,search" 25029576SJulian.Pullen@Sun.COM # and ${LDAP_ADMINDN} already exists, we are done 25039576SJulian.Pullen@Sun.COM ${EGREP} ".*${ADMIN_ACI_NAME}.*write,compare,read,search.*${LDAP_ADMINDN}.*" \ 25049576SJulian.Pullen@Sun.COM ${TMPDIR}/chk_adminwrite_aci 2>&1 > /dev/null 25058821SMichen.Chang@Sun.COM if [ $? -eq 0 ]; then 25068821SMichen.Chang@Sun.COM MSG="Admin ACI ${ADMIN_ACI_NAME} already exists for ${LDAP_BASEDN}." 25078821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 25088821SMichen.Chang@Sun.COM ${ECHO} " NOT SET: $MSG" 25098821SMichen.Chang@Sun.COM else 25108821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 25118821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 25128821SMichen.Chang@Sun.COM fi 25138821SMichen.Chang@Sun.COM return 0 25148821SMichen.Chang@Sun.COM fi 25158821SMichen.Chang@Sun.COM 25169576SJulian.Pullen@Sun.COM # If an ACI with ${ADMIN_ACI_NAME} and "(write)" and ${LDAP_ADMINDN} 25179576SJulian.Pullen@Sun.COM # already exists, delete it first. 25189576SJulian.Pullen@Sun.COM find_and_delete_ACI ".*${ADMIN_ACI_NAME}.*(write).*${LDAP_ADMINDN}.*" \ 25199576SJulian.Pullen@Sun.COM ${TMPDIR}/chk_adminwrite_aci ${ADMIN_ACI_NAME} 25209576SJulian.Pullen@Sun.COM 25218821SMichen.Chang@Sun.COM # Create the tmp file to add. 25228821SMichen.Chang@Sun.COM ( cat <<EOF 25238821SMichen.Chang@Sun.COMdn: ${LDAP_BASEDN} 25248821SMichen.Chang@Sun.COMchangetype: modify 25258821SMichen.Chang@Sun.COMadd: aci 25269576SJulian.Pullen@Sun.COMaci: (target="ldap:///${LDAP_BASEDN}")(targetattr="shadowLastChange 25279576SJulian.Pullen@Sun.COM ||shadowMin||shadowMax||shadowWarning||shadowInactive||shadowExpire 25289576SJulian.Pullen@Sun.COM ||shadowFlag||userPassword||loginShell||homeDirectory||gecos") 25299576SJulian.Pullen@Sun.COM (version 3.0; acl ${ADMIN_ACI_NAME}; allow (write,compare,read,search) 25309576SJulian.Pullen@Sun.COM userdn = "ldap:///${LDAP_ADMINDN}";) 25318821SMichen.Chang@Sun.COMEOF 25328821SMichen.Chang@Sun.COM) > ${TMPDIR}/admin_write 25338821SMichen.Chang@Sun.COM 25348821SMichen.Chang@Sun.COM # Add the entry. 25358821SMichen.Chang@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/admin_write ${VERB}" 25368821SMichen.Chang@Sun.COM if [ $? -ne 0 ]; then 25379576SJulian.Pullen@Sun.COM ${ECHO} " ERROR: Allow ${LDAP_ADMINDN} read/write access to shadow data failed!" 25388821SMichen.Chang@Sun.COM cleanup 25398821SMichen.Chang@Sun.COM exit 1 25408821SMichen.Chang@Sun.COM fi 25418821SMichen.Chang@Sun.COM 25428821SMichen.Chang@Sun.COM ${RM} -f ${TMPDIR}/admin_write 25438821SMichen.Chang@Sun.COM # Display message that the administrator ACL is set. 25449576SJulian.Pullen@Sun.COM MSG="Give ${LDAP_ADMINDN} read/write access to shadow data." 25458821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 25468821SMichen.Chang@Sun.COM ${ECHO} " ACI SET: $MSG" 25478821SMichen.Chang@Sun.COM else 25488821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 25498821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 25508821SMichen.Chang@Sun.COM fi 25518821SMichen.Chang@Sun.COM} 25528821SMichen.Chang@Sun.COM 25538821SMichen.Chang@Sun.COM# 25549576SJulian.Pullen@Sun.COM# allow_host_read_write_shadow(): Give host principal read/write permission 25558821SMichen.Chang@Sun.COM# for shadow data. 25568821SMichen.Chang@Sun.COM# 25579576SJulian.Pullen@Sun.COMallow_host_read_write_shadow() 25588821SMichen.Chang@Sun.COM{ 25599576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In allow_host_read_write_shadow()" 25608821SMichen.Chang@Sun.COM 25618821SMichen.Chang@Sun.COM # Set ACI Name 25628821SMichen.Chang@Sun.COM HOST_ACI_NAME="LDAP_Naming_Services_host_shadow_write" 25638821SMichen.Chang@Sun.COM 25648821SMichen.Chang@Sun.COM # Search for ACI_NAME 25658821SMichen.Chang@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_hostwrite_aci 2>&1" 25668821SMichen.Chang@Sun.COM ${GREP} "${HOST_ACI_NAME}" ${TMPDIR}/chk_hostwrite_aci > /dev/null 2>&1 25678821SMichen.Chang@Sun.COM if [ $? -eq 0 ]; then 25688821SMichen.Chang@Sun.COM MSG="Host ACI ${HOST_ACI_NAME} already exists for ${LDAP_BASEDN}." 25698821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 25708821SMichen.Chang@Sun.COM ${ECHO} " NOT ADDED: $MSG" 25718821SMichen.Chang@Sun.COM else 25728821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 25738821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 25748821SMichen.Chang@Sun.COM fi 25758821SMichen.Chang@Sun.COM return 0 25768821SMichen.Chang@Sun.COM fi 25778821SMichen.Chang@Sun.COM 25788821SMichen.Chang@Sun.COM # Create the tmp file to add. 25798821SMichen.Chang@Sun.COM ( cat <<EOF 25808821SMichen.Chang@Sun.COMdn: ${LDAP_BASEDN} 25818821SMichen.Chang@Sun.COMchangetype: modify 25828821SMichen.Chang@Sun.COMadd: aci 25839576SJulian.Pullen@Sun.COMaci: (target="ldap:///${LDAP_BASEDN}")(targetattr="shadowLastChange||shadowMin||shadowMax||shadowWarning||shadowInactive||shadowExpire||shadowFlag||userPassword||loginShell||homeDirectory||gecos")(version 3.0; acl ${HOST_ACI_NAME}; allow (write,compare,read,search) authmethod="sasl GSSAPI" and userdn = "ldap:///cn=*+ipHostNumber=*,ou=Hosts,${LDAP_BASEDN}";) 25848821SMichen.Chang@Sun.COMEOF 25859576SJulian.Pullen@Sun.COM) > ${TMPDIR}/host_read_write 25868821SMichen.Chang@Sun.COM 25878821SMichen.Chang@Sun.COM # Add the entry. 25889576SJulian.Pullen@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/host_read_write ${VERB}" 25898821SMichen.Chang@Sun.COM if [ $? -ne 0 ]; then 25908821SMichen.Chang@Sun.COM ${ECHO} " ERROR: Allow Host Principal to write shadow data failed!" 25918821SMichen.Chang@Sun.COM cleanup 25928821SMichen.Chang@Sun.COM exit 1 25938821SMichen.Chang@Sun.COM fi 25948821SMichen.Chang@Sun.COM 25959576SJulian.Pullen@Sun.COM ${RM} -f ${TMPDIR}/host_read_write 25969576SJulian.Pullen@Sun.COM MSG="Give host principal read/write permission for shadow." 25978821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 25988821SMichen.Chang@Sun.COM ${ECHO} " ACI SET: $MSG" 25998821SMichen.Chang@Sun.COM else 26008821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 26018821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 26028821SMichen.Chang@Sun.COM fi 26038821SMichen.Chang@Sun.COM} 26048821SMichen.Chang@Sun.COM 26058821SMichen.Chang@Sun.COM# 26068821SMichen.Chang@Sun.COM# Set up shadow update 26078821SMichen.Chang@Sun.COM# 26088821SMichen.Chang@Sun.COMsetup_shadow_update() { 26098821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In setup_shadow_update()" 26108821SMichen.Chang@Sun.COM 26118821SMichen.Chang@Sun.COM # get content of the profile 26128821SMichen.Chang@Sun.COM PROFILE_OUT=${TMPDIR}/prof_tmpfile 26138821SMichen.Chang@Sun.COM ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=${LDAP_PROFILE_NAME},ou=profile,${LDAP_BASEDN}\" -s base \"objectclass=*\" > $PROFILE_OUT 2>&1" 26148821SMichen.Chang@Sun.COM ${GREP} -i cn $PROFILE_OUT >/dev/null 2>&1 26158821SMichen.Chang@Sun.COM if [ $? -ne 0 ]; then 26168821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "Profile ${LDAP_PROFILE_NAME} does not exist" 26178821SMichen.Chang@Sun.COM ${RM} ${PROFILE_OUT} 26188821SMichen.Chang@Sun.COM return 26198821SMichen.Chang@Sun.COM fi 26208821SMichen.Chang@Sun.COM 26218821SMichen.Chang@Sun.COM # Search to see if authenticationMethod has 'GSSAPI' and 26228821SMichen.Chang@Sun.COM # credentialLevel has 'self'. If so, ask to use the 26238821SMichen.Chang@Sun.COM # host principal for shadow update 26248821SMichen.Chang@Sun.COM if [ $GSSAPI_AUTH_MAY_BE_USED -eq 1 ]; then 26258821SMichen.Chang@Sun.COM if ${GREP} authenticationMethod $PROFILE_OUT | ${GREP} GSSAPI >/dev/null 2>&1 26268821SMichen.Chang@Sun.COM then 26278821SMichen.Chang@Sun.COM if ${GREP} credentialLevel $PROFILE_OUT | ${GREP} self >/dev/null 2>&1 26288821SMichen.Chang@Sun.COM then 26298821SMichen.Chang@Sun.COM NEED_HOSTACL=1 26308821SMichen.Chang@Sun.COM fi 26318821SMichen.Chang@Sun.COM fi 26328821SMichen.Chang@Sun.COM ${RM} ${PROFILE_OUT} 26338821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "NEED_HOSTACL = $NEED_HOSTACL" 26348821SMichen.Chang@Sun.COM 26358821SMichen.Chang@Sun.COM if [ $NEED_HOSTACL -eq 1 ]; then 26368821SMichen.Chang@Sun.COM MSG="Use host principal for shadow data update (y/n/h)?" 26378821SMichen.Chang@Sun.COM get_confirm "$MSG" "y" "use_host_principal_help" 26388821SMichen.Chang@Sun.COM if [ $? -eq 1 ]; then 26399576SJulian.Pullen@Sun.COM delete_proxy_read_pw 26409576SJulian.Pullen@Sun.COM allow_host_read_write_shadow 26419576SJulian.Pullen@Sun.COM deny_non_host_shadow_access 26428821SMichen.Chang@Sun.COM ${ECHO} "" 26438821SMichen.Chang@Sun.COM ${ECHO} " Shadow update has been enabled." 26448821SMichen.Chang@Sun.COM else 26458821SMichen.Chang@Sun.COM ${ECHO} "" 26468821SMichen.Chang@Sun.COM ${ECHO} " Shadow update may not work." 26478821SMichen.Chang@Sun.COM fi 26488821SMichen.Chang@Sun.COM return 26498821SMichen.Chang@Sun.COM fi 26508821SMichen.Chang@Sun.COM fi 26518821SMichen.Chang@Sun.COM 26528821SMichen.Chang@Sun.COM MSG="Add the administrator identity (y/n/h)?" 26538821SMichen.Chang@Sun.COM get_confirm "$MSG" "y" "add_admin_cred_help" 26548821SMichen.Chang@Sun.COM if [ $? -eq 1 ]; then 26558821SMichen.Chang@Sun.COM get_adminDN 26568821SMichen.Chang@Sun.COM get_admin_pw 26578821SMichen.Chang@Sun.COM add_admin 26589576SJulian.Pullen@Sun.COM delete_proxy_read_pw 26599576SJulian.Pullen@Sun.COM allow_admin_read_write_shadow 26609576SJulian.Pullen@Sun.COM deny_non_admin_shadow_access 26618821SMichen.Chang@Sun.COM ${ECHO} "" 26628821SMichen.Chang@Sun.COM ${ECHO} " Shadow update has been enabled." 26638821SMichen.Chang@Sun.COM return 26648821SMichen.Chang@Sun.COM fi 26658821SMichen.Chang@Sun.COM 26668821SMichen.Chang@Sun.COM ${ECHO} " No administrator identity specified, shadow update may not work." 26678821SMichen.Chang@Sun.COM} 26688821SMichen.Chang@Sun.COM 26690Sstevel@tonic-gate 26700Sstevel@tonic-gate# 26710Sstevel@tonic-gate# prompt_config_info(): This function prompts the user for the config 26720Sstevel@tonic-gate# info that is not specified in the input file. 26730Sstevel@tonic-gate# 26740Sstevel@tonic-gateprompt_config_info() 26750Sstevel@tonic-gate{ 26760Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In prompt_config_info()" 26770Sstevel@tonic-gate 26780Sstevel@tonic-gate # Prompt for iDS server name. 26790Sstevel@tonic-gate get_ids_server 26800Sstevel@tonic-gate 26810Sstevel@tonic-gate # Prompt for iDS port number. 26820Sstevel@tonic-gate get_ids_port 26830Sstevel@tonic-gate 26840Sstevel@tonic-gate # Check iDS version for compatibility. 26850Sstevel@tonic-gate chk_ids_version 26860Sstevel@tonic-gate 26870Sstevel@tonic-gate # Check if the server supports the VLV. 26880Sstevel@tonic-gate chk_vlv_indexes 26890Sstevel@tonic-gate 26900Sstevel@tonic-gate # Get the Directory manager DN and passwd. 26910Sstevel@tonic-gate get_dirmgr_dn 26920Sstevel@tonic-gate get_dirmgr_pw 26930Sstevel@tonic-gate 26940Sstevel@tonic-gate # 26950Sstevel@tonic-gate # LDAP CLIENT PROFILE SPECIFIC INFORMATION. 26960Sstevel@tonic-gate # (i.e. The fields that show up in the profile.) 26970Sstevel@tonic-gate # 26980Sstevel@tonic-gate get_domain "domain_help" 26990Sstevel@tonic-gate 27000Sstevel@tonic-gate get_basedn 27010Sstevel@tonic-gate 27022830Sdjl gssapi_setup 27032830Sdjl 27040Sstevel@tonic-gate get_profile_name 27058821SMichen.Chang@Sun.COM 27068821SMichen.Chang@Sun.COM if [ "$LDAP_ENABLE_SHADOW_UPDATE" = "TRUE" ];then 27078821SMichen.Chang@Sun.COM setup_shadow_update 27089576SJulian.Pullen@Sun.COM cleanup 27098821SMichen.Chang@Sun.COM exit 0 27108821SMichen.Chang@Sun.COM fi 27118821SMichen.Chang@Sun.COM 27120Sstevel@tonic-gate get_srv_list 27130Sstevel@tonic-gate get_pref_srv 27140Sstevel@tonic-gate get_search_scope 27150Sstevel@tonic-gate 27160Sstevel@tonic-gate # If cred is "anonymous", make auth == "none" 27170Sstevel@tonic-gate get_cred_level 27180Sstevel@tonic-gate if [ "$LDAP_CRED_LEVEL" != "anonymous" ]; then 27190Sstevel@tonic-gate get_auth 27200Sstevel@tonic-gate fi 27210Sstevel@tonic-gate 27220Sstevel@tonic-gate get_followref 27230Sstevel@tonic-gate 27240Sstevel@tonic-gate # Query user about timelimt. 27250Sstevel@tonic-gate get_confirm "Do you want to modify the server timelimit value (y/n/h)?" "n" "tlim_help" 27260Sstevel@tonic-gate NEED_TIME=$? 27270Sstevel@tonic-gate [ $NEED_TIME -eq 1 ] && get_timelimit 27280Sstevel@tonic-gate 27290Sstevel@tonic-gate # Query user about sizelimit. 27300Sstevel@tonic-gate get_confirm "Do you want to modify the server sizelimit value (y/n/h)?" "n" "slim_help" 27310Sstevel@tonic-gate NEED_SIZE=$? 27320Sstevel@tonic-gate [ $NEED_SIZE -eq 1 ] && get_sizelimit 27330Sstevel@tonic-gate 27340Sstevel@tonic-gate # Does the user want to store passwords in crypt format? 27350Sstevel@tonic-gate get_want_crypt 27360Sstevel@tonic-gate 27370Sstevel@tonic-gate # Prompt for any Service Authentication Methods? 27380Sstevel@tonic-gate get_confirm "Do you want to setup a Service Authentication Methods (y/n/h)?" "n" "srvauth_help" 27390Sstevel@tonic-gate if [ $? -eq 1 ]; then 27400Sstevel@tonic-gate # Does the user want to set Service Authentication Method for pam_ldap? 27410Sstevel@tonic-gate get_confirm "Do you want to setup a Service Auth. Method for \"pam_ldap\" (y/n/h)?" "n" "pam_ldap_help" 27420Sstevel@tonic-gate NEED_SRVAUTH_PAM=$? 27430Sstevel@tonic-gate [ $NEED_SRVAUTH_PAM -eq 1 ] && get_srv_authMethod_pam 27440Sstevel@tonic-gate 27450Sstevel@tonic-gate # Does the user want to set Service Authentication Method for keyserv? 27460Sstevel@tonic-gate get_confirm "Do you want to setup a Service Auth. Method for \"keyserv\" (y/n/h)?" "n" "keyserv_help" 27470Sstevel@tonic-gate NEED_SRVAUTH_KEY=$? 27480Sstevel@tonic-gate [ $NEED_SRVAUTH_KEY -eq 1 ] && get_srv_authMethod_key 27490Sstevel@tonic-gate 27500Sstevel@tonic-gate # Does the user want to set Service Authentication Method for passwd-cmd? 27510Sstevel@tonic-gate get_confirm "Do you want to setup a Service Auth. Method for \"passwd-cmd\" (y/n/h)?" "n" "passwd-cmd_help" 27520Sstevel@tonic-gate NEED_SRVAUTH_CMD=$? 27530Sstevel@tonic-gate [ $NEED_SRVAUTH_CMD -eq 1 ] && get_srv_authMethod_cmd 27540Sstevel@tonic-gate fi 27552830Sdjl 27560Sstevel@tonic-gate 27570Sstevel@tonic-gate # Get Timeouts 27580Sstevel@tonic-gate get_srch_time 27590Sstevel@tonic-gate get_prof_ttl 27600Sstevel@tonic-gate get_bind_limit 27610Sstevel@tonic-gate 27628821SMichen.Chang@Sun.COM # Ask whether to enable shadow update 27638821SMichen.Chang@Sun.COM get_want_shadow_update 27648821SMichen.Chang@Sun.COM 27650Sstevel@tonic-gate # Reset the sdd_file and prompt user for SSD. Will use menus 27660Sstevel@tonic-gate # to build an SSD File. 27670Sstevel@tonic-gate reset_ssd_file 27680Sstevel@tonic-gate prompt_ssd 27690Sstevel@tonic-gate 27700Sstevel@tonic-gate # Display FULL debugging info. 27710Sstevel@tonic-gate disp_full_debug 27720Sstevel@tonic-gate 27730Sstevel@tonic-gate # Extra blank line to separate prompt lines from steps. 27740Sstevel@tonic-gate ${ECHO} " " 27750Sstevel@tonic-gate} 27760Sstevel@tonic-gate 27770Sstevel@tonic-gate 27780Sstevel@tonic-gate###################################################################### 27790Sstevel@tonic-gate# FUNCTIONS FOR display_summary() START HERE. 27800Sstevel@tonic-gate###################################################################### 27810Sstevel@tonic-gate 27820Sstevel@tonic-gate 27830Sstevel@tonic-gate# 27840Sstevel@tonic-gate# get_proxyagent(): Get the proxyagent DN. 27850Sstevel@tonic-gate# 27860Sstevel@tonic-gateget_proxyagent() 27870Sstevel@tonic-gate{ 27880Sstevel@tonic-gate LDAP_PROXYAGENT="cn=proxyagent,ou=profile,${LDAP_BASEDN}" # default 27890Sstevel@tonic-gate get_ans "Enter DN for proxy agent:" "$LDAP_PROXYAGENT" 27900Sstevel@tonic-gate LDAP_PROXYAGENT=$ANS 27910Sstevel@tonic-gate} 27920Sstevel@tonic-gate 27930Sstevel@tonic-gate 27940Sstevel@tonic-gate# 27950Sstevel@tonic-gate# get_proxy_pw(): Get the proxyagent passwd. 27960Sstevel@tonic-gate# 27970Sstevel@tonic-gateget_proxy_pw() 27980Sstevel@tonic-gate{ 27990Sstevel@tonic-gate get_passwd "Enter passwd for proxyagent:" 28000Sstevel@tonic-gate LDAP_PROXYAGENT_CRED=$ANS 28010Sstevel@tonic-gate} 28020Sstevel@tonic-gate 28030Sstevel@tonic-gate# 28040Sstevel@tonic-gate# display_summary(): Display a summary of values entered and let the 28050Sstevel@tonic-gate# user modify values at will. 28060Sstevel@tonic-gate# 28070Sstevel@tonic-gatedisplay_summary() 28080Sstevel@tonic-gate{ 28090Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In display_summary()" 28100Sstevel@tonic-gate 28110Sstevel@tonic-gate # Create lookup table for function names. First entry is dummy for 28120Sstevel@tonic-gate # shift. 28130Sstevel@tonic-gate TBL1="dummy" 28140Sstevel@tonic-gate TBL2="get_domain get_basedn get_profile_name" 28150Sstevel@tonic-gate TBL3="get_srv_list get_pref_srv get_search_scope get_cred_level" 28160Sstevel@tonic-gate TBL4="get_auth get_followref" 28170Sstevel@tonic-gate TBL5="get_timelimit get_sizelimit get_want_crypt" 28180Sstevel@tonic-gate TBL6="get_srv_authMethod_pam get_srv_authMethod_key get_srv_authMethod_cmd" 28190Sstevel@tonic-gate TBL7="get_srch_time get_prof_ttl get_bind_limit" 28208821SMichen.Chang@Sun.COM TBL8="get_want_shadow_update" 28218821SMichen.Chang@Sun.COM TBL9="prompt_ssd" 28228821SMichen.Chang@Sun.COM FUNC_TBL="$TBL1 $TBL2 $TBL3 $TBL4 $TBL5 $TBL6 $TBL7 $TBL8 $TBL9" 28230Sstevel@tonic-gate 28240Sstevel@tonic-gate # Since menu prompt string is long, set here. 28258821SMichen.Chang@Sun.COM _MENU_PROMPT="Enter config value to change: (1-20 0=commit changes)" 28260Sstevel@tonic-gate 28270Sstevel@tonic-gate # Infinite loop. Test for 0, and break in loop. 28280Sstevel@tonic-gate while : 28290Sstevel@tonic-gate do 28300Sstevel@tonic-gate # Display menu and get value in range. 28310Sstevel@tonic-gate display_msg summary_menu 28328821SMichen.Chang@Sun.COM get_menu_choice "${_MENU_PROMPT}" "0" "20" "0" 28330Sstevel@tonic-gate _CH=$MN_CH 28340Sstevel@tonic-gate 28350Sstevel@tonic-gate # Make sure where not exiting. 28360Sstevel@tonic-gate if [ $_CH -eq 0 ]; then 28370Sstevel@tonic-gate break # Break out of loop if 0 selected. 28380Sstevel@tonic-gate fi 28390Sstevel@tonic-gate 28400Sstevel@tonic-gate # Call appropriate function from function table. 28410Sstevel@tonic-gate set $FUNC_TBL 28420Sstevel@tonic-gate shift $_CH 28430Sstevel@tonic-gate $1 # Call the appropriate function. 28440Sstevel@tonic-gate done 28450Sstevel@tonic-gate 28460Sstevel@tonic-gate # If cred level is still see if user wants a change? 28470Sstevel@tonic-gate if ${ECHO} "$LDAP_CRED_LEVEL" | ${GREP} "proxy" > /dev/null 2>&1 28480Sstevel@tonic-gate then 28490Sstevel@tonic-gate if [ "$LDAP_AUTHMETHOD" != "none" ]; then 28500Sstevel@tonic-gate NEED_PROXY=1 # I assume integer test is faster? 28510Sstevel@tonic-gate get_proxyagent 28520Sstevel@tonic-gate get_proxy_pw 28530Sstevel@tonic-gate else 28540Sstevel@tonic-gate ${ECHO} "WARNING: Since Authentication method is 'none'." 28550Sstevel@tonic-gate ${ECHO} " Credential level will be set to 'anonymous'." 28560Sstevel@tonic-gate LDAP_CRED_LEVEL="anonymous" 28570Sstevel@tonic-gate fi 28580Sstevel@tonic-gate fi 28590Sstevel@tonic-gate 28608821SMichen.Chang@Sun.COM # If shadow update is enabled, set up administrator credential 28618821SMichen.Chang@Sun.COM if [ "$LDAP_ENABLE_SHADOW_UPDATE" = "TRUE" ]; then 28628821SMichen.Chang@Sun.COM NEED_ADMIN=1 28638821SMichen.Chang@Sun.COM if ${ECHO} "$LDAP_CRED_LEVEL" | ${GREP} "self" > /dev/null 2>&1; then 28648821SMichen.Chang@Sun.COM if ${ECHO} "$LDAP_AUTHMETHOD" | ${GREP} "GSSAPI" > /dev/null 2>&1; then 28658821SMichen.Chang@Sun.COM NEED_HOSTACL=1 28668821SMichen.Chang@Sun.COM NEED_ADMIN=0 28678821SMichen.Chang@Sun.COM fi 28688821SMichen.Chang@Sun.COM fi 28698821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "NEED_HOSTACL = $NEED_HOSTACL" 28708821SMichen.Chang@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "NEED_ADMIN = $NEED_ADMIN" 28718821SMichen.Chang@Sun.COM if [ $NEED_ADMIN -eq 1 ]; then 28728821SMichen.Chang@Sun.COM get_adminDN 28738821SMichen.Chang@Sun.COM get_admin_pw 28748821SMichen.Chang@Sun.COM fi 28758821SMichen.Chang@Sun.COM fi 28768821SMichen.Chang@Sun.COM 28770Sstevel@tonic-gate # Display FULL debugging info. 28780Sstevel@tonic-gate disp_full_debug 28790Sstevel@tonic-gate 28800Sstevel@tonic-gate # Final confirmation message. (ARE YOU SURE!) 28810Sstevel@tonic-gate ${ECHO} " " 28820Sstevel@tonic-gate get_confirm_nodef "WARNING: About to start committing changes. (y=continue, n=EXIT)" 28830Sstevel@tonic-gate if [ $? -eq 0 ]; then 28840Sstevel@tonic-gate ${ECHO} "Terminating setup without making changes at users request." 28852672Svl199446 cleanup 28860Sstevel@tonic-gate exit 1 28870Sstevel@tonic-gate fi 28880Sstevel@tonic-gate 28890Sstevel@tonic-gate # Print newline 28900Sstevel@tonic-gate ${ECHO} " " 28910Sstevel@tonic-gate} 28920Sstevel@tonic-gate 28930Sstevel@tonic-gate 28940Sstevel@tonic-gate# 28950Sstevel@tonic-gate# create_config_file(): Write config data to config file specified. 28960Sstevel@tonic-gate# 28970Sstevel@tonic-gatecreate_config_file() 28980Sstevel@tonic-gate{ 28990Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In create_config_file()" 29000Sstevel@tonic-gate 29010Sstevel@tonic-gate # If output file exists, delete it. 29020Sstevel@tonic-gate [ -f $OUTPUT_FILE ] && rm $OUTPUT_FILE 29030Sstevel@tonic-gate 29040Sstevel@tonic-gate # Create output file. 29050Sstevel@tonic-gate cat > $OUTPUT_FILE <<EOF 29060Sstevel@tonic-gate#!/bin/sh 29070Sstevel@tonic-gate# $OUTPUT_FILE - This file contains configuration information for 29080Sstevel@tonic-gate# Native LDAP. Use the idsconfig tool to load it. 29090Sstevel@tonic-gate# 29100Sstevel@tonic-gate# WARNING: This file was generated by idsconfig, and is intended to 29110Sstevel@tonic-gate# be loaded by idsconfig as is. DO NOT EDIT THIS FILE! 29120Sstevel@tonic-gate# 29130Sstevel@tonic-gateIDS_SERVER="$IDS_SERVER" 29140Sstevel@tonic-gateIDS_PORT=$IDS_PORT 29150Sstevel@tonic-gateIDS_TIMELIMIT=$IDS_TIMELIMIT 29160Sstevel@tonic-gateIDS_SIZELIMIT=$IDS_SIZELIMIT 29170Sstevel@tonic-gateLDAP_ROOTDN="$LDAP_ROOTDN" 29180Sstevel@tonic-gateLDAP_ROOTPWD=$LDAP_ROOTPWD 29190Sstevel@tonic-gateLDAP_DOMAIN="$LDAP_DOMAIN" 29200Sstevel@tonic-gateLDAP_SUFFIX="$LDAP_SUFFIX" 292110870SMilan.Jurik@Sun.COMGSSAPI_ENABLE=$GSSAPI_ENABLE 29222830SdjlLDAP_KRB_REALM="$LDAP_KRB_REALM" 29230Sstevel@tonic-gate 29240Sstevel@tonic-gate# Internal program variables that need to be set. 29250Sstevel@tonic-gateNEED_PROXY=$NEED_PROXY 29260Sstevel@tonic-gateNEED_TIME=$NEED_TIME 29270Sstevel@tonic-gateNEED_SIZE=$NEED_SIZE 29280Sstevel@tonic-gateNEED_CRYPT=$NEED_CRYPT 29298821SMichen.Chang@Sun.COMNEED_ADMIN=$NEED_ADMIN 29308821SMichen.Chang@Sun.COMNEED_HOSTACL=$NEED_HOSTACL 29318821SMichen.Chang@Sun.COMEXISTING_PROFILE=$EXISTING_PROFILE 29320Sstevel@tonic-gate 29330Sstevel@tonic-gate# LDAP PROFILE related defaults 29340Sstevel@tonic-gateLDAP_PROFILE_NAME="$LDAP_PROFILE_NAME" 29350Sstevel@tonic-gateDEL_OLD_PROFILE=1 29360Sstevel@tonic-gateLDAP_BASEDN="$LDAP_BASEDN" 29370Sstevel@tonic-gateLDAP_SERVER_LIST="$LDAP_SERVER_LIST" 29380Sstevel@tonic-gateLDAP_AUTHMETHOD="$LDAP_AUTHMETHOD" 29390Sstevel@tonic-gateLDAP_FOLLOWREF=$LDAP_FOLLOWREF 29400Sstevel@tonic-gateLDAP_SEARCH_SCOPE="$LDAP_SEARCH_SCOPE" 29410Sstevel@tonic-gateNEED_SRVAUTH_PAM=$NEED_SRVAUTH_PAM 29420Sstevel@tonic-gateNEED_SRVAUTH_KEY=$NEED_SRVAUTH_KEY 29430Sstevel@tonic-gateNEED_SRVAUTH_CMD=$NEED_SRVAUTH_CMD 29440Sstevel@tonic-gateLDAP_SRV_AUTHMETHOD_PAM="$LDAP_SRV_AUTHMETHOD_PAM" 29450Sstevel@tonic-gateLDAP_SRV_AUTHMETHOD_KEY="$LDAP_SRV_AUTHMETHOD_KEY" 29460Sstevel@tonic-gateLDAP_SRV_AUTHMETHOD_CMD="$LDAP_SRV_AUTHMETHOD_CMD" 29470Sstevel@tonic-gateLDAP_SEARCH_TIME_LIMIT=$LDAP_SEARCH_TIME_LIMIT 29480Sstevel@tonic-gateLDAP_PREF_SRVLIST="$LDAP_PREF_SRVLIST" 29490Sstevel@tonic-gateLDAP_PROFILE_TTL=$LDAP_PROFILE_TTL 29500Sstevel@tonic-gateLDAP_CRED_LEVEL="$LDAP_CRED_LEVEL" 29510Sstevel@tonic-gateLDAP_BIND_LIMIT=$LDAP_BIND_LIMIT 29520Sstevel@tonic-gate 29530Sstevel@tonic-gate# Proxy Agent 29540Sstevel@tonic-gateLDAP_PROXYAGENT="$LDAP_PROXYAGENT" 29550Sstevel@tonic-gateLDAP_PROXYAGENT_CRED=$LDAP_PROXYAGENT_CRED 29560Sstevel@tonic-gate 29578821SMichen.Chang@Sun.COM# enableShadowUpdate flag and Administrator credential 29588821SMichen.Chang@Sun.COMLDAP_ENABLE_SHADOW_UPDATE=$LDAP_ENABLE_SHADOW_UPDATE 29598821SMichen.Chang@Sun.COMLDAP_ADMINDN="$LDAP_ADMINDN" 29608821SMichen.Chang@Sun.COMLDAP_ADMIN_CRED=$LDAP_ADMIN_CRED 29618821SMichen.Chang@Sun.COM 29620Sstevel@tonic-gate# Export all the variables (just in case) 29630Sstevel@tonic-gateexport IDS_HOME IDS_PORT LDAP_ROOTDN LDAP_ROOTPWD LDAP_SERVER_LIST LDAP_BASEDN 29640Sstevel@tonic-gateexport LDAP_DOMAIN LDAP_SUFFIX LDAP_PROXYAGENT LDAP_PROXYAGENT_CRED 29650Sstevel@tonic-gateexport NEED_PROXY 29668821SMichen.Chang@Sun.COMexport LDAP_ENABLE_SHADOW_UPDATE LDAP_ADMINDN LDAP_ADMIN_CRED 29678821SMichen.Chang@Sun.COMexport NEED_ADMIN NEED_HOSTACL EXISTING_PROFILE 29680Sstevel@tonic-gateexport LDAP_PROFILE_NAME LDAP_BASEDN LDAP_SERVER_LIST 29690Sstevel@tonic-gateexport LDAP_AUTHMETHOD LDAP_FOLLOWREF LDAP_SEARCH_SCOPE LDAP_SEARCH_TIME_LIMIT 29700Sstevel@tonic-gateexport LDAP_PREF_SRVLIST LDAP_PROFILE_TTL LDAP_CRED_LEVEL LDAP_BIND_LIMIT 29710Sstevel@tonic-gateexport NEED_SRVAUTH_PAM NEED_SRVAUTH_KEY NEED_SRVAUTH_CMD 29720Sstevel@tonic-gateexport LDAP_SRV_AUTHMETHOD_PAM LDAP_SRV_AUTHMETHOD_KEY LDAP_SRV_AUTHMETHOD_CMD 297310870SMilan.Jurik@Sun.COMexport LDAP_SERV_SRCH_DES SSD_FILE GSSAPI_ENABLE LDAP_KRB_REALM 29740Sstevel@tonic-gate 29750Sstevel@tonic-gate# Service Search Descriptors start here if present: 29760Sstevel@tonic-gateEOF 29770Sstevel@tonic-gate # Add service search descriptors. 29780Sstevel@tonic-gate ssd_2_config "${OUTPUT_FILE}" 29790Sstevel@tonic-gate 29802672Svl199446 # Add LDAP suffix preferences 29812672Svl199446 print_suffix_config >> "${OUTPUT_FILE}" 29822672Svl199446 29830Sstevel@tonic-gate # Add the end of FILE tag. 29840Sstevel@tonic-gate ${ECHO} "" >> ${OUTPUT_FILE} 29850Sstevel@tonic-gate ${ECHO} "# End of $OUTPUT_FILE" >> ${OUTPUT_FILE} 29860Sstevel@tonic-gate} 29870Sstevel@tonic-gate 29880Sstevel@tonic-gate 29890Sstevel@tonic-gate# 29900Sstevel@tonic-gate# chk_vlv_indexes(): Do ldapsearch to see if server supports VLV. 29910Sstevel@tonic-gate# 29920Sstevel@tonic-gatechk_vlv_indexes() 29930Sstevel@tonic-gate{ 29940Sstevel@tonic-gate # Do ldapsearch to see if server supports VLV. 29950Sstevel@tonic-gate ${LDAPSEARCH} ${SERVER_ARGS} -b "" -s base "objectclass=*" > ${TMPDIR}/checkVLV 2>&1 29960Sstevel@tonic-gate eval "${GREP} 2.16.840.1.113730.3.4.9 ${TMPDIR}/checkVLV ${VERB}" 29970Sstevel@tonic-gate if [ $? -ne 0 ]; then 29980Sstevel@tonic-gate ${ECHO} "ERROR: VLV is not supported on LDAP server!" 29990Sstevel@tonic-gate cleanup 30000Sstevel@tonic-gate exit 1 30010Sstevel@tonic-gate fi 30020Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " VLV controls found on LDAP server." 30030Sstevel@tonic-gate} 30040Sstevel@tonic-gate 30050Sstevel@tonic-gate# 30060Sstevel@tonic-gate# get_backend(): this function gets the relevant backend 30070Sstevel@tonic-gate# (database) for LDAP_BASED. 30080Sstevel@tonic-gate# Description: set IDS_DATABASE; exit on failure. 30090Sstevel@tonic-gate# Prerequisite: LDAP_BASEDN and LDAP_SUFFIX are 30100Sstevel@tonic-gate# valid. 30110Sstevel@tonic-gate# 30120Sstevel@tonic-gate# backend is retrieved from suffixes and subsuffixes 30130Sstevel@tonic-gate# defined under "cn=mapping tree,cn=config". The 30140Sstevel@tonic-gate# nsslapd-state attribute of these suffixes entries 30150Sstevel@tonic-gate# is filled with either Backend, Disabled or referrals 30160Sstevel@tonic-gate# related values. We only want those that have a true 30170Sstevel@tonic-gate# backend database to select the relevant backend. 30180Sstevel@tonic-gate# 30190Sstevel@tonic-gateget_backend() 30200Sstevel@tonic-gate{ 30210Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_backend()" 30220Sstevel@tonic-gate 30230Sstevel@tonic-gate cur_suffix=${LDAP_BASEDN} 30240Sstevel@tonic-gate prev_suffix= 30250Sstevel@tonic-gate IDS_DATABASE= 30260Sstevel@tonic-gate while [ "${cur_suffix}" != "${prev_suffix}" ] 30270Sstevel@tonic-gate do 30280Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "testing LDAP suffix: ${cur_suffix}" 30290Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} " \ 30300Sstevel@tonic-gate "-b \"cn=\\\"${cur_suffix}\\\",cn=mapping tree,cn=config\" " \ 30310Sstevel@tonic-gate "-s base nsslapd-state=Backend nsslapd-backend 2>&1 " \ 30320Sstevel@tonic-gate "| ${GREP} 'nsslapd-backend=' " \ 30330Sstevel@tonic-gate "> ${TMPDIR}/ids_database_name 2>&1" 30340Sstevel@tonic-gate NUM_DBS=`wc -l ${TMPDIR}/ids_database_name | awk '{print $1}'` 30350Sstevel@tonic-gate case ${NUM_DBS} in 30360Sstevel@tonic-gate 0) # not a suffix, or suffix not activated; try next 30370Sstevel@tonic-gate prev_suffix=${cur_suffix} 30380Sstevel@tonic-gate cur_suffix=`${ECHO} ${cur_suffix} | cut -f2- -d','` 30390Sstevel@tonic-gate ;; 30400Sstevel@tonic-gate 1) # suffix found; get database name 30410Sstevel@tonic-gate IDS_DATABASE=`cat ${TMPDIR}/ids_database_name | cut -d= -f2` 30420Sstevel@tonic-gate ;; 30430Sstevel@tonic-gate *) # can not handle more than one database per suffix 30440Sstevel@tonic-gate ${ECHO} "ERROR: More than one database is configured " 30450Sstevel@tonic-gate ${ECHO} " for $LDAP_SUFFIX!" 30460Sstevel@tonic-gate ${ECHO} " $PROG can not configure suffixes where " 30470Sstevel@tonic-gate ${ECHO} " more than one database is used for one suffix." 30480Sstevel@tonic-gate cleanup 30490Sstevel@tonic-gate exit 1 30500Sstevel@tonic-gate ;; 30510Sstevel@tonic-gate esac 30520Sstevel@tonic-gate if [ -n "${IDS_DATABASE}" ]; then 30530Sstevel@tonic-gate break 30540Sstevel@tonic-gate fi 30550Sstevel@tonic-gate done 30560Sstevel@tonic-gate 30570Sstevel@tonic-gate if [ -z "${IDS_DATABASE}" ]; then 30580Sstevel@tonic-gate # should not happen, since LDAP_BASEDN is supposed to be valid 30590Sstevel@tonic-gate ${ECHO} "Could not find a valid backend for ${LDAP_BASEDN}." 30600Sstevel@tonic-gate ${ECHO} "Exiting." 30610Sstevel@tonic-gate cleanup 30620Sstevel@tonic-gate exit 1 30630Sstevel@tonic-gate fi 30640Sstevel@tonic-gate 30650Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "IDS_DATABASE: ${IDS_DATABASE}" 30660Sstevel@tonic-gate} 30670Sstevel@tonic-gate 30680Sstevel@tonic-gate# 30690Sstevel@tonic-gate# validate_suffix(): This function validates ${LDAP_SUFFIX} 30700Sstevel@tonic-gate# THIS FUNCTION IS FOR THE LOAD CONFIG FILE OPTION. 30710Sstevel@tonic-gate# 30720Sstevel@tonic-gatevalidate_suffix() 30730Sstevel@tonic-gate{ 30740Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In validate_suffix()" 30750Sstevel@tonic-gate 30760Sstevel@tonic-gate # Check LDAP_SUFFIX is not null 30770Sstevel@tonic-gate if [ -z "${LDAP_SUFFIX}" ]; then 30780Sstevel@tonic-gate ${ECHO} "Invalid suffix (null suffix)" 30790Sstevel@tonic-gate cleanup 30800Sstevel@tonic-gate exit 1 30810Sstevel@tonic-gate fi 30820Sstevel@tonic-gate 30830Sstevel@tonic-gate # Check LDAP_SUFFIX and LDAP_BASEDN are consistent 30840Sstevel@tonic-gate # Convert to lower case for basename. 30850Sstevel@tonic-gate format_string "${LDAP_BASEDN}" 30860Sstevel@tonic-gate LOWER_BASEDN="${FMT_STR}" 30870Sstevel@tonic-gate format_string "${LDAP_SUFFIX}" 30880Sstevel@tonic-gate LOWER_SUFFIX="${FMT_STR}" 30890Sstevel@tonic-gate 30900Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "LOWER_BASEDN: ${LOWER_BASEDN}" 30910Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "LOWER_SUFFIX: ${LOWER_SUFFIX}" 30920Sstevel@tonic-gate 30930Sstevel@tonic-gate if [ "${LOWER_BASEDN}" != "${LOWER_SUFFIX}" ]; then 30940Sstevel@tonic-gate sub_basedn=`basename "${LOWER_BASEDN}" "${LOWER_SUFFIX}"` 30950Sstevel@tonic-gate if [ "$sub_basedn" = "${LOWER_BASEDN}" ]; then 30960Sstevel@tonic-gate ${ECHO} "Invalid suffix ${LOWER_SUFFIX}" 30970Sstevel@tonic-gate ${ECHO} "for Base DN ${LOWER_BASEDN}" 30980Sstevel@tonic-gate cleanup 30990Sstevel@tonic-gate exit 1 31000Sstevel@tonic-gate fi 31010Sstevel@tonic-gate fi 31022672Svl199446 31032672Svl199446 # Check LDAP_SUFFIX does exist 31042672Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_SUFFIX}\" -s base \"objectclass=*\" > ${TMPDIR}/checkSuffix 2>&1" && return 0 31052672Svl199446 31062672Svl199446 # Well, suffix does not exist, try to prepare create it ... 31072672Svl199446 NEED_CREATE_SUFFIX=1 31082672Svl199446 prep_create_sfx_entry || 31092672Svl199446 { 31102672Svl199446 cleanup 31112672Svl199446 exit 1 31122672Svl199446 } 31132672Svl199446 [ -n "${NEED_CREATE_BACKEND}" ] && 31142672Svl199446 { 31152672Svl199446 # try to use id attr value of the suffix as a database name 31162672Svl199446 IDS_DATABASE=${_VAL} 31172672Svl199446 prep_create_sfx_backend 31182672Svl199446 case $? in 31192672Svl199446 1) # cann't use the name we want, so we can either exit or use 31202672Svl199446 # some another available name - doing the last ... 31212672Svl199446 IDS_DATABASE=${IDS_DATABASE_AVAIL} 31222672Svl199446 ;; 31232672Svl199446 2) # unable to determine database name 31242672Svl199446 cleanup 31252672Svl199446 exit 1 31262672Svl199446 ;; 31272672Svl199446 esac 31282672Svl199446 } 31292672Svl199446 31302672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "Suffix $LDAP_SUFFIX, Database $IDS_DATABASE" 31310Sstevel@tonic-gate} 31320Sstevel@tonic-gate 31330Sstevel@tonic-gate# 31340Sstevel@tonic-gate# validate_info(): This function validates the basic info collected 31350Sstevel@tonic-gate# So that some problems are caught right away. 31360Sstevel@tonic-gate# THIS FUNCTION IS FOR THE LOAD CONFIG FILE OPTION. 31370Sstevel@tonic-gate# 31380Sstevel@tonic-gatevalidate_info() 31390Sstevel@tonic-gate{ 31400Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In validate_info()" 31410Sstevel@tonic-gate 31420Sstevel@tonic-gate # Set SERVER_ARGS, AUTH_ARGS, and LDAP_ARGS for the config file. 31430Sstevel@tonic-gate SERVER_ARGS="-h ${IDS_SERVER} -p ${IDS_PORT}" 31440Sstevel@tonic-gate AUTH_ARGS="-D \"${LDAP_ROOTDN}\" -j ${LDAP_ROOTPWF}" 31450Sstevel@tonic-gate LDAP_ARGS="${SERVER_ARGS} ${AUTH_ARGS}" 31460Sstevel@tonic-gate export SERVER_ARGS 31470Sstevel@tonic-gate 31480Sstevel@tonic-gate # Check the Root DN and Root DN passwd. 31490Sstevel@tonic-gate # Use eval instead of $EVAL because not part of setup. (validate) 31500Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"\" -s base \"objectclass=*\" > ${TMPDIR}/checkDN 2>&1" 31510Sstevel@tonic-gate if [ $? -ne 0 ]; then 31520Sstevel@tonic-gate eval "${GREP} credential ${TMPDIR}/checkDN ${VERB}" 31530Sstevel@tonic-gate if [ $? -eq 0 ]; then 31540Sstevel@tonic-gate ${ECHO} "ERROR: Root DN passwd is invalid." 31550Sstevel@tonic-gate else 31560Sstevel@tonic-gate ${ECHO} "ERROR2: Invalid Root DN <${LDAP_ROOTDN}>." 31570Sstevel@tonic-gate fi 31580Sstevel@tonic-gate cleanup 31590Sstevel@tonic-gate exit 1 31600Sstevel@tonic-gate fi 31610Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " RootDN ... OK" 31620Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " RootDN passwd ... OK" 31630Sstevel@tonic-gate 31640Sstevel@tonic-gate # Check if the server supports the VLV. 31650Sstevel@tonic-gate chk_vlv_indexes 31660Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " VLV indexes ... OK" 31670Sstevel@tonic-gate 31680Sstevel@tonic-gate # Check LDAP suffix 31690Sstevel@tonic-gate validate_suffix 31700Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP suffix ... OK" 31710Sstevel@tonic-gate} 31720Sstevel@tonic-gate 31730Sstevel@tonic-gate# 31740Sstevel@tonic-gate# format_string(): take a string as argument and set FMT_STR 31750Sstevel@tonic-gate# to be the same string formatted as follow: 31760Sstevel@tonic-gate# - only lower case characters 31770Sstevel@tonic-gate# - no unnecessary spaces around , and = 31780Sstevel@tonic-gate# 31790Sstevel@tonic-gateformat_string() 31800Sstevel@tonic-gate{ 31810Sstevel@tonic-gate FMT_STR=`${ECHO} "$1" | tr '[A-Z]' '[a-z]' | 31820Sstevel@tonic-gate sed -e 's/[ ]*,[ ]*/,/g' -e 's/[ ]*=[ ]*/=/g'` 31830Sstevel@tonic-gate} 31840Sstevel@tonic-gate 31852672Svl199446# 31862672Svl199446# prepare for the suffix entry creation 31872672Svl199446# 31882672Svl199446# input : LDAP_BASEDN, LDAP_SUFFIX - base dn and suffix; 31892672Svl199446# in/out : LDAP_SUFFIX_OBJ, LDAP_SUFFIX_ACI - initially may come from config. 31902672Svl199446# output : NEED_CREATE_BACKEND - backend for this suffix needs to be created; 31912672Svl199446# _RDN, _ATT, _VAL - suffix's RDN, id attribute name and its value. 31922672Svl199446# return : 0 - success, otherwise error. 31932672Svl199446# 31942672Svl199446prep_create_sfx_entry() 31952672Svl199446{ 31962672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "In prep_create_sfx_entry()" 31972672Svl199446 31982672Svl199446 # check whether suffix corresponds to base dn 31992672Svl199446 format_string "${LDAP_BASEDN}" 32002672Svl199446 ${ECHO} ",${FMT_STR}" | ${GREP} ",${LDAP_SUFFIX}$" >/dev/null 2>&1 || 32012672Svl199446 { 32022672Svl199446 display_msg sfx_not_suitable 32032672Svl199446 return 1 32042672Svl199446 } 32052672Svl199446 32062672Svl199446 # parse LDAP_SUFFIX 32072672Svl199446 _RDN=`${ECHO} "${LDAP_SUFFIX}" | cut -d, -f1` 32082672Svl199446 _ATT=`${ECHO} "${_RDN}" | cut -d= -f1` 32092672Svl199446 _VAL=`${ECHO} "${_RDN}" | cut -d= -f2-` 32102672Svl199446 32112672Svl199446 # find out an objectclass for suffix entry if it is not defined yet 32122672Svl199446 [ -z "${LDAP_SUFFIX_OBJ}" ] && 32132672Svl199446 { 32142672Svl199446 get_objectclass ${_ATT} 32152672Svl199446 [ -z "${_ATTR_NAME}" ] && 32162672Svl199446 { 32172672Svl199446 display_msg obj_not_found 32182672Svl199446 return 1 32192672Svl199446 } 32202672Svl199446 LDAP_SUFFIX_OBJ=${_ATTR_NAME} 32212672Svl199446 } 32222672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "Suffix entry object is ${LDAP_SUFFIX_OBJ}" 32232672Svl199446 32242672Svl199446 # find out an aci for suffix entry if it is not defined yet 32252672Svl199446 [ -z "${LDAP_SUFFIX_ACI}" ] && 32262672Svl199446 { 32272672Svl199446 # set Directory Server default aci 32282672Svl199446 LDAP_SUFFIX_ACI=`cat <<EOF 32292672Svl199446aci: (targetattr != "userPassword || passwordHistory || passwordExpirationTime 32302672Svl199446 || passwordExpWarned || passwordRetryCount || retryCountResetTime || 32312672Svl199446 accountUnlockTime || passwordAllowChangeTime") 32322672Svl199446 ( 32332672Svl199446 version 3.0; 32342672Svl199446 acl "Anonymous access"; 32352672Svl199446 allow (read, search, compare) userdn = "ldap:///anyone"; 32362672Svl199446 ) 32372672Svl199446aci: (targetattr != "nsroledn || aci || nsLookThroughLimit || nsSizeLimit || 32382672Svl199446 nsTimeLimit || nsIdleTimeout || passwordPolicySubentry || 32392672Svl199446 passwordExpirationTime || passwordExpWarned || passwordRetryCount || 32402672Svl199446 retryCountResetTime || accountUnlockTime || passwordHistory || 32412672Svl199446 passwordAllowChangeTime") 32422672Svl199446 ( 32432672Svl199446 version 3.0; 32442672Svl199446 acl "Allow self entry modification except for some attributes"; 32452672Svl199446 allow (write) userdn = "ldap:///self"; 32462672Svl199446 ) 32472672Svl199446aci: (targetattr = "*") 32482672Svl199446 ( 32492672Svl199446 version 3.0; 32502672Svl199446 acl "Configuration Administrator"; 32512672Svl199446 allow (all) userdn = "ldap:///uid=admin,ou=Administrators, 32522672Svl199446 ou=TopologyManagement,o=NetscapeRoot"; 32532672Svl199446 ) 32542672Svl199446aci: (targetattr ="*") 32552672Svl199446 ( 32562672Svl199446 version 3.0; 32572672Svl199446 acl "Configuration Administrators Group"; 32582672Svl199446 allow (all) groupdn = "ldap:///cn=Configuration Administrators, 32592672Svl199446 ou=Groups,ou=TopologyManagement,o=NetscapeRoot"; 32602672Svl199446 ) 32612672Svl199446EOF 32622672Svl199446` 32632672Svl199446 } 32642672Svl199446 [ $DEBUG -eq 1 ] && cat <<EOF 32652672Svl199446DEBUG: ACI for ${LDAP_SUFFIX} is 32662672Svl199446${LDAP_SUFFIX_ACI} 32672672Svl199446EOF 32682672Svl199446 32692672Svl199446 NEED_CREATE_BACKEND= 32702672Svl199446 32712672Svl199446 # check the suffix mapping tree ... 32722672Svl199446 # if mapping exists, suffix should work, otherwise DS inconsistent 32732672Svl199446 # NOTE: -b 'cn=mapping tree,cn=config' -s one 'cn=\"$1\"' won't work 32742672Svl199446 # in case of 'cn' value in LDAP is not quoted by '"', 32752672Svl199446 # -b 'cn=\"$1\",cn=mapping tree,cn=config' works in all cases 32762672Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} \ 32772672Svl199446 -b 'cn=\"${LDAP_SUFFIX}\",cn=mapping tree,cn=config' \ 32782672Svl199446 -s base 'objectclass=*' dn ${VERB}" && 32792672Svl199446 { 32802672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "Suffix mapping already exists" 32812672Svl199446 # get_backend() either gets IDS_DATABASE or exits 32822672Svl199446 get_backend 32832672Svl199446 return 0 32842672Svl199446 } 32852672Svl199446 32862672Svl199446 # no suffix mapping, just in case check ldbm backends consistency - 32872672Svl199446 # there are must be NO any databases pointing to LDAP_SUFFIX 32882672Svl199446 [ -n "`${EVAL} \"${LDAPSEARCH} ${LDAP_ARGS} \ 32892672Svl199446 -b 'cn=ldbm database,cn=plugins,cn=config' \ 32902672Svl199446 -s one 'nsslapd-suffix=${LDAP_SUFFIX}' dn\" 2>/dev/null`" ] && 32912672Svl199446 { 32922672Svl199446 display_msg sfx_config_incons 32932672Svl199446 return 1 32942672Svl199446 } 32952672Svl199446 32962672Svl199446 # ok, no suffix mapping, no ldbm database 32972672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "DEBUG: backend needs to be created ..." 32982672Svl199446 NEED_CREATE_BACKEND=1 32992672Svl199446 return 0 33002672Svl199446} 33012672Svl199446 33022672Svl199446# 33032672Svl199446# prepare for the suffix backend creation 33042672Svl199446# 33052672Svl199446# input : IDS_DATABASE - requested ldbm db name (must be not null) 33062672Svl199446# in/out : IDS_DATABASE_AVAIL - available ldbm db name 33072672Svl199446# return : 0 - ldbm db name ok 33082672Svl199446# 1 - IDS_DATABASE exists, 33092672Svl199446# so IDS_DATABASE_AVAIL contains available name 33102672Svl199446# 2 - unable to find any available name 33112672Svl199446# 33122672Svl199446prep_create_sfx_backend() 33132672Svl199446{ 33142672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "In prep_create_sfx_backend()" 33152672Svl199446 33162672Svl199446 # check if requested name available 33172672Svl199446 [ "${IDS_DATABASE}" = "${IDS_DATABASE_AVAIL}" ] && return 0 33182672Svl199446 33192672Svl199446 # get the list of database names start with a requested name 33202672Svl199446 _LDBM_DBS=`${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} \ 33212672Svl199446 -b 'cn=ldbm database,cn=plugins,cn=config' \ 33222672Svl199446 -s one 'cn=${IDS_DATABASE}*' cn"` 2>/dev/null 33232672Svl199446 33242672Svl199446 # find available db name based on a requested name 33252672Svl199446 _i=""; _i_MAX=10 33262672Svl199446 while [ ${_i:-0} -lt ${_i_MAX} ] 33272672Svl199446 do 33282672Svl199446 _name="${IDS_DATABASE}${_i}" 33292672Svl199446 ${ECHO} "${_LDBM_DBS}" | ${GREP} -i "^cn=${_name}$" >/dev/null 2>&1 || 33302672Svl199446 { 33312672Svl199446 IDS_DATABASE_AVAIL="${_name}" 33322672Svl199446 break 33332672Svl199446 } 33342672Svl199446 _i=`expr ${_i:-0} + 1` 33352672Svl199446 done 33362672Svl199446 33372672Svl199446 [ "${IDS_DATABASE}" = "${IDS_DATABASE_AVAIL}" ] && return 0 33382672Svl199446 33392672Svl199446 [ -n "${IDS_DATABASE_AVAIL}" ] && 33402672Svl199446 { 33412672Svl199446 display_msg ldbm_db_exist 33422672Svl199446 return 1 33432672Svl199446 } 33442672Svl199446 33452672Svl199446 display_msg unable_find_db_name 33462672Svl199446 return 2 33472672Svl199446} 33482672Svl199446 33492672Svl199446# 33502672Svl199446# add suffix if needed, 33512672Svl199446# suffix entry and backend MUST be prepared by 33522672Svl199446# prep_create_sfx_entry and prep_create_sfx_backend correspondingly 33532672Svl199446# 33542672Svl199446# input : NEED_CREATE_SUFFIX, LDAP_SUFFIX, LDAP_SUFFIX_OBJ, _ATT, _VAL 33552672Svl199446# LDAP_SUFFIX_ACI, NEED_CREATE_BACKEND, IDS_DATABASE 33562672Svl199446# return : 0 - suffix successfully created, otherwise error occured 33572672Svl199446# 33582672Svl199446add_suffix() 33592672Svl199446{ 33602672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "In add_suffix()" 33612672Svl199446 33622672Svl199446 [ -n "${NEED_CREATE_SUFFIX}" ] || return 0 33632672Svl199446 33642672Svl199446 [ -n "${NEED_CREATE_BACKEND}" ] && 33652672Svl199446 { 33662672Svl199446 ${EVAL} "${LDAPADD} ${LDAP_ARGS} ${VERB}" <<EOF 33672672Svl199446dn: cn="${LDAP_SUFFIX}",cn=mapping tree,cn=config 33682672Svl199446objectclass: top 33692672Svl199446objectclass: extensibleObject 33702672Svl199446objectclass: nsMappingTree 33712672Svl199446cn: ${LDAP_SUFFIX} 33722672Svl199446nsslapd-state: backend 33732672Svl199446nsslapd-backend: ${IDS_DATABASE} 33742672Svl199446 33752672Svl199446dn: cn=${IDS_DATABASE},cn=ldbm database,cn=plugins,cn=config 33762672Svl199446objectclass: top 33772672Svl199446objectclass: extensibleObject 33782672Svl199446objectclass: nsBackendInstance 33792672Svl199446cn: ${IDS_DATABASE} 33802672Svl199446nsslapd-suffix: ${LDAP_SUFFIX} 33812672Svl199446EOF 33822672Svl199446 [ $? -ne 0 ] && 33832672Svl199446 { 33842672Svl199446 display_msg create_ldbm_db_error 33852672Svl199446 return 1 33862672Svl199446 } 33872672Svl199446 33882672Svl199446 ${ECHO} " ${STEP}. Database ${IDS_DATABASE} successfully created" 33892672Svl199446 STEP=`expr $STEP + 1` 33902672Svl199446 } 33912672Svl199446 33922672Svl199446 ${EVAL} "${LDAPADD} ${LDAP_ARGS} ${VERB}" <<EOF 33932672Svl199446dn: ${LDAP_SUFFIX} 33942672Svl199446objectclass: ${LDAP_SUFFIX_OBJ} 33952672Svl199446${_ATT}: ${_VAL} 33962672Svl199446${LDAP_SUFFIX_ACI} 33972672Svl199446EOF 33982672Svl199446 [ $? -ne 0 ] && 33992672Svl199446 { 34002672Svl199446 display_msg create_suffix_entry_error 34012672Svl199446 return 1 34022672Svl199446 } 34032672Svl199446 34042672Svl199446 ${ECHO} " ${STEP}. Suffix ${LDAP_SUFFIX} successfully created" 34052672Svl199446 STEP=`expr $STEP + 1` 34062672Svl199446 return 0 34072672Svl199446} 34082672Svl199446 34092672Svl199446# 34102672Svl199446# interactively get suffix and related info from a user 34112672Svl199446# 34122672Svl199446# input : LDAP_BASEDN - Base DN 34132672Svl199446# output : LDAP_SUFFIX - Suffix, _ATT, _VAL - id attribute and its value; 34142672Svl199446# LDAP_SUFFIX_OBJ, LDAP_SUFFIX_ACI - objectclass and aci; 34152672Svl199446# NEED_CREATE_BACKEND - tells whether backend needs to be created; 34162672Svl199446# IDS_DATABASE - prepared ldbm db name 34172672Svl199446# return : 0 - user gave a correct suffix 34182672Svl199446# 1 - suffix given by user cann't be created 34192672Svl199446# 34202672Svl199446get_suffix() 34212672Svl199446{ 34222672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "In get_suffix()" 34232672Svl199446 34242672Svl199446 while : 34252672Svl199446 do 34262672Svl199446 get_ans "Enter suffix to be created (b=back/h=help):" ${LDAP_BASEDN} 34272672Svl199446 case "${ANS}" in 34282672Svl199446 [Hh] | Help | help | \? ) display_msg create_suffix_help ;; 34292672Svl199446 [Bb] | Back | back | \< ) return 1 ;; 34302672Svl199446 * ) 34312672Svl199446 format_string "${ANS}" 34322672Svl199446 LDAP_SUFFIX=${FMT_STR} 34332672Svl199446 prep_create_sfx_entry || continue 34342672Svl199446 34352672Svl199446 [ -n "${NEED_CREATE_BACKEND}" ] && 34362672Svl199446 { 34372672Svl199446 IDS_DATABASE_AVAIL= # reset the available db name 34382672Svl199446 34392672Svl199446 reenter_suffix= 34402672Svl199446 while : 34412672Svl199446 do 34422672Svl199446 get_ans "Enter ldbm database name (b=back/h=help):" \ 34432672Svl199446 ${IDS_DATABASE_AVAIL:-${_VAL}} 34442672Svl199446 case "${ANS}" in 34452672Svl199446 [Hh] | \? ) display_msg enter_ldbm_db_help ;; 34462672Svl199446 [Bb] | \< ) reenter_suffix=1; break ;; 34472672Svl199446 * ) 34482672Svl199446 IDS_DATABASE="${ANS}" 34492672Svl199446 prep_create_sfx_backend && break 34502672Svl199446 esac 34512672Svl199446 done 34522672Svl199446 [ -n "${reenter_suffix}" ] && continue 34532672Svl199446 34542672Svl199446 [ $DEBUG -eq 1 ] && cat <<EOF 34552672Svl199446DEBUG: backend name for suffix ${LDAP_SUFFIX} will be ${IDS_DATABASE} 34562672Svl199446EOF 34572672Svl199446 } 34582672Svl199446 34592672Svl199446 # eventually everything is prepared 34602672Svl199446 return 0 34612672Svl199446 ;; 34622672Svl199446 esac 34632672Svl199446 done 34642672Svl199446} 34652672Svl199446 34662672Svl199446# 34672672Svl199446# print out a script which sets LDAP suffix related preferences 34682672Svl199446# 34692672Svl199446print_suffix_config() 34702672Svl199446{ 34712672Svl199446 cat <<EOF2 34722672Svl199446# LDAP suffix related preferences used only if needed 34734170Svl199446IDS_DATABASE="${IDS_DATABASE}" 34742672Svl199446LDAP_SUFFIX_OBJ="$LDAP_SUFFIX_OBJ" 34752672Svl199446LDAP_SUFFIX_ACI=\`cat <<EOF 34762672Svl199446${LDAP_SUFFIX_ACI} 34772672Svl199446EOF 34782672Svl199446\` 34792672Svl199446export IDS_DATABASE LDAP_SUFFIX_OBJ LDAP_SUFFIX_ACI 34802672Svl199446EOF2 34812672Svl199446} 34822672Svl199446 34830Sstevel@tonic-gate# 34840Sstevel@tonic-gate# check_basedn_suffix(): check that there is an existing 34850Sstevel@tonic-gate# valid suffix to hold current base DN 34860Sstevel@tonic-gate# return: 34872672Svl199446# 0: valid suffix found or new one should be created, 34882672Svl199446# NEED_CREATE_SUFFIX flag actually indicates that 34892672Svl199446# 1: some error occures 34900Sstevel@tonic-gate# 34910Sstevel@tonic-gatecheck_basedn_suffix() 34920Sstevel@tonic-gate{ 34930Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In check_basedn_suffix()" 34940Sstevel@tonic-gate 34952672Svl199446 NEED_CREATE_SUFFIX= 34962672Svl199446 34970Sstevel@tonic-gate # find out existing suffixes 34980Sstevel@tonic-gate discover_serv_suffix 34990Sstevel@tonic-gate 35000Sstevel@tonic-gate ${ECHO} " Validating LDAP Base DN and Suffix ..." 35010Sstevel@tonic-gate 35020Sstevel@tonic-gate # check that LDAP Base DN might be added 35030Sstevel@tonic-gate cur_ldap_entry=${LDAP_BASEDN} 35040Sstevel@tonic-gate prev_ldap_entry= 35050Sstevel@tonic-gate while [ "${cur_ldap_entry}" != "${prev_ldap_entry}" ] 35060Sstevel@tonic-gate do 35070Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "testing LDAP entry: ${cur_ldap_entry}" 35080Sstevel@tonic-gate ${LDAPSEARCH} ${SERVER_ARGS} -b "${cur_ldap_entry}" \ 35090Sstevel@tonic-gate -s one "objectclass=*" > /dev/null 2>&1 35100Sstevel@tonic-gate if [ $? -eq 0 ]; then 35110Sstevel@tonic-gate break 35120Sstevel@tonic-gate else 35130Sstevel@tonic-gate prev_ldap_entry=${cur_ldap_entry} 35140Sstevel@tonic-gate cur_ldap_entry=`${ECHO} ${cur_ldap_entry} | cut -f2- -d','` 35150Sstevel@tonic-gate fi 35160Sstevel@tonic-gate done 35170Sstevel@tonic-gate 35180Sstevel@tonic-gate if [ "${cur_ldap_entry}" = "${prev_ldap_entry}" ]; then 35192672Svl199446 ${ECHO} " No valid suffixes were found for Base DN ${LDAP_BASEDN}" 35202672Svl199446 35212672Svl199446 NEED_CREATE_SUFFIX=1 35222672Svl199446 return 0 35232672Svl199446 35240Sstevel@tonic-gate else 35250Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "found valid LDAP entry: ${cur_ldap_entry}" 35260Sstevel@tonic-gate 35270Sstevel@tonic-gate # Now looking for relevant suffix for this entry. 35280Sstevel@tonic-gate # LDAP_SUFFIX will then be used to add necessary 35290Sstevel@tonic-gate # base objects. See add_base_objects(). 35300Sstevel@tonic-gate format_string "${cur_ldap_entry}" 35310Sstevel@tonic-gate lower_entry="${FMT_STR}" 35320Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "final suffix list: ${LDAP_SUFFIX_LIST}" 35330Sstevel@tonic-gate oIFS=$IFS 35340Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "setting IFS to new line" 35350Sstevel@tonic-gate IFS=' 35360Sstevel@tonic-gate' 35370Sstevel@tonic-gate for suff in ${LDAP_SUFFIX_LIST} 35380Sstevel@tonic-gate do 35390Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "testing suffix: ${suff}" 35400Sstevel@tonic-gate format_string "${suff}" 35410Sstevel@tonic-gate lower_suff="${FMT_STR}" 35420Sstevel@tonic-gate if [ "${lower_entry}" = "${lower_suff}" ]; then 35430Sstevel@tonic-gate LDAP_SUFFIX="${suff}" 35440Sstevel@tonic-gate break 35450Sstevel@tonic-gate else 35460Sstevel@tonic-gate dcstmp=`basename "${lower_entry}" "${lower_suff}"` 35470Sstevel@tonic-gate if [ "${dcstmp}" = "${lower_entry}" ]; then 35480Sstevel@tonic-gate # invalid suffix, try next one 35490Sstevel@tonic-gate continue 35500Sstevel@tonic-gate else 35510Sstevel@tonic-gate # valid suffix found 35520Sstevel@tonic-gate LDAP_SUFFIX="${suff}" 35530Sstevel@tonic-gate break 35540Sstevel@tonic-gate fi 35550Sstevel@tonic-gate fi 35560Sstevel@tonic-gate done 35570Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "setting IFS to original value" 35580Sstevel@tonic-gate IFS=$oIFS 35590Sstevel@tonic-gate 35600Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "LDAP_SUFFIX: ${LDAP_SUFFIX}" 35610Sstevel@tonic-gate 35620Sstevel@tonic-gate if [ -z "${LDAP_SUFFIX}" ]; then 35630Sstevel@tonic-gate # should not happen, since we found the entry 35640Sstevel@tonic-gate ${ECHO} "Could not find a valid suffix for ${LDAP_BASEDN}." 35650Sstevel@tonic-gate ${ECHO} "Exiting." 35660Sstevel@tonic-gate return 1 35670Sstevel@tonic-gate fi 35680Sstevel@tonic-gate 35690Sstevel@tonic-gate # Getting relevant database (backend) 35700Sstevel@tonic-gate # IDS_DATABASE will then be used to create indexes. 35710Sstevel@tonic-gate get_backend 35720Sstevel@tonic-gate 35730Sstevel@tonic-gate return 0 35740Sstevel@tonic-gate fi 35750Sstevel@tonic-gate} 35760Sstevel@tonic-gate 35770Sstevel@tonic-gate# 35780Sstevel@tonic-gate# discover_serv_suffix(): This function queries the server to find 35790Sstevel@tonic-gate# suffixes available 35800Sstevel@tonic-gate# return: 0: OK, suffix found 35810Sstevel@tonic-gate# 1: suffix not determined 35820Sstevel@tonic-gatediscover_serv_suffix() 35830Sstevel@tonic-gate{ 35840Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In discover_serv_suffix()" 35850Sstevel@tonic-gate 35860Sstevel@tonic-gate # Search the server for the TOP of the TREE. 35870Sstevel@tonic-gate ${LDAPSEARCH} ${SERVER_ARGS} -b "" -s base "objectclass=*" > ${TMPDIR}/checkTOP 2>&1 35880Sstevel@tonic-gate ${GREP} -i namingcontexts ${TMPDIR}/checkTOP | \ 35890Sstevel@tonic-gate ${GREP} -i -v NetscapeRoot > ${TMPDIR}/treeTOP 35900Sstevel@tonic-gate NUM_TOP=`wc -l ${TMPDIR}/treeTOP | awk '{print $1}'` 35910Sstevel@tonic-gate case $NUM_TOP in 35920Sstevel@tonic-gate 0) 35932672Svl199446 [ $DEBUG -eq 1 ] && ${ECHO} "DEBUG: No suffix found in LDAP tree" 35940Sstevel@tonic-gate return 1 35950Sstevel@tonic-gate ;; 35960Sstevel@tonic-gate *) # build the list of suffixes; take out 'namingContexts=' in 35970Sstevel@tonic-gate # each line of ${TMPDIR}/treeTOP 35980Sstevel@tonic-gate LDAP_SUFFIX_LIST=`cat ${TMPDIR}/treeTOP | 35990Sstevel@tonic-gate awk '{ printf("%s\n",substr($0,16,length-15)) }'` 36000Sstevel@tonic-gate ;; 36010Sstevel@tonic-gate esac 36020Sstevel@tonic-gate 36030Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " LDAP_SUFFIX_LIST = $LDAP_SUFFIX_LIST" 36040Sstevel@tonic-gate return 0 36050Sstevel@tonic-gate} 36060Sstevel@tonic-gate 36070Sstevel@tonic-gate 36080Sstevel@tonic-gate# 36090Sstevel@tonic-gate# modify_cn(): Change the cn from MUST to MAY in ipNetwork. 36100Sstevel@tonic-gate# 36110Sstevel@tonic-gatemodify_cn() 36120Sstevel@tonic-gate{ 36130Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_cn()" 36140Sstevel@tonic-gate 36150Sstevel@tonic-gate ( cat <<EOF 36160Sstevel@tonic-gatedn: cn=schema 36170Sstevel@tonic-gatechangetype: modify 36180Sstevel@tonic-gateadd: objectclasses 36199285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork' DESC 'Standard LDAP objectclass' SUP top STRUCTURAL MUST ipNetworkNumber MAY ( ipNetmaskNumber $ manager $ cn $ l $ description ) X-ORIGIN 'RFC 2307' ) 36200Sstevel@tonic-gateEOF 36210Sstevel@tonic-gate) > ${TMPDIR}/ipNetwork_cn 36220Sstevel@tonic-gate 36230Sstevel@tonic-gate # Modify the cn for ipNetwork. 36240Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/ipNetwork_cn ${VERB}" 36250Sstevel@tonic-gate if [ $? -ne 0 ]; then 36260Sstevel@tonic-gate ${ECHO} " ERROR: update of cn for ipNetwork failed!" 36270Sstevel@tonic-gate cleanup 36280Sstevel@tonic-gate exit 1 36290Sstevel@tonic-gate fi 36300Sstevel@tonic-gate} 36310Sstevel@tonic-gate 36320Sstevel@tonic-gate 36330Sstevel@tonic-gate# modify_timelimit(): Modify timelimit to user value. 36340Sstevel@tonic-gatemodify_timelimit() 36350Sstevel@tonic-gate{ 36360Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_timelimit()" 36370Sstevel@tonic-gate 36380Sstevel@tonic-gate # Here doc to modify timelimit. 36390Sstevel@tonic-gate ( cat <<EOF 36400Sstevel@tonic-gatedn: cn=config 36410Sstevel@tonic-gatechangetype: modify 36420Sstevel@tonic-gatereplace: nsslapd-timelimit 36430Sstevel@tonic-gatensslapd-timelimit: ${IDS_TIMELIMIT} 36440Sstevel@tonic-gateEOF 36450Sstevel@tonic-gate) > ${TMPDIR}/ids_timelimit 36460Sstevel@tonic-gate 36470Sstevel@tonic-gate # Add the entry. 36480Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/ids_timelimit ${VERB}" 36490Sstevel@tonic-gate if [ $? -ne 0 ]; then 36500Sstevel@tonic-gate ${ECHO} " ERROR: update of nsslapd-timelimit failed!" 36510Sstevel@tonic-gate cleanup 36520Sstevel@tonic-gate exit 1 36530Sstevel@tonic-gate fi 36540Sstevel@tonic-gate 36550Sstevel@tonic-gate # Display messages for modifications made in patch. 36560Sstevel@tonic-gate ${ECHO} " ${STEP}. Changed timelimit to ${IDS_TIMELIMIT} in cn=config." 36570Sstevel@tonic-gate STEP=`expr $STEP + 1` 36580Sstevel@tonic-gate} 36590Sstevel@tonic-gate 36600Sstevel@tonic-gate 36610Sstevel@tonic-gate# modify_sizelimit(): Modify sizelimit to user value. 36620Sstevel@tonic-gatemodify_sizelimit() 36630Sstevel@tonic-gate{ 36640Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_sizelimit()" 36650Sstevel@tonic-gate 36660Sstevel@tonic-gate # Here doc to modify sizelimit. 36670Sstevel@tonic-gate ( cat <<EOF 36680Sstevel@tonic-gatedn: cn=config 36690Sstevel@tonic-gatechangetype: modify 36700Sstevel@tonic-gatereplace: nsslapd-sizelimit 36710Sstevel@tonic-gatensslapd-sizelimit: ${IDS_SIZELIMIT} 36720Sstevel@tonic-gateEOF 36730Sstevel@tonic-gate) > ${TMPDIR}/ids_sizelimit 36740Sstevel@tonic-gate 36750Sstevel@tonic-gate # Add the entry. 36760Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/ids_sizelimit ${VERB}" 36770Sstevel@tonic-gate if [ $? -ne 0 ]; then 36780Sstevel@tonic-gate ${ECHO} " ERROR: update of nsslapd-sizelimit failed!" 36790Sstevel@tonic-gate cleanup 36800Sstevel@tonic-gate exit 1 36810Sstevel@tonic-gate fi 36820Sstevel@tonic-gate 36830Sstevel@tonic-gate # Display messages for modifications made in patch. 36840Sstevel@tonic-gate ${ECHO} " ${STEP}. Changed sizelimit to ${IDS_SIZELIMIT} in cn=config." 36850Sstevel@tonic-gate STEP=`expr $STEP + 1` 36860Sstevel@tonic-gate} 36870Sstevel@tonic-gate 36880Sstevel@tonic-gate 36890Sstevel@tonic-gate# modify_pwd_crypt(): Modify the passwd storage scheme to support CRYPT. 36900Sstevel@tonic-gatemodify_pwd_crypt() 36910Sstevel@tonic-gate{ 36920Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_pwd_crypt()" 36930Sstevel@tonic-gate 36940Sstevel@tonic-gate # Here doc to modify passwordstoragescheme. 36950Sstevel@tonic-gate # IDS 5.2 moved passwordchangesceme off to a new data structure. 36960Sstevel@tonic-gate if [ $IDS_MAJVER -le 5 ] && [ $IDS_MINVER -le 1 ]; then 36970Sstevel@tonic-gate ( cat <<EOF 36980Sstevel@tonic-gatedn: cn=config 36990Sstevel@tonic-gatechangetype: modify 37000Sstevel@tonic-gatereplace: passwordstoragescheme 37010Sstevel@tonic-gatepasswordstoragescheme: crypt 37020Sstevel@tonic-gateEOF 37030Sstevel@tonic-gate ) > ${TMPDIR}/ids_crypt 37040Sstevel@tonic-gate else 37050Sstevel@tonic-gate ( cat <<EOF 37060Sstevel@tonic-gatedn: cn=Password Policy,cn=config 37070Sstevel@tonic-gatechangetype: modify 37080Sstevel@tonic-gatereplace: passwordstoragescheme 37090Sstevel@tonic-gatepasswordstoragescheme: crypt 37100Sstevel@tonic-gateEOF 37110Sstevel@tonic-gate ) > ${TMPDIR}/ids_crypt 37120Sstevel@tonic-gate fi 37130Sstevel@tonic-gate 37140Sstevel@tonic-gate # Add the entry. 37150Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/ids_crypt ${VERB}" 37160Sstevel@tonic-gate if [ $? -ne 0 ]; then 37170Sstevel@tonic-gate ${ECHO} " ERROR: update of passwordstoragescheme failed!" 37180Sstevel@tonic-gate cleanup 37190Sstevel@tonic-gate exit 1 37200Sstevel@tonic-gate fi 37210Sstevel@tonic-gate 37220Sstevel@tonic-gate # Display messages for modifications made in patch. 37230Sstevel@tonic-gate ${ECHO} " ${STEP}. Changed passwordstoragescheme to \"crypt\" in cn=config." 37240Sstevel@tonic-gate STEP=`expr $STEP + 1` 37250Sstevel@tonic-gate} 37260Sstevel@tonic-gate 37270Sstevel@tonic-gate 37280Sstevel@tonic-gate# 37290Sstevel@tonic-gate# add_eq_indexes(): Add indexes to improve search performance. 37300Sstevel@tonic-gate# 37310Sstevel@tonic-gateadd_eq_indexes() 37320Sstevel@tonic-gate{ 37330Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_eq_indexes()" 37340Sstevel@tonic-gate 37350Sstevel@tonic-gate # Set eq indexes to add. 37360Sstevel@tonic-gate _INDEXES="uidNumber ipNetworkNumber gidnumber oncrpcnumber automountKey" 37370Sstevel@tonic-gate 37382830Sdjl if [ -z "${IDS_DATABASE}" ]; then 37392830Sdjl get_backend 37402830Sdjl fi 37414170Svl199446 37420Sstevel@tonic-gate # Set _EXT to use as shortcut. 37430Sstevel@tonic-gate _EXT="cn=index,cn=${IDS_DATABASE},cn=ldbm database,cn=plugins,cn=config" 37440Sstevel@tonic-gate 37450Sstevel@tonic-gate # Display message to id current step. 37460Sstevel@tonic-gate ${ECHO} " ${STEP}. Processing eq,pres indexes:" 37470Sstevel@tonic-gate STEP=`expr $STEP + 1` 37480Sstevel@tonic-gate 37490Sstevel@tonic-gate # For loop to create indexes. 37500Sstevel@tonic-gate for i in ${_INDEXES}; do 37510Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " Adding index for ${i}" 37520Sstevel@tonic-gate 37530Sstevel@tonic-gate # Check if entry exists first, if so, skip to next. 37544170Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=${i},${_EXT}\" -s base \ 37554170Svl199446 \"objectclass=*\" > /dev/null 2>&1" 37560Sstevel@tonic-gate if [ $? -eq 0 ]; then 37570Sstevel@tonic-gate # Display index skipped. 37580Sstevel@tonic-gate ${ECHO} " ${i} (eq,pres) skipped already exists" 37590Sstevel@tonic-gate continue 37600Sstevel@tonic-gate fi 37610Sstevel@tonic-gate 37620Sstevel@tonic-gate # Here doc to create LDIF. 37630Sstevel@tonic-gate ( cat <<EOF 37640Sstevel@tonic-gatedn: cn=${i},${_EXT} 37650Sstevel@tonic-gateobjectClass: top 37660Sstevel@tonic-gateobjectClass: nsIndex 37670Sstevel@tonic-gatecn: ${i} 37680Sstevel@tonic-gatensSystemIndex: false 37690Sstevel@tonic-gatensIndexType: pres 37700Sstevel@tonic-gatensIndexType: eq 37710Sstevel@tonic-gateEOF 37720Sstevel@tonic-gate) > ${TMPDIR}/index_${i} 37730Sstevel@tonic-gate 37740Sstevel@tonic-gate # Add the index. 37750Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/index_${i} ${VERB}" 37760Sstevel@tonic-gate if [ $? -ne 0 ]; then 37770Sstevel@tonic-gate ${ECHO} " ERROR: Adding EQ,PRES index for ${i} failed!" 37780Sstevel@tonic-gate cleanup 37790Sstevel@tonic-gate exit 1 37800Sstevel@tonic-gate fi 37810Sstevel@tonic-gate 37820Sstevel@tonic-gate # Build date for task name. 37830Sstevel@tonic-gate _YR=`date '+%y'` 37840Sstevel@tonic-gate _MN=`date '+%m'` 37850Sstevel@tonic-gate _DY=`date '+%d'` 37860Sstevel@tonic-gate _H=`date '+%H'` 37870Sstevel@tonic-gate _M=`date '+%M'` 37880Sstevel@tonic-gate _S=`date '+%S'` 37890Sstevel@tonic-gate 37900Sstevel@tonic-gate # Build task name 37910Sstevel@tonic-gate TASKNAME="${i}_${_YR}_${_MN}_${_DY}_${_H}_${_M}_${_S}" 37920Sstevel@tonic-gate 37930Sstevel@tonic-gate # Build the task entry to add. 37940Sstevel@tonic-gate ( cat <<EOF 37950Sstevel@tonic-gatedn: cn=${TASKNAME}, cn=index, cn=tasks, cn=config 37960Sstevel@tonic-gatechangetype: add 37970Sstevel@tonic-gateobjectclass: top 37980Sstevel@tonic-gateobjectclass: extensibleObject 37990Sstevel@tonic-gatecn: ${TASKNAME} 38000Sstevel@tonic-gatensInstance: ${IDS_DATABASE} 38010Sstevel@tonic-gatensIndexAttribute: ${i} 38020Sstevel@tonic-gateEOF 38030Sstevel@tonic-gate) > ${TMPDIR}/task_${i} 38040Sstevel@tonic-gate 38050Sstevel@tonic-gate # Add the task. 38060Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/task_${i} ${VERB}" 38070Sstevel@tonic-gate if [ $? -ne 0 ]; then 38080Sstevel@tonic-gate ${ECHO} " ERROR: Adding task for ${i} failed!" 38090Sstevel@tonic-gate cleanup 38100Sstevel@tonic-gate exit 1 38110Sstevel@tonic-gate fi 38120Sstevel@tonic-gate 38130Sstevel@tonic-gate # Wait for task to finish, display current status. 38140Sstevel@tonic-gate while : 38150Sstevel@tonic-gate do 38164170Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} \ 38174170Svl199446 -b \"cn=${TASKNAME}, cn=index, cn=tasks, cn=config\" -s base \ 38184170Svl199446 \"objectclass=*\" nstaskstatus > \"${TMPDIR}/istask_${i}\" 2>&1" 38194170Svl199446 ${GREP} "${TASKNAME}" "${TMPDIR}/istask_${i}" > /dev/null 2>&1 38200Sstevel@tonic-gate if [ $? -ne 0 ]; then 38210Sstevel@tonic-gate break 38220Sstevel@tonic-gate fi 38234170Svl199446 TASK_STATUS=`${GREP} -i nstaskstatus "${TMPDIR}/istask_${i}" | 38244170Svl199446 head -1 | cut -d: -f2` 38250Sstevel@tonic-gate ${ECHO} " ${i} (eq,pres) $TASK_STATUS \r\c" 38260Sstevel@tonic-gate ${ECHO} "$TASK_STATUS" | ${GREP} "Finished" > /dev/null 2>&1 38270Sstevel@tonic-gate if [ $? -eq 0 ]; then 38280Sstevel@tonic-gate break 38290Sstevel@tonic-gate fi 38300Sstevel@tonic-gate sleep 2 38310Sstevel@tonic-gate done 38320Sstevel@tonic-gate 38330Sstevel@tonic-gate # Print newline because of \c. 38340Sstevel@tonic-gate ${ECHO} " " 38350Sstevel@tonic-gate done 38360Sstevel@tonic-gate} 38370Sstevel@tonic-gate 38380Sstevel@tonic-gate 38390Sstevel@tonic-gate# 38400Sstevel@tonic-gate# add_sub_indexes(): Add indexes to improve search performance. 38410Sstevel@tonic-gate# 38420Sstevel@tonic-gateadd_sub_indexes() 38430Sstevel@tonic-gate{ 38440Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_sub_indexes()" 38450Sstevel@tonic-gate 38460Sstevel@tonic-gate # Set eq indexes to add. 38470Sstevel@tonic-gate _INDEXES="ipHostNumber membernisnetgroup nisnetgrouptriple" 38480Sstevel@tonic-gate 38490Sstevel@tonic-gate # Set _EXT to use as shortcut. 38500Sstevel@tonic-gate _EXT="cn=index,cn=${IDS_DATABASE},cn=ldbm database,cn=plugins,cn=config" 38510Sstevel@tonic-gate 38520Sstevel@tonic-gate 38530Sstevel@tonic-gate # Display message to id current step. 38540Sstevel@tonic-gate ${ECHO} " ${STEP}. Processing eq,pres,sub indexes:" 38550Sstevel@tonic-gate STEP=`expr $STEP + 1` 38560Sstevel@tonic-gate 38570Sstevel@tonic-gate # For loop to create indexes. 38580Sstevel@tonic-gate for i in ${_INDEXES}; do 38590Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " Adding index for ${i}" 38600Sstevel@tonic-gate 38610Sstevel@tonic-gate # Check if entry exists first, if so, skip to next. 38624170Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=${i},${_EXT}\" \ 38634170Svl199446 -s base \"objectclass=*\" > /dev/null 2>&1" 38640Sstevel@tonic-gate if [ $? -eq 0 ]; then 38650Sstevel@tonic-gate # Display index skipped. 38660Sstevel@tonic-gate ${ECHO} " ${i} (eq,pres,sub) skipped already exists" 38670Sstevel@tonic-gate continue 38680Sstevel@tonic-gate fi 38690Sstevel@tonic-gate 38700Sstevel@tonic-gate # Here doc to create LDIF. 38710Sstevel@tonic-gate ( cat <<EOF 38720Sstevel@tonic-gatedn: cn=${i},${_EXT} 38730Sstevel@tonic-gateobjectClass: top 38740Sstevel@tonic-gateobjectClass: nsIndex 38750Sstevel@tonic-gatecn: ${i} 38760Sstevel@tonic-gatensSystemIndex: false 38770Sstevel@tonic-gatensIndexType: pres 38780Sstevel@tonic-gatensIndexType: eq 38790Sstevel@tonic-gatensIndexType: sub 38800Sstevel@tonic-gateEOF 38810Sstevel@tonic-gate) > ${TMPDIR}/index_${i} 38820Sstevel@tonic-gate 38830Sstevel@tonic-gate # Add the index. 38840Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/index_${i} ${VERB}" 38850Sstevel@tonic-gate if [ $? -ne 0 ]; then 38860Sstevel@tonic-gate ${ECHO} " ERROR: Adding EQ,PRES,SUB index for ${i} failed!" 38870Sstevel@tonic-gate cleanup 38880Sstevel@tonic-gate exit 1 38890Sstevel@tonic-gate fi 38900Sstevel@tonic-gate 38910Sstevel@tonic-gate # Build date for task name. 38920Sstevel@tonic-gate _YR=`date '+%y'` 38930Sstevel@tonic-gate _MN=`date '+%m'` 38940Sstevel@tonic-gate _DY=`date '+%d'` 38950Sstevel@tonic-gate _H=`date '+%H'` 38960Sstevel@tonic-gate _M=`date '+%M'` 38970Sstevel@tonic-gate _S=`date '+%S'` 38980Sstevel@tonic-gate 38990Sstevel@tonic-gate # Build task name 39000Sstevel@tonic-gate TASKNAME="${i}_${_YR}_${_MN}_${_DY}_${_H}_${_M}_${_S}" 39010Sstevel@tonic-gate 39020Sstevel@tonic-gate # Build the task entry to add. 39030Sstevel@tonic-gate ( cat <<EOF 39040Sstevel@tonic-gatedn: cn=${TASKNAME}, cn=index, cn=tasks, cn=config 39050Sstevel@tonic-gatechangetype: add 39060Sstevel@tonic-gateobjectclass: top 39070Sstevel@tonic-gateobjectclass: extensibleObject 39080Sstevel@tonic-gatecn: ${TASKNAME} 39090Sstevel@tonic-gatensInstance: ${IDS_DATABASE} 39100Sstevel@tonic-gatensIndexAttribute: ${i} 39110Sstevel@tonic-gateEOF 39120Sstevel@tonic-gate) > ${TMPDIR}/task_${i} 39130Sstevel@tonic-gate 39140Sstevel@tonic-gate # Add the task. 39150Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/task_${i} ${VERB}" 39160Sstevel@tonic-gate if [ $? -ne 0 ]; then 39170Sstevel@tonic-gate ${ECHO} " ERROR: Adding task for ${i} failed!" 39180Sstevel@tonic-gate cleanup 39190Sstevel@tonic-gate exit 1 39200Sstevel@tonic-gate fi 39210Sstevel@tonic-gate 39220Sstevel@tonic-gate # Wait for task to finish, display current status. 39230Sstevel@tonic-gate while : 39240Sstevel@tonic-gate do 39254170Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} \ 39264170Svl199446 -b \"cn=${TASKNAME}, cn=index, cn=tasks, cn=config\" -s base \ 39274170Svl199446 \"objectclass=*\" nstaskstatus > \"${TMPDIR}/istask_${i}\" 2>&1" 39284170Svl199446 ${GREP} "${TASKNAME}" "${TMPDIR}/istask_${i}" > /dev/null 2>&1 39290Sstevel@tonic-gate if [ $? -ne 0 ]; then 39300Sstevel@tonic-gate break 39310Sstevel@tonic-gate fi 39324170Svl199446 TASK_STATUS=`${GREP} -i nstaskstatus "${TMPDIR}/istask_${i}" | 39334170Svl199446 head -1 | cut -d: -f2` 39340Sstevel@tonic-gate ${ECHO} " ${i} (eq,pres,sub) $TASK_STATUS \r\c" 39350Sstevel@tonic-gate ${ECHO} "$TASK_STATUS" | ${GREP} "Finished" > /dev/null 2>&1 39360Sstevel@tonic-gate if [ $? -eq 0 ]; then 39370Sstevel@tonic-gate break 39380Sstevel@tonic-gate fi 39390Sstevel@tonic-gate sleep 2 39400Sstevel@tonic-gate done 39410Sstevel@tonic-gate 39420Sstevel@tonic-gate # Print newline because of \c. 39430Sstevel@tonic-gate ${ECHO} " " 39440Sstevel@tonic-gate done 39450Sstevel@tonic-gate} 39460Sstevel@tonic-gate 39470Sstevel@tonic-gate 39480Sstevel@tonic-gate# 39490Sstevel@tonic-gate# add_vlv_indexes(): Add VLV indexes to improve search performance. 39500Sstevel@tonic-gate# 39510Sstevel@tonic-gateadd_vlv_indexes() 39520Sstevel@tonic-gate{ 39530Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_vlv_indexes()" 39540Sstevel@tonic-gate 39550Sstevel@tonic-gate # Set eq indexes to add. 39560Sstevel@tonic-gate # Note semi colon separators because some filters contain colons 39570Sstevel@tonic-gate _INDEX1="${LDAP_DOMAIN}.getgrent;${LDAP_DOMAIN}_group_vlv_index;ou=group;objectClass=posixGroup" 39580Sstevel@tonic-gate _INDEX2="${LDAP_DOMAIN}.gethostent;${LDAP_DOMAIN}_hosts_vlv_index;ou=hosts;objectClass=ipHost" 39590Sstevel@tonic-gate _INDEX3="${LDAP_DOMAIN}.getnetent;${LDAP_DOMAIN}_networks_vlv_index;ou=networks;objectClass=ipNetwork" 39600Sstevel@tonic-gate _INDEX4="${LDAP_DOMAIN}.getpwent;${LDAP_DOMAIN}_passwd_vlv_index;ou=people;objectClass=posixAccount" 39610Sstevel@tonic-gate _INDEX5="${LDAP_DOMAIN}.getrpcent;${LDAP_DOMAIN}_rpc_vlv_index;ou=rpc;objectClass=oncRpc" 39620Sstevel@tonic-gate _INDEX6="${LDAP_DOMAIN}.getspent;${LDAP_DOMAIN}_shadow_vlv_index;ou=people;objectClass=shadowAccount" 39630Sstevel@tonic-gate 39640Sstevel@tonic-gate # Indexes added during NIS to LDAP transition 39650Sstevel@tonic-gate _INDEX7="${LDAP_DOMAIN}.getauhoent;${LDAP_DOMAIN}_auho_vlv_index;automountmapname=auto_home;objectClass=automount" 39660Sstevel@tonic-gate _INDEX8="${LDAP_DOMAIN}.getsoluent;${LDAP_DOMAIN}_solu_vlv_index;ou=people;objectClass=SolarisUserAttr" 39670Sstevel@tonic-gate _INDEX10="${LDAP_DOMAIN}.getauthent;${LDAP_DOMAIN}_auth_vlv_index;ou=SolarisAuthAttr;objectClass=SolarisAuthAttr" 39680Sstevel@tonic-gate _INDEX11="${LDAP_DOMAIN}.getexecent;${LDAP_DOMAIN}_exec_vlv_index;ou=SolarisProfAttr;&(objectClass=SolarisExecAttr)(SolarisKernelSecurityPolicy=*)" 39690Sstevel@tonic-gate _INDEX12="${LDAP_DOMAIN}.getprofent;${LDAP_DOMAIN}_prof_vlv_index;ou=SolarisProfAttr;&(objectClass=SolarisProfAttr)(SolarisAttrLongDesc=*)" 39700Sstevel@tonic-gate _INDEX13="${LDAP_DOMAIN}.getmailent;${LDAP_DOMAIN}_mail_vlv_index;ou=aliases;objectClass=mailGroup" 39710Sstevel@tonic-gate _INDEX14="${LDAP_DOMAIN}.getbootent;${LDAP_DOMAIN}__boot_vlv_index;ou=ethers;&(objectClass=bootableDevice)(bootParameter=*)" 39720Sstevel@tonic-gate _INDEX15="${LDAP_DOMAIN}.getethent;${LDAP_DOMAIN}_ethers_vlv_index;ou=ethers;&(objectClass=ieee802Device)(macAddress=*)" 39730Sstevel@tonic-gate _INDEX16="${LDAP_DOMAIN}.getngrpent;${LDAP_DOMAIN}_netgroup_vlv_index;ou=netgroup;objectClass=nisNetgroup" 39740Sstevel@tonic-gate _INDEX17="${LDAP_DOMAIN}.getipnent;${LDAP_DOMAIN}_ipn_vlv_index;ou=networks;&(objectClass=ipNetwork)(cn=*)" 39750Sstevel@tonic-gate _INDEX18="${LDAP_DOMAIN}.getmaskent;${LDAP_DOMAIN}_mask_vlv_index;ou=networks;&(objectClass=ipNetwork)(ipNetmaskNumber=*)" 39760Sstevel@tonic-gate _INDEX19="${LDAP_DOMAIN}.getprent;${LDAP_DOMAIN}_pr_vlv_index;ou=printers;objectClass=printerService" 39770Sstevel@tonic-gate _INDEX20="${LDAP_DOMAIN}.getip4ent;${LDAP_DOMAIN}_ip4_vlv_index;ou=hosts;&(objectClass=ipHost)(ipHostNumber=*.*)" 39780Sstevel@tonic-gate _INDEX21="${LDAP_DOMAIN}.getip6ent;${LDAP_DOMAIN}_ip6_vlv_index;ou=hosts;&(objectClass=ipHost)(ipHostNumber=*:*)" 39790Sstevel@tonic-gate 39800Sstevel@tonic-gate _INDEXES="$_INDEX1 $_INDEX2 $_INDEX3 $_INDEX4 $_INDEX5 $_INDEX6 $_INDEX7 $_INDEX8 $_INDEX9 $_INDEX10 $_INDEX11 $_INDEX12 $_INDEX13 $_INDEX14 $_INDEX15 $_INDEX16 $_INDEX17 $_INDEX18 $_INDEX19 $_INDEX20 $_INDEX21 " 39810Sstevel@tonic-gate 39820Sstevel@tonic-gate 39830Sstevel@tonic-gate # Set _EXT to use as shortcut. 39840Sstevel@tonic-gate _EXT="cn=${IDS_DATABASE},cn=ldbm database,cn=plugins,cn=config" 39850Sstevel@tonic-gate 39860Sstevel@tonic-gate 39870Sstevel@tonic-gate # Display message to id current step. 39880Sstevel@tonic-gate ${ECHO} " ${STEP}. Processing VLV indexes:" 39890Sstevel@tonic-gate STEP=`expr $STEP + 1` 39900Sstevel@tonic-gate 39910Sstevel@tonic-gate # Reset temp file for vlvindex commands. 39926842Sth160488 [ -f ${TMPDIR}/ds5_vlvindex_list ] && rm ${TMPDIR}/ds5_vlvindex_list 39936842Sth160488 touch ${TMPDIR}/ds5_vlvindex_list 39946842Sth160488 [ -f ${TMPDIR}/ds6_vlvindex_list ] && rm ${TMPDIR}/ds6_vlvindex_list 39956842Sth160488 touch ${TMPDIR}/ds6_vlvindex_list 39960Sstevel@tonic-gate 39970Sstevel@tonic-gate # Get the instance name from iDS server. 39980Sstevel@tonic-gate _INSTANCE="<server-instance>" # Default to old output. 39990Sstevel@tonic-gate 40000Sstevel@tonic-gate eval "${LDAPSEARCH} -v ${LDAP_ARGS} -b \"cn=config\" -s base \"objectclass=*\" nsslapd-instancedir | ${GREP} 'nsslapd-instancedir=' | cut -d'=' -f2- > ${TMPDIR}/instance_name 2>&1" 40010Sstevel@tonic-gate 40020Sstevel@tonic-gate ${GREP} "slapd-" ${TMPDIR}/instance_name > /dev/null 2>&1 # Check if seems right? 40030Sstevel@tonic-gate if [ $? -eq 0 ]; then # If success, grab name after "slapd-". 40040Sstevel@tonic-gate _INST_DIR=`cat ${TMPDIR}/instance_name` 40050Sstevel@tonic-gate _INSTANCE=`basename "${_INST_DIR}" | cut -d'-' -f2-` 40060Sstevel@tonic-gate fi 40070Sstevel@tonic-gate 40080Sstevel@tonic-gate # For loop to create indexes. 40090Sstevel@tonic-gate for p in ${_INDEXES}; do 40100Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} " Adding index for ${i}" 40110Sstevel@tonic-gate 40120Sstevel@tonic-gate # Break p (pair) into i and j parts. 40130Sstevel@tonic-gate i=`${ECHO} $p | cut -d';' -f1` 40140Sstevel@tonic-gate j=`${ECHO} $p | cut -d';' -f2` 40150Sstevel@tonic-gate k=`${ECHO} $p | cut -d';' -f3` 40160Sstevel@tonic-gate m=`${ECHO} $p | cut -d';' -f4` 40170Sstevel@tonic-gate 40180Sstevel@tonic-gate # Set _jEXT to use as shortcut. 40190Sstevel@tonic-gate _jEXT="cn=${j},${_EXT}" 40200Sstevel@tonic-gate 40210Sstevel@tonic-gate # Check if entry exists first, if so, skip to next. 40220Sstevel@tonic-gate ${LDAPSEARCH} ${SERVER_ARGS} -b "cn=${i},${_jEXT}" -s base "objectclass=*" > /dev/null 2>&1 40230Sstevel@tonic-gate if [ $? -eq 0 ]; then 40240Sstevel@tonic-gate # Display index skipped. 40250Sstevel@tonic-gate ${ECHO} " ${i} vlv_index skipped already exists" 40260Sstevel@tonic-gate continue 40270Sstevel@tonic-gate fi 40280Sstevel@tonic-gate 40290Sstevel@tonic-gate # Compute the VLV Scope from the LDAP_SEARCH_SCOPE. 40300Sstevel@tonic-gate # NOTE: A value of "base (0)" does not make sense. 40310Sstevel@tonic-gate case "$LDAP_SEARCH_SCOPE" in 40320Sstevel@tonic-gate sub) VLV_SCOPE="2" ;; 40330Sstevel@tonic-gate *) VLV_SCOPE="1" ;; 40340Sstevel@tonic-gate esac 40350Sstevel@tonic-gate 40360Sstevel@tonic-gate # Here doc to create LDIF. 40370Sstevel@tonic-gate ( cat <<EOF 40380Sstevel@tonic-gatedn: ${_jEXT} 40390Sstevel@tonic-gateobjectClass: top 40400Sstevel@tonic-gateobjectClass: vlvSearch 40410Sstevel@tonic-gatecn: ${j} 40420Sstevel@tonic-gatevlvbase: ${k},${LDAP_BASEDN} 40430Sstevel@tonic-gatevlvscope: ${VLV_SCOPE} 40440Sstevel@tonic-gatevlvfilter: (${m}) 40450Sstevel@tonic-gateaci: (target="ldap:///${_jEXT}")(targetattr="*")(version 3.0; acl "Config";allow(read,search,compare)userdn="ldap:///anyone";) 40460Sstevel@tonic-gate 40470Sstevel@tonic-gatedn: cn=${i},${_jEXT} 40480Sstevel@tonic-gatecn: ${i} 40490Sstevel@tonic-gatevlvSort: cn uid 40500Sstevel@tonic-gateobjectclass: top 40510Sstevel@tonic-gateobjectclass: vlvIndex 40520Sstevel@tonic-gateEOF 40530Sstevel@tonic-gate) > ${TMPDIR}/vlv_index_${i} 40540Sstevel@tonic-gate 40550Sstevel@tonic-gate # Add the index. 40560Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/vlv_index_${i} ${VERB}" 40570Sstevel@tonic-gate if [ $? -ne 0 ]; then 40580Sstevel@tonic-gate ${ECHO} " ERROR: Adding VLV index for ${i} failed!" 40590Sstevel@tonic-gate cleanup 40600Sstevel@tonic-gate exit 1 40610Sstevel@tonic-gate fi 40620Sstevel@tonic-gate 40630Sstevel@tonic-gate # Print message that index was created. 40640Sstevel@tonic-gate ${ECHO} " ${i} vlv_index Entry created" 40650Sstevel@tonic-gate 40660Sstevel@tonic-gate # Add command to list of vlvindex commands to run. 40676842Sth160488 ${ECHO} " directoryserver -s ${_INSTANCE} vlvindex -n ${IDS_DATABASE} -T ${i}" >> ${TMPDIR}/ds5_vlvindex_list 40686842Sth160488 ${ECHO} " <install-path>/bin/dsadm reindex -l -t ${i} <directory-instance-path> ${LDAP_SUFFIX}" >> ${TMPDIR}/ds6_vlvindex_list 40690Sstevel@tonic-gate done 40700Sstevel@tonic-gate} 40710Sstevel@tonic-gate 40720Sstevel@tonic-gate 40730Sstevel@tonic-gate# 40740Sstevel@tonic-gate# display_vlv_cmds(): Display VLV index commands to run on server. 40750Sstevel@tonic-gate# 40760Sstevel@tonic-gatedisplay_vlv_cmds() 40770Sstevel@tonic-gate{ 40786842Sth160488 if [ -s "${TMPDIR}/ds5_vlvindex_list" -o \ 40796842Sth160488 -s "${TMPDIR}/ds6_vlvindex_list" ]; then 40800Sstevel@tonic-gate display_msg display_vlv_list 40816842Sth160488 fi 40826842Sth160488 40836842Sth160488 if [ -s "${TMPDIR}/ds5_vlvindex_list" ]; then 40846842Sth160488 cat ${TMPDIR}/ds5_vlvindex_list 40856842Sth160488 fi 40866842Sth160488 40876842Sth160488 cat << EOF 40886842Sth160488 40896842Sth160488 40906842Sth160488EOF 40916842Sth160488 40926842Sth160488 if [ -s "${TMPDIR}/ds6_vlvindex_list" ]; then 40936842Sth160488 cat ${TMPDIR}/ds6_vlvindex_list 40940Sstevel@tonic-gate fi 40950Sstevel@tonic-gate} 40960Sstevel@tonic-gate 409710227SMilan.Jurik@Sun.COM# 409810227SMilan.Jurik@Sun.COM# keep_backward_compatibility(): Modify schema for the backward compatibility if 409910227SMilan.Jurik@Sun.COM# there are the incompatible attributes already 410010227SMilan.Jurik@Sun.COM# 410110227SMilan.Jurik@Sun.COMkeep_backward_compatibility() 410210227SMilan.Jurik@Sun.COM{ 410310227SMilan.Jurik@Sun.COM ${EVAL} "${LDAPSEARCH} ${SERVER_ARGS} -b cn=schema -s base \ 410410227SMilan.Jurik@Sun.COM \"objectclass=*\" attributeTypes | ${GREP} -i memberGid-oid ${VERB}" 410510227SMilan.Jurik@Sun.COM if [ $? -eq 0 ]; then 410610227SMilan.Jurik@Sun.COM ${SED} -e 's/1\.3\.6\.1\.4\.1\.42\.2\.27\.5\.1\.30\ /memberGid-oid\ /' \ 410710227SMilan.Jurik@Sun.COM ${TMPDIR}/schema_attr > ${TMPDIR}/schema_attr.new 410810227SMilan.Jurik@Sun.COM ${MV} ${TMPDIR}/schema_attr.new ${TMPDIR}/schema_attr 410910227SMilan.Jurik@Sun.COM fi 411010227SMilan.Jurik@Sun.COM 411110227SMilan.Jurik@Sun.COM ${EVAL} "${LDAPSEARCH} ${SERVER_ARGS} -b cn=schema -s base \ 411210227SMilan.Jurik@Sun.COM \"objectclass=*\" attributeTypes | ${GREP} -i rfc822mailMember-oid \ 411310227SMilan.Jurik@Sun.COM ${VERB}" 411410227SMilan.Jurik@Sun.COM if [ $? -eq 0 ]; then 411510227SMilan.Jurik@Sun.COM ${SED} -e \ 411610227SMilan.Jurik@Sun.COM 's/1\.3\.6\.1\.4\.1\.42\.2\.27\.2\.1\.15\ /rfc822mailMember-oid\ /' \ 411710227SMilan.Jurik@Sun.COM ${TMPDIR}/schema_attr > ${TMPDIR}/schema_attr.new 411810227SMilan.Jurik@Sun.COM ${MV} ${TMPDIR}/schema_attr.new ${TMPDIR}/schema_attr 411910227SMilan.Jurik@Sun.COM fi 412010227SMilan.Jurik@Sun.COM} 41210Sstevel@tonic-gate 41220Sstevel@tonic-gate# 41230Sstevel@tonic-gate# update_schema_attr(): Update Schema to support Naming. 41240Sstevel@tonic-gate# 41250Sstevel@tonic-gateupdate_schema_attr() 41260Sstevel@tonic-gate{ 41270Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In update_schema_attr()" 41280Sstevel@tonic-gate 41290Sstevel@tonic-gate ( cat <<EOF 41300Sstevel@tonic-gatedn: cn=schema 41310Sstevel@tonic-gatechangetype: modify 41320Sstevel@tonic-gateadd: attributetypes 41339285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.28 NAME 'nisPublickey' DESC 'NIS public key' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41349285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.29 NAME 'nisSecretkey' DESC 'NIS secret key' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41359285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.30 NAME 'nisDomain' DESC 'NIS domain' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41369285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.31 NAME 'automountMapName' DESC 'automount Map Name' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41379285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.32 NAME 'automountKey' DESC 'automount Key Value' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41389285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.1.1.1.33 NAME 'automountInformation' DESC 'automount information' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41399285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.1.1.12 NAME 'nisNetIdUser' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41409285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.1.1.13 NAME 'nisNetIdGroup' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41419285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.1.1.14 NAME 'nisNetIdHost' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41429285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.2.1.15 NAME 'rfc822mailMember' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41439285SMilan.Jurik@Sun.COMattributetypes: ( 2.16.840.1.113730.3.1.30 NAME 'mgrpRFC822MailMember' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41449285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.15 NAME 'SolarisLDAPServers' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41459285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.16 NAME 'SolarisSearchBaseDN' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE ) 41469285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.17 NAME 'SolarisCacheTTL' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41479285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.18 NAME 'SolarisBindDN' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE ) 41489285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.19 NAME 'SolarisBindPassword' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41499285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.20 NAME 'SolarisAuthMethod' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41509285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.21 NAME 'SolarisTransportSecurity' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41519285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.22 NAME 'SolarisCertificatePath' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41529285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.23 NAME 'SolarisCertificatePassword' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41539285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.24 NAME 'SolarisDataSearchDN' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41549285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.25 NAME 'SolarisSearchScope' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41559285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.26 NAME 'SolarisSearchTimeLimit' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 41569285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.27 NAME 'SolarisPreferredServer' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41579285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.28 NAME 'SolarisPreferredServerOnly' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41589285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.29 NAME 'SolarisSearchReferral' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41599285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.4 NAME 'SolarisAttrKeyValue' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41609285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.5 NAME 'SolarisAuditAlways' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41619285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.6 NAME 'SolarisAuditNever' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41629285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.7 NAME 'SolarisAttrShortDesc' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41639285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.8 NAME 'SolarisAttrLongDesc' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41649285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.9 NAME 'SolarisKernelSecurityPolicy' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41659285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.10 NAME 'SolarisProfileType' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41669285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.11 NAME 'SolarisProfileId' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41679285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.12 NAME 'SolarisUserQualifier' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41689285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.13 NAME 'SolarisAttrReserved1' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41699285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.14 NAME 'SolarisAttrReserved2' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41709285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.1 NAME 'SolarisProjectID' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 41719285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.2 NAME 'SolarisProjectName' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 41729285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.3 NAME 'SolarisProjectAttr' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41739285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.30 NAME 'memberGid' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41749285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.0 NAME 'defaultServerList' DESC 'Default LDAP server host address used by a DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41759285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.1 NAME 'defaultSearchBase' DESC 'Default LDAP base DN used by a DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 SINGLE-VALUE ) 41769285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.2 NAME 'preferredServerList' DESC 'Preferred LDAP server host addresses to be used by a DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41779285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.3 NAME 'searchTimeLimit' DESC 'Maximum time in seconds a DUA should allow for a search to complete' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 41789285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.4 NAME 'bindTimeLimit' DESC 'Maximum time in seconds a DUA should allow for the bind operation to complete' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 41799285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.5 NAME 'followReferrals' DESC 'Tells DUA if it should follow referrals returned by a DSA search result' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41809285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.6 NAME 'authenticationMethod' DESC 'A keystring which identifies the type of authentication method used to contact the DSA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41819285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.7 NAME 'profileTTL' DESC 'Time to live before a client DUA should re-read this configuration profile' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 41829285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.14 NAME 'serviceSearchDescriptor' DESC 'LDAP search descriptor list used by Naming-DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41839285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.9 NAME 'attributeMap' DESC 'Attribute mappings used by a Naming-DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41849285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.10 NAME 'credentialLevel' DESC 'Identifies type of credentials a DUA should use when binding to the LDAP server' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41859285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.11 NAME 'objectclassMap' DESC 'Objectclass mappings used by a Naming-DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41869285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.12 NAME 'defaultSearchScope' DESC 'Default search scope used by a DUA' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41870Sstevel@tonic-gateattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.13 NAME 'serviceCredentialLevel' DESC 'Search scope used by a service of the DUA' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) 41880Sstevel@tonic-gateattributetypes: ( 1.3.6.1.4.1.11.1.3.1.1.15 NAME 'serviceAuthenticationMethod' DESC 'Authentication Method used by a service of the DUA' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41899285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1140 NAME 'printer-uri' DESC 'A URI supported by this printer. This URI SHOULD be used as a relative distinguished name (RDN). If printer-xri-supported is implemented, then this URI value MUST be listed in a member value of printer-xri-supported.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41909285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1107 NAME 'printer-xri-supported' DESC 'The unordered list of XRI (extended resource identifiers) supported by this printer. Each member of the list consists of a URI (uniform resource identifier) followed by optional authentication and security metaparameters.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 41919285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1135 NAME 'printer-name' DESC 'The site-specific administrative name of this printer, more end-user friendly than a URI.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 41929285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1119 NAME 'printer-natural-language-configured' DESC 'The configured language in which error and status messages will be generated (by default) by this printer. Also, a possible language for printer string attributes set by operator, system administrator, or manufacturer. Also, the (declared) language of the "printer-name", "printer-location", "printer-info", and "printer-make-and-model" attributes of this printer. For example: "en-us" (US English) or "fr-fr" (French in France) Legal values of language tags conform to [RFC3066] "Tags for the Identification of Languages".' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 41939285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1136 NAME 'printer-location' DESC 'Identifies the location of the printer. This could include things like: "in Room 123A", "second floor of building XYZ".' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 41949285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1139 NAME 'printer-info' DESC 'Identifies the descriptive information about this printer. This could include things like: "This printer can be used for printing color transparencies for HR presentations", or "Out of courtesy for others, please print only small (1-5 page) jobs at this printer", or even "This printer is going away on July 1, 1997, please find a new printer".' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 41959285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1134 NAME 'printer-more-info' DESC 'A URI used to obtain more information about this specific printer. For example, this could be an HTTP type URI referencing an HTML page accessible to a Web Browser. The information obtained from this URI is intended for end user consumption.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 41969285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1138 NAME 'printer-make-and-model' DESC 'Identifies the make and model of the device. The device manufacturer MAY initially populate this attribute.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 41979285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1133 NAME 'printer-ipp-versions-supported' DESC 'Identifies the IPP protocol version(s) that this printer supports, including major and minor versions, i.e., the version numbers for which this Printer implementation meets the conformance requirements.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 41989285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1132 NAME 'printer-multiple-document-jobs-supported' DESC 'Indicates whether or not the printer supports more than one document per job, i.e., more than one Send-Document or Send-Data operation with document data.' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE ) 41999285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1109 NAME 'printer-charset-configured' DESC 'The configured charset in which error and status messages will be generated (by default) by this printer. Also, a possible charset for printer string attributes set by operator, system administrator, or manufacturer. For example: "utf-8" (ISO 10646/Unicode) or "iso-8859-1" (Latin1). Legal values are defined by the IANA Registry of Coded Character Sets and the "(preferred MIME name)" SHALL be used as the tag. For coherence with IPP Model, charset tags in this attribute SHALL be lowercase normalized. This attribute SHOULD be static (time of registration) and SHOULD NOT be dynamically refreshed attributetypes: (subsequently).' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} SINGLE-VALUE ) 42009285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1131 NAME 'printer-charset-supported' DESC 'Identifies the set of charsets supported for attribute type values of type Directory String for this directory entry. For example: "utf-8" (ISO 10646/Unicode) or "iso-8859-1" (Latin1). Legal values are defined by the IANA Registry of Coded Character Sets and the preferred MIME name.' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} ) 42019285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1137 NAME 'printer-generated-natural-language-supported' DESC 'Identifies the natural language(s) supported for this directory entry. For example: "en-us" (US English) or "fr-fr" (French in France). Legal values conform to [RFC3066], Tags for the Identification of Languages.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} ) 42029285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1130 NAME 'printer-document-format-supported' DESC 'The possible document formats in which data may be interpreted and printed by this printer. Legal values are MIME types come from the IANA Registry of Internet Media Types.' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42039285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1129 NAME 'printer-color-supported' DESC 'Indicates whether this printer is capable of any type of color printing at all, including highlight color.' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE ) 42049285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1128 NAME 'printer-compression-supported' DESC 'Compression algorithms supported by this printer. For example: "deflate, gzip". Legal values include; "none", "deflate" attributetypes: (public domain ZIP), "gzip" (GNU ZIP), "compress" (UNIX).' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} ) 42059285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1127 NAME 'printer-pages-per-minute' DESC 'The nominal number of pages per minute which may be output by this printer (e.g., a simplex or black-and-white printer). This attribute is informative, NOT a service guarantee. Typically, it is the value used in marketing literature to describe this printer.' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42069285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1126 NAME 'printer-pages-per-minute-color' DESC 'The nominal number of color pages per minute which may be output by this printer (e.g., a simplex or color printer). This attribute is informative, NOT a service guarantee. Typically, it is the value used in marketing literature to describe this printer.' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42079285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1125 NAME 'printer-finishings-supported' DESC 'The possible finishing operations supported by this printer. Legal values include; "none", "staple", "punch", "cover", "bind", "saddle-stitch", "edge-stitch", "staple-top-left", "staple-bottom-left", "staple-top-right", "staple-bottom-right", "edge-stitch-left", "edge-stitch-top", "edge-stitch-right", "edge-stitch-bottom", "staple-dual-left", "staple-dual-top", "staple-dual-right", "staple-dual-bottom".' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} ) 42089285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1124 NAME 'printer-number-up-supported' DESC 'The possible numbers of print-stream pages to impose upon a single side of an instance of a selected medium. Legal values include; 1, 2, and 4. Implementations may support other values.' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) 42099285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1123 NAME 'printer-sides-supported' DESC 'The number of impression sides (one or two) and the two-sided impression rotations supported by this printer. Legal values include; "one-sided", "two-sided-long-edge", "two-sided-short-edge".' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42109285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1122 NAME 'printer-media-supported' DESC 'The standard names/types/sizes (and optional color suffixes) of the media supported by this printer. For example: "iso-a4", "envelope", or "na-letter-white". Legal values conform to ISO 10175, Document Printing Application (DPA), and any IANA registered extensions.' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} ) 42119285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1117 NAME 'printer-media-local-supported' DESC 'Site-specific names of media supported by this printer, in the language in "printer-natural-language-configured". For example: "purchasing-form" (site-specific name) as opposed to (in "printer-media-supported"): "na-letter" (standard keyword from ISO 10175).' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} ) 42129285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1121 NAME 'printer-resolution-supported' DESC 'List of resolutions supported for printing documents by this printer. Each resolution value is a string with 3 fields: 1) Cross feed direction resolution (positive integer), 2) Feed direction resolution (positive integer), 3) Resolution unit. Legal values are "dpi" (dots per inch) and "dpcm" (dots per centimeter). Each resolution field is delimited by ">". For example: "300> 300> dpi>".' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} ) 42139285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1120 NAME 'printer-print-quality-supported' DESC 'List of print qualities supported for printing documents on this printer. For example: "draft, normal". Legal values include; "unknown", "draft", "normal", "high".' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42149285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1110 NAME 'printer-job-priority-supported' DESC 'Indicates the number of job priority levels supported. An IPP conformant printer which supports job priority must always support a full range of priorities from "1" to "100" (to ensure consistent behavior), therefore this attribute describes the "granularity". Legal values of this attribute are from "1" to "100".' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42159285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1118 NAME 'printer-copies-supported' DESC 'The maximum number of copies of a document that may be printed as a single job. A value of "0" indicates no maximum limit. A value of "-1" indicates unknown.' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42169285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1111 NAME 'printer-job-k-octets-supported' DESC 'The maximum size in kilobytes (1,024 octets actually) incoming print job that this printer will accept. A value of "0" indicates no maximum limit. A value of "-1" indicates unknown.' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) 42179285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1112 NAME 'printer-current-operator' DESC 'The name of the current human operator responsible for operating this printer. It is suggested that this string include information that would enable other humans to reach the operator, such as a phone number.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 42189285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1113 NAME 'printer-service-person' DESC 'The name of the current human service person responsible for servicing this printer. It is suggested that this string include information that would enable other humans to reach the service person, such as a phone number.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} SINGLE-VALUE ) 42199285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1114 NAME 'printer-delivery-orientation-supported' DESC 'The possible delivery orientations of pages as they are printed and ejected from this printer. Legal values include; "unknown", "face-up", and "face-down".' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42209285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1115 NAME 'printer-stacking-order-supported' DESC 'The possible stacking order of pages as they are printed and ejected from this printer. Legal values include; "unknown", "first-to-last", "last-to-first".' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42219285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1116 NAME 'printer-output-features-supported' DESC 'The possible output features supported by this printer. Legal values include; "unknown", "bursting", "decollating", "page-collating", "offset-stacking".' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42229285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.18.0.2.4.1108 NAME 'printer-aliases' DESC 'Site-specific administrative names of this printer in addition the printer name specified for printer-name.' EQUALITY caseIgnoreMatch ORDERING caseIgnoreOrderingMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} ) 42239285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.63 NAME 'sun-printer-bsdaddr' DESC 'Sets the server, print queue destination name and whether the client generates protocol extensions. "Solaris" specifies a Solaris print server extension. The value is represented by the following value: server "," destination ", Solaris".' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) 42249285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.64 NAME 'sun-printer-kvp' DESC 'This attribute contains a set of key value pairs which may have meaning to the print subsystem or may be user defined. Each value is represented by the following: key "=" value.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) 42250Sstevel@tonic-gateattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.57 NAME 'nisplusTimeZone' DESC 'tzone column from NIS+ timezone table' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 42269285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.67 NAME 'ipTnetTemplateName' DESC 'Trusted Solaris network template template_name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 42279285SMilan.Jurik@Sun.COMattributetypes: ( 1.3.6.1.4.1.42.2.27.5.1.68 NAME 'ipTnetNumber' DESC 'Trusted Solaris network template ip_address' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) 42280Sstevel@tonic-gateEOF 42290Sstevel@tonic-gate) > ${TMPDIR}/schema_attr 42300Sstevel@tonic-gate 423110227SMilan.Jurik@Sun.COM keep_backward_compatibility 423210227SMilan.Jurik@Sun.COM 42330Sstevel@tonic-gate # Add the entry. 42340Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/schema_attr ${VERB}" 42350Sstevel@tonic-gate if [ $? -ne 0 ]; then 42360Sstevel@tonic-gate ${ECHO} " ERROR: update of schema attributes failed!" 42370Sstevel@tonic-gate cleanup 42380Sstevel@tonic-gate exit 1 42390Sstevel@tonic-gate fi 42400Sstevel@tonic-gate 42410Sstevel@tonic-gate # Display message that schema is updated. 42420Sstevel@tonic-gate ${ECHO} " ${STEP}. Schema attributes have been updated." 42430Sstevel@tonic-gate STEP=`expr $STEP + 1` 42440Sstevel@tonic-gate} 42450Sstevel@tonic-gate 42460Sstevel@tonic-gate 42470Sstevel@tonic-gate# 42480Sstevel@tonic-gate# update_schema_obj(): Update the schema objectclass definitions. 42490Sstevel@tonic-gate# 42500Sstevel@tonic-gateupdate_schema_obj() 42510Sstevel@tonic-gate{ 42520Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In update_schema_obj()" 42530Sstevel@tonic-gate 42540Sstevel@tonic-gate # Add the objectclass definitions. 42550Sstevel@tonic-gate ( cat <<EOF 42560Sstevel@tonic-gatedn: cn=schema 42570Sstevel@tonic-gatechangetype: modify 42580Sstevel@tonic-gateadd: objectclasses 42599285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.1.1.2.14 NAME 'NisKeyObject' SUP top MUST ( cn $ nisPublickey $ nisSecretkey ) MAY ( uidNumber $ description ) ) 42600Sstevel@tonic-gate 42610Sstevel@tonic-gatedn: cn=schema 42620Sstevel@tonic-gatechangetype: modify 42630Sstevel@tonic-gateadd: objectclasses 42649285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.1.1.2.15 NAME 'nisDomainObject' SUP top MUST nisDomain ) 42650Sstevel@tonic-gate 42660Sstevel@tonic-gatedn: cn=schema 42670Sstevel@tonic-gatechangetype: modify 42680Sstevel@tonic-gateadd: objectclasses 42699285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.1.1.2.16 NAME 'automountMap' SUP top MUST automountMapName MAY description ) 42700Sstevel@tonic-gate 42710Sstevel@tonic-gatedn: cn=schema 42720Sstevel@tonic-gatechangetype: modify 42730Sstevel@tonic-gateadd: objectclasses 42749285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.1.1.2.17 NAME 'automount' SUP top MUST ( automountKey $ automountInformation ) MAY description ) 42750Sstevel@tonic-gate 42760Sstevel@tonic-gatedn: cn=schema 42770Sstevel@tonic-gatechangetype: modify 42780Sstevel@tonic-gateadd: objectclasses 42799285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.7 NAME 'SolarisNamingProfile' SUP top MUST ( cn $ SolarisLDAPservers $ SolarisSearchBaseDN ) MAY ( SolarisBindDN $ SolarisBindPassword $ SolarisAuthMethod $ SolarisTransportSecurity $ SolarisCertificatePath $ SolarisCertificatePassword $ SolarisDataSearchDN $ SolarisSearchScope $ SolarisSearchTimeLimit $ SolarisPreferredServer $ SolarisPreferredServerOnly $ SolarisCacheTTL $ SolarisSearchReferral ) ) 42800Sstevel@tonic-gate 42810Sstevel@tonic-gatedn: cn=schema 42820Sstevel@tonic-gatechangetype: modify 42830Sstevel@tonic-gateadd: objectclasses 42849285SMilan.Jurik@Sun.COMobjectclasses: ( 2.16.840.1.113730.3.2.4 NAME 'mailGroup' SUP top MUST mail MAY ( cn $ mgrpRFC822MailMember ) ) 42850Sstevel@tonic-gate 42860Sstevel@tonic-gatedn: cn=schema 42870Sstevel@tonic-gatechangetype: modify 42880Sstevel@tonic-gateadd: objectclasses 42899285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.1.2.5 NAME 'nisMailAlias' SUP top MUST cn MAY rfc822mailMember ) 42900Sstevel@tonic-gate 42910Sstevel@tonic-gatedn: cn=schema 42920Sstevel@tonic-gatechangetype: modify 42930Sstevel@tonic-gateadd: objectclasses 42949285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.1.2.6 NAME 'nisNetId' SUP top MUST cn MAY ( nisNetIdUser $ nisNetIdGroup $ nisNetIdHost ) ) 42950Sstevel@tonic-gate 42960Sstevel@tonic-gatedn: cn=schema 42970Sstevel@tonic-gatechangetype: modify 42980Sstevel@tonic-gateadd: objectclasses 42999285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.2 NAME 'SolarisAuditUser' SUP top AUXILIARY MAY ( SolarisAuditAlways $ SolarisAuditNever ) ) 43000Sstevel@tonic-gate 43010Sstevel@tonic-gatedn: cn=schema 43020Sstevel@tonic-gatechangetype: modify 43030Sstevel@tonic-gateadd: objectclasses 43049285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.3 NAME 'SolarisUserAttr' SUP top AUXILIARY MAY ( SolarisUserQualifier $ SolarisAttrReserved1 $ SolarisAttrReserved2 $ SolarisAttrKeyValue ) ) 43050Sstevel@tonic-gate 43060Sstevel@tonic-gatedn: cn=schema 43070Sstevel@tonic-gatechangetype: modify 43080Sstevel@tonic-gateadd: objectclasses 43099285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.4 NAME 'SolarisAuthAttr' SUP top MUST cn MAY ( SolarisAttrReserved1 $ SolarisAttrReserved2 $ SolarisAttrShortDesc $ SolarisAttrLongDesc $ SolarisAttrKeyValue ) ) 43100Sstevel@tonic-gate 43110Sstevel@tonic-gatedn: cn=schema 43120Sstevel@tonic-gatechangetype: modify 43130Sstevel@tonic-gateadd: objectclasses 43149285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.5 NAME 'SolarisProfAttr' SUP top MUST cn MAY ( SolarisAttrReserved1 $ SolarisAttrReserved2 $ SolarisAttrLongDesc $ SolarisAttrKeyValue ) ) 43150Sstevel@tonic-gate 43160Sstevel@tonic-gatedn: cn=schema 43170Sstevel@tonic-gatechangetype: modify 43180Sstevel@tonic-gateadd: objectclasses 43199285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.6 NAME 'SolarisExecAttr' SUP top AUXILIARY MAY ( SolarisKernelSecurityPolicy $ SolarisProfileType $ SolarisAttrReserved1 $ SolarisAttrReserved2 $ SolarisProfileID $ SolarisAttrKeyValue ) ) 43200Sstevel@tonic-gate 43210Sstevel@tonic-gatedn: cn=schema 43220Sstevel@tonic-gatechangetype: modify 43230Sstevel@tonic-gateadd: objectclasses 43249285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.1 NAME 'SolarisProject' SUP top MUST ( SolarisProjectID $ SolarisProjectName ) MAY ( memberUid $ memberGid $ description $ SolarisProjectAttr ) ) 43250Sstevel@tonic-gate 43260Sstevel@tonic-gatedn: cn=schema 43270Sstevel@tonic-gatechangetype: modify 43280Sstevel@tonic-gateadd: objectclasses 43299285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.11.1.3.1.2.4 NAME 'DUAConfigProfile' SUP top DESC 'Abstraction of a base configuration for a DUA' MUST cn MAY ( defaultServerList $ preferredServerList $ defaultSearchBase $ defaultSearchScope $ searchTimeLimit $ bindTimeLimit $ credentialLevel $ authenticationMethod $ followReferrals $ serviceSearchDescriptor $ serviceCredentialLevel $ serviceAuthenticationMethod $ objectclassMap $ attributeMap $ profileTTL ) ) 43300Sstevel@tonic-gate 43310Sstevel@tonic-gatedn: cn=schema 43320Sstevel@tonic-gatechangetype: modify 43330Sstevel@tonic-gateadd: objectclasses 43349285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.2549 NAME 'slpService' DESC 'DUMMY definition' SUP top MUST objectclass ) 43350Sstevel@tonic-gate 43360Sstevel@tonic-gatedn: cn=schema 43370Sstevel@tonic-gatechangetype: modify 43380Sstevel@tonic-gateadd: objectclasses 43399285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.254 NAME 'slpServicePrinter' DESC 'Service Location Protocol (SLP) information.' SUP slpService AUXILIARY ) 43400Sstevel@tonic-gate 43410Sstevel@tonic-gatedn: cn=schema 43420Sstevel@tonic-gatechangetype: modify 43430Sstevel@tonic-gateadd: objectclasses 43449285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.258 NAME 'printerAbstract' DESC 'Printer related information.' SUP top ABSTRACT MAY ( printer-name $ printer-natural-language-configured $ printer-location $ printer-info $ printer-more-info $ printer-make-and-model $ printer-multiple-document-jobs-supported $ printer-charset-configured $ printer-charset-supported $ printer-generated-natural-language-supported $ printer-document-format-supported $ printer-color-supported $ printer-compression-supported $ printer-pages-per-minute $ printer-pages-per-minute-color $ printer-finishings-supported $ printer-number-up-supported $ printer-sides-supported $ printer-media-supported $ printer-media-local-supported $ printer-resolution-supported $ printer-print-quality-supported $ printer-job-priority-supported $ printer-copies-supported $ printer-job-k-octets-supported $ printer-current-operator $ printer-service-person $ printer-delivery-orientation-supported $ printer-stacking-order-supported $ printer-output-features-supported ) ) 43450Sstevel@tonic-gate 43460Sstevel@tonic-gatedn: cn=schema 43470Sstevel@tonic-gatechangetype: modify 43480Sstevel@tonic-gateadd: objectclasses 43499285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.255 NAME 'printerService' DESC 'Printer information.' SUP printerAbstract STRUCTURAL MAY ( printer-uri $ printer-xri-supported ) ) 43500Sstevel@tonic-gate 43510Sstevel@tonic-gatedn: cn=schema 43520Sstevel@tonic-gatechangetype: modify 43530Sstevel@tonic-gateadd: objectclasses 43549285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.257 NAME 'printerServiceAuxClass' DESC 'Printer information.' SUP printerAbstract AUXILIARY MAY ( printer-uri $ printer-xri-supported ) ) 43550Sstevel@tonic-gate 43560Sstevel@tonic-gatedn: cn=schema 43570Sstevel@tonic-gatechangetype: modify 43580Sstevel@tonic-gateadd: objectclasses 43599285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.256 NAME 'printerIPP' DESC 'Internet Printing Protocol (IPP) information.' SUP top AUXILIARY MAY ( printer-ipp-versions-supported $ printer-multiple-document-jobs-supported ) ) 43600Sstevel@tonic-gate 43610Sstevel@tonic-gatedn: cn=schema 43620Sstevel@tonic-gatechangetype: modify 43630Sstevel@tonic-gateadd: objectclasses 43649285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.18.0.2.6.253 NAME 'printerLPR' DESC 'LPR information.' SUP top AUXILIARY MUST printer-name MAY printer-aliases ) 43650Sstevel@tonic-gate 43660Sstevel@tonic-gatedn: cn=schema 43670Sstevel@tonic-gatechangetype: modify 43680Sstevel@tonic-gateadd: objectclasses 43699285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.14 NAME 'sunPrinter' DESC 'Sun printer information' SUP top AUXILIARY MUST printer-name MAY ( sun-printer-bsdaddr $ sun-printer-kvp ) ) 43700Sstevel@tonic-gate 43710Sstevel@tonic-gatedn: cn=schema 43720Sstevel@tonic-gatechangetype: modify 43730Sstevel@tonic-gateadd: objectclasses 43749285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.12 NAME 'nisplusTimeZoneData' DESC 'NIS+ timezone table data' SUP top STRUCTURAL MUST cn MAY ( nisplusTimeZone $ description ) ) 43751676Sjpk 43761676Sjpkdn: cn=schema 43771676Sjpkchangetype: modify 43781676Sjpkadd: objectclasses 43799285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.8 NAME 'ipTnetTemplate' DESC 'Object class for TSOL network templates' SUP top MUST ipTnetTemplateName MAY SolarisAttrKeyValue ) 43801676Sjpk 43811676Sjpkdn: cn=schema 43821676Sjpkchangetype: modify 43831676Sjpkadd: objectclasses 43849285SMilan.Jurik@Sun.COMobjectclasses: ( 1.3.6.1.4.1.42.2.27.5.2.9 NAME 'ipTnetHost' DESC 'Associates an IP address or wildcard with a TSOL template_name' SUP top AUXILIARY MUST ipTnetNumber ) 43850Sstevel@tonic-gateEOF 43860Sstevel@tonic-gate) > ${TMPDIR}/schema_obj 43870Sstevel@tonic-gate 43880Sstevel@tonic-gate # Add the entry. 43890Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/schema_obj ${VERB}" 43900Sstevel@tonic-gate if [ $? -ne 0 ]; then 43910Sstevel@tonic-gate ${ECHO} " ERROR: update of schema objectclass definitions failed!" 43920Sstevel@tonic-gate cleanup 43930Sstevel@tonic-gate exit 1 43940Sstevel@tonic-gate fi 43950Sstevel@tonic-gate 43960Sstevel@tonic-gate # Display message that schema is updated. 43970Sstevel@tonic-gate ${ECHO} " ${STEP}. Schema objectclass definitions have been added." 43980Sstevel@tonic-gate STEP=`expr $STEP + 1` 43990Sstevel@tonic-gate} 44000Sstevel@tonic-gate 44010Sstevel@tonic-gate# 44020Sstevel@tonic-gate# modify_top_aci(): Modify the ACI for the top entry to disable self modify 44030Sstevel@tonic-gate# of user attributes. 44040Sstevel@tonic-gate# 44050Sstevel@tonic-gatemodify_top_aci() 44060Sstevel@tonic-gate{ 44070Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In modify_top_aci()" 44080Sstevel@tonic-gate 44090Sstevel@tonic-gate # Set ACI Name 44100Sstevel@tonic-gate ACI_NAME="LDAP_Naming_Services_deny_write_access" 44110Sstevel@tonic-gate 44120Sstevel@tonic-gate # Search for ACI_NAME 44130Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_top_aci 2>&1" 44140Sstevel@tonic-gate if [ $? -ne 0 ]; then 44150Sstevel@tonic-gate ${ECHO} "Error searching aci for ${LDAP_BASEDN}" 44160Sstevel@tonic-gate cat ${TMPDIR}/chk_top_aci 44170Sstevel@tonic-gate cleanup 44180Sstevel@tonic-gate exit 1 44190Sstevel@tonic-gate fi 44200Sstevel@tonic-gate ${GREP} "${ACI_NAME}" ${TMPDIR}/chk_top_aci > /dev/null 2>&1 44210Sstevel@tonic-gate if [ $? -eq 0 ]; then 44229576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. Top level ACI ${ACI_NAME} already exists for ${LDAP_BASEDN}." 44239576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 44249576SJulian.Pullen@Sun.COM return 0 44250Sstevel@tonic-gate fi 44260Sstevel@tonic-gate 44270Sstevel@tonic-gate # Crate LDIF for top level ACI. 44280Sstevel@tonic-gate ( cat <<EOF 44290Sstevel@tonic-gatedn: ${LDAP_BASEDN} 44300Sstevel@tonic-gatechangetype: modify 44310Sstevel@tonic-gateadd: aci 4432*12788Sgary.winiger@oracle.comaci: (targetattr = "cn||uid||uidNumber||gidNumber||homeDirectory||shadowLastChange||shadowMin||shadowMax||shadowWarning||shadowInactive||shadowExpire||shadowFlag||memberUid||SolarisAttrKeyValue||SolarisAttrReserved1||SolarisAttrReserved2||SolarisUserQualifier")(version 3.0; acl ${ACI_NAME}; deny (write) userdn = "ldap:///self";) 44330Sstevel@tonic-gate- 44340Sstevel@tonic-gateEOF 44350Sstevel@tonic-gate) > ${TMPDIR}/top_aci 44360Sstevel@tonic-gate 44370Sstevel@tonic-gate # Add the entry. 44380Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/top_aci ${VERB}" 44390Sstevel@tonic-gate if [ $? -ne 0 ]; then 44400Sstevel@tonic-gate ${ECHO} " ERROR: Modify of top level ACI failed! (restricts self modify)" 44410Sstevel@tonic-gate cleanup 44420Sstevel@tonic-gate exit 1 44430Sstevel@tonic-gate fi 44440Sstevel@tonic-gate 44459576SJulian.Pullen@Sun.COM # Display message that ACI is updated. 44468821SMichen.Chang@Sun.COM MSG="ACI for ${LDAP_BASEDN} modified to disable self modify." 44478821SMichen.Chang@Sun.COM if [ $EXISTING_PROFILE -eq 1 ];then 44488821SMichen.Chang@Sun.COM ${ECHO} " ACI SET: $MSG" 44498821SMichen.Chang@Sun.COM else 44508821SMichen.Chang@Sun.COM ${ECHO} " ${STEP}. $MSG" 44518821SMichen.Chang@Sun.COM STEP=`expr $STEP + 1` 44528821SMichen.Chang@Sun.COM fi 44530Sstevel@tonic-gate} 44540Sstevel@tonic-gate 44550Sstevel@tonic-gate# 44569576SJulian.Pullen@Sun.COM# find_and_delete_ACI(): Find an ACI in file $2 with a matching pattern $1. 44579576SJulian.Pullen@Sun.COM# Delete the ACI and print a message using $3 as the ACI name. $3 is needed 44589576SJulian.Pullen@Sun.COM# because it could have a different value than that of $1. 44599576SJulian.Pullen@Sun.COMfind_and_delete_ACI() 44609576SJulian.Pullen@Sun.COM{ 44619576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In find_and_delete_ACI" 44629576SJulian.Pullen@Sun.COM 44639576SJulian.Pullen@Sun.COM # if an ACI with pattern $1 exists in file $2, delete it from ${LDAP_BASEDN} 44649576SJulian.Pullen@Sun.COM ${EGREP} $1 $2 | ${SED} -e 's/aci=//' > ${TMPDIR}/grep_find_delete_aci 2>&1 44659576SJulian.Pullen@Sun.COM if [ -s ${TMPDIR}/grep_find_delete_aci ]; then 44669576SJulian.Pullen@Sun.COM aci_to_delete=`${CAT} ${TMPDIR}/grep_find_delete_aci` 44679576SJulian.Pullen@Sun.COM 44689576SJulian.Pullen@Sun.COM # Create the tmp file to delete the ACI. 44699576SJulian.Pullen@Sun.COM ( cat <<EOF 44709576SJulian.Pullen@Sun.COMdn: ${LDAP_BASEDN} 44719576SJulian.Pullen@Sun.COMchangetype: modify 44729576SJulian.Pullen@Sun.COMdelete: aci 44739576SJulian.Pullen@Sun.COMaci: ${aci_to_delete} 44749576SJulian.Pullen@Sun.COMEOF 44759576SJulian.Pullen@Sun.COM ) > ${TMPDIR}/find_delete_aci 44769576SJulian.Pullen@Sun.COM 44779576SJulian.Pullen@Sun.COM # Delete the ACI 44789576SJulian.Pullen@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/find_delete_aci ${VERB}" 44799576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 44809576SJulian.Pullen@Sun.COM ${ECHO} " ERROR: Remove of $3 ACI failed!" 44819576SJulian.Pullen@Sun.COM cleanup 44829576SJulian.Pullen@Sun.COM exit 1 44839576SJulian.Pullen@Sun.COM fi 44849576SJulian.Pullen@Sun.COM 44859576SJulian.Pullen@Sun.COM ${RM} -f ${TMPDIR}/find_delete_aci 44869576SJulian.Pullen@Sun.COM # Display message that an ACL is deleted. 44879576SJulian.Pullen@Sun.COM MSG="ACI $3 deleted." 44889576SJulian.Pullen@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 44899576SJulian.Pullen@Sun.COM ${ECHO} " ACI DELETED: $MSG" 44909576SJulian.Pullen@Sun.COM else 44919576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. $MSG" 44929576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 44939576SJulian.Pullen@Sun.COM fi 44949576SJulian.Pullen@Sun.COM fi 44959576SJulian.Pullen@Sun.COM} 44969576SJulian.Pullen@Sun.COM 44979576SJulian.Pullen@Sun.COM# 44989576SJulian.Pullen@Sun.COM# Add an ACI to deny non-admin access to shadow data when 44999576SJulian.Pullen@Sun.COM# shadow update is enabled. 45009576SJulian.Pullen@Sun.COM# 45019576SJulian.Pullen@Sun.COMdeny_non_admin_shadow_access() 45029576SJulian.Pullen@Sun.COM{ 45039576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In deny_non_admin_shadow_access()" 45049576SJulian.Pullen@Sun.COM 45059576SJulian.Pullen@Sun.COM # Set ACI Names 45069576SJulian.Pullen@Sun.COM ACI_TO_ADD="LDAP_Naming_Services_deny_non_admin_shadow_access" 45079576SJulian.Pullen@Sun.COM ACI_TO_DEL="LDAP_Naming_Services_deny_non_host_shadow_access" 45089576SJulian.Pullen@Sun.COM 45099576SJulian.Pullen@Sun.COM # Search for ACI_TO_ADD 45109576SJulian.Pullen@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_aci_non_admin 2>&1" 45119576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 45129576SJulian.Pullen@Sun.COM ${ECHO} "Error searching aci for ${LDAP_BASEDN}" 45139576SJulian.Pullen@Sun.COM cleanup 45149576SJulian.Pullen@Sun.COM exit 1 45159576SJulian.Pullen@Sun.COM fi 45169576SJulian.Pullen@Sun.COM 45179576SJulian.Pullen@Sun.COM # If an ACI with ${ACI_TO_ADD} already exists, we are done. 45189576SJulian.Pullen@Sun.COM ${EGREP} ${ACI_TO_ADD} ${TMPDIR}/chk_aci_non_admin 2>&1 > /dev/null 45199576SJulian.Pullen@Sun.COM if [ $? -eq 0 ]; then 45209576SJulian.Pullen@Sun.COM MSG="ACI ${ACI_TO_ADD} already set for ${LDAP_BASEDN}." 45219576SJulian.Pullen@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 45229576SJulian.Pullen@Sun.COM ${ECHO} " NOT SET: $MSG" 45239576SJulian.Pullen@Sun.COM else 45249576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. $MSG" 45259576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 45269576SJulian.Pullen@Sun.COM fi 45279576SJulian.Pullen@Sun.COM return 0 45289576SJulian.Pullen@Sun.COM fi 45299576SJulian.Pullen@Sun.COM 45309576SJulian.Pullen@Sun.COM # The deny_non_admin_shadow_access and deny_non_host_shadow_access ACIs 45319576SJulian.Pullen@Sun.COM # should be mutually exclusive, so if the latter exists, delete it. 45329576SJulian.Pullen@Sun.COM find_and_delete_ACI ${ACI_TO_DEL} ${TMPDIR}/chk_aci_non_admin ${ACI_TO_DEL} 45339576SJulian.Pullen@Sun.COM 45349576SJulian.Pullen@Sun.COM # Create the tmp file to add. 45359576SJulian.Pullen@Sun.COM ( cat <<EOF 45369576SJulian.Pullen@Sun.COMdn: ${LDAP_BASEDN} 45379576SJulian.Pullen@Sun.COMchangetype: modify 45389576SJulian.Pullen@Sun.COMadd: aci 45399576SJulian.Pullen@Sun.COMaci: (target="ldap:///${LDAP_BASEDN}")(targetattr = "shadowLastChange|| 45409576SJulian.Pullen@Sun.COM shadowMin|| shadowMax||shadowWarning||shadowInactive||shadowExpire|| 45419576SJulian.Pullen@Sun.COM shadowFlag||userPassword") (version 3.0; acl ${ACI_TO_ADD}; 45429576SJulian.Pullen@Sun.COM deny (write,read,search,compare) userdn != "ldap:///${LDAP_ADMINDN}";) 45439576SJulian.Pullen@Sun.COMEOF 45449576SJulian.Pullen@Sun.COM) > ${TMPDIR}/non_admin_aci_write 45459576SJulian.Pullen@Sun.COM 45469576SJulian.Pullen@Sun.COM # Add the entry. 45479576SJulian.Pullen@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/non_admin_aci_write ${VERB}" 45489576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 45499576SJulian.Pullen@Sun.COM ${ECHO} " ERROR: Adding ACI ${ACI_TO_ADD} failed!" 45509576SJulian.Pullen@Sun.COM ${CAT} ${TMPDIR}/non_admin_aci_write 45519576SJulian.Pullen@Sun.COM cleanup 45529576SJulian.Pullen@Sun.COM exit 1 45539576SJulian.Pullen@Sun.COM fi 45549576SJulian.Pullen@Sun.COM 45559576SJulian.Pullen@Sun.COM ${RM} -f ${TMPDIR}/non_admin_aci_write 45569576SJulian.Pullen@Sun.COM # Display message that the non-admin access to shadow data is denied. 45579576SJulian.Pullen@Sun.COM MSG="Non-Admin access to shadow data denied." 45589576SJulian.Pullen@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 45599576SJulian.Pullen@Sun.COM ${ECHO} " ACI SET: $MSG" 45609576SJulian.Pullen@Sun.COM else 45619576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. $MSG" 45629576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 45639576SJulian.Pullen@Sun.COM fi 45649576SJulian.Pullen@Sun.COM} 45659576SJulian.Pullen@Sun.COM 45669576SJulian.Pullen@Sun.COM# 45679576SJulian.Pullen@Sun.COM# Add an ACI to deny non-host access to shadow data when 45689576SJulian.Pullen@Sun.COM# shadow update is enabled and auth Method if gssapi. 45699576SJulian.Pullen@Sun.COM# 45709576SJulian.Pullen@Sun.COMdeny_non_host_shadow_access() 45719576SJulian.Pullen@Sun.COM{ 45729576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In deny_non_host_shadow_access()" 45739576SJulian.Pullen@Sun.COM 45749576SJulian.Pullen@Sun.COM # Set ACI Names 45759576SJulian.Pullen@Sun.COM ACI_TO_ADD="LDAP_Naming_Services_deny_non_host_shadow_access" 45769576SJulian.Pullen@Sun.COM ACI_TO_DEL="LDAP_Naming_Services_deny_non_admin_shadow_access" 45779576SJulian.Pullen@Sun.COM 45789576SJulian.Pullen@Sun.COM # Search for ACI_TO_ADD 45799576SJulian.Pullen@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_aci_non_host 2>&1" 45809576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 45819576SJulian.Pullen@Sun.COM ${ECHO} "Error searching aci for ${LDAP_BASEDN}" 45829576SJulian.Pullen@Sun.COM cleanup 45839576SJulian.Pullen@Sun.COM exit 1 45849576SJulian.Pullen@Sun.COM fi 45859576SJulian.Pullen@Sun.COM 45869576SJulian.Pullen@Sun.COM # If an ACI with ${ACI_TO_ADD} already exists, we are done. 45879576SJulian.Pullen@Sun.COM ${EGREP} ${ACI_TO_ADD} ${TMPDIR}/chk_aci_non_host 2>&1 > /dev/null 45889576SJulian.Pullen@Sun.COM if [ $? -eq 0 ]; then 45899576SJulian.Pullen@Sun.COM MSG="ACI ${ACI_TO_ADD} already set for ${LDAP_BASEDN}." 45909576SJulian.Pullen@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 45919576SJulian.Pullen@Sun.COM ${ECHO} " NOT SET: $MSG" 45929576SJulian.Pullen@Sun.COM else 45939576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. $MSG" 45949576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 45959576SJulian.Pullen@Sun.COM fi 45969576SJulian.Pullen@Sun.COM return 0 45979576SJulian.Pullen@Sun.COM fi 45989576SJulian.Pullen@Sun.COM 45999576SJulian.Pullen@Sun.COM # The deny_non_admin_shadow_access and deny_non_host_shadow_access ACIs 46009576SJulian.Pullen@Sun.COM # should be mutually exclusive, so if the former exists, delete it. 46019576SJulian.Pullen@Sun.COM find_and_delete_ACI ${ACI_TO_DEL} ${TMPDIR}/chk_aci_non_host ${ACI_TO_DEL} 46029576SJulian.Pullen@Sun.COM 46039576SJulian.Pullen@Sun.COM # Create the tmp file to add. 46049576SJulian.Pullen@Sun.COM ( cat <<EOF 46059576SJulian.Pullen@Sun.COMdn: ${LDAP_BASEDN} 46069576SJulian.Pullen@Sun.COMchangetype: modify 46079576SJulian.Pullen@Sun.COMadd: aci 46089576SJulian.Pullen@Sun.COMaci: (target="ldap:///${LDAP_BASEDN}")(targetattr = "shadowLastChange|| 46099576SJulian.Pullen@Sun.COM shadowMin|| shadowMax||shadowWarning||shadowInactive||shadowExpire|| 46109576SJulian.Pullen@Sun.COM shadowFlag||userPassword") (version 3.0; acl ${ACI_TO_ADD}; 46119576SJulian.Pullen@Sun.COM deny (write,read,search,compare) 46129576SJulian.Pullen@Sun.COM userdn != "ldap:///cn=*+ipHostNumber=*,ou=Hosts,${LDAP_BASEDN}";) 46139576SJulian.Pullen@Sun.COMEOF 46149576SJulian.Pullen@Sun.COM) > ${TMPDIR}/non_host_aci_write 46159576SJulian.Pullen@Sun.COM 46169576SJulian.Pullen@Sun.COM # Add the entry. 46179576SJulian.Pullen@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/non_host_aci_write ${VERB}" 46189576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 46199576SJulian.Pullen@Sun.COM ${ECHO} " ERROR: Adding ACI ${ACI_TO_ADD} failed!" 46209576SJulian.Pullen@Sun.COM ${CAT} ${TMPDIR}/non_host_aci_write 46219576SJulian.Pullen@Sun.COM cleanup 46229576SJulian.Pullen@Sun.COM exit 1 46239576SJulian.Pullen@Sun.COM fi 46249576SJulian.Pullen@Sun.COM 46259576SJulian.Pullen@Sun.COM ${RM} -f ${TMPDIR}/non_host_aci_write 46269576SJulian.Pullen@Sun.COM # Display message that the non-host access to shadow data is denied. 46279576SJulian.Pullen@Sun.COM MSG="Non-host access to shadow data is denied." 46289576SJulian.Pullen@Sun.COM if [ $EXISTING_PROFILE -eq 1 ]; then 46299576SJulian.Pullen@Sun.COM ${ECHO} " ACI SET: $MSG" 46309576SJulian.Pullen@Sun.COM else 46319576SJulian.Pullen@Sun.COM ${ECHO} " ${STEP}. $MSG" 46329576SJulian.Pullen@Sun.COM STEP=`expr $STEP + 1` 46339576SJulian.Pullen@Sun.COM fi 46349576SJulian.Pullen@Sun.COM} 46359576SJulian.Pullen@Sun.COM 46369576SJulian.Pullen@Sun.COM# 46370Sstevel@tonic-gate# add_vlv_aci(): Add access control information (aci) for VLV. 46380Sstevel@tonic-gate# 46390Sstevel@tonic-gateadd_vlv_aci() 46400Sstevel@tonic-gate{ 46410Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_vlv_aci()" 46420Sstevel@tonic-gate 46430Sstevel@tonic-gate # Add the VLV ACI. 46440Sstevel@tonic-gate ( cat <<EOF 46450Sstevel@tonic-gatedn: oid=2.16.840.1.113730.3.4.9,cn=features,cn=config 46460Sstevel@tonic-gatechangetype: modify 46470Sstevel@tonic-gatereplace: aci 46480Sstevel@tonic-gateaci: (targetattr != "aci") (version 3.0; acl "VLV Request Control"; allow(read,search,compare) userdn = "ldap:///anyone";) 46490Sstevel@tonic-gateEOF 46500Sstevel@tonic-gate) > ${TMPDIR}/vlv_aci 46510Sstevel@tonic-gate 46520Sstevel@tonic-gate # Add the entry. 46530Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/vlv_aci ${VERB}" 46540Sstevel@tonic-gate if [ $? -ne 0 ]; then 46550Sstevel@tonic-gate ${ECHO} " ERROR: Add of VLV ACI failed!" 46560Sstevel@tonic-gate cleanup 46570Sstevel@tonic-gate exit 1 46580Sstevel@tonic-gate fi 46590Sstevel@tonic-gate 46600Sstevel@tonic-gate # Display message that schema is updated. 46610Sstevel@tonic-gate ${ECHO} " ${STEP}. Add of VLV Access Control Information (ACI)." 46620Sstevel@tonic-gate STEP=`expr $STEP + 1` 46630Sstevel@tonic-gate} 46640Sstevel@tonic-gate 46650Sstevel@tonic-gate 46660Sstevel@tonic-gate# 46670Sstevel@tonic-gate# set_nisdomain(): Add the NisDomainObject to the Base DN. 46680Sstevel@tonic-gate# 46690Sstevel@tonic-gateset_nisdomain() 46700Sstevel@tonic-gate{ 46710Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In set_nisdomain()" 46720Sstevel@tonic-gate 46730Sstevel@tonic-gate # Check if nisDomain is already set. 46742672Svl199446 ${EVAL} "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base \ 46752672Svl199446 \"objectclass=*\"" > ${TMPDIR}/chk_nisdomain 2>&1 46762672Svl199446 ${EVAL} "${GREP} -i nisDomain ${TMPDIR}/chk_nisdomain ${VERB}" 46770Sstevel@tonic-gate if [ $? -eq 0 ]; then 46780Sstevel@tonic-gate ${ECHO} " ${STEP}. NisDomainObject for ${LDAP_BASEDN} was already set." 46790Sstevel@tonic-gate STEP=`expr $STEP + 1` 46800Sstevel@tonic-gate return 0 46810Sstevel@tonic-gate fi 46820Sstevel@tonic-gate 46830Sstevel@tonic-gate # Add the new top level containers. 46840Sstevel@tonic-gate ( cat <<EOF 46850Sstevel@tonic-gatedn: ${LDAP_BASEDN} 46860Sstevel@tonic-gatechangetype: modify 46870Sstevel@tonic-gateobjectclass: nisDomainObject 46880Sstevel@tonic-gatenisdomain: ${LDAP_DOMAIN} 46890Sstevel@tonic-gateEOF 46900Sstevel@tonic-gate) > ${TMPDIR}/nis_domain 46910Sstevel@tonic-gate 46920Sstevel@tonic-gate # Add the entry. 46930Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/nis_domain ${VERB}" 46940Sstevel@tonic-gate if [ $? -ne 0 ]; then 46950Sstevel@tonic-gate ${ECHO} " ERROR: update of NisDomainObject in ${LDAP_BASEDN} failed." 46960Sstevel@tonic-gate cleanup 46970Sstevel@tonic-gate exit 1 46980Sstevel@tonic-gate fi 46990Sstevel@tonic-gate 47000Sstevel@tonic-gate # Display message that schema is updated. 47010Sstevel@tonic-gate ${ECHO} " ${STEP}. NisDomainObject added to ${LDAP_BASEDN}." 47020Sstevel@tonic-gate STEP=`expr $STEP + 1` 47030Sstevel@tonic-gate} 47040Sstevel@tonic-gate 47050Sstevel@tonic-gate 47060Sstevel@tonic-gate# 47070Sstevel@tonic-gate# check_attrName(): Check that the attribute name is valid. 47080Sstevel@tonic-gate# $1 Key to check. 47090Sstevel@tonic-gate# Returns 0 : valid name 1 : invalid name 47100Sstevel@tonic-gate# 47110Sstevel@tonic-gatecheck_attrName() 47120Sstevel@tonic-gate{ 47130Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In check_attrName()" 47140Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "check_attrName: Input Param = $1" 47150Sstevel@tonic-gate 47160Sstevel@tonic-gate ${ECHO} $1 | ${EGREP} '^[0-9]+(\.[0-9]+)*$' > /dev/null 2>&1 47170Sstevel@tonic-gate if [ $? -eq 0 ]; then 47180Sstevel@tonic-gate ${EVAL} "${LDAPSEARCH} ${SERVER_ARGS} -b cn=schema -s base \"objectclass=*\" \ 47190Sstevel@tonic-gate attributeTypes | ${EGREP} -i '^attributetypes[ ]*=[ ]*\([ ]*$1 ' ${VERB}" 47200Sstevel@tonic-gate else 47210Sstevel@tonic-gate ${EVAL} "${LDAPSEARCH} ${SERVER_ARGS} -b cn=schema -s base \"objectclass=*\" \ 47220Sstevel@tonic-gate attributeTypes | ${EGREP} -i \"'$1'\" ${VERB}" 47230Sstevel@tonic-gate fi 47240Sstevel@tonic-gate 47250Sstevel@tonic-gate if [ $? -ne 0 ]; then 47260Sstevel@tonic-gate return 1 47270Sstevel@tonic-gate else 47280Sstevel@tonic-gate return 0 47290Sstevel@tonic-gate fi 47300Sstevel@tonic-gate} 47310Sstevel@tonic-gate 47320Sstevel@tonic-gate 47330Sstevel@tonic-gate# 47340Sstevel@tonic-gate# get_objectclass(): Determine the objectclass for the given attribute name 47350Sstevel@tonic-gate# $1 Attribute name to check. 47360Sstevel@tonic-gate# _ATTR_NAME Return value, Object Name or NULL if unknown to idsconfig. 47370Sstevel@tonic-gate# 47380Sstevel@tonic-gate# NOTE: An attribute name can be valid but still we might not be able 47390Sstevel@tonic-gate# to determine the objectclass from the table. 47400Sstevel@tonic-gate# In such cases, the user needs to create the necessary object(s). 47410Sstevel@tonic-gate# 47420Sstevel@tonic-gateget_objectclass() 47430Sstevel@tonic-gate{ 47440Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In get_objectclass()" 47450Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "get_objectclass: Input Param = $1" 47460Sstevel@tonic-gate 47470Sstevel@tonic-gate # Set return value to NULL string. 47480Sstevel@tonic-gate _ATTR_NAME="" 47490Sstevel@tonic-gate 47500Sstevel@tonic-gate # Test key for type: 47510Sstevel@tonic-gate case `${ECHO} ${1} | tr '[A-Z]' '[a-z]'` in 47520Sstevel@tonic-gate ou | organizationalunitname | 2.5.4.11) _ATTR_NAME="organizationalUnit" ;; 47530Sstevel@tonic-gate dc | domaincomponent | 0.9.2342.19200300.100.1.25) _ATTR_NAME="domain" ;; 47540Sstevel@tonic-gate o | organizationname | 2.5.4.10) _ATTR_NAME="organization" ;; 47550Sstevel@tonic-gate c | countryname | 2.5.4.6) _ATTR_NAME="country" ;; 47560Sstevel@tonic-gate *) _ATTR_NAME="" ;; 47570Sstevel@tonic-gate esac 47580Sstevel@tonic-gate 47590Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "get_objectclass: _ATTR_NAME = $_ATTR_NAME" 47600Sstevel@tonic-gate} 47610Sstevel@tonic-gate 47620Sstevel@tonic-gate 47630Sstevel@tonic-gate# 47640Sstevel@tonic-gate# add_base_objects(): Add any necessary base objects. 47650Sstevel@tonic-gate# 47660Sstevel@tonic-gateadd_base_objects() 47670Sstevel@tonic-gate{ 47680Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_base_objects()" 47690Sstevel@tonic-gate 47700Sstevel@tonic-gate # Convert to lower case for basename. 47710Sstevel@tonic-gate format_string "${LDAP_BASEDN}" 47720Sstevel@tonic-gate LOWER_BASEDN="${FMT_STR}" 47730Sstevel@tonic-gate format_string "${LDAP_SUFFIX}" 47740Sstevel@tonic-gate LOWER_SUFFIX="${FMT_STR}" 47750Sstevel@tonic-gate 47760Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "LOWER_BASEDN: ${LOWER_BASEDN}" 47770Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "LOWER_SUFFIX: ${LOWER_SUFFIX}" 47780Sstevel@tonic-gate 47790Sstevel@tonic-gate # Create additional components. 47800Sstevel@tonic-gate if [ "${LOWER_BASEDN}" = "${LOWER_SUFFIX}" ]; then 47810Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "Base DN and Suffix equivalent" 47820Sstevel@tonic-gate else 47830Sstevel@tonic-gate # first, test that the suffix is valid 47840Sstevel@tonic-gate dcstmp=`basename "${LOWER_BASEDN}" "${LOWER_SUFFIX}"` 47850Sstevel@tonic-gate if [ "$dcstmp" = "${LOWER_BASEDN}" ]; then 47860Sstevel@tonic-gate # should not happen since check_basedn_suffix() succeeded 47870Sstevel@tonic-gate ${ECHO} "Invalid suffix ${LOWER_SUFFIX}" 47880Sstevel@tonic-gate ${ECHO} "for Base DN ${LOWER_BASEDN}" 47890Sstevel@tonic-gate cleanup 47900Sstevel@tonic-gate exit 1 47910Sstevel@tonic-gate fi 47920Sstevel@tonic-gate # OK, suffix is valid, start working with LDAP_BASEDN 47930Sstevel@tonic-gate # field separator is ',' (i.e., space is a valid character) 47940Sstevel@tonic-gate dcstmp2="`${ECHO} ${LDAP_BASEDN} | 47950Sstevel@tonic-gate sed -e 's/[ ]*,[ ]*/,/g' -e 's/[ ]*=[ ]*/=/g'`" 47960Sstevel@tonic-gate dcs="" 47970Sstevel@tonic-gate # use dcstmp to count the loop, and dcstmp2 to get the correct 47980Sstevel@tonic-gate # string case 47990Sstevel@tonic-gate # dcs should be in reverse order, only for these components 48000Sstevel@tonic-gate # that need to be added 48010Sstevel@tonic-gate while [ -n "${dcstmp}" ] 48020Sstevel@tonic-gate do 48030Sstevel@tonic-gate i2=`${ECHO} "$dcstmp2" | cut -f1 -d','` 48040Sstevel@tonic-gate dk=`${ECHO} $i2 | awk -F= '{print $1}'` 48050Sstevel@tonic-gate dc=`${ECHO} $i2 | awk -F= '{print $2}'` 48060Sstevel@tonic-gate dcs="$dk=$dc,$dcs"; 48070Sstevel@tonic-gate dcstmp2=`${ECHO} "$dcstmp2" | cut -f2- -d','` 48080Sstevel@tonic-gate dcstmp=`${ECHO} "$dcstmp" | cut -f2- -d','` 48090Sstevel@tonic-gate [ $DEBUG -eq 1 ] && \ 48100Sstevel@tonic-gate ${ECHO} "dcs: ${dcs}\ndcstmp: ${dcstmp}\ndcstmp2: ${dcstmp2}\n" 48110Sstevel@tonic-gate done 48120Sstevel@tonic-gate 48130Sstevel@tonic-gate 48140Sstevel@tonic-gate 48150Sstevel@tonic-gate lastdc=${LDAP_SUFFIX} 48160Sstevel@tonic-gate dc=`${ECHO} "${dcs}" | cut -f1 -d','` 48170Sstevel@tonic-gate dcstmp=`${ECHO} "${dcs}" | cut -f2- -d','` 48180Sstevel@tonic-gate while [ -n "${dc}" ]; do 48190Sstevel@tonic-gate # Get Key and component from $dc. 48200Sstevel@tonic-gate dk2=`${ECHO} $dc | awk -F= '{print $1}'` 48210Sstevel@tonic-gate dc2=`${ECHO} $dc | awk -F= '{print $2}'` 48220Sstevel@tonic-gate 48230Sstevel@tonic-gate # At this point, ${dk2} is a valid attribute name 48240Sstevel@tonic-gate 48250Sstevel@tonic-gate # Check if entry exists first, if so, skip to next. 48260Sstevel@tonic-gate ${LDAPSEARCH} ${SERVER_ARGS} -b "${dk2}=${dc2},$lastdc" -s base "objectclass=*" > /dev/null 2>&1 48270Sstevel@tonic-gate if [ $? -eq 0 ]; then 48280Sstevel@tonic-gate # Set the $lastdc to new dc. 48290Sstevel@tonic-gate lastdc="${dk2}=${dc2},$lastdc" 48300Sstevel@tonic-gate 48310Sstevel@tonic-gate # Process next component. 48320Sstevel@tonic-gate dc=`${ECHO} "${dcstmp}" | cut -f1 -d','` 48330Sstevel@tonic-gate dcstmp=`${ECHO} "${dcstmp}" | cut -f2- -d','` 48340Sstevel@tonic-gate continue 48350Sstevel@tonic-gate 48360Sstevel@tonic-gate fi 48370Sstevel@tonic-gate 48380Sstevel@tonic-gate # Determine the objectclass for the entry. 48390Sstevel@tonic-gate get_objectclass $dk2 48400Sstevel@tonic-gate OBJ_Name=${_ATTR_NAME} 48410Sstevel@tonic-gate if [ "${OBJ_Name}" = "" ]; then 48420Sstevel@tonic-gate ${ECHO} "Cannot determine objectclass for $dk2" 48430Sstevel@tonic-gate ${ECHO} "Please create ${dk2}=${dc2},$lastdc entry and rerun idsconfig" 48440Sstevel@tonic-gate exit 1 48450Sstevel@tonic-gate fi 48460Sstevel@tonic-gate 48470Sstevel@tonic-gate # Add the new container. 48480Sstevel@tonic-gate ( cat <<EOF 48490Sstevel@tonic-gatedn: ${dk2}=${dc2},$lastdc 48500Sstevel@tonic-gate${dk2}: $dc2 48510Sstevel@tonic-gateobjectClass: top 48520Sstevel@tonic-gateobjectClass: ${OBJ_Name} 48530Sstevel@tonic-gateEOF 48540Sstevel@tonic-gate) > ${TMPDIR}/base_objects 48550Sstevel@tonic-gate 48560Sstevel@tonic-gate 48570Sstevel@tonic-gate # Set the $lastdc to new dc. 48580Sstevel@tonic-gate lastdc="${dk2}=${dc2},$lastdc" 48590Sstevel@tonic-gate 48600Sstevel@tonic-gate # Add the entry. 48610Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/base_objects ${VERB}" 48620Sstevel@tonic-gate if [ $? -ne 0 ]; then 48630Sstevel@tonic-gate ${ECHO} " ERROR: update of base objects ${dc} failed." 48640Sstevel@tonic-gate cleanup 48650Sstevel@tonic-gate exit 1 48660Sstevel@tonic-gate fi 48670Sstevel@tonic-gate 48680Sstevel@tonic-gate # Display message that schema is updated. 48690Sstevel@tonic-gate ${ECHO} " ${STEP}. Created DN component ${dc}." 48700Sstevel@tonic-gate STEP=`expr $STEP + 1` 48710Sstevel@tonic-gate 48720Sstevel@tonic-gate # Process next component. 48730Sstevel@tonic-gate dc=`${ECHO} "${dcstmp}" | cut -f1 -d','` 48740Sstevel@tonic-gate dcstmp=`${ECHO} "${dcstmp}" | cut -f2- -d','` 48750Sstevel@tonic-gate done 48760Sstevel@tonic-gate fi 48770Sstevel@tonic-gate} 48780Sstevel@tonic-gate 48790Sstevel@tonic-gate 48800Sstevel@tonic-gate# 48810Sstevel@tonic-gate# add_new_containers(): Add the top level classes. 48820Sstevel@tonic-gate# 48830Sstevel@tonic-gate# $1 = Base DN 48840Sstevel@tonic-gate# 48850Sstevel@tonic-gateadd_new_containers() 48860Sstevel@tonic-gate{ 48870Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_new_containers()" 48880Sstevel@tonic-gate 48890Sstevel@tonic-gate for ou in people group rpc protocols networks netgroup \ 48904170Svl199446 aliases hosts services ethers profile printers projects \ 48911676Sjpk SolarisAuthAttr SolarisProfAttr Timezone ipTnet ; do 48920Sstevel@tonic-gate 48930Sstevel@tonic-gate # Check if nismaps already exist. 48940Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"ou=${ou},${LDAP_BASEDN}\" -s base \"objectclass=*\" ${VERB}" 48950Sstevel@tonic-gate if [ $? -eq 0 ]; then 48960Sstevel@tonic-gate continue 48970Sstevel@tonic-gate fi 48980Sstevel@tonic-gate 48990Sstevel@tonic-gate # Create TMP file to add. 49000Sstevel@tonic-gate ( cat <<EOF 49010Sstevel@tonic-gatedn: ou=${ou},${LDAP_BASEDN} 49020Sstevel@tonic-gateou: ${ou} 49030Sstevel@tonic-gateobjectClass: top 49040Sstevel@tonic-gateobjectClass: organizationalUnit 49050Sstevel@tonic-gateEOF 49060Sstevel@tonic-gate) > ${TMPDIR}/toplevel.${ou} 49070Sstevel@tonic-gate 49080Sstevel@tonic-gate # Add the entry. 49090Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/toplevel.${ou} ${VERB}" 49100Sstevel@tonic-gate if [ $? -ne 0 ]; then 49110Sstevel@tonic-gate ${ECHO} " ERROR: Add of ou=${ou} container failed!" 49120Sstevel@tonic-gate cleanup 49130Sstevel@tonic-gate exit 1 49140Sstevel@tonic-gate fi 49150Sstevel@tonic-gate done 49160Sstevel@tonic-gate 49170Sstevel@tonic-gate # Display message that top level OU containers complete. 49180Sstevel@tonic-gate ${ECHO} " ${STEP}. Top level \"ou\" containers complete." 49190Sstevel@tonic-gate STEP=`expr $STEP + 1` 49200Sstevel@tonic-gate} 49210Sstevel@tonic-gate 49220Sstevel@tonic-gate 49230Sstevel@tonic-gate# 49240Sstevel@tonic-gate# add_auto_maps(): Add the automount map entries. 49250Sstevel@tonic-gate# 49260Sstevel@tonic-gate# auto_home, auto_direct, auto_master, auto_shared 49270Sstevel@tonic-gate# 49280Sstevel@tonic-gateadd_auto_maps() 49290Sstevel@tonic-gate{ 49300Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_auto_maps()" 49310Sstevel@tonic-gate 49320Sstevel@tonic-gate # Set AUTO_MAPS for maps to create. 49330Sstevel@tonic-gate AUTO_MAPS="auto_home auto_direct auto_master auto_shared" 49340Sstevel@tonic-gate 49350Sstevel@tonic-gate for automap in $AUTO_MAPS; do 49360Sstevel@tonic-gate # Check if automaps already exist. 49370Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"automountMapName=${automap},${LDAP_BASEDN}\" -s base \"objectclass=*\" ${VERB}" 49380Sstevel@tonic-gate if [ $? -eq 0 ]; then 49390Sstevel@tonic-gate continue 49400Sstevel@tonic-gate fi 49410Sstevel@tonic-gate 49420Sstevel@tonic-gate # Create the tmp file to add. 49430Sstevel@tonic-gate ( cat <<EOF 49440Sstevel@tonic-gatedn: automountMapName=${automap},${LDAP_BASEDN} 49450Sstevel@tonic-gateautomountMapName: ${automap} 49460Sstevel@tonic-gateobjectClass: top 49470Sstevel@tonic-gateobjectClass: automountMap 49480Sstevel@tonic-gateEOF 49490Sstevel@tonic-gate) > ${TMPDIR}/automap.${automap} 49500Sstevel@tonic-gate 49510Sstevel@tonic-gate # Add the entry. 49520Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/automap.${automap} ${VERB}" 49530Sstevel@tonic-gate if [ $? -ne 0 ]; then 49540Sstevel@tonic-gate ${ECHO} " ERROR: Add of automap ${automap} failed!" 49550Sstevel@tonic-gate cleanup 49560Sstevel@tonic-gate exit 1 49570Sstevel@tonic-gate fi 49580Sstevel@tonic-gate done 49590Sstevel@tonic-gate 49600Sstevel@tonic-gate # Display message that automount entries are updated. 49610Sstevel@tonic-gate ${ECHO} " ${STEP}. automount maps: $AUTO_MAPS processed." 49620Sstevel@tonic-gate STEP=`expr $STEP + 1` 49630Sstevel@tonic-gate} 49640Sstevel@tonic-gate 49650Sstevel@tonic-gate 49660Sstevel@tonic-gate# 49670Sstevel@tonic-gate# add_proxyagent(): Add entry for nameservice to use to access server. 49680Sstevel@tonic-gate# 49690Sstevel@tonic-gateadd_proxyagent() 49700Sstevel@tonic-gate{ 49710Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_proxyagent()" 49720Sstevel@tonic-gate 49739285SMilan.Jurik@Sun.COM # Check if proxy agent already exists. 49740Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_PROXYAGENT}\" -s base \"objectclass=*\" ${VERB}" 49750Sstevel@tonic-gate if [ $? -eq 0 ]; then 49760Sstevel@tonic-gate ${ECHO} " ${STEP}. Proxy Agent ${LDAP_PROXYAGENT} already exists." 49770Sstevel@tonic-gate STEP=`expr $STEP + 1` 49780Sstevel@tonic-gate return 0 49790Sstevel@tonic-gate fi 49800Sstevel@tonic-gate 49810Sstevel@tonic-gate # Get cn and sn names from LDAP_PROXYAGENT. 49820Sstevel@tonic-gate cn_tmp=`${ECHO} ${LDAP_PROXYAGENT} | cut -f1 -d, | cut -f2 -d=` 49830Sstevel@tonic-gate 49840Sstevel@tonic-gate # Create the tmp file to add. 49850Sstevel@tonic-gate ( cat <<EOF 49860Sstevel@tonic-gatedn: ${LDAP_PROXYAGENT} 49870Sstevel@tonic-gatecn: ${cn_tmp} 49880Sstevel@tonic-gatesn: ${cn_tmp} 49890Sstevel@tonic-gateobjectclass: top 49900Sstevel@tonic-gateobjectclass: person 49910Sstevel@tonic-gateuserpassword: ${LDAP_PROXYAGENT_CRED} 49920Sstevel@tonic-gateEOF 49930Sstevel@tonic-gate) > ${TMPDIR}/proxyagent 49940Sstevel@tonic-gate 49950Sstevel@tonic-gate # Add the entry. 49960Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/proxyagent ${VERB}" 49970Sstevel@tonic-gate if [ $? -ne 0 ]; then 49980Sstevel@tonic-gate ${ECHO} " ERROR: Adding proxyagent failed!" 49990Sstevel@tonic-gate cleanup 50000Sstevel@tonic-gate exit 1 50010Sstevel@tonic-gate fi 50020Sstevel@tonic-gate 50030Sstevel@tonic-gate # Display message that schema is updated. 50040Sstevel@tonic-gate ${ECHO} " ${STEP}. Proxy Agent ${LDAP_PROXYAGENT} added." 50050Sstevel@tonic-gate STEP=`expr $STEP + 1` 50060Sstevel@tonic-gate} 50070Sstevel@tonic-gate 50080Sstevel@tonic-gate# 50090Sstevel@tonic-gate# allow_proxy_read_pw(): Give Proxy Agent read permission for password. 50100Sstevel@tonic-gate# 50110Sstevel@tonic-gateallow_proxy_read_pw() 50120Sstevel@tonic-gate{ 50130Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In allow_proxy_read_pw()" 50140Sstevel@tonic-gate 50150Sstevel@tonic-gate # Search for ACI_NAME 50160Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_proxyread_aci 2>&1" 50170Sstevel@tonic-gate ${GREP} "${PROXY_ACI_NAME}" ${TMPDIR}/chk_proxyread_aci > /dev/null 2>&1 50180Sstevel@tonic-gate if [ $? -eq 0 ]; then 50190Sstevel@tonic-gate ${ECHO} " ${STEP}. Proxy ACI ${PROXY_ACI_NAME=} already exists for ${LDAP_BASEDN}." 50200Sstevel@tonic-gate STEP=`expr $STEP + 1` 50210Sstevel@tonic-gate return 0 50220Sstevel@tonic-gate fi 50230Sstevel@tonic-gate 50240Sstevel@tonic-gate # Create the tmp file to add. 50250Sstevel@tonic-gate ( cat <<EOF 50260Sstevel@tonic-gatedn: ${LDAP_BASEDN} 50270Sstevel@tonic-gatechangetype: modify 50280Sstevel@tonic-gateadd: aci 50299576SJulian.Pullen@Sun.COMaci: (target="ldap:///${LDAP_BASEDN}")(targetattr="userPassword") 50309576SJulian.Pullen@Sun.COM (version 3.0; acl ${PROXY_ACI_NAME}; allow (compare,read,search) 50319576SJulian.Pullen@Sun.COM userdn = "ldap:///${LDAP_PROXYAGENT}";) 50320Sstevel@tonic-gateEOF 50330Sstevel@tonic-gate) > ${TMPDIR}/proxy_read 50340Sstevel@tonic-gate 50350Sstevel@tonic-gate # Add the entry. 50360Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/proxy_read ${VERB}" 50370Sstevel@tonic-gate if [ $? -ne 0 ]; then 50380Sstevel@tonic-gate ${ECHO} " ERROR: Allow ${LDAP_PROXYAGENT} to read password failed!" 50390Sstevel@tonic-gate cleanup 50400Sstevel@tonic-gate exit 1 50410Sstevel@tonic-gate fi 50420Sstevel@tonic-gate 50430Sstevel@tonic-gate # Display message that schema is updated. 50440Sstevel@tonic-gate ${ECHO} " ${STEP}. Give ${LDAP_PROXYAGENT} read permission for password." 50450Sstevel@tonic-gate STEP=`expr $STEP + 1` 50460Sstevel@tonic-gate} 50470Sstevel@tonic-gate 50489576SJulian.Pullen@Sun.COM# Delete Proxy Agent read permission for password. 50499576SJulian.Pullen@Sun.COMdelete_proxy_read_pw() 50509576SJulian.Pullen@Sun.COM{ 50519576SJulian.Pullen@Sun.COM [ $DEBUG -eq 1 ] && ${ECHO} "In delete_proxy_read_pw()" 50529576SJulian.Pullen@Sun.COM 50539576SJulian.Pullen@Sun.COM # Search for ACI_NAME 50549576SJulian.Pullen@Sun.COM eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"${LDAP_BASEDN}\" -s base objectclass=* aci > ${TMPDIR}/chk_proxyread_aci 2>&1" 50559576SJulian.Pullen@Sun.COM ${GREP} "${PROXY_ACI_NAME}" ${TMPDIR}/chk_proxyread_aci | \ 50569576SJulian.Pullen@Sun.COM ${SED} -e 's/aci=//' > ${TMPDIR}/grep_proxyread_aci 2>&1 50579576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 50589576SJulian.Pullen@Sun.COM ${ECHO} "Proxy ACI ${PROXY_ACI_NAME} does not exist for ${LDAP_BASEDN}." 50599576SJulian.Pullen@Sun.COM return 0 50609576SJulian.Pullen@Sun.COM fi 50619576SJulian.Pullen@Sun.COM 50629576SJulian.Pullen@Sun.COM # We need to remove proxy agent's read access to user passwords, 50639576SJulian.Pullen@Sun.COM # but We do not know the value of the ${LDAP_PROXYAGENT} here, so 50649576SJulian.Pullen@Sun.COM # 1. if only one match found, delete it 50659576SJulian.Pullen@Sun.COM # 2. if more than one matches found, ask the user which one to delete 50669576SJulian.Pullen@Sun.COM HOWMANY=`${WC} -l ${TMPDIR}/grep_proxyread_aci | ${NAWK} '{print $1}'` 50679576SJulian.Pullen@Sun.COM if [ $HOWMANY -eq 0 ]; then 50689576SJulian.Pullen@Sun.COM ${ECHO} "Proxy ACI ${PROXY_ACI_NAME} does not exist for ${LDAP_BASEDN}." 50699576SJulian.Pullen@Sun.COM return 0 50709576SJulian.Pullen@Sun.COM fi 50719576SJulian.Pullen@Sun.COM if [ $HOWMANY -eq 1 ];then 50729576SJulian.Pullen@Sun.COM proxy_aci=`${CAT} ${TMPDIR}/grep_proxyread_aci` 50739576SJulian.Pullen@Sun.COM else 50749576SJulian.Pullen@Sun.COM ${CAT} << EOF 50759576SJulian.Pullen@Sun.COM 50769576SJulian.Pullen@Sun.COMProxy agent is not allowed to read user passwords when shadow 50779576SJulian.Pullen@Sun.COMupdate is enabled. There are more than one proxy agents found. 50789576SJulian.Pullen@Sun.COMPlease select the currently proxy agent being used, so that 50799576SJulian.Pullen@Sun.COMidsconfig can remove its read access to user passwords. 50809576SJulian.Pullen@Sun.COM 50819576SJulian.Pullen@Sun.COMThe proxy agents are: 50829576SJulian.Pullen@Sun.COM 50839576SJulian.Pullen@Sun.COMEOF 50849576SJulian.Pullen@Sun.COM # generate the proxy agent list 50859576SJulian.Pullen@Sun.COM ${SED} -e "s/.*ldap:\/\/\/.*ldap:\/\/\///" \ 50869576SJulian.Pullen@Sun.COM ${TMPDIR}/grep_proxyread_aci | ${SED} -e "s/\";)//" > \ 50879576SJulian.Pullen@Sun.COM ${TMPDIR}/proxy_agent_list 50889576SJulian.Pullen@Sun.COM 50899576SJulian.Pullen@Sun.COM # print the proxy agent list 50909576SJulian.Pullen@Sun.COM ${NAWK} '{print NR ": " $0}' ${TMPDIR}/proxy_agent_list 50919576SJulian.Pullen@Sun.COM 50929576SJulian.Pullen@Sun.COM # ask the user to pick one 50939576SJulian.Pullen@Sun.COM _MENU_PROMPT="Select the proxy agent (1-$HOWMANY): " 50949576SJulian.Pullen@Sun.COM get_menu_choice "${_MENU_PROMPT}" "0" "$HOWMANY" 50959576SJulian.Pullen@Sun.COM _CH=$MN_CH 50969576SJulian.Pullen@Sun.COM proxy_aci=`${SED} -n "$_CH p" ${TMPDIR}/grep_proxyread_aci` 50979576SJulian.Pullen@Sun.COM fi 50989576SJulian.Pullen@Sun.COM 50999576SJulian.Pullen@Sun.COM # Create the tmp file to delete the ACI. 51009576SJulian.Pullen@Sun.COM ( cat <<EOF 51019576SJulian.Pullen@Sun.COMdn: ${LDAP_BASEDN} 51029576SJulian.Pullen@Sun.COMchangetype: modify 51039576SJulian.Pullen@Sun.COMdelete: aci 51049576SJulian.Pullen@Sun.COMaci: ${proxy_aci} 51059576SJulian.Pullen@Sun.COMEOF 51069576SJulian.Pullen@Sun.COM ) > ${TMPDIR}/proxy_delete 51079576SJulian.Pullen@Sun.COM 51089576SJulian.Pullen@Sun.COM # Delete the ACI 51099576SJulian.Pullen@Sun.COM ${EVAL} "${LDAPMODIFY} ${LDAP_ARGS} -f ${TMPDIR}/proxy_delete ${VERB}" 51109576SJulian.Pullen@Sun.COM if [ $? -ne 0 ]; then 51119576SJulian.Pullen@Sun.COM ${ECHO} " ERROR: Remove of ${PROXY_ACI_NAME} ACI failed!" 51129576SJulian.Pullen@Sun.COM cat ${TMPDIR}/proxy_delete 51139576SJulian.Pullen@Sun.COM cleanup 51149576SJulian.Pullen@Sun.COM exit 1 51159576SJulian.Pullen@Sun.COM fi 51169576SJulian.Pullen@Sun.COM 51179576SJulian.Pullen@Sun.COM # Display message that ACI is updated. 51189576SJulian.Pullen@Sun.COM MSG="Removed ${PROXY_ACI_NAME} ACI for proxyagent read permission for password." 51199576SJulian.Pullen@Sun.COM ${ECHO} " " 51209576SJulian.Pullen@Sun.COM ${ECHO} " ACI REMOVED: $MSG" 51219576SJulian.Pullen@Sun.COM ${ECHO} " The ACI removed is $proxy_aci" 51229576SJulian.Pullen@Sun.COM ${ECHO} " " 51239576SJulian.Pullen@Sun.COM} 51249576SJulian.Pullen@Sun.COM 51250Sstevel@tonic-gate# 51260Sstevel@tonic-gate# add_profile(): Add client profile to server. 51270Sstevel@tonic-gate# 51280Sstevel@tonic-gateadd_profile() 51290Sstevel@tonic-gate{ 51300Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In add_profile()" 51310Sstevel@tonic-gate 51320Sstevel@tonic-gate # If profile name already exists, DELETE it, and add new one. 51330Sstevel@tonic-gate eval "${LDAPSEARCH} ${LDAP_ARGS} -b \"cn=${LDAP_PROFILE_NAME},ou=profile,${LDAP_BASEDN}\" -s base \"objectclass=*\" ${VERB}" 51340Sstevel@tonic-gate if [ $? -eq 0 ]; then 51350Sstevel@tonic-gate # Create Delete file. 51360Sstevel@tonic-gate ( cat <<EOF 51370Sstevel@tonic-gatecn=${LDAP_PROFILE_NAME},ou=profile,${LDAP_BASEDN} 51380Sstevel@tonic-gateEOF 51390Sstevel@tonic-gate) > ${TMPDIR}/del_profile 51400Sstevel@tonic-gate 51410Sstevel@tonic-gate # Check if DEL_OLD_PROFILE is set. (If not ERROR) 51420Sstevel@tonic-gate if [ $DEL_OLD_PROFILE -eq 0 ]; then 51430Sstevel@tonic-gate ${ECHO} "ERROR: Profile name ${LDAP_PROFILE_NAME} exists! Add failed!" 51440Sstevel@tonic-gate exit 1 51450Sstevel@tonic-gate fi 51460Sstevel@tonic-gate 51470Sstevel@tonic-gate # Delete the OLD profile. 51480Sstevel@tonic-gate ${EVAL} "${LDAPDELETE} ${LDAP_ARGS} -f ${TMPDIR}/del_profile ${VERB}" 51490Sstevel@tonic-gate if [ $? -ne 0 ]; then 51500Sstevel@tonic-gate ${ECHO} " ERROR: Attempt to DELETE profile failed!" 51510Sstevel@tonic-gate cleanup 51520Sstevel@tonic-gate exit 1 51530Sstevel@tonic-gate fi 51540Sstevel@tonic-gate fi 51550Sstevel@tonic-gate 51560Sstevel@tonic-gate # Build the "ldapclient genprofile" command string to execute. 51570Sstevel@tonic-gate GEN_CMD="ldapclient genprofile -a \"profileName=${LDAP_PROFILE_NAME}\"" 51580Sstevel@tonic-gate 51590Sstevel@tonic-gate # Add required argument defaultSearchBase. 51600Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"defaultSearchBase=${LDAP_BASEDN}\"" 51610Sstevel@tonic-gate 51620Sstevel@tonic-gate # Add optional parameters. 51630Sstevel@tonic-gate [ -n "$LDAP_SERVER_LIST" ] && \ 51640Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"defaultServerList=${LDAP_SERVER_LIST}\"" 51650Sstevel@tonic-gate [ -n "$LDAP_SEARCH_SCOPE" ] && \ 51660Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"defaultSearchScope=${LDAP_SEARCH_SCOPE}\"" 51670Sstevel@tonic-gate [ -n "$LDAP_CRED_LEVEL" ] && \ 51680Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"credentialLevel=${LDAP_CRED_LEVEL}\"" 51690Sstevel@tonic-gate [ -n "$LDAP_AUTHMETHOD" ] && \ 51700Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"authenticationMethod=${LDAP_AUTHMETHOD}\"" 51710Sstevel@tonic-gate [ -n "$LDAP_FOLLOWREF" ] && \ 51720Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"followReferrals=${LDAP_FOLLOWREF}\"" 51730Sstevel@tonic-gate [ -n "$LDAP_SEARCH_TIME_LIMIT" ] && \ 51740Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"searchTimeLimit=${LDAP_SEARCH_TIME_LIMIT}\"" 51750Sstevel@tonic-gate [ -n "$LDAP_PROFILE_TTL" ] && \ 51760Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"profileTTL=${LDAP_PROFILE_TTL}\"" 51770Sstevel@tonic-gate [ -n "$LDAP_BIND_LIMIT" ] && \ 51780Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"bindTimeLimit=${LDAP_BIND_LIMIT}\"" 51790Sstevel@tonic-gate [ -n "$LDAP_PREF_SRVLIST" ] && \ 51800Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"preferredServerList=${LDAP_PREF_SRVLIST}\"" 51810Sstevel@tonic-gate [ -n "$LDAP_SRV_AUTHMETHOD_PAM" ] && \ 51820Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"serviceAuthenticationMethod=${LDAP_SRV_AUTHMETHOD_PAM}\"" 51830Sstevel@tonic-gate [ -n "$LDAP_SRV_AUTHMETHOD_KEY" ] && \ 51840Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"serviceAuthenticationMethod=${LDAP_SRV_AUTHMETHOD_KEY}\"" 51850Sstevel@tonic-gate [ -n "$LDAP_SRV_AUTHMETHOD_CMD" ] && \ 51860Sstevel@tonic-gate GEN_CMD="${GEN_CMD} -a \"serviceAuthenticationMethod=${LDAP_SRV_AUTHMETHOD_CMD}\"" 51870Sstevel@tonic-gate 51880Sstevel@tonic-gate # Check if there are any service search descriptors to ad. 51890Sstevel@tonic-gate if [ -s "${SSD_FILE}" ]; then 51900Sstevel@tonic-gate ssd_2_profile 51910Sstevel@tonic-gate fi 51920Sstevel@tonic-gate 51930Sstevel@tonic-gate # Execute "ldapclient genprofile" to create profile. 51940Sstevel@tonic-gate eval ${GEN_CMD} > ${TMPDIR}/gen_profile 2> ${TMPDIR}/gen_profile_ERR 51950Sstevel@tonic-gate if [ $? -ne 0 ]; then 51960Sstevel@tonic-gate ${ECHO} " ERROR: ldapclient genprofile failed!" 51970Sstevel@tonic-gate cleanup 51980Sstevel@tonic-gate exit 1 51990Sstevel@tonic-gate fi 52000Sstevel@tonic-gate 52010Sstevel@tonic-gate # Add the generated profile.. 52020Sstevel@tonic-gate ${EVAL} "${LDAPMODIFY} -a ${LDAP_ARGS} -f ${TMPDIR}/gen_profile ${VERB}" 52030Sstevel@tonic-gate if [ $? -ne 0 ]; then 52040Sstevel@tonic-gate ${ECHO} " ERROR: Attempt to add profile failed!" 52050Sstevel@tonic-gate cleanup 52060Sstevel@tonic-gate exit 1 52070Sstevel@tonic-gate fi 52080Sstevel@tonic-gate 52090Sstevel@tonic-gate # Display message that schema is updated. 52100Sstevel@tonic-gate ${ECHO} " ${STEP}. Generated client profile and loaded on server." 52110Sstevel@tonic-gate STEP=`expr $STEP + 1` 52120Sstevel@tonic-gate} 52130Sstevel@tonic-gate 52140Sstevel@tonic-gate 52150Sstevel@tonic-gate# 52160Sstevel@tonic-gate# cleanup(): Remove the TMPDIR and all files in it. 52170Sstevel@tonic-gate# 52180Sstevel@tonic-gatecleanup() 52190Sstevel@tonic-gate{ 52200Sstevel@tonic-gate [ $DEBUG -eq 1 ] && ${ECHO} "In cleanup()" 52210Sstevel@tonic-gate 52220Sstevel@tonic-gate rm -fr ${TMPDIR} 52230Sstevel@tonic-gate} 52240Sstevel@tonic-gate 52250Sstevel@tonic-gate 52260Sstevel@tonic-gate# 52270Sstevel@tonic-gate# * * * MAIN * * * 52280Sstevel@tonic-gate# 52290Sstevel@tonic-gate# Description: 52300Sstevel@tonic-gate# This script assumes that the iPlanet Directory Server (iDS) is 52310Sstevel@tonic-gate# installed and that setup has been run. This script takes the 52320Sstevel@tonic-gate# iDS server from that point and sets up the infrastructure for 52330Sstevel@tonic-gate# LDAP Naming Services. After running this script, ldapaddent(1M) 52340Sstevel@tonic-gate# or some other tools can be used to populate data. 52350Sstevel@tonic-gate 52360Sstevel@tonic-gate# Initialize the variables that need to be set to NULL, or some 52370Sstevel@tonic-gate# other initial value before the rest of the functions can be called. 52380Sstevel@tonic-gateinit 52390Sstevel@tonic-gate 52400Sstevel@tonic-gate# Parse command line arguments. 52410Sstevel@tonic-gateparse_arg $* 52420Sstevel@tonic-gateshift $? 52430Sstevel@tonic-gate 52440Sstevel@tonic-gate# Print extra line to separate from prompt. 52450Sstevel@tonic-gate${ECHO} " " 52460Sstevel@tonic-gate 52470Sstevel@tonic-gate# Either Load the user specified config file 52480Sstevel@tonic-gate# or prompt user for config info. 52490Sstevel@tonic-gateif [ -n "$INPUT_FILE" ] 52500Sstevel@tonic-gatethen 52510Sstevel@tonic-gate load_config_file 52520Sstevel@tonic-gate INTERACTIVE=0 # Turns off prompts that occur later. 52530Sstevel@tonic-gate validate_info # Validate basic info in file. 52540Sstevel@tonic-gate chk_ids_version # Check iDS version for compatibility. 52550Sstevel@tonic-gateelse 52560Sstevel@tonic-gate # Display BACKUP warning to user. 52570Sstevel@tonic-gate display_msg backup_server 52580Sstevel@tonic-gate get_confirm "Do you wish to continue with server setup (y/n/h)?" "n" "backup_help" 52590Sstevel@tonic-gate if [ $? -eq 0 ]; then # if No, cleanup and exit. 52600Sstevel@tonic-gate cleanup ; exit 1 52610Sstevel@tonic-gate fi 52620Sstevel@tonic-gate 52630Sstevel@tonic-gate # Prompt for values. 52640Sstevel@tonic-gate prompt_config_info 52650Sstevel@tonic-gate display_summary # Allow user to modify results. 52660Sstevel@tonic-gate INTERACTIVE=1 # Insures future prompting. 52670Sstevel@tonic-gatefi 52680Sstevel@tonic-gate 52690Sstevel@tonic-gate# Modify slapd.oc.conf to ALLOW cn instead of REQUIRE. 52700Sstevel@tonic-gatemodify_cn 52710Sstevel@tonic-gate 52720Sstevel@tonic-gate# Modify timelimit to user value. 52730Sstevel@tonic-gate[ $NEED_TIME -eq 1 ] && modify_timelimit 52740Sstevel@tonic-gate 52750Sstevel@tonic-gate# Modify sizelimit to user value. 52760Sstevel@tonic-gate[ $NEED_SIZE -eq 1 ] && modify_sizelimit 52770Sstevel@tonic-gate 52780Sstevel@tonic-gate# Modify the password storage scheme to support CRYPT. 52790Sstevel@tonic-gateif [ "$NEED_CRYPT" = "TRUE" ]; then 52800Sstevel@tonic-gate modify_pwd_crypt 52810Sstevel@tonic-gatefi 52820Sstevel@tonic-gate 52830Sstevel@tonic-gate# Update the schema (Attributes, Objectclass Definitions) 52842830Sdjlif [ ${SCHEMA_UPDATED} -eq 0 ]; then 52852830Sdjl update_schema_attr 52862830Sdjl update_schema_obj 52872830Sdjlfi 52880Sstevel@tonic-gate 52892672Svl199446# Add suffix together with its root entry (if needed) 52902672Svl199446add_suffix || 52912672Svl199446{ 52922672Svl199446 cleanup 52932672Svl199446 exit 1 52942672Svl199446} 52952672Svl199446 52960Sstevel@tonic-gate# Add base objects (if needed) 52970Sstevel@tonic-gateadd_base_objects 52980Sstevel@tonic-gate 52990Sstevel@tonic-gate# Update the NisDomainObject. 53000Sstevel@tonic-gate# The Base DN might of just been created, so this MUST happen after 53010Sstevel@tonic-gate# the base objects have been added! 53020Sstevel@tonic-gateset_nisdomain 53030Sstevel@tonic-gate 53040Sstevel@tonic-gate# Add top level classes (new containers) 53050Sstevel@tonic-gateadd_new_containers 53060Sstevel@tonic-gate 53070Sstevel@tonic-gate# Add common nismaps. 53080Sstevel@tonic-gateadd_auto_maps 53090Sstevel@tonic-gate 53100Sstevel@tonic-gate# Modify top ACI. 53110Sstevel@tonic-gatemodify_top_aci 53120Sstevel@tonic-gate 53130Sstevel@tonic-gate# Add Access Control Information for VLV. 53140Sstevel@tonic-gateadd_vlv_aci 53150Sstevel@tonic-gate 53160Sstevel@tonic-gate# if Proxy needed, Add Proxy Agent and give read permission for password. 53170Sstevel@tonic-gateif [ $NEED_PROXY -eq 1 ]; then 53180Sstevel@tonic-gate add_proxyagent 53199576SJulian.Pullen@Sun.COM if [ "$LDAP_ENABLE_SHADOW_UPDATE" != "TRUE" ]; then 53209576SJulian.Pullen@Sun.COM allow_proxy_read_pw 53219576SJulian.Pullen@Sun.COM fi 53220Sstevel@tonic-gatefi 53230Sstevel@tonic-gate 53248821SMichen.Chang@Sun.COM# If admin needed for shadow update, Add the administrator identity and 53259576SJulian.Pullen@Sun.COM# give read/write permission for shadow, and deny all others read/write 53269576SJulian.Pullen@Sun.COM# access to it. 53278821SMichen.Chang@Sun.COMif [ $NEED_ADMIN -eq 1 ]; then 53288821SMichen.Chang@Sun.COM add_admin 53299576SJulian.Pullen@Sun.COM allow_admin_read_write_shadow 53309576SJulian.Pullen@Sun.COM # deny non-admin access to shadow data 53319576SJulian.Pullen@Sun.COM deny_non_admin_shadow_access 53328821SMichen.Chang@Sun.COMfi 53338821SMichen.Chang@Sun.COM 533410870SMilan.Jurik@Sun.COMif [ $GSSAPI_ENABLE -eq 1 ]; then 533510870SMilan.Jurik@Sun.COM add_id_mapping_rules 533610870SMilan.Jurik@Sun.COM # do not modify ACI if "sasl/GSSAPI" and "self" are not selected 533710870SMilan.Jurik@Sun.COM if [ "$LDAP_CRED_LEVEL" = "self" -a "$LDAP_AUTHMETHOD" = "sasl/GSSAPI" ]; then 533810870SMilan.Jurik@Sun.COM modify_userpassword_acl_for_gssapi 533910870SMilan.Jurik@Sun.COM else 534010870SMilan.Jurik@Sun.COM ${ECHO} " ACL for GSSAPI was not set because of incompatibility in profile." 534110870SMilan.Jurik@Sun.COM fi 534210870SMilan.Jurik@Sun.COMfi 534310870SMilan.Jurik@Sun.COM 53449576SJulian.Pullen@Sun.COM# If use host principal for shadow update, give read/write permission for 53459576SJulian.Pullen@Sun.COM# shadow, and deny all others' read/write access to it. 53468821SMichen.Chang@Sun.COMif [ $NEED_HOSTACL -eq 1 ]; then 53479576SJulian.Pullen@Sun.COM allow_host_read_write_shadow 53489576SJulian.Pullen@Sun.COM # deny non-host access to shadow data 53499576SJulian.Pullen@Sun.COM deny_non_host_shadow_access 53508821SMichen.Chang@Sun.COMfi 53518821SMichen.Chang@Sun.COM 53529576SJulian.Pullen@Sun.COM 53530Sstevel@tonic-gate# Generate client profile and add it to the server. 53540Sstevel@tonic-gateadd_profile 53550Sstevel@tonic-gate 53560Sstevel@tonic-gate# Add Indexes to improve Search Performance. 53570Sstevel@tonic-gateadd_eq_indexes 53580Sstevel@tonic-gateadd_sub_indexes 53590Sstevel@tonic-gateadd_vlv_indexes 53600Sstevel@tonic-gate 53610Sstevel@tonic-gate# Display setup complete message 53620Sstevel@tonic-gatedisplay_msg setup_complete 53630Sstevel@tonic-gate 53640Sstevel@tonic-gate# Display VLV index commands to be executed on server. 53650Sstevel@tonic-gatedisplay_vlv_cmds 53660Sstevel@tonic-gate 53670Sstevel@tonic-gate# Create config file if requested. 53680Sstevel@tonic-gate[ -n "$OUTPUT_FILE" ] && create_config_file 53690Sstevel@tonic-gate 53700Sstevel@tonic-gate# Removed the TMPDIR and all files in it. 53710Sstevel@tonic-gatecleanup 53720Sstevel@tonic-gate 53730Sstevel@tonic-gateexit 0 53740Sstevel@tonic-gate# end of MAIN. 5375