Add SQL backing to Moonshot-*-TargetedId generation. Added three attributes for gener...
[freeradius.git] / raddb / sites-available / inner-tunnel
1 # -*- text -*-
2 ######################################################################
3 #
4 #       This is a virtual server that handles *only* inner tunnel
5 #       requests for EAP-TTLS and PEAP types.
6 #
7 #       $Id$
8 #
9 ######################################################################
10
11 server inner-tunnel {
12
13 #
14 #  This next section is here to allow testing of the "inner-tunnel"
15 #  authentication methods, independently from the "default" server.
16 #  It is listening on "localhost", so that it can only be used from
17 #  the same machine.
18 #
19 #       $ radtest USER PASSWORD 127.0.0.1:18120 0 testing123
20 #
21 #  If it works, you have configured the inner tunnel correctly.  To check
22 #  if PEAP will work, use:
23 #
24 #       $ radtest -t mschap USER PASSWORD 127.0.0.1:18120 0 testing123
25 #
26 #  If that works, PEAP should work.  If that command doesn't work, then
27 #
28 #       FIX THE INNER TUNNEL CONFIGURATION SO THAT IT WORKS.
29 #
30 #  Do NOT do any PEAP tests.  It won't help.  Instead, concentrate
31 #  on fixing the inner tunnel configuration.  DO NOTHING ELSE.
32 #
33 listen {
34        ipaddr = 127.0.0.1
35        port = 18120
36        type = auth
37 }
38
39
40 #  Authorization. First preprocess (hints and huntgroups files),
41 #  then realms, and finally look in the "users" file.
42 #
43 #  The order of the realm modules will determine the order that
44 #  we try to find a matching realm.
45 #
46 #  Make *sure* that 'preprocess' comes before any realm if you
47 #  need to setup hints for the remote radius server
48 authorize {
49         #
50         #  Take a User-Name, and perform some checks on it, for spaces and other
51         #  invalid characters.  If the User-Name appears invalid, reject the
52         #  request.
53         #
54         #  See policy.d/filter for the definition of the filter_username policy.
55         #
56         filter_username
57
58         #
59         #  Do checks on outer / inner User-Name, so that users
60         #  can't spoof us by using incompatible identities
61         #
62 #       filter_inner_identity
63
64         #
65         #  The chap module will set 'Auth-Type := CHAP' if we are
66         #  handling a CHAP request and Auth-Type has not already been set
67         chap
68
69         #
70         #  If the users are logging in with an MS-CHAP-Challenge
71         #  attribute for authentication, the mschap module will find
72         #  the MS-CHAP-Challenge attribute, and add 'Auth-Type := MS-CHAP'
73         #  to the request, which will cause the server to then use
74         #  the mschap module for authentication.
75         mschap
76
77         #
78         #  Pull crypt'd passwords from /etc/passwd or /etc/shadow,
79         #  using the system API's to get the password.  If you want
80         #  to read /etc/passwd or /etc/shadow directly, see the
81         #  passwd module, above.
82         #
83 #       unix
84
85         #
86         #  Look for IPASS style 'realm/', and if not found, look for
87         #  '@realm', and decide whether or not to proxy, based on
88         #  that.
89 #       IPASS
90
91         #
92         #  If you are using multiple kinds of realms, you probably
93         #  want to set "ignore_null = yes" for all of them.
94         #  Otherwise, when the first style of realm doesn't match,
95         #  the other styles won't be checked.
96         #
97         #  Note that proxying the inner tunnel authentication means
98         #  that the user MAY use one identity in the outer session
99         #  (e.g. "anonymous", and a different one here
100         #  (e.g. "user@example.com").  The inner session will then be
101         #  proxied elsewhere for authentication.  If you are not
102         #  careful, this means that the user can cause you to forward
103         #  the authentication to another RADIUS server, and have the
104         #  accounting logs *not* sent to the other server.  This makes
105         #  it difficult to bill people for their network activity.
106         #
107         suffix
108 #       ntdomain
109
110         #
111         #  The "suffix" module takes care of stripping the domain
112         #  (e.g. "@example.com") from the User-Name attribute, and the
113         #  next few lines ensure that the request is not proxied.
114         #
115         #  If you want the inner tunnel request to be proxied, delete
116         #  the next few lines.
117         #
118         update control {
119                 &Proxy-To-Realm := LOCAL
120         }
121
122         #
123         #  This module takes care of EAP-MSCHAPv2 authentication.
124         #
125         #  It also sets the EAP-Type attribute in the request
126         #  attribute list to the EAP type from the packet.
127         #
128         #  The example below uses module failover to avoid querying all
129         #  of the following modules if the EAP module returns "ok".
130         #  Therefore, your LDAP and/or SQL servers will not be queried
131         #  for the many packets that go back and forth to set up TTLS
132         #  or PEAP.  The load on those servers will therefore be reduced.
133         #
134         eap {
135                 ok = return
136         }
137
138         #
139         #  Read the 'users' file
140         files
141
142         #
143         #  Look in an SQL database.  The schema of the database
144         #  is meant to mirror the "users" file.
145         #
146         #  See "Authorization Queries" in sql.conf
147         -sql
148
149         #
150         #  If you are using /etc/smbpasswd, and are also doing
151         #  mschap authentication, the un-comment this line, and
152         #  enable the "smbpasswd" module.
153 #       smbpasswd
154
155         #
156         #  The ldap module reads passwords from the LDAP database.
157         -ldap
158
159         #
160         #  Enforce daily limits on time spent logged in.
161 #       daily
162
163         expiration
164         logintime
165
166         #
167         #  If no other module has claimed responsibility for
168         #  authentication, then try to use PAP.  This allows the
169         #  other modules listed above to add a "known good" password
170         #  to the request, and to do nothing else.  The PAP module
171         #  will then see that password, and use it to do PAP
172         #  authentication.
173         #
174         #  This module should be listed last, so that the other modules
175         #  get a chance to set Auth-Type for themselves.
176         #
177         pap
178 }
179
180
181 #  Authentication.
182 #
183 #
184 #  This section lists which modules are available for authentication.
185 #  Note that it does NOT mean 'try each module in order'.  It means
186 #  that a module from the 'authorize' section adds a configuration
187 #  attribute 'Auth-Type := FOO'.  That authentication type is then
188 #  used to pick the appropriate module from the list below.
189 #
190
191 #  In general, you SHOULD NOT set the Auth-Type attribute.  The server
192 #  will figure it out on its own, and will do the right thing.  The
193 #  most common side effect of erroneously setting the Auth-Type
194 #  attribute is that one authentication method will work, but the
195 #  others will not.
196 #
197 #  The common reasons to set the Auth-Type attribute by hand
198 #  is to either forcibly reject the user, or forcibly accept him.
199 #
200 authenticate {
201         #
202         #  PAP authentication, when a back-end database listed
203         #  in the 'authorize' section supplies a password.  The
204         #  password can be clear-text, or encrypted.
205         Auth-Type PAP {
206                 pap
207         }
208
209         #
210         #  Most people want CHAP authentication
211         #  A back-end database listed in the 'authorize' section
212         #  MUST supply a CLEAR TEXT password.  Encrypted passwords
213         #  won't work.
214         Auth-Type CHAP {
215                 chap
216         }
217
218         #
219         #  MSCHAP authentication.
220         Auth-Type MS-CHAP {
221                 mschap
222         }
223
224         #
225         #  For old names, too.
226         #
227         mschap
228
229         #
230         #  Pluggable Authentication Modules.
231 #       pam
232
233         # Uncomment it if you want to use ldap for authentication
234         #
235         # Note that this means "check plain-text password against
236         # the ldap database", which means that EAP won't work,
237         # as it does not supply a plain-text password.
238         #
239         #  We do NOT recommend using this.  LDAP servers are databases.
240         #  They are NOT authentication servers.  FreeRADIUS is an
241         #  authentication server, and knows what to do with authentication.
242         #  LDAP servers do not.
243         #
244 #       Auth-Type LDAP {
245 #               ldap
246 #       }
247
248         #
249         #  Allow EAP authentication.
250         eap
251 }
252
253 ######################################################################
254 #
255 #       There are no accounting requests inside of EAP-TTLS or PEAP
256 #       tunnels.
257 #
258 ######################################################################
259
260
261 #  Session database, used for checking Simultaneous-Use. Either the radutmp
262 #  or rlm_sql module can handle this.
263 #  The rlm_sql module is *much* faster
264 session {
265         radutmp
266
267         #
268         #  See "Simultaneous Use Checking Queries" in sql.conf
269 #       sql
270 }
271
272
273 #  Post-Authentication
274 #  Once we KNOW that the user has been authenticated, there are
275 #  additional steps we can take.
276 #
277 #  Note that the last packet of the inner-tunnel authentication
278 #  MAY NOT BE the last packet of the outer session.  So updating
279 #  the outer reply MIGHT work, and sometimes MIGHT NOT.  The
280 #  exact functionality depends on both the inner and outer
281 #  authentication methods.
282 #
283 #  If you need to send a reply attribute in the outer session,
284 #  the ONLY safe way is to set "use_tunneled_reply = yes", and
285 #  then update the inner-tunnel reply.
286 post-auth {
287         #  If you want privacy to remain, see the
288         #  Chargeable-User-Identity attribute from RFC 4372.
289         #  If you want to use it just uncomment the line below.
290 #       cui-inner
291
292         #
293         #  If you want to have a log of authentication replies,
294         #  un-comment the following line, and enable the
295         #  'detail reply_log' module.
296 #       reply_log
297
298         #
299         #  After authenticating the user, do another SQL query.
300         #
301         #  See "Authentication Logging Queries" in sql.conf
302         -sql
303
304         #
305         #  Instead of sending the query to the SQL server,
306         #  write it into a log file.
307         #
308 #       sql_log
309
310         #
311         #  Un-comment the following if you have set
312         #  'edir_account_policy_check = yes' in the ldap module sub-section of
313         #  the 'modules' section.
314         #
315 #       ldap
316
317
318         #
319         #  Un-comment the following if you want to generate Moonshot (ABFAB) TargetedIds
320         #
321         #  IMPORTANT: This requires the UUID package to be installed, and a targeted_id_salt
322         #             to be configured.
323         #
324         #  This functionality also supports SQL backing. To use this functionality, enable
325         #  and configure the moonshot-targeted-ids SQL module in the mods-enabled directory.
326         #  Then remove the comments from the appropriate lines in each of the below
327         #  policies in the policy.d/moonshot-targeted-ids file.
328         #
329 #       moonshot_host_tid
330 #       moonshot_realm_tid
331 #       moonshot_coi_tid
332
333         #
334         #  Instead of "use_tunneled_reply", change this "if (0)" to an
335         #  "if (1)".
336         #
337         if (0) {
338                 #
339                 #  These attributes are for the inner-tunnel only,
340                 #  and MUST NOT be copied to the outer reply.
341                 #
342                 update reply {
343                         User-Name !* ANY
344                         Message-Authenticator !* ANY
345                         EAP-Message !* ANY
346                         Proxy-State !* ANY
347                         MS-MPPE-Encryption-Types !* ANY
348                         MS-MPPE-Encryption-Policy !* ANY
349                         MS-MPPE-Send-Key !* ANY
350                         MS-MPPE-Recv-Key !* ANY
351                 }
352
353                 #
354                 #  Copy the inner reply attributes to the outer
355                 #  session-state list.  The post-auth policy will take
356                 #  care of copying the outer session-state list to the
357                 #  outer reply.
358                 #
359                 update {
360                         &outer.session-state: += &reply:
361                 }
362         }
363
364         #
365         #  Access-Reject packets are sent through the REJECT sub-section of the
366         #  post-auth section.
367         #
368         #  Add the ldap module name (or instance) if you have set
369         #  'edir_account_policy_check = yes' in the ldap module configuration
370         #
371         Post-Auth-Type REJECT {
372                 # log failed authentications in SQL, too.
373                 -sql
374                 attr_filter.access_reject
375
376                 #
377                 #  Let the outer session know which module failed, and why.
378                 #
379                 update outer.session-state {
380                         &Module-Failure-Message := &request:Module-Failure-Message
381                 }
382         }
383 }
384
385 #
386 #  When the server decides to proxy a request to a home server,
387 #  the proxied request is first passed through the pre-proxy
388 #  stage.  This stage can re-write the request, or decide to
389 #  cancel the proxy.
390 #
391 #  Only a few modules currently have this method.
392 #
393 pre-proxy {
394         #  Uncomment the following line if you want to change attributes
395         #  as defined in the preproxy_users file.
396 #       files
397
398         #  Uncomment the following line if you want to filter requests
399         #  sent to remote servers based on the rules defined in the
400         #  'attrs.pre-proxy' file.
401 #       attr_filter.pre-proxy
402
403         #  If you want to have a log of packets proxied to a home
404         #  server, un-comment the following line, and the
405         #  'detail pre_proxy_log' section, above.
406 #       pre_proxy_log
407 }
408
409 #
410 #  When the server receives a reply to a request it proxied
411 #  to a home server, the request may be massaged here, in the
412 #  post-proxy stage.
413 #
414 post-proxy {
415
416         #  If you want to have a log of replies from a home server,
417         #  un-comment the following line, and the 'detail post_proxy_log'
418         #  section, above.
419 #       post_proxy_log
420
421         #  Uncomment the following line if you want to filter replies from
422         #  remote proxies based on the rules defined in the 'attrs' file.
423 #       attr_filter.post-proxy
424
425         #
426         #  If you are proxying LEAP, you MUST configure the EAP
427         #  module, and you MUST list it here, in the post-proxy
428         #  stage.
429         #
430         #  You MUST also use the 'nostrip' option in the 'realm'
431         #  configuration.  Otherwise, the User-Name attribute
432         #  in the proxied request will not match the user name
433         #  hidden inside of the EAP packet, and the end server will
434         #  reject the EAP request.
435         #
436         eap
437 }
438
439 } # inner-tunnel server block