]> git.ipfire.org Git - thirdparty/squid.git/blame - helpers/basic_auth/LDAP/basic_ldap_auth.8
Boilerplate: update copyright blurbs for Basic authentication helpers
[thirdparty/squid.git] / helpers / basic_auth / LDAP / basic_ldap_auth.8
CommitLineData
83915266 1.if !'po4a'hide' .TH basic_ldap_auth 8 "14 January 2005"
b3def772 2.
cfca18fc 3.SH NAME
83915266
AJ
4.if !'po4a'hide' .B basic_ldap_auth
5.if !'po4a'hide' \-
6LDAP authentication helper for Squid
b3def772 7.
cfca18fc 8.SH SYNOPSIS
8c2b74bc 9.if !'po4a'hide' .B basic_ldap_auth
83915266
AJ
10.if !'po4a'hide' .B \-b\ \"
11base DN
12.if !'po4a'hide' .B \"\ [\-u
13attribute
14.if !'po4a'hide' .B ]\ [
15options
16.if !'po4a'hide' .B ]\ [
92a0c1e0 17LDAP server name
83915266
AJ
18.if !'po4a'hide' .B [:
19port
20.if !'po4a'hide' .B ]|
21URI
22.if !'po4a'hide' .B ]...
b627c18a 23.br
8c2b74bc 24.if !'po4a'hide' .B basic_ldap_auth
83915266
AJ
25.if !'po4a'hide' .B \-b\ \"
26base DN
27.if !'po4a'hide' .B \"\ \-f\ \"
28LDAP search filter
29.if !'po4a'hide' .B \"\ [
30options
31.if !'po4a'hide' .B ]\ [
92a0c1e0 32LDAP server name
83915266
AJ
33.if !'po4a'hide' .B [:
34port
35.if !'po4a'hide' .B ]|
36URI
37.if !'po4a'hide' .B ]...
b3def772 38.
cfca18fc 39.SH DESCRIPTION
83915266
AJ
40.B basic_ldap_auth
41allows Squid to connect to a LDAP directory to
cfca18fc 42validate the user name and password of Basic HTTP authentication.
076d1037 43LDAP options are specified as parameters on the command line,
44while the username(s) and password(s) to be checked against the
45LDAP directory are specified on subsequent lines of input to the
46helper, one username/password pair per line separated by a space.
8c2b74bc 47.PP
076d1037 48As expected by the basic authentication construct of Squid, after
49specifying a username and password followed by a new line, this
83915266
AJ
50helper will produce either
51.B OK
52or
53.B ERR
54on the following line to show if the specified credentials are correct
55according to the LDAP directory.
8c2b74bc 56.PP
b3def772 57The program has two major modes of operation. In the default mode
58of operation the users DN is constructed using the base DN and
59user attribute. In the other mode of operation a search
60filter is used to locate valid user DN's below the base DN.
61.
428744a1 62.SH OPTIONS
83915266
AJ
63.if !'po4a'hide' .TP 12
64.if !'po4a'hide' .B "\-b basedn"
65.B REQUIRED.
cfca18fc 66Specifies the base DN under which the users are located.
b3def772 67.
83915266
AJ
68.if !'po4a'hide' .TP
69.if !'po4a'hide' .B "\-f filter"
70LDAP search
71.B filter
72to locate the user DN. Required if the users
2fd77e91 73are in a hierarchy below the base DN, or if the login name is
74not what builds the user specific part of the users DN.
83915266 75.br
92a0c1e0
AJ
76The search filter can contain up to 15 occurrences of
77.B %s
78which will be replaced by the username, as in
56834b2a 79.B "\"uid\=%s\""
92a0c1e0 80for RFC2037 directories. For a detailed description of LDAP search
b3def772 81filter syntax see RFC2254.
92a0c1e0
AJ
82.br
83Will crash if other
84.B %
85values than
86.B %s
87are used, or if more than 15
88.B %s
89are used.
b3def772 90.
83915266
AJ
91.if !'po4a'hide' .TP
92.if !'po4a'hide' .B "\-u userattr"
b3def772 93Specifies the name of the DN attribute that contains the username/login.
94Combined with the base DN to construct the users DN when no search filter
92a0c1e0
AJ
95is specified (
96.B \-f
97option). Defaults to
98.B uid
83915266
AJ
99.br
100.B Note:
101This can only be done if all your users are located directly under
b3def772 102the same position in the LDAP tree and the login name is used for naming
103each user object. If your LDAP tree does not match these criterias or if
104you want to filter who are valid users then you need to use a search filter
83915266
AJ
105to search for your users DN (
106.B \-f
107option).
108.
109.if !'po4a'hide' .TP
110.if !'po4a'hide' .B "\-U passwordattr"
111Use
112.I ldap_compare
113instead of
114.I ldap_simple_bind
115to verify the users password.
116.B passwordattr
117is the LDAP attribute storing the users password.
118.
119.if !'po4a'hide' .TP
120.if !'po4a'hide' .B "\-s base|one|sub"
121Search scope when performing user DN searches specified
122by the
123.B \-f
124option. Defaults to
125.B sub
126.br
cfca18fc 127.IP
128.B base
129object only,
83915266 130.IP
cfca18fc 131.B one
132level below the base object or
83915266 133.IP
cfca18fc 134.BR sub tree
135below the base object
136.
83915266
AJ
137.if !'po4a'hide' .TP
138.if !'po4a'hide' .B "\-D binddn \-w password"
cfca18fc 139The DN and password to bind as while performing searches. Required by the
83915266 140.B \-f
cfca18fc 141flag if the directory does not allow anonymous searches.
83915266 142.br
cfca18fc 143As the password needs to be printed in plain text in your Squid configuration
2fd77e91 144it is strongly recommended to use a account with minimal associated privileges.
cfca18fc 145This to limit the damage in case someone could get hold of a copy of your
146Squid configuration file.
b3def772 147.
83915266
AJ
148.if !'po4a'hide' .TP
149.if !'po4a'hide' .B "\-D binddn \-W secretfile "
954a8513 150The DN and the name of a file containing the password
151to bind as while performing searches.
83915266 152.br
954a8513 153Less insecure version of the former parameter pair with two advantages:
92a0c1e0
AJ
154The password does not occur in the process listing,
155and the password is not being compromised if someone gets the squid
954a8513 156configuration file without getting the secretfile.
157.
83915266
AJ
158.if !'po4a'hide' .TP
159.if !'po4a'hide' .B \-P
cfca18fc 160Use a persistent LDAP connection. Normally the LDAP connection
161is only open while validating a username to preserve resources
162at the LDAP server. This option causes the LDAP connection to
163be kept open, allowing it to be reused for further user
164validations. Recommended for larger installations.
b3def772 165.
83915266
AJ
166.if !'po4a'hide' .TP
167.if !'po4a'hide' .B \-O
b627c18a 168Only bind once per LDAP connection. Some LDAP servers do not
83915266
AJ
169allow re-binding as another user after a successful
170.I ldap_bind.
b627c18a 171The use of this option always opens a new connection for each
83915266
AJ
172login attempt. If combined with the
173.B \-P
174option for persistent
b627c18a 175LDAP connection then the connection used for searching for the
176user DN is kept persistent but a new connection is opened
177to verify each users password once the DN is found.
178.
83915266
AJ
179.if !'po4a'hide' .TP
180.if !'po4a'hide' .B \-R
181Do not follow referrals
b3def772 182.
83915266
AJ
183.if !'po4a'hide' .TP
184.if !'po4a'hide' .B "\-a never|always|search|find"
185when to dereference aliases. Defaults to
186.B never
cfca18fc 187.IP
83915266 188.B never
cfca18fc 189dereference aliases (default),
83915266 190.B always
cfca18fc 191dereference aliases, only while
83915266 192.B search ing
cfca18fc 193or only to
194.B find
83915266 195the base object.
b3def772 196.
83915266
AJ
197.if !'po4a'hide' .TP
198.if !'po4a'hide' .B "\-H ldap_uri
b627c18a 199Specity the LDAP server to connect to by LDAP URI (requires OpenLDAP libraries).
200Servers can also be specified last on the command line.
7ba68818 201.
83915266
AJ
202.if !'po4a'hide' .TP
203.if !'po4a'hide' .B "\-h ldap_server"
b627c18a 204Specify the LDAP server to connect to. Servers can also be specified last
205on the command line.
83915266
AJ
206.
207.if !'po4a'hide' .TP
208.if !'po4a'hide' .B "\-p ldap_port"
e1b65506 209Specify an alternate TCP port where the LDAP server is listening if
b627c18a 210other than the default LDAP port 389. Can also be specified within the
e1b65506 211server specification by using servername:port syntax.
cfca18fc 212.
83915266
AJ
213.if !'po4a'hide' .TP
214.if !'po4a'hide' .B "\-v 2|3"
b8e70af0
AJ
215LDAP protocol version. Defaults to
216.B 3
217if not specified.
076d1037 218.
83915266
AJ
219.if !'po4a'hide' .TP
220.if !'po4a'hide' .BI \-Z
653b264e 221Use TLS encryption
222.
83915266
AJ
223.if !'po4a'hide' .TP
224.if !'po4a'hide' .B "\-S certpath"
653b264e 225Enable LDAP over SSL (requires Netscape LDAP API libraries)
226.
83915266
AJ
227.if !'po4a'hide' .TP
228.if !'po4a'hide' .B "\-c connect_timeout"
229Specify
230.B timeout
231used when connecting to LDAP servers (requires
653b264e 232Netscape LDAP API libraries)
83915266
AJ
233.
234.if !'po4a'hide' .TP
235.if !'po4a'hide' .B "\-t search_timeout"
653b264e 236Specify time limit on LDAP search operations
237.
83915266
AJ
238.if !'po4a'hide' .TP
239.if !'po4a'hide' .B \-d
307228f1 240Debug mode where each step taken will get reported in detail.
241Useful for understanding what goes wrong if the results is
242not what is expected.
243.
83915266 244.SH CONFIGURATION
cfca18fc 245For directories using the RFC2307 layout with a single domain, all
246you need to specify is usually the base DN under where your users
b3def772 247are located and the server name:
cfca18fc 248.IP
b8e70af0 249.if !'po4a'hide' .RS
481d7e00 250.if !'po4a'hide' .B basic_ldap_auth -b "ou=people,dc=your,dc=domain" ldapserver
b8e70af0 251.if !'po4a'hide' .RE
83915266
AJ
252.PP
253If you have sub\-domains then you need to use a search filter approach
e1b65506 254to locate your user DNs as these can no longer be constructed directly
b3def772 255from the base DN and login name alone:
cfca18fc 256.IP
b8e70af0 257.if !'po4a'hide' .RS
481d7e00 258.if !'po4a'hide' .B basic_ldap_auth -b "dc=your,dc=domain" -f "uid=%s" ldapserver
b8e70af0 259.if !'po4a'hide' .RE
83915266 260.PP
e1b65506 261And similarly if you only want to allow access to users having a
b3def772 262specific attribute
263.IP
b8e70af0 264.if !'po4a'hide' .RS
481d7e00 265.if !'po4a'hide' .B basic_ldap_auth -b "dc=your,dc=domain" -f "(&(uid=%s)(specialattribute=value))" ldapserver
b8e70af0 266.if !'po4a'hide' .RE
83915266
AJ
267.PP
268Or if the user attribute of the user DN is
269.B "cn"
270instead of
271.B "uid"
272and you do not want to have to search for the users then you could use something
2fd77e91 273like the following example for Active Directory:
cfca18fc 274.IP
b8e70af0 275.if !'po4a'hide' .RS
481d7e00 276.if !'po4a'hide' .B basic_ldap_auth -u cn -b "cn=Users,dc=your,dc=domain" ldapserver
b8e70af0 277.if !'po4a'hide' .RE
83915266 278.PP
2fd77e91 279If you want to search for the user DN and your directory does not allow
83915266
AJ
280anonymous searches then you must also use the
281.B \-D
282and
283.B \-w
284flags to specify a user DN and password to log in as to perform the searches, as in the
2fd77e91 285following complex Active Directory example
cfca18fc 286.IP
b8e70af0 287.if !'po4a'hide' .RS
481d7e00 288.if !'po4a'hide' .B basic_ldap_auth -P -R -b "dc=your,dc=domain" -D "cn=squid,cn=users,dc=your,dc=domain" -w "secretsquidpassword" -f "(&(userPrincipalName=%s)(objectClass=Person))" activedirectoryserver
b8e70af0 289.if !'po4a'hide' .RE
b3def772 290.
83915266
AJ
291.PP
292.B NOTE:
b3def772 293When constructing search filters it is strongly recommended to test the filter
83915266
AJ
294using
295.B ldapsearch
296before you attempt to use
297.B basic_ldap_auth.
298This to verify that the filter matches what you expect.
299.
cfca18fc 300.SH AUTHOR
8c2b74bc
AJ
301This program is written by
302.if !'po4a'hide' .I Glenn Newton <gnewton@wapiti.cisti.nrc.ca>
303.if !'po4a'hide' .I Henrik Nordstrom <hno@squid-cache.org>
304.
305This manual is written by
306.if !'po4a'hide' .I Henrik Nordstrom <hno@squid-cache.org>
cfca18fc 307.
83915266 308.SH COPYRIGHT
5b95b903
AJ
309.PP
310 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
311 *
312 * Squid software is distributed under GPLv2+ license and includes
313 * contributions from numerous individuals and organizations.
314 * Please see the COPYING and CONTRIBUTORS files for details.
315.PP
92a0c1e0
AJ
316This program and documentation is copyright to the authors named above.
317.PP
c871f41e 318Distributed under the GNU General Public License (GNU GPL) version 2 or later (GPLv2+).
cfca18fc 319.
320.SH QUESTIONS
83915266
AJ
321Questions on the usage of this program can be sent to the
322.I Squid Users mailing list
323.if !'po4a'hide' <squid-users@squid-cache.org>
324.PP
325Or to your favorite LDAP list/friend if the question is more related to
b3def772 326LDAP than Squid.
cfca18fc 327.
328.SH REPORTING BUGS
c871f41e
AJ
329Bug reports need to be made in English.
330See http://wiki.squid-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report.
331.PP
8c2b74bc 332Report bugs or bug fixes using http://bugs.squid-cache.org/
83915266 333.PP
8c2b74bc 334Report serious security bugs to
b3def772 335.I Squid Bugs <squid-bugs@squid-cache.org>
83915266 336.PP
8c2b74bc
AJ
337Report ideas for new improvements to the
338.I Squid Developers mailing list
339.if !'po4a'hide' <squid-dev@squid-cache.org>
b3def772 340.
83915266 341.SH SEE ALSO
6d5cbee6
AJ
342.if !'po4a'hide' .BR squid "(8), "
343.if !'po4a'hide' .BR ldapsearch "(1), "
344.if !'po4a'hide' .BR GPL "(7), "
b3def772 345.br
83915266 346Your favorite LDAP documentation.
b3def772 347.br
348.BR RFC2254 " - The String Representation of LDAP Search Filters,"
6d5cbee6
AJ
349.br
350The Squid FAQ wiki
351.if !'po4a'hide' http://wiki.squid-cache.org/SquidFaq
352.br
353The Squid Configuration Manual
354.if !'po4a'hide' http://www.squid-cache.org/Doc/config/
355