basic_ldap_auth(8)
π basic_ldap_auth(8) β LDAP authentication helper for Squid π
okay bestie, sit down, hydrate, because we're about to make LDAP auth make sense. this is basic_ldap_auth, a lil helper from the System Manager's Manual section (section 8, system admin tools, iykyk). she's not glamorous but she WORKS and she's lowkey carrying your whole proxy login situation. π«Ά
β¨ NAME β¨
basic_ldap_auth β LDAP authentication helper for Squid π¦
β¨ SYNOPSIS β¨
basic_ldap_auth -b " base DN " [-u attribute ] [ options ] [ LDAP server
name [: port ]| URI ]...
basic_ldap_auth -b " base DN " -f " LDAP search filter " [ options ] [
LDAP server name [: port ]| URI ]...
β¨ DESCRIPTION β¨
so. basic_ldap_auth lets Squid go talk to an LDAP directory and check whether a username + password pair is actually legit, for Basic HTTP authentication. the way it works: you hand all your LDAP settings over as command-line parameters, and then the username(s) and password(s) you want checked get fed in on subsequent lines of input to the helper β one username/password pair per line, separated by a single space. no cap. π
and because Squid's basic auth construct expects a very specific lil ritual: after you give it a username and password and a newline, this helper will print either OK or ERR on the following line, telling you whether those credentials check out according to the LDAP directory. that's it. that's the whole vibe check. β
β
the program has two major modes of operation:
- default mode β the user's DN is constructed from the base DN plus the user attribute.
- the other mode β a search filter is used to locate valid user DNs down below the base DN.
pick your fighter. both slay. π
β¨ OPTIONS β¨
-b basednβ REQUIRED. this is the base DN under which your users are located. no base DN, no party. π«-f filterβ the LDAP search filter used to locate the user DN. you need this if your users live in a hierarchy below the base DN, or if the login name isn't the thing that builds the user-specific part of the user's DN. the search filter can contain up to 15 occurrences of%s, which get replaced by the username β likeuid=%sfor RFC2037 directories. for the full deets on LDAP search filter syntax, go read RFC2254. π
π Will crash if other % values than %s are used, or if more than 15 %s are used. not a drill, bestie. she will simply pass away.
-u userattrβ the name of the DN attribute that holds the username/login. combined with the base DN to construct the user's DN when no search filter is specified (that's the-foption). defaults touid. π Note: this can only be done if all your users sit directly under the same position in the LDAP tree, and the login name is what names each user object. if your LDAP tree doesn't match those criteria, or if you want to filter who counts as a valid user, then you need to use a search filter to find your users' DN β that's the-foption, babes.-U passwordattrβ useldap_compareinstead ofldap_simple_bindto verify the user's password.passwordattris the LDAP attribute storing the user's password. π-s base|one|subβ the search scope used when performing user DN searches specified by the-foption. defaults tosub.baseβ object only,oneβ one level below the base object, orsubβ subtree below the base object. π³
-D binddn -w passwordβ the DN and password to bind as while performing searches. required by the-fflag if the directory does not allow anonymous searches.
β οΈ since the password has to be printed in plain text in your Squid configuration, it is strongly recommended to use an account with minimal associated privileges. this limits the damage in case someone gets hold of a copy of your Squid configuration file. protect yourself, queen. π
-D binddn -W secretfileβ the DN, plus the name of a file containing the password to bind as while performing searches. this is the less insecure version of the former parameter pair, with two advantages: the password does not occur in the process listing, and the password isn't compromised if someone gets the squid configuration file without getting the secretfile. glow up. β¨-Pβ use a persistent LDAP connection. normally the LDAP connection is only open while validating a username, to preserve resources at the LDAP server. this option keeps the LDAP connection open so it can be reused for further user validations. recommended for larger installations. ποΈ-Oβ only bind once per LDAP connection. some LDAP servers do not allow re-binding as another user after a successfulldap_bind. using this option always opens a new connection for each login attempt. if combined with the-Poption for a persistent LDAP connection, then the connection used for searching for the user DN is kept persistent, but a new connection is opened to verify each user's password once the DN is found. π-Rβ do not follow referrals. π«π§-a never|always|search|findβ when to dereference aliases. defaults tonever.neverβ never dereference aliases (default),alwaysβ always dereference aliases,searchβ only during a search, orfindβ only to find the base object. π
-H ldap_uriβ specify the LDAP server to connect to by LDAP URI (requires OpenLDAP libraries). servers can also be specified last on the command line. π°οΈ-h ldap_serverβ specify the LDAP server to connect to. servers can also be specified last on the command line. π»-p ldap_portβ specify an alternate TCP port where the LDAP server is listening, if other than the default LDAP port389. can also be specified within the server specification by usingservername:portsyntax. πͺ-v 2|3β LDAP protocol version. defaults to3if not specified. π’-Zβ use TLS encryption. π-S certpathβ enable LDAP over SSL (requires Netscape LDAP API libraries). π‘οΈ-c connect_timeoutβ specify timeout used when connecting to LDAP servers (requires Netscape LDAP API libraries). β±οΈ-t search_timeoutβ specify time limit on LDAP search operations. β³-dβ debug mode, where each step taken gets reported in detail. super useful for understanding what goes wrong if the result isn't what you expected. ππ
β¨ CONFIGURATION β¨
for directories using the RFC2307 layout with a single domain, usually all you need to specify is the base DN under where your users are located, plus the server name:
basic_ldap_auth -b ou=people,dc=your,dc=domain ldapserver
if you've got sub-domains, then you need the search filter approach to locate your user DNs, because they can no longer be constructed directly from the base DN and login name alone:
basic_ldap_auth -b dc=your,dc=domain -f uid=%s ldapserver
and similarly, if you only want to allow access to users having a specific attribute:
basic_ldap_auth -b dc=your,dc=domain -f (&(uid=%s)(specialattribute=value)) ldapserver
or, if the user attribute of the user DN is cn instead of uid, and you do not want to have to search for the users, you could use something like the following example for Active Directory:
basic_ldap_auth -u cn -b cn=Users,dc=your,dc=domain ldapserver
if you want to search for the user DN and your directory does not allow anonymous searches, then you must also use the -D and -w flags to specify a user DN and password to log in as, so the searches can be performed β as in the following complex Active Directory example:
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
π NOTE: when constructing search filters it is strongly recommended to test the filter usingldapsearchbefore you attempt to usebasic_ldap_auth. this verifies that the filter matches what you expect. test first, ship later. π§ͺ
β¨ AUTHOR β¨
this program is written by Glenn Newton <gnewton@wapiti.cisti.nrc.ca> and Henrik Nordstrom <hno@squid-cache.org>. this manual is written by Henrik Nordstrom <hno@squid-cache.org>. legends, honestly. ππ
β¨ COPYRIGHT β¨
* Copyright (C) 1996-2026 The Squid Software Foundation and
contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
* Please see the COPYING and CONTRIBUTORS files for details.
this program and documentation is copyright to the authors named above. π
distributed under the GNU General Public License (GNU GPL) version 2 or later (GPLv2+).
β¨ QUESTIONS β¨
got questions about using this program? send them to the Squid Users mailing list <squid-users@lists.squid-cache.org> π
or hit up your favorite LDAP list/friend if the question is more about LDAP than Squid. mutuals helping mutuals. π«
β¨ REPORTING BUGS β¨
bug reports need to be made in English. see https://wiki.squid-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report. π
report bugs or bug fixes using https://bugs.squid-cache.org/ π
report serious security bugs to Squid Bugs <squid-bugs@lists.squid-cache.org> π¨
report ideas for new improvements to the Squid Developers mailing list <squid-dev@lists.squid-cache.org> π‘
β¨ SEE ALSO β¨
squid(8)ldapsearch(1)GPL(7)- Your favorite LDAP documentation.
- RFC2254 - The String Representation of LDAP Search Filters,
- The Squid FAQ wiki
https://wiki.squid-cache.org/SquidFaq - The Squid Configuration Manual
http://www.squid-cache.org/Doc/config/
okay and that's the whole page!! π this one's dated 14 January 2005 and it lives in section basic_ldap_auth(8) β oldie but a goodie, still eating after all these years. go configure something iconic bestie π πβ¨
π¦ where this page comes from
- arch rolling: squid 7.7-1 Β· GPL
- fedora 43: squid 7:7.5-1.fc43 Β· GPL-2.0-or-later AND (LGPL-2.0-or-later AND MIT AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC AND LicenseRef-Fedora-Public-Domain AND Beerware)
- fedora 44: squid 7:7.4-1.fc44 Β· GPL-2.0-or-later AND (LGPL-2.0-or-later AND MIT AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC AND LicenseRef-Fedora-Public-Domain AND Beerware)
- fedora 44: squid 7:7.7-1.fc44 Β· GPL-2.0-or-later AND (LGPL-2.0-or-later AND MIT AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC AND LicenseRef-Fedora-Public-Domain AND Beerware)
- nixos 26.05: squid 7.6
- nixpkgs unstable: squid 7.6
- ubuntu resolute: squid 7.7-0ubuntu0.26.04.1
- ubuntu stonking: squid 7.7-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms