---
name: "libnss-ldap.conf"
section: "5"
platform: "linux"
package: "libnss-ldap"
version: "265-6"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/libnss-ldap.conf"
---

# libnss-ldap.conf(5)

LDAP nameservice provider

## NAME

nss\_ldap - LDAP nameservice provider

## DESCRIPTION

The **nss\_ldap** module is a set of C library extensions which allows X.500 and LDAP directory servers to be used as a primary source of name service information. (Name service information typically includes users, hosts, groups, and other such data historically stored in flat files or NIS.)

Features of the PADL nss\_ldap module include support for both the RFC 2307 and RFC 2307bis schema, a common implementation across multiple platforms, Kerberos and SSL security, configurable schema mapping, and configuration file compatibility with the [**pam\_ldap**(5)](/pam_ldap/5.md) module.

Because LDAP is a hierarchical directory service, one can distribute the information in a manner which reflects organizational structure. This contrasts with the flat, single domain policy of NIS. LDAP has many of the advantages of NIS+ (security and scalability) without the complexity.

**nss\_ldap** will work alongside existing NIS, NIS+, DNS and flat file name services. More importantly, because it builds as a shared library, it is not necessary to recompile any applications to take advantage of LDAP.

The present version of **nss\_ldap** supports AIX 4.3.3 and above, FreeBSD 5.1, HP-UX 11i, Linux and Solaris 2.6 and above. Many vendors provide their own LDAP nameservice providers, often also called nss\_ldap. This manual page applies to the PADL **nss\_ldap** module only. If you are using a vendor provided module, consult the relevant documentation instead.

The features supported by the version of **nss\_ldap** depend on which flags were enabled when the software was built. Most features are enabled in the configuration file, described below. (The location of the configuration file is configurable at compile time; the default path is /etc/libnss-ldap.conf.) Also, some features may be unavailable on certain operating systems or with certain LDAP libraries. For more information, consult your vendor.

## CONFIGURATION

**nss\_ldap** stores its configuration in the **ldap.conf** file, the location of which is configurable at compile time. (It should be noted that some LDAP client libraries, such as OpenLDAP, also use a configuration file of the same name. **nss\_ldap** supports many of the same configuration file options as OpenLDAP, but it adds several that are specific to the functionality it provides. Additionally, it is not guaranteed that **nss\_ldap** will continue to match the configuration file semantics of OpenLDAP. You may wish to use different files.)

Configuration file options consist of a keyword followed by a space and any arguments. The following options are supported by both **nss\_ldap** and the PADL **pam\_ldap** module:

- **host \<name:port ...\>**

  **Specifies the name(s) or IP address(es) of the** *LDAP* server(s) to connect to. In the case that **nss\_ldap** is used for host name resolution, each server should be specified as an IP address or name that can be resolved without using *LDAP.* Multiple servers may be specified, each separated by a space. The failover time depends on whether the *LDAP* client library supports configurable network or connect timeouts (see **bind\_timelimit** below).

- **base \<base\>**

  Specifies the default base distinguished name (DN) to use for searches.

- **uri \<ldap\[is\]://\[name\[:port\]\] ...\>**

  For *LDAP* client libraries that support it, specifies the URI(s) of the LDAP server(s) to connect to. The URI scheme may be **ldap,** **ldapi,** or **ldaps,** specifying LDAP over TCP, IPC and SSL respectively. If applicable, a port number can be specified; the default port number for the selected protocol is used if omitted. This option takes precedence over the **host** option; it is not possible to combine the two.

- **ldap\_version \<version\>**

  Specifies the version of the *LDAP* protocol to use. Presently **version** must be 2 or 3. The default is to use the maximum version supported by the client library.

- **binddn \<binddn\>**

  Specifies the distinguished name with which to bind to the directory server(s). This option is optional; the default is to bind anonymously.

- **bindpw \<bindpw\>**

  Specifies the cleartext credentials with which to bind. This option is only applicable when used with **binddn** above. The default is no credential (anonymous bind). When binding to the directory using *SASL* or other authentication mechanisms apart from simple binds, this option is not used.

- **rootbinddn \<binddn\>**

  This option has the same syntax and effect as the **binddn** option above, except it applies when the effective user ID is zero. If not specified, then the identity specified in **binddn** is used instead. Because the configuration file may be readable by many users, the root bind DN credentials are stored in the **ldap.secret** file instead. This file is usually in the same directory as the configuration file.

