.\" DO NOT EDIT THIS FILE, IT IS NOT THE MASTER! .\" IT IS GENERATED AUTOMATICALLY FROM sudoers.ldap.mdoc.in .\" .\" Copyright (c) 2003-2014 Todd C. Miller .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .TH "SUDOERS.LDAP" "8" "February 7, 2014" "Sudo @PACKAGE_VERSION@" "OpenBSD System Manager's Manual" .nh .if n .ad l .SH "NAME" \fBsudoers.ldap\fR \- sudo LDAP configuration .SH "DESCRIPTION" In addition to the standard \fIsudoers\fR file, \fBsudo\fR may be configured via LDAP. This can be especially useful for synchronizing \fIsudoers\fR in a large, distributed environment. .PP Using LDAP for \fIsudoers\fR has several benefits: .TP 4n \fBo\fR \fBsudo\fR no longer needs to read \fIsudoers\fR in its entirety. When LDAP is used, there are only two or three LDAP queries per invocation. This makes it especially fast and particularly usable in LDAP environments. .TP 4n \fBo\fR \fBsudo\fR no longer exits if there is a typo in \fIsudoers\fR. It is not possible to load LDAP data into the server that does not conform to the sudoers schema, so proper syntax is guaranteed. It is still possible to have typos in a user or host name, but this will not prevent \fBsudo\fR from running. .TP 4n \fBo\fR It is possible to specify per-entry options that override the global default options. \fI@sysconfdir@/sudoers\fR only supports default options and limited options associated with user/host/commands/aliases. The syntax is complicated and can be difficult for users to understand. Placing the options directly in the entry is more natural. .TP 4n \fBo\fR The \fBvisudo\fR program is no longer needed. \fBvisudo\fR provides locking and syntax checking of the \fI@sysconfdir@/sudoers\fR file. Since LDAP updates are atomic, locking is no longer necessary. Because syntax is checked when the data is inserted into LDAP, there is no need for a specialized tool to check syntax. .PP Another major difference between LDAP and file-based \fIsudoers\fR is that in LDAP, \fBsudo\fR-specific Aliases are not supported. .PP For the most part, there is really no need for \fBsudo\fR-specific Aliases. Unix groups, non-Unix groups (via the \fIgroup_plugin\fR) or user netgroups can be used in place of User_Aliases and Runas_Aliases. Host netgroups can be used in place of Host_Aliases. Since groups and netgroups can also be stored in LDAP there is no real need for \fBsudo\fR-specific aliases. .PP Cmnd_Aliases are not really required either since it is possible to have multiple users listed in a \fRsudoRole\fR. Instead of defining a Cmnd_Alias that is referenced by multiple users, one can create a \fRsudoRole\fR that contains the commands and assign multiple users to it. .SS "SUDOers LDAP container" The \fIsudoers\fR configuration is contained in the \fRou=SUDOers\fR LDAP container. .PP Sudo first looks for the \fRcn=default\fR entry in the SUDOers container. If found, the multi-valued \fRsudoOption\fR attribute is parsed in the same manner as a global \fRDefaults\fR line in \fI@sysconfdir@/sudoers\fR. In the following example, the \fRSSH_AUTH_SOCK\fR variable will be preserved in the environment for all users. .nf .sp .RS 4n dn: cn=defaults,ou=SUDOers,dc=example,dc=com objectClass: top objectClass: sudoRole cn: defaults description: Default sudoOption's go here sudoOption: env_keep+=SSH_AUTH_SOCK .RE .fi .PP The equivalent of a sudoer in LDAP is a \fRsudoRole\fR. It consists of the following attributes: .TP 6n \fBsudoUser\fR A user name, user ID (prefixed with \(oq#\(cq), Unix group name or ID (prefixed with \(oq%\(cq or \(oq%#\(cq respectively), user netgroup (prefixed with \(oq+\(cq), or non-Unix group name or ID (prefixed with \(oq%:\(cq or \(oq%:#\(cq respectively). Non-Unix group support is only available when an appropriate \fIgroup_plugin\fR is defined in the global \fIdefaults\fR \fRsudoRole\fR object. .TP 6n \fBsudoHost\fR A host name, IP address, IP network, or host netgroup (prefixed with a \(oq+\(cq). The special value \fRALL\fR will match any host. .TP 6n \fBsudoCommand\fR A fully-qualified Unix command name with optional command line arguments, potentially including globbing characters (aka wild cards). If a command name is preceded by an exclamation point, \(oq\&!\(cq, the user will be prohibited from running that command. .sp The built-in command \(lq\fRsudoedit\fR\(rq is used to permit a user to run \fBsudo\fR with the \fB\-e\fR option (or as \fBsudoedit\fR). It may take command line arguments just as a normal command does. Note that \(lq\fRsudoedit\fR\(rq is a command built into \fBsudo\fR itself and must be specified in without a leading path. .sp The special value \fRALL\fR will match any command. .sp If a command name is prefixed with a SHA-2 digest, it will only be allowed if the digest matches. This may be useful in situations where the user invoking \fBsudo\fR has write access to the command or its parent directory. The following digest formats are supported: sha224, sha256, sha384 and sha512. The digest name must be followed by a colon (\(oq:\&\(cq) and then the actual digest, in either hex or base64 format. For example, given the following value for sudoCommand: .nf .sp .RS 10n sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ /bin/ls .RE .fi .RS 6n .sp The user may only run \fI/bin/ls\fR if its sha224 digest matches the specified value. Command digests are only supported by version 1.8.7 or higher. .RE .TP 6n \fBsudoOption\fR Identical in function to the global options described above, but specific to the \fRsudoRole\fR in which it resides. .TP 6n \fBsudoRunAsUser\fR A user name or uid (prefixed with \(oq#\(cq) that commands may be run as or a Unix group (prefixed with a \(oq%\(cq) or user netgroup (prefixed with a \(oq+\(cq) that contains a list of users that commands may be run as. The special value \fRALL\fR will match any user. .sp The \fRsudoRunAsUser\fR attribute is only available in \fBsudo\fR versions 1.7.0 and higher. Older versions of \fBsudo\fR use the \fRsudoRunAs\fR attribute instead. .TP 6n \fBsudoRunAsGroup\fR A Unix group or gid (prefixed with \(oq#\(cq) that commands may be run as. The special value \fRALL\fR will match any group. .sp The \fRsudoRunAsGroup\fR attribute is only available in \fBsudo\fR versions 1.7.0 and higher. .TP 6n \fBsudoNotBefore\fR A timestamp in the form \fRyyyymmddHHMMSSZ\fR that can be used to provide a start date/time for when the \fRsudoRole\fR will be valid. If multiple \fRsudoNotBefore\fR entries are present, the earliest is used. Note that timestamps must be in Coordinated Universal Time (UTC), not the local timezone. The minute and seconds portions are optional, but some LDAP servers require that they be present (contrary to the RFC). .sp The \fRsudoNotBefore\fR attribute is only available in \fBsudo\fR versions 1.7.5 and higher and must be explicitly enabled via the \fBSUDOERS_TIMED\fR option in \fI@ldap_conf@\fR. .TP 6n \fBsudoNotAfter\fR A timestamp in the form \fRyyyymmddHHMMSSZ\fR that indicates an expiration date/time, after which the \fRsudoRole\fR will no longer be valid. If multiple \fRsudoNotBefore\fR entries are present, the last one is used. Note that timestamps must be in Coordinated Universal Time (UTC), not the local timezone. The minute and seconds portions are optional, but some LDAP servers require that they be present (contrary to the RFC). .sp The \fRsudoNotAfter\fR attribute is only available in \fBsudo\fR versions 1.7.5 and higher and must be explicitly enabled via the \fBSUDOERS_TIMED\fR option in \fI@ldap_conf@\fR. .TP 6n \fBsudoOrder\fR The \fRsudoRole\fR entries retrieved from the LDAP directory have no inherent order. The \fRsudoOrder\fR attribute is an integer (or floating point value for LDAP servers that support it) that is used to sort the matching entries. This allows LDAP-based sudoers entries to more closely mimic the behavior of the sudoers file, where the of the entries influences the result. If multiple entries match, the entry with the highest \fRsudoOrder\fR attribute is chosen. This corresponds to the \(lqlast match\(rq behavior of the sudoers file. If the \fRsudoOrder\fR attribute is not present, a value of 0 is assumed. .sp The \fRsudoOrder\fR attribute is only available in \fBsudo\fR versions 1.7.5 and higher. .PP Each attribute listed above should contain a single value, but there may be multiple instances of each attribute type. A \fRsudoRole\fR must contain at least one \fRsudoUser\fR, \fRsudoHost\fR and \fRsudoCommand\fR. .PP The following example allows users in group wheel to run any command on any host via \fBsudo\fR: .nf .sp .RS 4n dn: cn=%wheel,ou=SUDOers,dc=example,dc=com objectClass: top objectClass: sudoRole cn: %wheel sudoUser: %wheel sudoHost: ALL sudoCommand: ALL .RE .fi .SS "Anatomy of LDAP sudoers lookup" When looking up a sudoer using LDAP there are only two or three LDAP queries per invocation. The first query is to parse the global options. The second is to match against the user's name and the groups that the user belongs to. (The special \fRALL\fR tag is matched in this query too.) If no match is returned for the user's name and groups, a third query returns all entries containing user netgroups and checks to see if the user belongs to any of them. .PP If timed entries are enabled with the \fBSUDOERS_TIMED\fR configuration directive, the LDAP queries include a sub-filter that limits retrieval to entries that satisfy the time constraints, if any. .SS "Differences between LDAP and non-LDAP sudoers" There are some subtle differences in the way sudoers is handled once in LDAP. Probably the biggest is that according to the RFC, LDAP ordering is arbitrary and you cannot expect that Attributes and Entries are returned in any specific order. .PP The order in which different entries are applied can be controlled using the \fRsudoOrder\fR attribute, but there is no way to guarantee the order of attributes within a specific entry. If there are conflicting command rules in an entry, the negative takes precedence. This is called paranoid behavior (not necessarily the most specific match). .PP Here is an example: .nf .sp .RS 4n # /etc/sudoers: # Allow all commands except shell johnny ALL=(root) ALL,!/bin/sh # Always allows all commands because ALL is matched last puddles ALL=(root) !/bin/sh,ALL # LDAP equivalent of johnny # Allows all commands except shell dn: cn=role1,ou=Sudoers,dc=my-domain,dc=com objectClass: sudoRole objectClass: top cn: role1 sudoUser: johnny sudoHost: ALL sudoCommand: ALL sudoCommand: !/bin/sh # LDAP equivalent of puddles # Notice that even though ALL comes last, it still behaves like # role1 since the LDAP code assumes the more paranoid configuration dn: cn=role2,ou=Sudoers,dc=my-domain,dc=com objectClass: sudoRole objectClass: top cn: role2 sudoUser: puddles sudoHost: ALL sudoCommand: !/bin/sh sudoCommand: ALL .RE .fi .PP Another difference is that negations on the Host, User or Runas are currently ignored. For example, the following attributes do not behave the way one might expect. .nf .sp .RS 4n # does not match all but joe # rather, does not match anyone sudoUser: !joe # does not match all but joe # rather, matches everyone including Joe sudoUser: ALL sudoUser: !joe # does not match all but web01 # rather, matches all hosts including web01 sudoHost: ALL sudoHost: !web01 .RE .fi .SS "Sudoers schema" In order to use \fBsudo\fR's LDAP support, the \fBsudo\fR schema must be installed on your LDAP server. In addition, be sure to index the \fRsudoUser\fR attribute. .PP Three versions of the schema: one for OpenLDAP servers (\fIschema.OpenLDAP\fR), one for Netscape-derived servers (\fIschema.iPlanet\fR), and one for Microsoft Active Directory (\fIschema.ActiveDirectory\fR) may be found in the \fBsudo\fR distribution. .PP The schema for \fBsudo\fR in OpenLDAP form is also included in the \fIEXAMPLES\fR section. .SS "Configuring ldap.conf" Sudo reads the \fI@ldap_conf@\fR file for LDAP-specific configuration. Typically, this file is shared between different LDAP-aware clients. As such, most of the settings are not \fBsudo\fR-specific. Note that \fBsudo\fR parses \fI@ldap_conf@\fR itself and may support options that differ from those described in the system's ldap.conf(@mansectsu@) manual. The path to \fIldap.conf\fR may be overridden via the \fIldap_conf\fR plugin argument in sudo.conf(@mansectform@). .PP Also note that on systems using the OpenLDAP libraries, default values specified in \fI/etc/openldap/ldap.conf\fR or the user's \fI.ldaprc\fR files are not used. .PP Only those options explicitly listed in \fI@ldap_conf@\fR as being supported by \fBsudo\fR are honored. Configuration options are listed below in upper case but are parsed in a case-independent manner. .PP The pound sign (\(oq#\(cq) is used to indicate a comment. Both the comment character and any text after it, up to the end of the line, are ignored. Long lines can be continued with a backslash (\(oq\e\(cq) as the last character on the line. Note that leading white space is removed from the beginning of lines even when the continuation character is used. .TP 6n \fBURI\fR \fIldap[s]://[hostname[:port]] ...\fR Specifies a white space-delimited list of one or more URIs describing the LDAP server(s) to connect to. The \fIprotocol\fR may be either \fIldap\fR \fIldaps\fR, the latter being for servers that support TLS (SSL) encryption. If no \fIport\fR is specified, the default is port 389 for \fRldap://\fR or port 636 for \fRldaps://\fR. If no \fIhostname\fR is specified, \fBsudo\fR will connect to \fIlocalhost\fR. Multiple \fBURI\fR lines are treated identically to a \fBURI\fR line containing multiple entries. Only systems using the OpenSSL libraries support the mixing of \fRldap://\fR and \fRldaps://\fR URIs. Both the Netscape-derived and Tivoli LDAP libraries used on most commercial versions of Unix are only capable of supporting one or the other. .TP 6n \fBHOST\fR \fIname[:port] ...\fR If no \fBURI\fR is specified, the \fBHOST\fR parameter specifies a white space-delimited list of LDAP servers to connect to. Each host may include an optional \fIport\fR separated by a colon (\(oq:\&\(cq). The \fBHOST\fR parameter is deprecated in favor of the \fBURI\fR specification and is included for backwards compatibility. .TP 6n \fBPORT\fR \fIport_number\fR If no \fBURI\fR is specified, the \fBPORT\fR parameter specifies the default port to connect to on the LDAP server if a \fBHOST\fR parameter does not specify the port itself. If no \fBPORT\fR parameter is used, the default is port 389 for LDAP and port 636 for LDAP over TLS (SSL). The \fBPORT\fR parameter is deprecated in favor of the \fBURI\fR specification and is included for backwards compatibility. .TP 6n \fBBIND_TIMELIMIT\fR \fIseconds\fR The \fBBIND_TIMELIMIT\fR parameter specifies the amount of time, in seconds, to wait while trying to connect to an LDAP server. If multiple \fBURI\fRs or \fBHOST\fRs are specified, this is the amount of time to wait before trying the next one in the list. .TP 6n \fBNETWORK_TIMEOUT\fR \fIseconds\fR An alias for \fBBIND_TIMELIMIT\fR for OpenLDAP compatibility. .TP 6n \fBTIMELIMIT\fR \fIseconds\fR The \fBTIMELIMIT\fR parameter specifies the amount of time, in seconds, to wait for a response to an LDAP query. .TP 6n \fBTIMEOUT\fR \fIseconds\fR The \fBTIMEOUT\fR parameter specifies the amount of time, in seconds, to wait for a response from the various LDAP APIs. .TP 6n \fBSUDOERS_BASE\fR \fIbase\fR The base DN to use when performing \fBsudo\fR LDAP queries. Typically this is of the form \fRou=SUDOers,dc=example,dc=com\fR for the domain \fRexample.com\fR. Multiple \fBSUDOERS_BASE\fR lines may be specified, in which case they are queried in the order specified. .TP 6n \fBSUDOERS_SEARCH_FILTER\fR \fIldap_filter\fR An LDAP filter which is used to restrict the set of records returned when performing a \fBsudo\fR LDAP query. Typically, this is of the form \fRattribute=value\fR or \fR(&(attribute=value)(attribute2=value2))\fR. The default search filter is: \fRobjectClass=sudoRole\fR. If \fIldap_filter\fR is omitted, no search filter will be used. .TP 6n \fBSUDOERS_TIMED\fR \fIon/true/yes/off/false/no\fR Whether or not to evaluate the \fRsudoNotBefore\fR and \fRsudoNotAfter\fR attributes that implement time-dependent sudoers entries. .TP 6n \fBSUDOERS_DEBUG\fR \fIdebug_level\fR This sets the debug level for \fBsudo\fR LDAP queries. Debugging information is printed to the standard error. A value of 1 results in a moderate amount of debugging information. A value of 2 shows the results of the matches themselves. This parameter should not be set in a production environment as the extra information is likely to confuse users. .sp The \fBSUDOERS_DEBUG\fR parameter is deprecated and will be removed in a future release. The same information is now logged via the \fBsudo\fR debugging framework using the \(lqldap\(rq subsystem at priorities \fIdiag\fR and \fIinfo\fR for \fIdebug_level\fR values 1 and 2 respectively. See the sudo.conf(@mansectform@) manual for details on how to configure \fBsudo\fR debugging. .TP 6n \fBBINDDN\fR \fIDN\fR The \fBBINDDN\fR parameter specifies the identity, in the form of a Distinguished Name (DN), to use when performing LDAP operations. If not specified, LDAP operations are performed with an anonymous identity. By default, most LDAP servers will allow anonymous access. .TP 6n \fBBINDPW\fR \fIsecret\fR The \fBBINDPW\fR parameter specifies the password to use when performing LDAP operations. This is typically used in conjunction with the \fBBINDDN\fR parameter. .TP 6n \fBROOTBINDDN\fR \fIDN\fR The \fBROOTBINDDN\fR parameter specifies the identity, in the form of a Distinguished Name (DN), to use when performing privileged LDAP operations, such as \fIsudoers\fR queries. The password corresponding to the identity should be stored in the or the path specified by the \fIldap_secret\fR plugin argument in sudo.conf(@mansectform@), which defaults to \fI@ldap_secret@\fR. If no \fBROOTBINDDN\fR is specified, the \fBBINDDN\fR identity is used (if any). .TP 6n \fBLDAP_VERSION\fR \fInumber\fR The version of the LDAP protocol to use when connecting to the server. The default value is protocol version 3. .TP 6n \fBSSL\fR \fIon/true/yes/off/false/no\fR If the \fBSSL\fR parameter is set to \fRon\fR, \fRtrue\fR \fRor\fR \fRyes\fR, TLS (SSL) encryption is always used when communicating with the LDAP server. Typically, this involves connecting to the server on port 636 (ldaps). .TP 6n \fBSSL\fR \fIstart_tls\fR If the \fBSSL\fR parameter is set to \fRstart_tls\fR, the LDAP server connection is initiated normally and TLS encryption is begun before the bind credentials are sent. This has the advantage of not requiring a dedicated port for encrypted communications. This parameter is only supported by LDAP servers that honor the \fIstart_tls\fR extension, such as the OpenLDAP and Tivoli Directory servers. .TP 6n \fBTLS_CHECKPEER\fR \fIon/true/yes/off/false/no\fR If enabled, \fBTLS_CHECKPEER\fR will cause the LDAP server's TLS certificated to be verified. If the server's TLS certificate cannot be verified (usually because it is signed by an unknown certificate authority), \fBsudo\fR will be unable to connect to it. If \fBTLS_CHECKPEER\fR is disabled, no check is made. Note that disabling the check creates an opportunity for man-in-the-middle attacks since the server's identity will not be authenticated. If possible, the CA's certificate should be installed locally so it can be verified. This option is not supported by the Tivoli Directory Server LDAP libraries. .TP 6n \fBTLS_CACERT\fR \fIfile name\fR An alias for \fBTLS_CACERTFILE\fR for OpenLDAP compatibility. .TP 6n \fBTLS_CACERTFILE\fR \fIfile name\fR The path to a certificate authority bundle which contains the certificates for all the Certificate Authorities the client knows to be valid, e.g.\& \fI/etc/ssl/ca-bundle.pem\fR. This option is only supported by the OpenLDAP libraries. Netscape-derived LDAP libraries use the same certificate database for CA and client certificates (see \fBTLS_CERT\fR). .TP 6n \fBTLS_CACERTDIR\fR \fIdirectory\fR Similar to \fBTLS_CACERTFILE\fR but instead of a file, it is a directory containing individual Certificate Authority certificates, e.g.\& \fI/etc/ssl/certs\fR. The directory specified by \fBTLS_CACERTDIR\fR is checked after \fBTLS_CACERTFILE\fR. This option is only supported by the OpenLDAP libraries. .TP 6n \fBTLS_CERT\fR \fIfile name\fR The path to a file containing the client certificate which can be used to authenticate the client to the LDAP server. The certificate type depends on the LDAP libraries used. .PP .RS 6n .PD 0 .TP 6n OpenLDAP: \fRtls_cert /etc/ssl/client_cert.pem\fR .PD .TP 6n Netscape-derived: \fRtls_cert /var/ldap/cert7.db\fR .TP 6n Tivoli Directory Server: Unused, the key database specified by \fBTLS_KEY\fR contains both keys and certificates. .sp When using Netscape-derived libraries, this file may also contain Certificate Authority certificates. .PD 0 .PP .RE .PD .TP 6n \fBTLS_KEY\fR \fIfile name\fR The path to a file containing the private key which matches the certificate specified by \fBTLS_CERT\fR. The private key must not be password-protected. The key type depends on the LDAP libraries used. .PP .RS 6n .PD 0 .TP 6n OpenLDAP: \fRtls_key /etc/ssl/client_key.pem\fR .PD .TP 6n Netscape-derived: \fRtls_key /var/ldap/key3.db\fR .TP 6n Tivoli Directory Server: \fRtls_key /usr/ldap/ldapkey.kdb\fR .PD 0 .PP When using Tivoli LDAP libraries, this file may also contain Certificate Authority and client certificates and may be encrypted. .RE .PD .TP 6n \fBTLS_KEYPW\fR \fIsecret\fR The \fBTLS_KEYPW\fR contains the password used to decrypt the key database on clients using the Tivoli Directory Server LDAP library. This should be a simple string without quotes. The password may not include the comment character (\(oq#\(cq) and escaping of special characters with a backslash (\(oq\e\(cq) is not supported. If this option is used, \fI@ldap_conf@\fR must not be world-readable to avoid exposing the password. Alternately, a \fIstash file\fR can be used to store the password in encrypted form (see below). .sp If no \fBTLS_KEYPW\fR is specified, a \fIstash file\fR will be used if it exists. The \fIstash file\fR must have the same path as the file specified by \fBTLS_KEY\fR, but use a \fR.sth\fR file extension instead of \fR.kdb\fR, e.g.\& \fRldapkey.sth\fR. The default \fRldapkey.kdb\fR that ships with Tivoli Directory Server is encrypted with the password \fRssl_password\fR. The \fIgsk8capicmd\fR utility can be used to manage the key database and create a \fIstash file\fR. This option is only supported by the Tivoli LDAP libraries. .TP 6n \fBTLS_RANDFILE\fR \fIfile name\fR The \fBTLS_RANDFILE\fR parameter specifies the path to an entropy source for systems that lack a random device. It is generally used in conjunction with \fIprngd\fR or \fIegd\fR. This option is only supported by the OpenLDAP libraries. .TP 6n \fBTLS_CIPHERS\fR \fIcipher list\fR The \fBTLS_CIPHERS\fR parameter allows the administer to restrict which encryption algorithms may be used for TLS (SSL) connections. See the OpenLDAP or Tivoli Directory Server manual for a list of valid ciphers. This option is not supported by Netscape-derived libraries. .TP 6n \fBUSE_SASL\fR \fIon/true/yes/off/false/no\fR Enable \fBUSE_SASL\fR for LDAP servers that support SASL authentication. .TP 6n \fBSASL_AUTH_ID\fR \fIidentity\fR The SASL user name to use when connecting to the LDAP server. By default, \fBsudo\fR will use an anonymous connection. .TP 6n \fBROOTUSE_SASL\fR \fIon/true/yes/off/false/no\fR Enable \fBROOTUSE_SASL\fR to enable SASL authentication when connecting to an LDAP server from a privileged process, such as \fBsudo\fR. .TP 6n \fBROOTSASL_AUTH_ID\fR \fIidentity\fR The SASL user name to use when \fBROOTUSE_SASL\fR is enabled. .TP 6n \fBSASL_SECPROPS\fR \fInone/properties\fR SASL security properties or \fInone\fR for no properties. See the SASL programmer's manual for details. .TP 6n \fBKRB5_CCNAME\fR \fIfile name\fR The path to the Kerberos 5 credential cache to use when authenticating with the remote server. .TP 6n \fBDEREF\fR \fInever/searching/finding/always\fR How alias dereferencing is to be performed when searching. See the ldap.conf(@mansectsu@) manual for a full description of this option. .PP See the \fIldap.conf\fR entry in the \fIEXAMPLES\fR section. .SS "Configuring nsswitch.conf" Unless it is disabled at build time, \fBsudo\fR consults the Name Service Switch file, \fI@nsswitch_conf@\fR, to specify the \fIsudoers\fR search order. Sudo looks for a line beginning with \fRsudoers\fR: and uses this to determine the search order. Note that \fBsudo\fR does not stop searching after the first match and later matches take precedence over earlier ones. The following sources are recognized: .PP .RS 4n .PD 0 .TP 10n files read sudoers from \fI@sysconfdir@/sudoers\fR .TP 10n ldap read sudoers from LDAP .RE .PD .PP In addition, the entry \fR[NOTFOUND=return]\fR will short-circuit the search if the user was not found in the preceding source. .PP To consult LDAP first followed by the local sudoers file (if it exists), use: .nf .sp .RS 4n sudoers: ldap files .RE .fi .PP The local \fIsudoers\fR file can be ignored completely by using: .nf .sp .RS 4n sudoers: ldap .RE .fi .PP If the \fI@nsswitch_conf@\fR file is not present or there is no sudoers line, the following default is assumed: .nf .sp .RS 4n sudoers: files .RE .fi .PP Note that \fI@nsswitch_conf@\fR is supported even when the underlying operating system does not use an nsswitch.conf file, except on AIX (see below). .SS "Configuring netsvc.conf" On AIX systems, the \fI@netsvc_conf@\fR file is consulted instead of \fI@nsswitch_conf@\fR. \fBsudo\fR simply treats \fInetsvc.conf\fR as a variant of \fInsswitch.conf\fR; information in the previous section unrelated to the file format itself still applies. .PP To consult LDAP first followed by the local sudoers file (if it exists), use: .nf .sp .RS 4n sudoers = ldap, files .RE .fi .PP The local \fIsudoers\fR file can be ignored completely by using: .nf .sp .RS 4n sudoers = ldap .RE .fi .PP To treat LDAP as authoritative and only use the local sudoers file if the user is not present in LDAP, use: .nf .sp .RS 4n sudoers = ldap = auth, files .RE .fi .PP Note that in the above example, the \fRauth\fR qualifier only affects user lookups; both LDAP and \fIsudoers\fR will be queried for \fRDefaults\fR entries. .PP If the \fI@netsvc_conf@\fR file is not present or there is no sudoers line, the following default is assumed: .nf .sp .RS 4n sudoers = files .RE .fi .SH "FILES" .TP 26n \fI@ldap_conf@\fR LDAP configuration file .TP 26n \fI@nsswitch_conf@\fR determines sudoers source order .TP 26n \fI@netsvc_conf@\fR determines sudoers source order on AIX .SH "EXAMPLES" .SS "Example ldap.conf" .nf .RS 2n # Either specify one or more URIs or one or more host:port pairs. # If neither is specified sudo will default to localhost, port 389. # #host ldapserver #host ldapserver1 ldapserver2:390 # # Default port if host is specified without one, defaults to 389. #port 389 # # URI will override the host and port settings. uri ldap://ldapserver #uri ldaps://secureldapserver #uri ldaps://secureldapserver ldap://ldapserver # # The amount of time, in seconds, to wait while trying to connect to # an LDAP server. bind_timelimit 30 # # The amount of time, in seconds, to wait while performing an LDAP query. timelimit 30 # # Must be set or sudo will ignore LDAP; may be specified multiple times. sudoers_base ou=SUDOers,dc=example,dc=com # # verbose sudoers matching from ldap #sudoers_debug 2 # # Enable support for time-based entries in sudoers. #sudoers_timed yes # # optional proxy credentials #binddn #bindpw #rootbinddn # # LDAP protocol version, defaults to 3 #ldap_version 3 # # Define if you want to use an encrypted LDAP connection. # Typically, you must also set the port to 636 (ldaps). #ssl on # # Define if you want to use port 389 and switch to # encryption before the bind credentials are sent. # Only supported by LDAP servers that support the start_tls # extension such as OpenLDAP. #ssl start_tls # # Additional TLS options follow that allow tweaking of the # SSL/TLS connection. # #tls_checkpeer yes # verify server SSL certificate #tls_checkpeer no # ignore server SSL certificate # # If you enable tls_checkpeer, specify either tls_cacertfile # or tls_cacertdir. Only supported when using OpenLDAP. # #tls_cacertfile /etc/certs/trusted_signers.pem #tls_cacertdir /etc/certs # # For systems that don't have /dev/random # use this along with PRNGD or EGD.pl to seed the # random number pool to generate cryptographic session keys. # Only supported when using OpenLDAP. # #tls_randfile /etc/egd-pool # # You may restrict which ciphers are used. Consult your SSL # documentation for which options go here. # Only supported when using OpenLDAP. # #tls_ciphers # # Sudo can provide a client certificate when communicating to # the LDAP server. # Tips: # * Enable both lines at the same time. # * Do not password protect the key file. # * Ensure the keyfile is only readable by root. # # For OpenLDAP: #tls_cert /etc/certs/client_cert.pem #tls_key /etc/certs/client_key.pem # # For SunONE or iPlanet LDAP, tls_cert and tls_key may specify either # a directory, in which case the files in the directory must have the # default names (e.g. cert8.db and key4.db), or the path to the cert # and key files themselves. However, a bug in version 5.0 of the LDAP # SDK will prevent specific file names from working. For this reason # it is suggested that tls_cert and tls_key be set to a directory, # not a file name. # # The certificate database specified by tls_cert may contain CA certs # and/or the client's cert. If the client's cert is included, tls_key # should be specified as well. # For backward compatibility, "sslpath" may be used in place of tls_cert. #tls_cert /var/ldap #tls_key /var/ldap # # If using SASL authentication for LDAP (OpenSSL) # use_sasl yes # sasl_auth_id # rootuse_sasl yes # rootsasl_auth_id # sasl_secprops none # krb5_ccname /etc/.ldapcache .RE .fi .SS "Sudo schema for OpenLDAP" The following schema, in OpenLDAP format, is included with \fBsudo\fR source and binary distributions as \fIschema.OpenLDAP\fR. Simply copy it to the schema directory (e.g.\& \fI/etc/openldap/schema\fR), add the proper \fRinclude\fR line in \fIslapd.conf\fR and restart \fBslapd\fR. .nf .sp .RS 2n attributetype ( 1.3.6.1.4.1.15953.9.1.1 NAME 'sudoUser' DESC 'User(s) who may run sudo' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.2 NAME 'sudoHost' DESC 'Host(s) who may run sudo' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.3 NAME 'sudoCommand' DESC 'Command(s) to be executed by sudo' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.4 NAME 'sudoRunAs' DESC 'User(s) impersonated by sudo' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.5 NAME 'sudoOption' DESC 'Options(s) followed by sudo' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.6 NAME 'sudoRunAsUser' DESC 'User(s) impersonated by sudo' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.7 NAME 'sudoRunAsGroup' DESC 'Group(s) impersonated by sudo' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) attributetype ( 1.3.6.1.4.1.15953.9.1.8 NAME 'sudoNotBefore' DESC 'Start of time interval for which the entry is valid' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 ) attributetype ( 1.3.6.1.4.1.15953.9.1.9 NAME 'sudoNotAfter' DESC 'End of time interval for which the entry is valid' EQUALITY generalizedTimeMatch ORDERING generalizedTimeOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 ) attributeTypes ( 1.3.6.1.4.1.15953.9.1.10 NAME 'sudoOrder' DESC 'an integer to order the sudoRole entries' EQUALITY integerMatch ORDERING integerOrderingMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 ) objectclass ( 1.3.6.1.4.1.15953.9.2.1 NAME 'sudoRole' SUP top STRUCTURAL DESC 'Sudoer Entries' MUST ( cn ) MAY ( sudoUser $ sudoHost $ sudoCommand $ sudoRunAs $ sudoRunAsUser $ sudoRunAsGroup $ sudoOption $ sudoNotBefore $ sudoNotAfter $ sudoOrder $ description ) ) .RE .fi .SH "SEE ALSO" ldap.conf(@mansectform@), sudo.conf(@mansectform@), sudoers(@mansectsu@) .SH "CAVEATS" Note that there are differences in the way that LDAP-based \fIsudoers\fR is parsed compared to file-based \fIsudoers\fR. See the \fIDifferences between LDAP and non-LDAP sudoers\fR section for more information. .SH "BUGS" If you feel you have found a bug in \fBsudo\fR, please submit a bug report at http://www.sudo.ws/sudo/bugs/ .SH "SUPPORT" Limited free support is available via the sudo-users mailing list, see http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the archives. .SH "DISCLAIMER" \fBsudo\fR is provided \(lqAS IS\(rq and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. See the LICENSE file distributed with \fBsudo\fR or http://www.sudo.ws/sudo/license.html for complete details.