Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP)
Previous Next

Initializing an LDAP Client

ldapclient(1M) is a utility used to set up LDAP clients in the Solaris system. ldapclient assumes the server has already been configured with the appropriate client profiles. You must install and configure the server with the appropriate profiles before you can set up clients.


Note - The Solaris operating system does not support a configuration in which a NIS client and a Native LDAP client co-exist on the same client machine.


There are two main ways to set up a client by using ldapclient.

  • Profile

    At a minimum, you need to specify the server address containing the profile and domain you want to use. If no profile is specified, then the “default” profile is assumed. The server will provide the rest of the required information, except for proxy and certificate database information. If a client's credential level is proxy or proxy anonymous, you must supply the proxy bind DN and password. See Assigning Client Credential Levels for more information.

  • Manual

    You configure the profile on the client itself, which means defining all parameters from the command line. Thus, the profile information is stored in cache files and is never refreshed by the server.


Note - Though you can manually configure clients, it is not recommended. Using the configuration profiles decreases the complexity and cost of managing clients.


Using Profiles to Initialize a Client

How to Initialize a Client Using Profiles
  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Run ldapclient with init.
    # ldapclient init \
    -a profileName=new \
    -a domainName=west.example.com 192.168.0.1
    System successfully configured

Using Per-User Credentials


Note - Do not edit either of the client configuration files directly. Use ldapclient to create or modify the content of these files.


How to Initialize a Client Using Per-User Credentials
Before You Begin

Before you set up a client with per-user credentials the following items must already be configured:

  • One or more Kerberos KDC servers must be configured and running.

  • DNS, client access to a DNS server, and at least one DNS server, must be configured and running.

  • Kerberos on the client machine must be configured and enabled.

  • A Kerberos client installation profile must exist. Such a profile might be:

    # cat /usr/tmp/krb5.profile
    REALM SPARKS.COM
    KDC kdc.example.com
    ADMIN super/admin
    FILEPATH /usr/tmp/krb5.conf
    NFS 1
    DNSLOOKUP none
  • The LDAP server must be installed and configured to support the sasl/GSSAPI.

  • Appropriate identity mapping configurations must exist.

  • Kerberos host principals for the directory server and the KDC must be set up in the KDC.

  • idsconfig must have been run on the directory server DIT to be used.

  • An appropriate per-user profile gssapi profile (such as gssapi_EXAMPLE.COM) must have been created.

    An illustration of a per-user profile in idsconfig is shown in the following partial example:

    # /usr/lib/ldap/idsconfig
    Do you wish to continue with server setup (y/n/h)? [n] y
    Enter the iPlanet Directory Server's (iDS) hostname to setup: kdc.example.com
    Enter the port number for iDS (h=help): [389] <Enter your port>
    Enter the directory manager DN: [cn=Directory Manager] <Enter your DN>
    Enter passwd for cn=Directory Manager : <Enter your password>
    Enter the domainname to be served (h=help): [example.com] <Enter your domain>
    Enter LDAP Base DN (h=help): [dc=example,dc=com] <Enter your DN>
    GSSAPI is supported. Do you want to set up gssapi:(y/n) [n] y
    Enter Kerberos Realm: [EXAMPLE.COM] EXAMPLE.COM
    You can create a sasl/GSSAPI enabled profile with default values now.
    Do you want to create a sasl/GSSAPI default profile ? [n] y
    Enter. the profile name (h=help): [gssapi_EXAMPLE.COM] <Enter>
    GSSAPI setup is done. ...
  • The necessary user principals must exist in the Key Distribution Center (KDC).

  • On the client machine, Kerberos must be initialized using the client profile with a command such as:

    # /usr/sbin/kclient -p /usr/tmp/krb5.profile

  • /etc/nsswitch.ldap must be configured to use dns for hosts and ipnodes like this:

    host: files dns

    ipnodes: files dns

    (Modify this file with an editor as necessary)

  • /etc/resolv.conf must be configured and the dns service must be running (See the DNS chapters in this document for details)

  • The directory server DIT must be pre-loaded with (at a minimum) the users of this client machine, the client host and necessary auto_home LDAP entries. See other sections of this manual for details on how to add entries using ldapaddent.

  1. Run ldapclient init to initialize the client using the gssapi profile

    # /usr/sbin/ldapclient init -a profilename=gssapi_SPARKS.COM -a \

    domainname=example.com 9.9.9.50

  2. Try to log in as a user:

    Run kinit -p user.

    Run ldaplist -l passwd user in user's login session and you should see “userpassword.”

    But ldaplist -l passwd bar can get the entry without userpassword. By default root can still see userpassword of everybody.

