The ldapclient utility can be used to:
initialize LDAP client machines
restore the network service environment on LDAP clients
list the contents of the LDAP client cache in human-readable format.
The ldap_gen_profile utility creates (on the standard output) an LDIF file that can be loaded into an LDAP server to be used as the client profile, which can be downloaded by ldapclient .
The synopsis (-P profile_name ) is used to initialize an LDAP client machine, using a profile stored on an LDAP server specified by LDAP_server_addr . This is simplest method and will provide the default format with all the correct settings for talking to the set of servers. It will also ensure that the ldap_cachemgr(1M) can automatically update the configuration file as it changes.
The second synopsis (-i | -m ) is used to initialize a LDAP client machine. The -i option is used to convert machines to use LDAP or to change the machine's domain name. It assigns a default value for the required parameters if they are not specified. You must be logged in as superuser on the machine that is to become a LDAP client. The -m option is used to modify the parameters in the cache file. It updates the parameter specified.
The -i option in conjunction with -a none option can be used to initialize an unauthenticated LDAP client machine without having to specify a password.
If the authentication method such as simple or cram_md5r equires a password and one is not specified with the -w client_password option, the administrator is prompted for the password. If one is not provided, the command will fail.
During the client initialization process, files that are being modified are backed up as files .orig . The files that are usually modified during a client initialization are: /etc/defaultdomain , /etc/nsswitch.conf , and, if they exist, /var/yp/binding/`domainname` for a NIS(YP) client or /var/nis/NIS_COLD_START for a NIS+ client, or if the machine is already an LDAP client, /var/ldap/ldap_client_cache and /var/ldap/ldap_client_cred . Note that a file will not be saved if a backup file already exists.
The -i option does not set up an LDAP client to resolve hostnames using DNS. Refer to the DNS documentation for information on setting up DNS. See resolv.conf(4) .
The third synopsis (-l ) is used to list the LDAP client cache. The output will be human-readable (cache files are not guaranteed to be human-readable.)
The fourth synopsis (-u ) is used to uninitialize the network service environment, restoring it to the one in use before ldapclient -i was executed. You must be logged in as superuser on the machine that is to be restored. The restoration will succeeds only if the machine was initialized with ldapclient -i because it uses the backup files created by the -i option.
The machine must be rebooted after initializing a machine or restoring the network service.
The following options are supported:
Specify authentication method. Multiple values can be specified, separated by commas. The default value is none . If simple or cram_md5 is specified, a password must be provided (see -w below).
Specify search baseDN (for example dc=eng ,dc=sun ,dc=com .) The default is the root naming context on the first server specified.
Specify alternative baseDN for LDAP searches (for example, ou=people ,dc=corp ,dc=sun ,dc=com .) An define alternative search baseDN can be defined for each database possible in the /etc/nsswitch.conf file (see nsswitch.conf(4) ). To remove a specific alternate baseDN, specify the database without any argument (for example, "passwd :"). The default value for all databases is NULL .
Specify the domain name (which becomes the defaultdomain for the machine). The default is the current domain name.
Specify the Bind Distinguished Name (for example, cn=proxyagent ,ou=profile ,cd=eng ,dc=sun ,dc=com .)
Specify the TTL value for the client information. This is only relevant if the machine was initialized with a client profile. Set client_TTL to 0 (zero) if you do not wish for ldap_cachemgr to attempt an automatic refresh from the servers. The times are specified with either a zero ``0'' (for no expiration) or a positive integer and either ``d'' for days, ``h'' for hours, ``m'' for minutes or ``s'' for seconds. The default is 12h.
List the contents of the LDAP client cache. The output (sent to standard output) is meant to be easily readable (the direct contents of the cache files might not be easily readable.).
Modify parameters in the configuration file.
Specify LDAP operation timeout value. The default is the TCP default (usually 3 minutes.)
Inform the client to contact only the servers on the preferred list (if for instance they are at the wrong end of a WAN). The default is FALSE.
Specify the server preference list (for example, 184.108.40.206:8080,220.127.116.11:386.) The preferred servers can be defined either by the server specific address or the subnet that the server resides. To remove the server preference, specify "" for the -p option. The default preference is the local subnet.
Specify a profile that is downloaded from the server and sets all the entries automatically. This option also sets an expiration time that ldap_cachemgr can use to automatically update the file if needed. The default profile_name is 'default ' and is stored in the bind distinguished name. The profile name is also stored in cache file.
Specify the search referal option, either followref or noref . The default is followref .
Uninitialize LDAP client. This option is appropriate only if ldapclient was used to initialize client.
Specify verbose mode.
Specify client password for simple and cram_md5 authentication modes. This option is not required if authentication mode is none .
The following operands are supported:
Server address (for example, 18.104.22.168:389,22.214.171.124.) The port number is optional; if not specified, the default LDAP server port number ':389' is used.
Setup a client using the default profile stored on the server specified. This should list all the correct values for talking to your domain.
example# ldapclient -P default 126.96.36.199
example# ldapclient -i -a none 188.8.131.52
Setup an LDAP client to use cram_md5 with client password "secret", with the domain information expiring once a week, with no search dereference, with the domain name "xyz.sun.com", and with the LDAP server running on port number 386 at IP address 184.108.40.206.
example# ldapclient -i -a cram_md5 -w secret -d xyz.sun.com. \\ -r noref 220.127.116.11:386
Setup an LDAPclient using two servers and with authentication mode of simple . The user will be prompted for a client password.
example# ldapclient -i 18.104.22.168 22.214.171.124:386
Setup an LDAP client with authentication mode of none that does not try an encrypt the transport with SSL and talks to only one server.
example# ldapclient -i -a none -a 126.96.36.199
Use ldap_gen_profile to set only the Base DN and the server addresses, usoing all possible default values.
example# ldap_gen_profile \\ -D cn=proxyagent,ou=profile,cd=eng,dc=sun,dc=com \\ 188.8.131.52 184.108.40.206:386 > ldif_profile
example# ldap_gen_profile -P eng -a cram_md5 -d ge.co.uk -w test123 \\ -b dc=eng,dc=ge-uk,dc=com -B ou=people,dc=lab,dc=ge-uk,dc=com \\ -D cn=proxyagent,ou=profile,cd=eng,dc=ge-uk,dc=com -r noref \\ -e 1h -O -p 220.127.116.11 -o 30s 18.104.22.168 22.214.171.124 \\ 126.96.36.199 > ldif_profile
contains a list of servers, their transport addresses, and the security method used to access them
contains Bind Distinguished Name (see -D above) and the encrypted password
system default domainname, matching the domainname of the "NIS data" in the LDAP servers
configuration file for the name-service switch
sample configuration file that uses "files" and "ldap"
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|