- **port \<port\>**

  Specifies the port to connect to; this option is used with the **host** option, and is ignored with the **uri** option.

- **scope \<sub\|one\|base\>**

  Specifies the search scope (subtree, one level or base object). The default scope is subtree; base scope is almost never useful for nameservice lookups.

- **deref \<never\|searching\|finding\|always\>**

  Specifies the policy for dereferencing aliases. The default policy is to never dereference aliases.

- **timelimit \<timelimit\>**

  Specifies the time limit (in seconds) to use when performing searches. A value of zero (0), which is the default, is to wait indefinitely for searches to be completed.

- **bind\_timelimit \<timelimit\>**

  Specifies the time limit (in seconds) to use when connecting to the directory server. This is distinct from the time limit specified in **timelimit** and affects the initial server connection only. (Server connections are otherwise cached.) Only some *LDAP* client libraries have the underlying functionality necessary to support this option. The default bind timelimit is 30 seconds.

- **referrals \<yes\|no\>**

  Specifies whether automatic referral chasing should be enabled. The default behaviour is specified by the *LDAP* client library.

- **restart \<yes\|no\>**

  Specifies whether the *LDAP* client library should restart the [select(2)](/select/2.md) system call when interrupted. This feature is not supported by all client libraries.

- **logdir \<directory\>**

  Specifies the directory used for logging by the *LDAP* client library. This feature is not supported by all client libraries.

- **debug \<level\>**

  Specifies the debug level used for logging by the *LDAP* client library. This feature is not supported by all client libraries, and does not apply to the **nss\_ldap** and **pam\_ldap** modules themselves (debugging, if any, is configured separately and usually at compile time).

- **ssl \<on\|off\|start\_tls\>**

  Specifies whether to use SSL/TLS or not (the default is not to). If **start\_tls** is specified then StartTLS is used rather than raw LDAP over SSL. Not all *LDAP* client libraries support both SSL and StartTLS, and all related configuration options.

- **sslpath \<cert7\_path\>**

  For the Netscape and Mozilla *LDAP* client libraries only, this specifies the path to the X.509 certificate database.

- **tls\_checkpeer \<yes\|no\>**

  Specifies whether to require and verify the server certificate or not, when using SSL/TLS with the OpenLDAP client library. The default is to use the default behaviour of the client library; for OpenLDAP 2.0 and earlier it is "no", for OpenLDAP 2.1 and later it is "yes". At least one of **tls\_cacertdir** and **tls\_cacertfile** is required if peer verification is enabled.

- **tls\_cacertdir \<certificate\_dir\>**

  Specifies the directory containing X.509 certificates for peer authentication.

- **tls\_cacertfile \<certificate\_file\>**

  Specifies the path to the X.509 certificate for peer authentication.

- **tls\_randfile \<entropy\_file\>**

  Specifies the path to an entropy source.

- **tls\_ciphers \<ciphers\>**

  Specifies the ciphers to use for TLS. See your TLS implementation's documentation for further information.

- **tls\_cert \<certificate\_file\>**

  Specifies the path to the file containing the local certificate for client TLS authentication.

- **tls\_key \<key\_file\>**

  Specifies the path to the file containing the private key for client TLS authentication.

- The following configuration options apply to nss\_ldap only:

  - **bind\_policy \<hard\_open\|hard\_init\|soft\>**

  Specifies the policy to use for reconnecting to an unavailable *LDAP* server. The default is **hard\_open,** which reconnects if opening the connection to the directory server failed. By contrast, **hard\_init** reconnects if initializing the connection failed. Initializing may not actually contact the directory server, and it is possible that a malformed configuration file will trigger reconnection. If **soft** is specified, then **nss\_ldap** will return immediately on server failure. All "hard" reconnect policies block with exponential backoff before retrying.

- **nss\_connect\_policy \<persist\|oneshot\>**

  Determines whether nss\_ldap persists connections. The default is for the connection to the LDAP server to remain open after the first request.

- **idle\_timelimit \<timelimit\>**

  Specifies the time (in seconds) after which **nss\_ldap** will close connections to the directory server. The default is not to time out connections.

- **sasl\_authid \<authid\>**

  Specifies the authorization identity to be used when performing SASL authentication.