More Information
Notes About Using Per-User Credentials
  • If the syslog has messages: libsldap: Status: 7 Mesg: openConnection: GSSAPI bind failed - 82 Local error, it is likely that Kerberos is not initialized or its ticket is expired. Run klist to browse it. Run kinit -p foo or kinit -R -p foo and try again.

  • If you want to, you can add pam_krb5.so.1 to /etc/pam.conf so it will automatically kinit when you log in.

  • For example:

    login auth optional pam_krb5.so.1 
    rlogin auth optional pam_krb5.so.1
    other auth optional pam_krb5.so.1
  • If a user is kinited and the syslog message indicates Invalid credential, then the problem could be the host entry (root) or user entry is not in LDAP directory or mapping rules are not correct.

  • When ldapclient init is executed, it makes some checks if the LDAP profile contains self/ sasl/GSSAPI configuration. If it fails at /etc/nsswitch.ldap check, then the usual reason is that dns was not added to host: and ipnodes:.

  • If it fails because the DNS client not enabled, run svcs -l dns/client to see if /etc/resolv.conf is missing or it is just disabled. Run svcadm enable dns/client to enable it.

  • If the check fails because of sasl/GSSAPI bind, check syslog to find out what went wrong.

See other references in this guide and in the System Administration Guide: Security Services for details.

Using Proxy Credentials

How to Initialize a Client Using Proxy Credentials

Note - Do not edit either of the client configuration files directly. Use ldapclient to create or modify the content of these files.


  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Run ldapclient (defining proxy values).
    # ldapclient init \
    -a proxyDN=cn=proxyagent,ou=profile,dc=west,dc=example,dc=com \
    -a domainName=west.example.com \
    -a profileName=pit1 \
    -a proxyPassword=test1234 192.168.0.1
    System successfully configured

    The -a proxyDN and -a proxyPassword are required if the profile to be used is set up for proxy. As the credentials are not stored in the profile saved on the server, you must supply the information when you initialize the client. This method is more secure than the older method of storing the proxy credentials on the server.

    The proxy information is used to create /var/ldap/ldap_client_cred. The rest of the information is put in /var/ldap/ldap_client_file.

Initializing a Client Manually

Superusers. or administrators with an equivalent role, can perform manual client configurations. However, many of the checks are bypassed during the process, so it is relatively easy to misconfigure your system. In addition, you must change settings on every machine, instead of in one central place, as is done when using profiles.

How to Initialize a Client Manually
  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Use ldapclient manual to initialize the client.
    # ldapclient manual \
    -a domainName=dc=west.example.com \
    -a credentialLevel=proxy \
    -a defaultSearchBase=dc=west,dc=example,dc=com \ 
    -a proxyDN=cn=proxyagent,ou=profile,dc=west,dc=example,dc=com \ 
    -a proxyPassword=testtest 192.168.0.1
  3. Use ldapclient list to verify.
    NS_LDAP_FILE_VERSION= 2.0
    NS_LDAP_BINDDN= cn=proxyagent,ou=profile,dc=west,dc=example,dc=com
    NS_LDAP_BINDPASSWD= {NS1}4a3788e8c053424f
    NS_LDAP_SERVERS= 192.168.0.1
    NS_LDAP_SEARCH_BASEDN= dc=west,dc=example,dc=com
    NS_LDAP_CREDENTIAL_LEVEL= proxy

Modifying a Manual Client Configuration

How to Modify a Manual Configuration
  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Use the ldapclient mod command to change the authentication method to simple.
    # ldapclient mod -a authenticationMethod=simple
  3. Use ldapclient list to verify the change was made.
    # ldapclient list
    NS_LDAP_FILE_VERSION= 2.0
    NS_LDAP_BINDDN= cn=proxyagent,ou=profile,dc=west,dc=example,dc=com
    NS_LDAP_BINDPASSWD= {NS1}4a3788e8c053424f
    NS_LDAP_SERVERS= 192.168.0.1
    NS_LDAP_SEARCH_BASEDN= dc=west,dc=example,dc=com
    NS_LDAP_AUTH= simple
    NS_LDAP_CREDENTIAL_LEVEL= proxy
Troubleshooting

You cannot change some attributes of an LDAP client configuration by using the mod subcommand. For example, you cannot change the profileName and profileTTL attributes. To change these attributes, create a new profile by using the ldapclient init command, as described in Using Profiles to Initialize a Client. Or, run the ldapclient manual command, as described in Initializing a Client Manually.

Uninitializing a Client

ldapclient uninit restores the client name service to what it was prior to the most recent init, modify, or manual operation. In other words, it performs an “undo” on the last step taken. For example, if the client was configured to use profile1 and was then changed to use profile2, using ldapclient uninit would revert the client back to using profile1.

How to Uninitialize a Client
  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Chapter 9, Using Role-Based Access Control (Tasks), in System Administration Guide: Security Services.

  2. Use ldapclient uninit.
    # ldapclient uninit
    System successfully recovered

Setting Up TLS Security


