Merge commit 'upstream/1.7.2p7'
[debian/sudo] / sudoers.ldap.man.in
1 .\" Copyright (c) 2003-2009
2 .\"     Todd C. Miller <Todd.Miller@courtesan.com>
3 .\" 
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\" 
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 .\" 
17 .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
18 .\"
19 .\" Standard preamble:
20 .\" ========================================================================
21 .de Sp \" Vertical space (when we can't use .PP)
22 .if t .sp .5v
23 .if n .sp
24 ..
25 .de Vb \" Begin verbatim text
26 .ft CW
27 .nf
28 .ne \\$1
29 ..
30 .de Ve \" End verbatim text
31 .ft R
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
37 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
38 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
39 .\" nothing in troff, for use with C<>.
40 .tr \(*W-
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` 
50 .    ds C' 
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" Escape single quotes in literal strings from groff's Unicode transform.
60 .ie \n(.g .ds Aq \(aq
61 .el       .ds Aq '
62 .\"
63 .\" If the F register is turned on, we'll generate index entries on stderr for
64 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
65 .\" entries marked with X<> in POD.  Of course, you'll have to process the
66 .\" output yourself in some meaningful fashion.
67 .ie \nF \{\
68 .    de IX
69 .    tm Index:\\$1\t\\n%\t"\\$2"
70 ..
71 .    nr % 0
72 .    rr F
73 .\}
74 .el \{\
75 .    de IX
76 ..
77 .\}
78 .\"
79 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
80 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
81 .    \" fudge factors for nroff and troff
82 .if n \{\
83 .    ds #H 0
84 .    ds #V .8m
85 .    ds #F .3m
86 .    ds #[ \f1
87 .    ds #] \fP
88 .\}
89 .if t \{\
90 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
91 .    ds #V .6m
92 .    ds #F 0
93 .    ds #[ \&
94 .    ds #] \&
95 .\}
96 .    \" simple accents for nroff and troff
97 .if n \{\
98 .    ds ' \&
99 .    ds ` \&
100 .    ds ^ \&
101 .    ds , \&
102 .    ds ~ ~
103 .    ds /
104 .\}
105 .if t \{\
106 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
107 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
108 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
109 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
110 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
111 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
112 .\}
113 .    \" troff and (daisy-wheel) nroff accents
114 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
115 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
116 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
117 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
118 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
119 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
120 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
121 .ds ae a\h'-(\w'a'u*4/10)'e
122 .ds Ae A\h'-(\w'A'u*4/10)'E
123 .    \" corrections for vroff
124 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
125 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
126 .    \" for low resolution devices (crt and lpr)
127 .if \n(.H>23 .if \n(.V>19 \
128 \{\
129 .    ds : e
130 .    ds 8 ss
131 .    ds o a
132 .    ds d- d\h'-1'\(ga
133 .    ds D- D\h'-1'\(hy
134 .    ds th \o'bp'
135 .    ds Th \o'LP'
136 .    ds ae ae
137 .    ds Ae AE
138 .\}
139 .rm #[ #] #H #V #F C
140 .\" ========================================================================
141 .\"
142 .IX Title "SUDOERS.LDAP @mansectform@"
143 .TH SUDOERS.LDAP @mansectform@ "June  1, 2010" "1.7.2p7" "MAINTENANCE COMMANDS"
144 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
145 .\" way too many mistakes in technical documents.
146 .if n .ad l
147 .nh
148 .SH "NAME"
149 sudoers.ldap \- sudo LDAP configuration
150 .SH "DESCRIPTION"
151 .IX Header "DESCRIPTION"
152 In addition to the standard \fIsudoers\fR file, \fBsudo\fR may be configured
153 via \s-1LAP\s0.  This can be especially useful for synchronizing \fIsudoers\fR
154 in a large, distributed environment.
155 .PP
156 Using \s-1LDAP\s0 for \fIsudoers\fR has several benefits:
157 .IP "\(bu" 4
158 \&\fBsudo\fR no longer needs to read \fIsudoers\fR in its entirety.  When
159 \&\s-1LDAP\s0 is used, there are only two or three \s-1LDAP\s0 queries per invocation.
160 This makes it especially fast and particularly usable in \s-1LDAP\s0
161 environments.
162 .IP "\(bu" 4
163 \&\fBsudo\fR no longer exits if there is a typo in \fIsudoers\fR.
164 It is not possible to load \s-1LDAP\s0 data into the server that does
165 not conform to the sudoers schema, so proper syntax is guaranteed.
166 It is still possible to have typos in a user or host name, but
167 this will not prevent \fBsudo\fR from running.
168 .IP "\(bu" 4
169 It is possible to specify per-entry options that override the global
170 default options.  \fI@sysconfdir@/sudoers\fR only supports default options and
171 limited options associated with user/host/commands/aliases.  The
172 syntax is complicated and can be difficult for users to understand.
173 Placing the options directly in the entry is more natural.
174 .IP "\(bu" 4
175 The \fBvisudo\fR program is no longer needed.  \fBvisudo\fR provides
176 locking and syntax checking of the \fI@sysconfdir@/sudoers\fR file.
177 Since \s-1LDAP\s0 updates are atomic, locking is no longer necessary.
178 Because syntax is checked when the data is inserted into \s-1LDAP\s0, there
179 is no need for a specialized tool to check syntax.
180 .PP
181 Another major difference between \s-1LDAP\s0 and file-based \fIsudoers\fR
182 is that in \s-1LDAP\s0, \fBsudo\fR\-specific Aliases are not supported.
183 .PP
184 For the most part, there is really no need for \fBsudo\fR\-specific
185 Aliases.  Unix groups or user netgroups can be used in place of
186 User_Aliases and RunasAliases.  Host netgroups can be used in place
187 of HostAliases.  Since Unix groups and netgroups can also be stored
188 in \s-1LDAP\s0 there is no real need for \fBsudo\fR\-specific aliases.
189 .PP
190 Cmnd_Aliases are not really required either since it is possible
191 to have multiple users listed in a sudoRole.  Instead of defining
192 a Cmnd_Alias that is referenced by multiple users, one can create
193 a sudoRole that contains the commands and assign multiple users
194 to it.
195 .SS "SUDOers \s-1LDAP\s0 container"
196 .IX Subsection "SUDOers LDAP container"
197 The \fIsudoers\fR configuration is contained in the \f(CW\*(C`ou=SUDOers\*(C'\fR \s-1LDAP\s0
198 container.
199 .PP
200 Sudo first looks for the \f(CW\*(C`cn=default\*(C'\fR entry in the SUDOers container.
201 If found, the multi-valued \f(CW\*(C`sudoOption\*(C'\fR attribute is parsed in the
202 same manner as a global \f(CW\*(C`Defaults\*(C'\fR line in \fI@sysconfdir@/sudoers\fR.  In
203 the following example, the \f(CW\*(C`SSH_AUTH_SOCK\*(C'\fR variable will be preserved
204 in the environment for all users.
205 .PP
206 .Vb 6
207 \&    dn: cn=defaults,ou=SUDOers,dc=example,dc=com
208 \&    objectClass: top
209 \&    objectClass: sudoRole
210 \&    cn: defaults
211 \&    description: Default sudoOption\*(Aqs go here
212 \&    sudoOption: env_keep+=SSH_AUTH_SOCK
213 .Ve
214 .PP
215 The equivalent of a sudoer in \s-1LDAP\s0 is a \f(CW\*(C`sudoRole\*(C'\fR.  It consists of
216 the following components:
217 .IP "\fBsudoUser\fR" 4
218 .IX Item "sudoUser"
219 A user name, uid (prefixed with \f(CW\*(Aq#\*(Aq\fR), Unix group (prefixed with
220 a \f(CW\*(Aq%\*(Aq\fR) or user netgroup (prefixed with a \f(CW\*(Aq+\*(Aq\fR).
221 .IP "\fBsudoHost\fR" 4
222 .IX Item "sudoHost"
223 A host name, \s-1IP\s0 address, \s-1IP\s0 network, or host netgroup (prefixed
224 with a \f(CW\*(Aq+\*(Aq\fR).
225 The special value \f(CW\*(C`ALL\*(C'\fR will match any host.
226 .IP "\fBsudoCommand\fR" 4
227 .IX Item "sudoCommand"
228 A Unix command with optional command line arguments, potentially
229 including globbing characters (aka wild cards).
230 The special value \f(CW\*(C`ALL\*(C'\fR will match any command.
231 If a command is prefixed with an exclamation point \f(CW\*(Aq!\*(Aq\fR, the
232 user will be prohibited from running that command.
233 .IP "\fBsudoOption\fR" 4
234 .IX Item "sudoOption"
235 Identical in function to the global options described above, but
236 specific to the \f(CW\*(C`sudoRole\*(C'\fR in which it resides.
237 .IP "\fBsudoRunAsUser\fR" 4
238 .IX Item "sudoRunAsUser"
239 A user name or uid (prefixed with \f(CW\*(Aq#\*(Aq\fR) that commands may be run
240 as or a Unix group (prefixed with a \f(CW\*(Aq%\*(Aq\fR) or user netgroup (prefixed
241 with a \f(CW\*(Aq+\*(Aq\fR) that contains a list of users that commands may be
242 run as.
243 The special value \f(CW\*(C`ALL\*(C'\fR will match any user.
244 .IP "\fBsudoRunAsGroup\fR" 4
245 .IX Item "sudoRunAsGroup"
246 A Unix group or gid (prefixed with \f(CW\*(Aq#\*(Aq\fR) that commands may be run as.
247 The special value \f(CW\*(C`ALL\*(C'\fR will match any group.
248 .PP
249 Each component listed above should contain a single value, but there
250 may be multiple instances of each component type.  A sudoRole must
251 contain at least one \f(CW\*(C`sudoUser\*(C'\fR, \f(CW\*(C`sudoHost\*(C'\fR and \f(CW\*(C`sudoCommand\*(C'\fR.
252 .PP
253 The following example allows users in group wheel to run any command
254 on any host via \fBsudo\fR:
255 .PP
256 .Vb 7
257 \&    dn: cn=%wheel,ou=SUDOers,dc=example,dc=com
258 \&    objectClass: top
259 \&    objectClass: sudoRole
260 \&    cn: %wheel
261 \&    sudoUser: %wheel
262 \&    sudoHost: ALL
263 \&    sudoCommand: ALL
264 .Ve
265 .SS "Anatomy of \s-1LDAP\s0 sudoers lookup"
266 .IX Subsection "Anatomy of LDAP sudoers lookup"
267 When looking up a sudoer using \s-1LDAP\s0 there are only two or three
268 \&\s-1LDAP\s0 queries per invocation.  The first query is to parse the global
269 options.  The second is to match against the user's name and the
270 groups that the user belongs to.  (The special \s-1ALL\s0 tag is matched
271 in this query too.)  If no match is returned for the user's name
272 and groups, a third query returns all entries containing user
273 netgroups and checks to see if the user belongs to any of them.
274 .SS "Differences between \s-1LDAP\s0 and non-LDAP sudoers"
275 .IX Subsection "Differences between LDAP and non-LDAP sudoers"
276 There are some subtle differences in the way sudoers is handled
277 once in \s-1LDAP\s0.  Probably the biggest is that according to the \s-1RFC\s0,
278 \&\s-1LDAP\s0 ordering is arbitrary and you cannot expect that Attributes
279 and Entries are returned in any specific order.  If there are
280 conflicting command rules on an entry, the negative takes precedence.
281 This is called paranoid behavior (not necessarily the most specific
282 match).
283 .PP
284 Here is an example:
285 .PP
286 .Vb 5
287 \&    # /etc/sudoers:
288 \&    # Allow all commands except shell
289 \&    johnny  ALL=(root) ALL,!/bin/sh
290 \&    # Always allows all commands because ALL is matched last
291 \&    puddles ALL=(root) !/bin/sh,ALL
292 \&
293 \&    # LDAP equivalent of johnny
294 \&    # Allows all commands except shell
295 \&    dn: cn=role1,ou=Sudoers,dc=my\-domain,dc=com
296 \&    objectClass: sudoRole
297 \&    objectClass: top
298 \&    cn: role1
299 \&    sudoUser: johnny
300 \&    sudoHost: ALL
301 \&    sudoCommand: ALL
302 \&    sudoCommand: !/bin/sh
303 \&
304 \&    # LDAP equivalent of puddles
305 \&    # Notice that even though ALL comes last, it still behaves like
306 \&    # role1 since the LDAP code assumes the more paranoid configuration
307 \&    dn: cn=role2,ou=Sudoers,dc=my\-domain,dc=com
308 \&    objectClass: sudoRole
309 \&    objectClass: top
310 \&    cn: role2
311 \&    sudoUser: puddles
312 \&    sudoHost: ALL
313 \&    sudoCommand: !/bin/sh
314 \&    sudoCommand: ALL
315 .Ve
316 .PP
317 Another difference is that negations on the Host, User or Runas are
318 currently ignorred.  For example, the following attributes do not
319 behave the way one might expect.
320 .PP
321 .Vb 3
322 \&    # does not match all but joe
323 \&    # rather, does not match anyone
324 \&    sudoUser: !joe
325 \&
326 \&    # does not match all but joe
327 \&    # rather, matches everyone including Joe
328 \&    sudoUser: ALL
329 \&    sudoUser: !joe
330 \&
331 \&    # does not match all but web01
332 \&    # rather, matches all hosts including web01
333 \&    sudoHost: ALL
334 \&    sudoHost: !web01
335 .Ve
336 .SS "Sudoers Schema"
337 .IX Subsection "Sudoers Schema"
338 In order to use \fBsudo\fR's \s-1LDAP\s0 support, the \fBsudo\fR schema must be
339 installed on your \s-1LDAP\s0 server.  In addition, be sure to index the
340 \&'sudoUser' attribute.
341 .PP
342 Three versions of the schema: one for OpenLDAP servers (\fIschema.OpenLDAP\fR),
343 one for Netscape-derived servers (\fIschema.iPlanet\fR), and one for
344 Microsoft Active Directory (\fIschema.ActiveDirectory\fR) may
345 be found in the \fBsudo\fR distribution.
346 .PP
347 The schema for \fBsudo\fR in OpenLDAP form is included in the \s-1EXAMPLES\s0
348 section.
349 .SS "Configuring ldap.conf"
350 .IX Subsection "Configuring ldap.conf"
351 Sudo reads the \fI@ldap_conf@\fR file for LDAP-specific configuration.
352 Typically, this file is shared amongst different LDAP-aware clients.
353 As such, most of the settings are not \fBsudo\fR\-specific.  Note that
354 \&\fBsudo\fR parses \fI@ldap_conf@\fR itself and may support options
355 that differ from those described in the \fIldap.conf\fR\|(@mansectform@) manual.
356 .PP
357 Also note that on systems using the OpenLDAP libraries, default
358 values specified in \fI/etc/openldap/ldap.conf\fR or the user's
359 \&\fI.ldaprc\fR files are not used.
360 .PP
361 Only those options explicitly listed in \fI@ldap_conf@\fR that are
362 supported by \fBsudo\fR are honored.  Configuration options are listed
363 below in upper case but are parsed in a case-independent manner.
364 .IP "\fB\s-1URI\s0\fR ldap[s]://[hostname[:port]] ..." 4
365 .IX Item "URI ldap[s]://[hostname[:port]] ..."
366 Specifies a whitespace-delimited list of one or more URIs describing
367 the \s-1LDAP\s0 server(s) to connect to.  The \fIprotocol\fR may be either \fBldap\fR
368 or \fBldaps\fR, the latter being for servers that support \s-1TLS\s0 (\s-1SSL\s0)
369 encryption.  If no \fIport\fR is specified, the default is port 389 for
370 \&\f(CW\*(C`ldap://\*(C'\fR or port 636 for \f(CW\*(C`ldaps://\*(C'\fR.  If no \fIhostname\fR is specified,
371 \&\fBsudo\fR will connect to \fBlocalhost\fR.  Only systems using the OpenSSL
372 libraries support the mixing of \f(CW\*(C`ldap://\*(C'\fR and \f(CW\*(C`ldaps://\*(C'\fR URIs.
373 The Netscape-derived libraries used on most commercial versions of
374 Unix are only capable of supporting one or the other.
375 .IP "\fB\s-1HOST\s0\fR name[:port] ..." 4
376 .IX Item "HOST name[:port] ..."
377 If no \fB\s-1URI\s0\fR is specified, the \fB\s-1HOST\s0\fR parameter specifies a
378 whitespace-delimited list of \s-1LDAP\s0 servers to connect to.  Each host
379 may include an optional \fIport\fR separated by a colon (':').  The
380 \&\fB\s-1HOST\s0\fR parameter is deprecated in favor of the \fB\s-1URI\s0\fR specification
381 and is included for backwards compatibility.
382 .IP "\fB\s-1PORT\s0\fR port_number" 4
383 .IX Item "PORT port_number"
384 If no \fB\s-1URI\s0\fR is specified, the \fB\s-1PORT\s0\fR parameter specifies the
385 default port to connect to on the \s-1LDAP\s0 server if a \fB\s-1HOST\s0\fR parameter
386 does not specify the port itself.  If no \fB\s-1PORT\s0\fR parameter is used,
387 the default is port 389 for \s-1LDAP\s0 and port 636 for \s-1LDAP\s0 over \s-1TLS\s0
388 (\s-1SSL\s0).  The \fB\s-1PORT\s0\fR parameter is deprecated in favor of the \fB\s-1URI\s0\fR
389 specification and is included for backwards compatibility.
390 .IP "\fB\s-1BIND_TIMELIMIT\s0\fR seconds" 4
391 .IX Item "BIND_TIMELIMIT seconds"
392 The \fB\s-1BIND_TIMELIMIT\s0\fR parameter specifies the amount of time, in seconds,
393 to wait while trying to connect to an \s-1LDAP\s0 server.  If multiple \fB\s-1URI\s0\fRs or
394 \&\fB\s-1HOST\s0\fRs are specified, this is the amount of time to wait before trying
395 the next one in the list.
396 .IP "\fB\s-1TIMELIMIT\s0\fR seconds" 4
397 .IX Item "TIMELIMIT seconds"
398 The \fB\s-1TIMELIMIT\s0\fR parameter specifies the amount of time, in seconds,
399 to wait for a response to an \s-1LDAP\s0 query.
400 .IP "\fB\s-1SUDOERS_BASE\s0\fR base" 4
401 .IX Item "SUDOERS_BASE base"
402 The base \s-1DN\s0 to use when performing \fBsudo\fR \s-1LDAP\s0 queries.  Typically
403 this is of the form \f(CW\*(C`ou=SUDOers,dc=example,dc=com\*(C'\fR for the domain
404 \&\f(CW\*(C`example.com\*(C'\fR.
405 .IP "\fB\s-1SUDOERS_DEBUG\s0\fR debug_level" 4
406 .IX Item "SUDOERS_DEBUG debug_level"
407 This sets the debug level for \fBsudo\fR \s-1LDAP\s0 queries.  Debugging
408 information is printed to the standard error.  A value of 1 results
409 in a moderate amount of debugging information.  A value of 2 shows
410 the results of the matches themselves.  This parameter should not
411 be set in a production environment as the extra information is
412 likely to confuse users.
413 .IP "\fB\s-1BINDDN\s0\fR \s-1DN\s0" 4
414 .IX Item "BINDDN DN"
415 The \fB\s-1BINDDN\s0\fR parameter specifies the identity, in the form of a
416 Distinguished Name (\s-1DN\s0), to use when performing \s-1LDAP\s0 operations.
417 If not specified, \s-1LDAP\s0 operations are performed with an anonymous
418 identity.  By default, most \s-1LDAP\s0 servers will allow anonymous access.
419 .IP "\fB\s-1BINDPW\s0\fR secret" 4
420 .IX Item "BINDPW secret"
421 The \fB\s-1BINDPW\s0\fR parameter specifies the password to use when performing
422 \&\s-1LDAP\s0 operations.  This is typically used in conjunction with the
423 \&\fB\s-1BINDDN\s0\fR parameter.
424 .IP "\fB\s-1ROOTBINDDN\s0\fR \s-1DN\s0" 4
425 .IX Item "ROOTBINDDN DN"
426 The \fB\s-1ROOTBINDDN\s0\fR parameter specifies the identity, in the form of
427 a Distinguished Name (\s-1DN\s0), to use when performing privileged \s-1LDAP\s0
428 operations, such as \fIsudoers\fR queries.  The password corresponding
429 to the identity should be stored in \fI@ldap_secret@\fR.
430 If not specified, the \fB\s-1BINDDN\s0\fR identity is used (if any).
431 .IP "\fB\s-1LDAP_VERSION\s0\fR number" 4
432 .IX Item "LDAP_VERSION number"
433 The version of the \s-1LDAP\s0 protocol to use when connecting to the server.
434 The default value is protocol version 3.
435 .IP "\fB\s-1SSL\s0\fR on/true/yes/off/false/no" 4
436 .IX Item "SSL on/true/yes/off/false/no"
437 If the \fB\s-1SSL\s0\fR parameter is set to \f(CW\*(C`on\*(C'\fR, \f(CW\*(C`true\*(C'\fR or \f(CW\*(C`yes\*(C'\fR, \s-1TLS\s0
438 (\s-1SSL\s0) encryption is always used when communicating with the \s-1LDAP\s0
439 server.  Typically, this involves connecting to the server on port
440 636 (ldaps).
441 .IP "\fB\s-1SSL\s0\fR start_tls" 4
442 .IX Item "SSL start_tls"
443 If the \fB\s-1SSL\s0\fR parameter is set to \f(CW\*(C`start_tls\*(C'\fR, the \s-1LDAP\s0 server
444 connection is initiated normally and \s-1TLS\s0 encryption is begun before
445 the bind credentials are sent.  This has the advantage of not
446 requiring a dedicated port for encrypted communications.  This
447 parameter is only supported by \s-1LDAP\s0 servers that honor the \f(CW\*(C`start_tls\*(C'\fR
448 extension, such as the OpenLDAP server.
449 .IP "\fB\s-1TLS_CHECKPEER\s0\fR on/true/yes/off/false/no" 4
450 .IX Item "TLS_CHECKPEER on/true/yes/off/false/no"
451 If enabled, \fB\s-1TLS_CHECKPEER\s0\fR will cause the \s-1LDAP\s0 server's \s-1TLS\s0
452 certificated to be verified.  If the server's \s-1TLS\s0 certificate cannot
453 be verified (usually because it is signed by an unknown certificate
454 authority), \fBsudo\fR will be unable to connect to it.  If \fB\s-1TLS_CHECKPEER\s0\fR
455 is disabled, no check is made.
456 .IP "\fB\s-1TLS_CACERTFILE\s0\fR file name" 4
457 .IX Item "TLS_CACERTFILE file name"
458 The path to a certificate authority bundle which contains the certificates
459 for all the Certificate Authorities the client knows to be valid,
460 e.g. \fI/etc/ssl/ca\-bundle.pem\fR.
461 This option is only supported by the OpenLDAP libraries.
462 .IP "\fB\s-1TLS_CACERTDIR\s0\fR directory" 4
463 .IX Item "TLS_CACERTDIR directory"
464 Similar to \fB\s-1TLS_CACERTFILE\s0\fR but instead of a file, it is a
465 directory containing individual Certificate Authority certificates,
466 e.g. \fI/etc/ssl/certs\fR.
467 The directory specified by \fB\s-1TLS_CACERTDIR\s0\fR is checked after
468 \&\fB\s-1TLS_CACERTFILE\s0\fR.
469 This option is only supported by the OpenLDAP libraries.
470 .IP "\fB\s-1TLS_CERT\s0\fR file name" 4
471 .IX Item "TLS_CERT file name"
472 The path to a file containing the client certificate which can
473 be used to authenticate the client to the \s-1LDAP\s0 server.
474 The certificate type depends on the \s-1LDAP\s0 libraries used.
475 .Sp
476 OpenLDAP:
477     \f(CW\*(C`tls_cert /etc/ssl/client_cert.pem\*(C'\fR
478 .Sp
479 Netscape-derived:
480     \f(CW\*(C`tls_cert /var/ldap/cert7.db\*(C'\fR
481 .Sp
482 When using Netscape-derived libraries, this file may also contain
483 Certificate Authority certificates.
484 .IP "\fB\s-1TLS_KEY\s0\fR file name" 4
485 .IX Item "TLS_KEY file name"
486 The path to a file containing the private key which matches the
487 certificate specified by \fB\s-1TLS_CERT\s0\fR.  The private key must not be
488 password-protected.  The key type depends on the \s-1LDAP\s0 libraries
489 used.
490 .Sp
491 OpenLDAP:
492     \f(CW\*(C`tls_key /etc/ssl/client_key.pem\*(C'\fR
493 .Sp
494 Netscape-derived:
495     \f(CW\*(C`tls_key /var/ldap/key3.db\*(C'\fR
496 .IP "\fB\s-1TLS_RANDFILE\s0\fR file name" 4
497 .IX Item "TLS_RANDFILE file name"
498 The \fB\s-1TLS_RANDFILE\s0\fR parameter specifies the path to an entropy
499 source for systems that lack a random device.  It is generally used
500 in conjunction with \fIprngd\fR or \fIegd\fR.
501 This option is only supported by the OpenLDAP libraries.
502 .IP "\fB\s-1TLS_CIPHERS\s0\fR cipher list" 4
503 .IX Item "TLS_CIPHERS cipher list"
504 The \fB\s-1TLS_CIPHERS\s0\fR parameter allows the administer to restrict
505 which encryption algorithms may be used for \s-1TLS\s0 (\s-1SSL\s0) connections.
506 See the OpenSSL manual for a list of valid ciphers.
507 This option is only supported by the OpenLDAP libraries.
508 .IP "\fB\s-1USE_SASL\s0\fR on/true/yes/off/false/no" 4
509 .IX Item "USE_SASL on/true/yes/off/false/no"
510 Enable \fB\s-1USE_SASL\s0\fR for \s-1LDAP\s0 servers that support \s-1SASL\s0 authentication.
511 .IP "\fB\s-1SASL_AUTH_ID\s0\fR identity" 4
512 .IX Item "SASL_AUTH_ID identity"
513 The \s-1SASL\s0 user name to use when connecting to the \s-1LDAP\s0 server.
514 By default, \fBsudo\fR will use an anonymous connection.
515 .IP "\fB\s-1ROOTUSE_SASL\s0\fR on/true/yes/off/false/no" 4
516 .IX Item "ROOTUSE_SASL on/true/yes/off/false/no"
517 Enable \fB\s-1ROOTUSE_SASL\s0\fR to enable \s-1SASL\s0 authentication when connecting
518 to an \s-1LDAP\s0 server from a privileged process, such as \fBsudo\fR.
519 .IP "\fB\s-1ROOTSASL_AUTH_ID\s0\fR identity" 4
520 .IX Item "ROOTSASL_AUTH_ID identity"
521 The \s-1SASL\s0 user name to use when \fB\s-1ROOTUSE_SASL\s0\fR is enabled.
522 .IP "\fB\s-1SASL_SECPROPS\s0\fR none/properties" 4
523 .IX Item "SASL_SECPROPS none/properties"
524 \&\s-1SASL\s0 security properties or \fInone\fR for no properties.  See the
525 \&\s-1SASL\s0 programmer's manual for details.
526 .IP "\fB\s-1KRB5_CCNAME\s0\fR file name" 4
527 .IX Item "KRB5_CCNAME file name"
528 The path to the Kerberos 5 credential cache to use when authenticating
529 with the remote server.
530 .PP
531 See the \f(CW\*(C`ldap.conf\*(C'\fR entry in the \s-1EXAMPLES\s0 section.
532 .SS "Configuring nsswitch.conf"
533 .IX Subsection "Configuring nsswitch.conf"
534 Unless it is disabled at build time, \fBsudo\fR consults the Name
535 Service Switch file, \fI@nsswitch_conf@\fR, to specify the \fIsudoers\fR
536 search order.  Sudo looks for a line beginning with \f(CW\*(C`sudoers\*(C'\fR: and
537 uses this to determine the search order.  Note that \fBsudo\fR does
538 not stop searching after the first match and later matches take
539 precedence over earlier ones.
540 .PP
541 The following sources are recognized:
542 .PP
543 .Vb 2
544 \&    files       read sudoers from F<@sysconfdir@/sudoers>
545 \&    ldap        read sudoers from LDAP
546 .Ve
547 .PP
548 In addition, the entry \f(CW\*(C`[NOTFOUND=return]\*(C'\fR will short-circuit the
549 search if the user was not found in the preceding source.
550 .PP
551 To consult \s-1LDAP\s0 first followed by the local sudoers file (if it
552 exists), use:
553 .PP
554 .Vb 1
555 \&    sudoers: ldap files
556 .Ve
557 .PP
558 The local \fIsudoers\fR file can be ignored completely by using:
559 .PP
560 .Vb 1
561 \&    sudoers: ldap
562 .Ve
563 .PP
564 If the \fI@nsswitch_conf@\fR file is not present or there is no
565 sudoers line, the following default is assumed:
566 .PP
567 .Vb 1
568 \&    sudoers: files
569 .Ve
570 .PP
571 Note that \fI@nsswitch_conf@\fR is supported even when the underlying
572 operating system does not use an nsswitch.conf file.
573 .SS "Configuring netsvc.conf"
574 .IX Subsection "Configuring netsvc.conf"
575 On \s-1AIX\s0 systems, the \fI@netsvc_conf@\fR file is consulted instead of
576 \&\fI@nsswitch_conf@\fR.  \fBsudo\fR simply treats \fInetsvc.conf\fR as a
577 variant of \fInsswitch.conf\fR; information in the previous section
578 unrelated to the file format itself still applies.
579 .PP
580 To consult \s-1LDAP\s0 first followed by the local sudoers file (if it
581 exists), use:
582 .PP
583 .Vb 1
584 \&    sudoers = ldap, files
585 .Ve
586 .PP
587 The local \fIsudoers\fR file can be ignored completely by using:
588 .PP
589 .Vb 1
590 \&    sudoers = ldap
591 .Ve
592 .PP
593 To treat \s-1LDAP\s0 as authoratative and only use the local sudoers file
594 if the user is not present in \s-1LDAP\s0, use:
595 .PP
596 .Vb 1
597 \&    sudoers = ldap = auth, files
598 .Ve
599 .PP
600 Note that in the above example, the \f(CW\*(C`auth\*(C'\fR qualfier only affects
601 user lookups; both \s-1LDAP\s0 and \fIsudoers\fR will be queried for \f(CW\*(C`Defaults\*(C'\fR
602 entries.
603 .PP
604 If the \fI@netsvc_conf@\fR file is not present or there is no
605 sudoers line, the following default is assumed:
606 .PP
607 .Vb 1
608 \&    sudoers = files
609 .Ve
610 .SH "FILES"
611 .IX Header "FILES"
612 .ie n .IP "\fI@ldap_conf@\fR" 24
613 .el .IP "\fI@ldap_conf@\fR" 24
614 .IX Item "@ldap_conf@"
615 \&\s-1LDAP\s0 configuration file
616 .ie n .IP "\fI@nsswitch_conf@\fR" 24
617 .el .IP "\fI@nsswitch_conf@\fR" 24
618 .IX Item "@nsswitch_conf@"
619 determines sudoers source order
620 .ie n .IP "\fI@netsvc_conf@\fR" 24
621 .el .IP "\fI@netsvc_conf@\fR" 24
622 .IX Item "@netsvc_conf@"
623 determines sudoers source order on \s-1AIX\s0
624 .SH "EXAMPLES"
625 .IX Header "EXAMPLES"
626 .SS "Example ldap.conf"
627 .IX Subsection "Example ldap.conf"
628 .Vb 10
629 \&  # Either specify one or more URIs or one or more host:port pairs.
630 \&  # If neither is specified sudo will default to localhost, port 389.
631 \&  #
632 \&  #host          ldapserver
633 \&  #host          ldapserver1 ldapserver2:390
634 \&  #
635 \&  # Default port if host is specified without one, defaults to 389.
636 \&  #port          389
637 \&  #
638 \&  # URI will override the host and port settings.
639 \&  uri            ldap://ldapserver
640 \&  #uri            ldaps://secureldapserver
641 \&  #uri            ldaps://secureldapserver ldap://ldapserver
642 \&  #
643 \&  # The amount of time, in seconds, to wait while trying to connect to
644 \&  # an LDAP server.
645 \&  bind_timelimit 30
646 \&  #
647 \&  # The amount of time, in seconds, to wait while performing an LDAP query.
648 \&  timelimit 30
649 \&  #
650 \&  # must be set or sudo will ignore LDAP
651 \&  sudoers_base   ou=SUDOers,dc=example,dc=com
652 \&  #
653 \&  # verbose sudoers matching from ldap
654 \&  #sudoers_debug 2
655 \&  #
656 \&  # optional proxy credentials
657 \&  #binddn        <who to search as>
658 \&  #bindpw        <password>
659 \&  #rootbinddn    <who to search as, uses /etc/ldap.secret for bindpw>
660 \&  #
661 \&  # LDAP protocol version, defaults to 3
662 \&  #ldap_version 3
663 \&  #
664 \&  # Define if you want to use an encrypted LDAP connection.
665 \&  # Typically, you must also set the port to 636 (ldaps).
666 \&  #ssl on
667 \&  #
668 \&  # Define if you want to use port 389 and switch to
669 \&  # encryption before the bind credentials are sent.
670 \&  # Only supported by LDAP servers that support the start_tls
671 \&  # extension such as OpenLDAP.
672 \&  #ssl start_tls
673 \&  #
674 \&  # Additional TLS options follow that allow tweaking of the
675 \&  # SSL/TLS connection.
676 \&  #
677 \&  #tls_checkpeer yes # verify server SSL certificate
678 \&  #tls_checkpeer no  # ignore server SSL certificate
679 \&  #
680 \&  # If you enable tls_checkpeer, specify either tls_cacertfile
681 \&  # or tls_cacertdir.  Only supported when using OpenLDAP.
682 \&  #
683 \&  #tls_cacertfile /etc/certs/trusted_signers.pem
684 \&  #tls_cacertdir  /etc/certs
685 \&  #
686 \&  # For systems that don\*(Aqt have /dev/random
687 \&  # use this along with PRNGD or EGD.pl to seed the
688 \&  # random number pool to generate cryptographic session keys.
689 \&  # Only supported when using OpenLDAP.
690 \&  #
691 \&  #tls_randfile /etc/egd\-pool
692 \&  #
693 \&  # You may restrict which ciphers are used.  Consult your SSL
694 \&  # documentation for which options go here.
695 \&  # Only supported when using OpenLDAP.
696 \&  #
697 \&  #tls_ciphers <cipher\-list>
698 \&  #
699 \&  # Sudo can provide a client certificate when communicating to
700 \&  # the LDAP server.
701 \&  # Tips:
702 \&  #   * Enable both lines at the same time.
703 \&  #   * Do not password protect the key file.
704 \&  #   * Ensure the keyfile is only readable by root.
705 \&  #
706 \&  # For OpenLDAP:
707 \&  #tls_cert /etc/certs/client_cert.pem
708 \&  #tls_key  /etc/certs/client_key.pem
709 \&  #
710 \&  # For SunONE or iPlanet LDAP, tls_cert and tls_key may specify either
711 \&  # a directory, in which case the files in the directory must have the
712 \&  # default names (e.g. cert8.db and key4.db), or the path to the cert
713 \&  # and key files themselves.  However, a bug in version 5.0 of the LDAP
714 \&  # SDK will prevent specific file names from working.  For this reason
715 \&  # it is suggested that tls_cert and tls_key be set to a directory,
716 \&  # not a file name.
717 \&  #
718 \&  # The certificate database specified by tls_cert may contain CA certs
719 \&  # and/or the client\*(Aqs cert.  If the client\*(Aqs cert is included, tls_key
720 \&  # should be specified as well.
721 \&  # For backward compatibility, "sslpath" may be used in place of tls_cert.
722 \&  #tls_cert /var/ldap
723 \&  #tls_key /var/ldap
724 \&  #
725 \&  # If using SASL authentication for LDAP (OpenSSL)
726 \&  # use_sasl yes
727 \&  # sasl_auth_id <SASL username>
728 \&  # rootuse_sasl yes
729 \&  # rootsasl_auth_id <SASL username for root access>
730 \&  # sasl_secprops none
731 \&  # krb5_ccname /etc/.ldapcache
732 .Ve
733 .SS "Sudo schema for OpenLDAP"
734 .IX Subsection "Sudo schema for OpenLDAP"
735 The following schema is in OpenLDAP format.  Simply copy it to the
736 schema directory (e.g. \fI/etc/openldap/schema\fR), add the proper
737 \&\f(CW\*(C`include\*(C'\fR line in \f(CW\*(C`slapd.conf\*(C'\fR and restart \fBslapd\fR.
738 .PP
739 .Vb 6
740 \& attributetype ( 1.3.6.1.4.1.15953.9.1.1
741 \&    NAME \*(AqsudoUser\*(Aq
742 \&    DESC \*(AqUser(s) who may  run sudo\*(Aq
743 \&    EQUALITY caseExactIA5Match
744 \&    SUBSTR caseExactIA5SubstringsMatch
745 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
746 \&
747 \& attributetype ( 1.3.6.1.4.1.15953.9.1.2
748 \&    NAME \*(AqsudoHost\*(Aq
749 \&    DESC \*(AqHost(s) who may run sudo\*(Aq
750 \&    EQUALITY caseExactIA5Match
751 \&    SUBSTR caseExactIA5SubstringsMatch
752 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
753 \&
754 \& attributetype ( 1.3.6.1.4.1.15953.9.1.3
755 \&    NAME \*(AqsudoCommand\*(Aq
756 \&    DESC \*(AqCommand(s) to be executed by sudo\*(Aq
757 \&    EQUALITY caseExactIA5Match
758 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
759 \&
760 \& attributetype ( 1.3.6.1.4.1.15953.9.1.4
761 \&    NAME \*(AqsudoRunAs\*(Aq
762 \&    DESC \*(AqUser(s) impersonated by sudo\*(Aq
763 \&    EQUALITY caseExactIA5Match
764 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
765 \&
766 \& attributetype ( 1.3.6.1.4.1.15953.9.1.5
767 \&    NAME \*(AqsudoOption\*(Aq
768 \&    DESC \*(AqOptions(s) followed by sudo\*(Aq
769 \&    EQUALITY caseExactIA5Match
770 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
771 \&
772 \& attributetype ( 1.3.6.1.4.1.15953.9.1.6
773 \&    NAME \*(AqsudoRunAsUser\*(Aq
774 \&    DESC \*(AqUser(s) impersonated by sudo\*(Aq
775 \&    EQUALITY caseExactIA5Match
776 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
777 \&
778 \& attributetype ( 1.3.6.1.4.1.15953.9.1.7
779 \&    NAME \*(AqsudoRunAsGroup\*(Aq
780 \&    DESC \*(AqGroup(s) impersonated by sudo\*(Aq
781 \&    EQUALITY caseExactIA5Match
782 \&    SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
783 \&
784 \& objectclass ( 1.3.6.1.4.1.15953.9.2.1 NAME \*(AqsudoRole\*(Aq SUP top STRUCTURAL
785 \&    DESC \*(AqSudoer Entries\*(Aq
786 \&    MUST ( cn )
787 \&    MAY ( sudoUser $ sudoHost $ sudoCommand $ sudoRunAs $ sudoRunAsUser $
788 \&          sudoRunAsGroup $ sudoOption $ description )
789 \&    )
790 .Ve
791 .SH "SEE ALSO"
792 .IX Header "SEE ALSO"
793 \&\fIldap.conf\fR\|(@mansectform@), \fIsudoers\fR\|(5)
794 .SH "CAVEATS"
795 .IX Header "CAVEATS"
796 The way that \fIsudoers\fR is parsed differs between Note that there
797 are differences in the way that LDAP-based \fIsudoers\fR is parsed
798 compared to file-based \fIsudoers\fR.  See the \*(L"Differences between
799 \&\s-1LDAP\s0 and non-LDAP sudoers\*(R" section for more information.
800 .SH "BUGS"
801 .IX Header "BUGS"
802 If you feel you have found a bug in \fBsudo\fR, please submit a bug report
803 at http://www.sudo.ws/sudo/bugs/
804 .SH "SUPPORT"
805 .IX Header "SUPPORT"
806 Limited free support is available via the sudo-users mailing list,
807 see http://www.sudo.ws/mailman/listinfo/sudo\-users to subscribe or
808 search the archives.
809 .SH "DISCLAIMER"
810 .IX Header "DISCLAIMER"
811 \&\fBsudo\fR is provided ``\s-1AS\s0 \s-1IS\s0'' and any express or implied warranties,
812 including, but not limited to, the implied warranties of merchantability
813 and fitness for a particular purpose are disclaimed.  See the \s-1LICENSE\s0
814 file distributed with \fBsudo\fR or http://www.sudo.ws/sudo/license.html
815 for complete details.