- **rootsasl\_auth\_id \<authid\>**

  Specifies the authorization identity to be used when performing SASL authentication as root (when the effective user ID is zero).

- **sasl\_secprops \<properties\>**

  Specifies Cyrus SASL security properties. Allowed values are described in the [ldap.conf(5)](/ldap.conf/5.md) manual page.

- **rootuse\_sasl \<yes\|no\>**

  Specifies whether SASL authentication should be used when the effective user ID is zero.

- **krb5\_ccname \<PREFIX:args\>**

  If **nss\_ldap** is built with configurable GSS-API credentials cache name support, specifies the Kerberos credentials cache to use.

- **nss\_paged\_results \<yes\|no\>**

  Enables support for paged results.

- **pagesize \<pagesize\>**

  When paged results are enabled (see above), specifies the number of entries to return in a single page. The default is 1000.

- **nss\_base\_\<map\> \<basedn?scope?filter\>**

  Specify the search base, scope and filter to be used for specific maps. (Note that **map** forms part of the configuration file keyword and is one of passwd, shadow, group, hosts, services, networks, protocols, rpc, ethers, netmasks, bootparams, aliases and netgroup.) The syntax of **basedn** and **scope** are the same as for the configuration file options of the same name, with the addition of being able to omit the trailing suffix of the base DN (in which case the global base DN will be appended instead).  The **filter** is a search filter to be added to the default search filter for a specific map, such that the effective filter is the logical intersection of the two. The base DN, scope and filter are separated with literal question marks (?) as given above; this is for compatibility with the DUA configuration profile schema and the **ldapprofile** tool. This option may be specified multiple times.

- **nss\_map\_attribute \<from\_attribute\> \<to\_attribute\>**

  This option may be specified multiple times, and directs **nss\_ldap** to use the attribute **to\_attribute** instead of the RFC 2307 attribute **from\_attribute** in all lookups. If  **nss\_ldap** was built without schema mapping support, then this option is ignored.

- **nss\_map\_objectclass \<from\_objectclass\> \<to\_objectclass\>**

  This option may be specified multiple times, and directs **nss\_ldap** to use the object class **to\_objectclass** instead of the RFC 2307 object class **from\_objectclass** in all lookups. If **nss\_ldap** was built without schema mapping support, then this option is ignored.

- **nss\_default\_attribute\_value \<attribute\> \<value\>**

  Specifies the default value to use for entries that lack the specified attribute. This option may be specified multiple times, for different attributes. If **nss\_ldap** was built without schema mapping support, then this option is ignored.

- **nss\_override\_attribute\_value \<attribute\> \<value\>**

  Specifies a value to use for the specified attribute in preference  to that contained in the actual entry. This option may be specified multiple times, for different attributes. If **nss\_ldap** was built without schema mapping support, then this option is ignored.

- **nss\_schema \<rfc2307bis\|rfc2307\>**

  If the value of this option is rfc2307bis then support for the RFC2307bis schema (distinguished names in groups) will be enabled.

- **nss\_initgroups \<backlink\>**

  This option directs the **nss\_ldap** implementation of **[initgroups(3)](/initgroups/3.md)** to determine a user's group membership by reading the memberOf attribute of their directory entry (and of any nested groups), rather than querying on uniqueMember. This may provide increased performance with certain directory servers that have peculiar indexing configurations. If RFC2307bis support is disabled, then this option is ignored.

- **nss\_initgroups\_ignoreusers \<user1,user2,...,userN\>**

  This option directs the **nss\_ldap** implementation of **[initgroups(3)](/initgroups/3.md)** to return NSS\_STATUS\_NOTFOUND if called with a listed users as its argument.

- **nss\_getgrent\_skipmembers \<yes\|no\>**

  Specifies whether or not to populate the members list in the group structure for group lookups. If very large groups are present, enabling this option will greatly increase performance, at the cost of some lost functionality. You should verify no local applications rely on this information before enabling this on a production system.

- **nss\_srv\_domain \<domain\>**

  This option determines the DNS domain used for performing SRV lookups.

## AUTHOR

The **nss\_ldap** module was developed by PADL Software Pty Ltd (www.padl.com).

## FILES

- /etc/libnss-ldap.conf, /etc/libnss-ldap.secret, /etc/nsswitch.conf

  ## SEE ALSO

[**nsswitch.conf**(5)](/nsswitch.conf/5.md)