Note - The security database files must be readable by everyone. Do not include any private keys in the key3.db.


If using TLS, the necessary security databases must be installed. In particular, the certificate and key database files are needed. For example, if you adopt an older database format from Netscape Communicator, two files, cert7.db and key3.db, are required. Or if you use a new database format from Mozilla, three files, cert8.db, key3.db and secmod.db are needed. The cert7.db or cert8.db file contains trusted certificates. The key3.db file contains the client's keys. Even if the LDAP naming service client does not use client keys, this file must be present. The secmod.db file contains the security modules such as PKCS#11 module. This file is not required if the older format is used.


Note - Before running ldapclient, you should set up and install the needed security database files described in this section.


See the section about configuring LDAP clients to use SSL in the “Managing SSL” chapter of the Administrator's Guide for the version of Sun Java System Directory Server you are using. For information on how to create and manage these files. Once configured, these files must be stored in the location expected by the LDAP naming services client. The attribute certificatePath is used to determine this location. This is by default /var/ldap.

For example, after setting up the necessary cert7.db and key3.db files using Netscape CommunicatorTM, copy the files to the default location.

# cp $HOME/.netscape/cert7.db /var/ldap
# cp $HOME/.netscape/key3.db /var/ldap

Next, give everyone read access.

# chmod 444 /var/ldap/cert7.db
# chmod 444 /var/ldap/key3.db

Note - While Netscape manages the cert7.db and key3.db files in the $HOME/.netscape directory, Mozilla has its cert8.db, key3.db and secmod.db files managed in a sub-directory under $HOME/.mozilla. Copies of these security databases must be stored on a local file system if you are using them for an LDAP naming services client.


Configuring PAM

pam_ldap is one authentication and account management PAM module option for LDAP. See the pam_ldap(5) man page and Appendix A, Solaris 10 Software Updates to DNS, NIS, and LDAP for more information about the features currently supported with pam_ldap.

If you have selected both the per-user mode and the self credentials option, then you must also enable the PAM Kerberos pam_krb5(5) pam modules. See pam_krb5(5) and the System Administration Guide: Security Services documentation for further details.

Configuring PAM to Use UNIX policy

To configure PAM to use UNIX policy, follow the sample in Example pam.conf File for pam_ldap. Add the lines that contain pam_ldap.so.1 to the client's /etc/pam.conf file. For details, see the pam.conf(4) man page.

Configuring PAM to Use LDAP server_policy

To configure PAM to use LDAP server_policy, follow the sample in Example pam_conf file for pam_ldap Configured for Account Management. Add the lines that contain pam_ldap.so.1 to the client's /etc/pam.conf file. In addition, if any PAM module in the sample pam.conf file specifies the binding flag and the server_policy option, use the same flag and option for the corresponding module in the client's /etc/pam.conf file. Also, add the server_policy option to the line that contains the service module pam_authtok_store.so.1.


Note - Previously, if you enabled pam_ldap account management, all users needed to provide a login password for authentication any time they logged in to the system. Therefore, nonpassword-based logins using tools such as rsh, rlogin, or ssh would fail.

Now, however, pam_ldap(5), when used with Sun Java System Directory Servers DS5.2p4 and newer releases, enables users to log in with rsh, rlogin, rcp and ssh without giving a password.

pam_ldap(5) is now modified to do account management and retrieve the account status of users without authenticating to Directory Server as the user logging in. The new control to this on Directory Server is 1.3.6.1.4.1.42.2.27.9.5.8, which is enabled by default.

To modify this control for other than default, add Access Control Instructions (ACI) on Directory Server:

dn: oid=1.3.6.1.4.1.42.2.27.9.5.8,cn=features,cn=config
objectClass: top
objectClass: directoryServerFeature
oid:1.3.6.1.4.1.42.2.27.9.5.8
cn:Password Policy Account Usable Request Control
aci: (targetattr != "aci")(version 3.0; acl "Account Usable"; 
     allow (read, search, compare, proxy)
     (groupdn = "ldap:///cn=Administrators,cn=config");)
creatorsName: cn=server,cn=plugins,cn=config
modifiersName: cn=server,cn=plugins,cn=config

  • The binding control flag

    Using the binding control flag allows a local password override of a remote (LDAP) password. For example, if a user account is found on both the local files and the LDAP namespace, the password associated with the local account takes precedence over the remote password. Thus, if the local password expires, authentication fails even if the remote LDAP password is still valid.

  • The server_policy option

    The server_policy option instructs pam_unix_auth, pam_unix_account, and pam_passwd_auth to ignore a user found in the LDAP namespace and to allow pam_ldap to perform authentication or account validation. In the case of pam_authtok_store, a new password is passed to the LDAP server without encryption. The password is thereby stored in the directory according to the password encryption scheme configured on the server. For more information, see pam.conf(4) and pam_ldap(5).

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire