Add ldap caching. Make rlm_ldap thread safe. Fix a memory leak in ldap_xlat.
[freeradius.git] / doc / rlm_ldap
1 1.   INSTALATION
2
3 This module depends on OpenLDAP v2.x SDK libraries.
4 For details on obtaining source of OpenLDAP look at <http://www.openldap.org>.
5 OpenLDAP SDK in turn depends on OpenSSL crypto libraries and (optionaly) on 
6 Cyrus-SASL libraries.
7
8 2. CONFIGURATION
9
10 Add following subsection to the modules{} section of radiusd.conf to control
11 the rlm_ldap module:
12
13   modules {
14         ...
15         
16         ldap {
17
18 #       server: space separated list of host[:port]
19 #       default: settings for your system, as set in etc/openldap/ldap.conf
20 #
21                 server   = localhost
22
23 #       net_timeout: # of seconds to wait for response of the server 
24 #                       (network failures)
25 #       default: 10
26 #
27                 net_timeout = 1
28
29 #       timeout: # seconds to wait for LDAP query to finish
30 #       default: 20
31 #
32                 timeout = 2
33
34 #       timelimit: # of seconds server has to process the query 
35 #                       (server-side time limit)
36 #       default: 20
37 #
38                 timelimit = 5
39
40 #       ldap_debug: debug flag for LDAP SDK (see OpenLDAP documentation)
41 #       default: 0x0000 (no debugging messages)
42 #       Example:(LDAP_DEBUG_FILTER+LDAP_DEBUG_CONNS)
43                 ldap_debug = 0x0028 
44
45 #       identity: DN under which LDAP searches are done
46 #       password: pasword which authenticate this DN
47 #       default: anonymous bind, no password required
48 #       NOTE: searches are done now over unencrypted connection!
49 #
50 #       identity = "cn=admin,o=My Org,c=UA"
51 #       password = mypass
52
53 #       ldap_cache_timeout: The timeout for the ldap cache in secs
54 #       If it is set to zero then ldap caching will be disabled
55 #       default: 120
56
57         ldap_cache_timeout = 120
58
59 #       ldap_cache_size: The maximum ldap cache size. If it is set to zero
60 #       then the ldap cache size will be unlimited
61 #       default: 0
62
63         ldap_cache_size = 0
64
65 #       ldap_connections_number: The number of ldap connections that the module
66 #       will keep open to use in requests. Usually it will not need to be larger
67 #       than 5-10 connections
68 #       default: 5
69
70         ldap_connections_number = 5
71
72 #       basedn = <Base of LDAP searches>
73 #
74                 basedn   = "o=My Org,c=UA"
75
76 #       filter: LDAP search filter, to locate user object using name
77 #       supplied by client during Radius authentication
78 #       
79 #       default: 
80 #               filter   = "(uid=%u)"
81
82 #       default_profile: DN of a LDAP object, which contains default RADIUS 
83 #       attributes. 
84 #       default: NULL - use only user specific attributes or attributes, 
85 #       supplied by other modules.
86 #               
87         default_profile = "cn=RadProfile,o=My Org,c=UA"
88
89 #       profile_attribute: user object attribute, which contains DN of 
90 #       radiusProfile object for this user.
91 #       default: NULL - use only user specific attributes or attributes,
92 #       supplied by other modules.
93 #
94 #       profile_attribute = "radiusProfileDn"
95
96 #       access_group: membership in this group controls radius access for user
97 #       default: NULL 
98 #       (means all users located in the LDAP tree under specified "basedn")
99 #       
100                 access_group = "cn=RemoteUsers,o=My Org,c=UA"
101
102 #       access_attr: if attribute is specified, module checks for its existance
103 #       in user object. If it exists and is set to TRUE, user is allowed to get
104 #       remote access.
105 #       default: NULL - don't check for the attribute
106                 access_attr = "dialupAccess"
107
108 #       password_header: If the user password is available we add it to the check items
109 #       (to assist in CHAP ie) striping any headers first.
110 #       default: NULL
111 #
112 #       password_header = "{clear}"
113
114 #       password_attribute: Define the attribute which contains the user password.
115 #       default: NULL - don't add password
116 #
117 #       password_attribute = "userPassword"
118
119 #       groupname_attribute: The attribute used for searching for a group in the ldap server.
120 #       default: cn - Search filter is "(cn=%GroupName)"
121 #
122 #       groupname_attribute = "cn"
123
124 #       groupmembership_filter: The filter to search for group membership of a particular user
125 #       after we have found the DN for the group.
126 #       default: (|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))
127 #
128 #       groupmembership_filter = "(|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))"      
129
130         }
131 }
132
133 NOTE:
134 As LDAP is case insensitive, you should probably also set "lower_user = yes" 
135 and "lower_time = before" in main section of radiusd.conf, to get limits on 
136 simultaneous logins working correctly. Otherwise, users will be able get large 
137 number of sessions, capitalizing parts of their login names.
138
139 MODULE MESSAGES:
140 On user rejection rlm_ldap will return the following module messages:
141
142 "rlm_ldap: User not found"
143 "rlm_ldap: Access Attribute denies access"
144 "rlm_ldap: User is not an access group member"
145 "rlm_ldap: Bind as user failed"
146
147 These messages will be visible in radius.log as aditional information in
148 "Login incorrect" and "Invalid user" log messages.
149
150 DIRECTORY COMPATIBILITY NOTE:
151 If you use LDAP only for authorization and authentication (e.g. you can not
152  afford schema extention), I propose to set all necessary attributes in 
153 raddb/users file with following authorize section of radiusd.conf :
154
155 authorize { 
156         ldap {
157                 notfound = return
158         } 
159         files  
160 }