1*41ce3b17Snaddy.\" $OpenBSD: login_ldap.8,v 1.3 2022/03/31 17:27:18 naddy Exp $ 2f95714a4Smartijn.\" Copyright (c) 2002 Institute for Open Systems Technology Australia (IFOST) 3f95714a4Smartijn.\" Copyright (c) 2007 Michael Erdely <merdely@openbsd.org> 4f95714a4Smartijn.\" Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org> 5f95714a4Smartijn.\" All rights reserved. 6f95714a4Smartijn.\" 7f95714a4Smartijn.\" Redistribution and use in source and binary forms, with or without 8f95714a4Smartijn.\" modification, are permitted provided that the following conditions 9f95714a4Smartijn.\" are met: 10f95714a4Smartijn.\" 1. Redistributions of source code must retain the above copyright 11f95714a4Smartijn.\" notice, this list of conditions and the following disclaimer. 12f95714a4Smartijn.\" 2. Redistributions in binary form must reproduce the above copyright 13f95714a4Smartijn.\" notice, this list of conditions and the following disclaimer in the 14f95714a4Smartijn.\" documentation and/or other materials provided with the distribution. 15f95714a4Smartijn.\" 3. The name of the author may not be used to endorse or promote products 16f95714a4Smartijn.\" derived from this software without specific prior written permission. 17f95714a4Smartijn.\" 18f95714a4Smartijn.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 19f95714a4Smartijn.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 20f95714a4Smartijn.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21f95714a4Smartijn.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22f95714a4Smartijn.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23f95714a4Smartijn.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 24f95714a4Smartijn.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25f95714a4Smartijn.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26f95714a4Smartijn.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 27f95714a4Smartijn.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28f95714a4Smartijn.\" 29*41ce3b17Snaddy.Dd $Mdocdate: March 31 2022 $ 30f95714a4Smartijn.Dt LOGIN_LDAP 8 31f95714a4Smartijn.Os 32f95714a4Smartijn.Sh NAME 33f95714a4Smartijn.Nm login_ldap 34f95714a4Smartijn.Nd contact LDAP directory server for authentication 35f95714a4Smartijn.Sh SYNOPSIS 36f95714a4Smartijn.Nm login_ldap 37f95714a4Smartijn.Op Fl d 389be2b23bSmartijn.Op Fl s Ar service 399be2b23bSmartijn.Op Fl v Ar name Ns = Ns Ar value 40f95714a4Smartijn.Ar user 41f95714a4Smartijn.Op Ar class 42f95714a4Smartijn.Sh DESCRIPTION 43f95714a4SmartijnThe 44f95714a4Smartijn.Nm 45f95714a4Smartijnutility contacts an LDAP server to authenticate a 46f95714a4Smartijn.Ar user . 47f95714a4Smartijn.Pp 48f95714a4SmartijnAvailable options are: 49f95714a4Smartijn.Bl -tag -width indent 509be2b23bSmartijn.It Fl d 519be2b23bSmartijnPrint debugging information. 52f95714a4Smartijn.It Fl s 53f95714a4SmartijnSpecify the service. 54f95714a4SmartijnCurrently only 559be2b23bSmartijn.Dq login 56f95714a4Smartijnand 579be2b23bSmartijn.Dq response 58f95714a4Smartijnare supported. 59f95714a4SmartijnThe challenge service is not supported, but it is not an error to specify 609be2b23bSmartijnthis service. 61*41ce3b17SnaddyIf this happens, 62f95714a4Smartijn.Nm 63f95714a4Smartijnwill request the response service. 64f95714a4Smartijn.It Fl v 659be2b23bSmartijnThis option is for compatibility and is ignored. 66f95714a4Smartijn.El 67f95714a4Smartijn.Pp 68f95714a4Smartijn.Nm 699be2b23bSmartijnsearches for the 70f95714a4Smartijn.Ar user 719be2b23bSmartijnon the LDAP server based on the filter parameters in the configuration file. 72*41ce3b17SnaddyIf the user is found, it will try to bind to it using the supplied password. 73f95714a4Smartijn.Pp 74f95714a4Smartijn.Nm 75f95714a4Smartijnuses the 76f95714a4Smartijn.Ar ldap-conffile 77f95714a4Smartijn.Xr login.conf 5 78f95714a4Smartijnvariable to determine the location of the configuration file. 79f95714a4SmartijnIf no 80f95714a4Smartijn.Ar ldap-conffile 81*41ce3b17Snaddycan be found, it will fall back to 82f95714a4Smartijn.Pa /etc/login_ldap.conf . 83f95714a4SmartijnThe configuration file must be owned by root with group auth and permissions 84f95714a4Smartijn0640. 85f95714a4Smartijn.Sh LOGIN_LDAP.CONF VARIABLES 86f95714a4SmartijnThe login_ldap.conf file takes one key value pair per line separated by a 87f95714a4Smartijn.Sq = . 88f95714a4SmartijnNo spaces are allowed between the 89f95714a4Smartijn.Sq = 90f95714a4Smartijnand 91f95714a4Smartijn.Ar value . 92f95714a4SmartijnThe 93f95714a4Smartijn.Ar key 94f95714a4Smartijnmay have leading and trailing whitespaces. 95f95714a4SmartijnEmpty lines and lines starting with a 96f95714a4Smartijn.Sq # 97f95714a4Smartijnare ignored. 98f95714a4Smartijn.Pp 99f95714a4SmartijnThe 100f95714a4Smartijn.Nm 101f95714a4Smartijnutility requires the following variables: 102f95714a4Smartijn.Bl -tag -width basedn 103f95714a4Smartijn.It Ar host 104f95714a4SmartijnThe hostname of the LDAP server or an LDAP URL. 105f95714a4SmartijnThe LDAP URL is described in the following format: 106f95714a4Smartijn.Pp 107f95714a4Smartijn.Sm off 108f95714a4Smartijn.Op Ar protocol No :// 109f95714a4Smartijn.Ar host Op : Ar port 110f95714a4Smartijn.Sm on 111f95714a4Smartijn.Pp 112f95714a4SmartijnThe following protocols are supported: 113f95714a4Smartijn.Pp 114f95714a4Smartijn.Bl -tag -width "ldap+tls" -compact 115f95714a4Smartijn.It ldap 116f95714a4SmartijnConnect with TCP in plain text. 117f95714a4SmartijnThis is the default. 118f95714a4Smartijn.It ldaps 119f95714a4SmartijnConnect with TLS. 120f95714a4SmartijnThe default port is 636. 121f95714a4Smartijn.It ldap+tls 122f95714a4SmartijnConnect with TCP and enable TLS using the StartTLS operation. 123f95714a4Smartijn.El 124f95714a4Smartijn.Pp 125f95714a4SmartijnMultiple host entries are supported and are tried in order of appearance. 126f95714a4Smartijn.It Ar basedn 127f95714a4SmartijnPoint in the LDAP server's Directory Information Tree 128f95714a4Smartijn.Nm 129f95714a4Smartijnshould begin searching for user objects. 130f95714a4SmartijnThis option can be omitted if the binddn points directly to the user entry. 131f95714a4Smartijn.It Ar binddn 132f95714a4SmartijnDN used by 133f95714a4Smartijn.Nm 1349be2b23bSmartijnto bind to the LDAP server. 135*41ce3b17SnaddyIf no basedn is set, this is used to bind directly to the user and uses the user 136f95714a4Smartijnsupplied password. 137f95714a4SmartijnUse FORMAT FILTERS to specify the username in this case. 138f95714a4Smartijn.Pp 139*41ce3b17SnaddyIf basedn is set, it is used together with bindpw to bind to the LDAP server and 140f95714a4Smartijnsearch for the user entry based on filter and scope. 141f95714a4SmartijnIf 142f95714a4Smartijn.Ar binddn 143*41ce3b17Snaddyis omitted and basedn is set, an anonymous bind is used to search for the user 144f95714a4Smartijnentry. 145f95714a4Smartijn.El 146f95714a4Smartijn.Pp 147f95714a4SmartijnIn most cases, you will need to configure additional options. 148f95714a4SmartijnThe following entries to login_ldap.conf are also recognised by 149f95714a4Smartijn.Nm 150f95714a4Smartijnand are optional: 151f95714a4Smartijn.Bl -tag -width cacertdir 152f95714a4Smartijn.It Ar bindpw 153f95714a4SmartijnPassword used by 154f95714a4Smartijn.Nm 1559be2b23bSmartijnto bind to the LDAP server. 1569be2b23bSmartijnLeave this out for a passwordless bind. 157f95714a4Smartijn.It Ar filter 158f95714a4SmartijnLDAP search filter (in accordance with RFC 1558) which identifies the 1599be2b23bSmartijnobjectclasses and attributes necessary for 160f95714a4Smartijn.Nm 1619be2b23bSmartijnto locate the user object. 1629be2b23bSmartijnSee the 1639be2b23bSmartijn.Sx FILTER FORMATS 1649be2b23bSmartijnsection for details. 165f95714a4Smartijn.It Ar timeout 1669be2b23bSmartijnTime in seconds to wait for the LDAP server to respond to a query. 1679be2b23bSmartijnThe default is 60 seconds per query, with up to four queries occurring. 168f95714a4Smartijn.It Ar scope 169f95714a4SmartijnThe directory scope when performing the user lookup (first pass) search. 170f95714a4SmartijnAcceptable values are: 1719be2b23bSmartijn.Pp 1729be2b23bSmartijn.Bl -tag -width baseXXX -offset indent -compact 173f95714a4Smartijn.It base 174f95714a4SmartijnBase object search 175f95714a4Smartijn.It one 176f95714a4SmartijnOne level search 177f95714a4Smartijn.It sub 178f95714a4SmartijnFull subtree search 179f95714a4Smartijn.El 180f95714a4Smartijn.Pp 181f95714a4SmartijnThe default is sub if scope is unspecified. 182f95714a4Smartijn.It Ar cacert 183f95714a4SmartijnThe pathname of the CA used for SSL certificates. 184f95714a4Smartijn.It Ar cacertdir 1859be2b23bSmartijnThe directory containing the certificates of trusted CAs. 186f95714a4Smartijn.El 187f95714a4Smartijn.Pp 188f95714a4SmartijnAn additional groupcheck can be performed to verify the user is allowed to log 189f95714a4Smartijnin. 190f95714a4SmartijnThis can be done by specifying 191f95714a4Smartijn.Ar gbasedn , Ar gfilter 192f95714a4Smartijnand optionally 193f95714a4Smartijn.Ar gscope . 194f95714a4SmartijnSee 195f95714a4Smartijn.Ar basedn , Ar filter 196f95714a4Smartijnand 197f95714a4Smartijn.Ar scope 198f95714a4Smartijnfor semantics. 199f95714a4SmartijnThese checks are performed by the binddn user. 200f95714a4Smartijn.Sh FILTER FORMATS 201f95714a4SmartijnThe following format specifiers are valid for the filter: 202f95714a4Smartijn.Bl -tag -width xxx 203f95714a4Smartijn.It %u 2049be2b23bSmartijnUsername. 2059be2b23bSmartijnThe username of the user to be authenticated as specified by the 206f95714a4Smartijn.Ar user 207f95714a4Smartijnargument. 208f95714a4Smartijn.It %h 2099be2b23bSmartijnHostname. 2109be2b23bSmartijnThe hostname of the host the user is trying to authenticate on, 211f95714a4Smartijnas returned by 212f95714a4Smartijn.Xr gethostname 3 213f95714a4Smartijnand displayed by 214f95714a4Smartijn.Xr hostname 1 . 215f95714a4Smartijn.It %d 216f95714a4SmartijnThe dn of the user attempting authentication as returned from the first pass of 217f95714a4Smartijnthe search. 218f95714a4SmartijnThis option is only available to gfilter and gbasedn. 219f95714a4Smartijn.It %% 220f95714a4SmartijnA literal 221f95714a4Smartijn.Sq % 222f95714a4Smartijncharacter. 223f95714a4Smartijn.El 2249be2b23bSmartijn.Sh FILES 2259be2b23bSmartijn.Bl -tag -width /etc/examples/login_ldap.conf -compact 2269be2b23bSmartijn.It Pa /etc/examples/login_ldap.conf 2279be2b23bSmartijnExample configuration file. 2289be2b23bSmartijn.El 229f95714a4Smartijn.Sh SEE ALSO 230f95714a4Smartijn.Xr ldap 1 , 2319be2b23bSmartijn.Xr login 1 , 2329be2b23bSmartijn.Xr login.conf 5 , 2339be2b23bSmartijn.Xr ldapd 8 , 234f95714a4Smartijn.Xr ypldap 8 235f95714a4Smartijn.Sh HISTORY 236f95714a4SmartijnThe 237f95714a4Smartijn.Nm 2389be2b23bSmartijnutility first appeared in 239f95714a4Smartijn.Ox 3.3 240f95714a4Smartijnports and was later mostly rewritten by 241f95714a4Smartijn.An Martijn van Duren Aq Mt martijn@openbsd.org 242f95714a4Smartijnand imported into 243f95714a4Smartijn.Ox 6.8 . 244f95714a4Smartijn.Sh AUTHORS 245f95714a4SmartijnThe 246f95714a4Smartijn.Nm 247f95714a4Smartijnutility was originally written by: 248f95714a4Smartijn.Pp 249f95714a4Smartijn.An Peter Werner Aq Mt peterw@ifost.org.au 250f95714a4Smartijn.An Michael Erdely Aq Mt merdely@openbsd.org 251f95714a4Smartijn.Sh CAVEATS 252f95714a4SmartijnAs there is no SASL support, passwords are sent to the LDAP server. 253f95714a4SmartijnTLS should be used to protect the password in transit. 254