Policy for injecting operator-name
[freeradius.git] / raddb / sites-available / default
1 ######################################################################
2 #
3 #       As of 2.0.0, FreeRADIUS supports virtual hosts using the
4 #       "server" section, and configuration directives.
5 #
6 #       Virtual hosts should be put into the "sites-available"
7 #       directory.  Soft links should be created in the "sites-enabled"
8 #       directory to these files.  This is done in a normal installation.
9 #
10 #       If you are using 802.1X (EAP) authentication, please see also
11 #       the "inner-tunnel" virtual server.  You wll likely have to edit
12 #       that, too, for authentication to work.
13 #
14 #       $Id$
15 #
16 ######################################################################
17 #
18 #       Read "man radiusd" before editing this file.  See the section
19 #       titled DEBUGGING.  It outlines a method where you can quickly
20 #       obtain the configuration you want, without running into
21 #       trouble.  See also "man unlang", which documents the format
22 #       of this file.
23 #
24 #       This configuration is designed to work in the widest possible
25 #       set of circumstances, with the widest possible number of
26 #       authentication methods.  This means that in general, you should
27 #       need to make very few changes to this file.
28 #
29 #       The best way to configure the server for your local system
30 #       is to CAREFULLY edit this file.  Most attempts to make large
31 #       edits to this file will BREAK THE SERVER.  Any edits should
32 #       be small, and tested by running the server with "radiusd -X".
33 #       Once the edits have been verified to work, save a copy of these
34 #       configuration files somewhere.  (e.g. as a "tar" file).  Then,
35 #       make more edits, and test, as above.
36 #
37 #       There are many "commented out" references to modules such
38 #       as ldap, sql, etc.  These references serve as place-holders.
39 #       If you need the functionality of that module, then configure
40 #       it in radiusd.conf, and un-comment the references to it in
41 #       this file.  In most cases, those small changes will result
42 #       in the server being able to connect to the DB, and to
43 #       authenticate users.
44 #
45 ######################################################################
46
47 #
48 #       In 1.x, the "authorize", etc. sections were global in
49 #       radiusd.conf.  As of 2.0, they SHOULD be in a server section.
50 #
51 #       The server section with no virtual server name is the "default"
52 #       section.  It is used when no server name is specified.
53 #
54 #       We don't indent the rest of this file, because doing so
55 #       would make it harder to read.
56 #
57
58 #  Authorization. First preprocess (hints and huntgroups files),
59 #  then realms, and finally look in the "users" file.
60 #
61 #  Any changes made here should also be made to the "inner-tunnel"
62 #  virtual server.
63 #
64 #  The order of the realm modules will determine the order that
65 #  we try to find a matching realm.
66 #
67 #  Make *sure* that 'preprocess' comes before any realm if you 
68 #  need to setup hints for the remote radius server
69 authorize {
70         #
71         #  Security settings.  Take a User-Name, and do some simple
72         #  checks on it, for spaces and other invalid characters.  If
73         #  it looks like the user is trying to play games, reject it.
74         #
75         #  This should probably be enabled by default.
76         #
77         #  See policy.conf for the definition of the filter_username policy.
78         #
79 #       filter_username
80
81         #
82         #  The preprocess module takes care of sanitizing some bizarre
83         #  attributes in the request, and turning them into attributes
84         #  which are more standard.
85         #
86         #  It takes care of processing the 'raddb/hints' and the
87         #  'raddb/huntgroups' files.
88         preprocess
89
90         #  If you require that the Operator-Name be set
91         #  for your local clients then uncomment the operator-name
92         #  below and set the operator-name for your clients in clients.conf
93 #       operator-name
94
95         #
96         #  If you want to have a log of authentication requests,
97         #  un-comment the following line, and the 'detail auth_log'
98         #  section, above.
99 #       auth_log
100
101         #
102         #  The chap module will set 'Auth-Type := CHAP' if we are
103         #  handling a CHAP request and Auth-Type has not already been set
104         chap
105
106         #
107         #  If the users are logging in with an MS-CHAP-Challenge
108         #  attribute for authentication, the mschap module will find
109         #  the MS-CHAP-Challenge attribute, and add 'Auth-Type := MS-CHAP'
110         #  to the request, which will cause the server to then use
111         #  the mschap module for authentication.
112         mschap
113
114         #
115         #  If you have a Cisco SIP server authenticating against
116         #  FreeRADIUS, uncomment the following line, and the 'digest'
117         #  line in the 'authenticate' section.
118         digest
119
120         #
121         #  The WiMAX specification says that the Calling-Station-Id
122         #  is 6 octets of the MAC.  This definition conflicts with
123         #  RFC 3580, and all common RADIUS practices.  Un-commenting
124         #  the "wimax" module here means that it will fix the
125         #  Calling-Station-Id attribute to the normal format as
126         #  specified in RFC 3580 Section 3.21
127 #       wimax
128
129         #
130         #  Look for IPASS style 'realm/', and if not found, look for
131         #  '@realm', and decide whether or not to proxy, based on
132         #  that.
133 #       IPASS
134
135         #
136         #  If you are using multiple kinds of realms, you probably
137         #  want to set "ignore_null = yes" for all of them.
138         #  Otherwise, when the first style of realm doesn't match,
139         #  the other styles won't be checked.
140         #
141         suffix
142 #       ntdomain
143
144         #
145         #  This module takes care of EAP-MD5, EAP-TLS, and EAP-LEAP
146         #  authentication.
147         #
148         #  It also sets the EAP-Type attribute in the request
149         #  attribute list to the EAP type from the packet.
150         #
151         #  As of 2.0, the EAP module returns "ok" in the authorize stage
152         #  for TTLS and PEAP.  In 1.x, it never returned "ok" here, so
153         #  this change is compatible with older configurations.
154         #
155         #  The example below uses module failover to avoid querying all
156         #  of the following modules if the EAP module returns "ok".
157         #  Therefore, your LDAP and/or SQL servers will not be queried
158         #  for the many packets that go back and forth to set up TTLS
159         #  or PEAP.  The load on those servers will therefore be reduced.
160         #
161         eap {
162                 ok = return
163         }
164
165         #
166         #  Pull crypt'd passwords from /etc/passwd or /etc/shadow,
167         #  using the system API's to get the password.  If you want
168         #  to read /etc/passwd or /etc/shadow directly, see the
169         #  passwd module in radiusd.conf.
170         #
171 #       unix
172
173         #
174         #  Read the 'users' file
175         files
176
177         #
178         #  Look in an SQL database.  The schema of the database
179         #  is meant to mirror the "users" file.
180         #
181         #  See "Authorization Queries" in sql.conf
182 #       sql
183
184         #
185         #  If you are using /etc/smbpasswd, and are also doing
186         #  mschap authentication, the un-comment this line, and
187         #  configure the 'etc_smbpasswd' module, above.
188 #       etc_smbpasswd
189
190         #
191         #  The ldap module will set Auth-Type to LDAP if it has not
192         #  already been set
193 #       ldap
194
195         #
196         #  Enforce daily limits on time spent logged in.
197 #       daily
198
199         #
200         # Use the checkval module
201 #       checkval
202
203         expiration
204         logintime
205
206         #
207         #  If no other module has claimed responsibility for
208         #  authentication, then try to use PAP.  This allows the
209         #  other modules listed above to add a "known good" password
210         #  to the request, and to do nothing else.  The PAP module
211         #  will then see that password, and use it to do PAP
212         #  authentication.
213         #
214         #  This module should be listed last, so that the other modules
215         #  get a chance to set Auth-Type for themselves.
216         #
217         pap
218
219         #
220         #  If "status_server = yes", then Status-Server messages are passed
221         #  through the following section, and ONLY the following section.
222         #  This permits you to do DB queries, for example.  If the modules
223         #  listed here return "fail", then NO response is sent.
224         #
225 #       Autz-Type Status-Server {
226 #
227 #       }
228 }
229
230
231 #  Authentication.
232 #
233 #
234 #  This section lists which modules are available for authentication.
235 #  Note that it does NOT mean 'try each module in order'.  It means
236 #  that a module from the 'authorize' section adds a configuration
237 #  attribute 'Auth-Type := FOO'.  That authentication type is then
238 #  used to pick the apropriate module from the list below.
239 #
240
241 #  In general, you SHOULD NOT set the Auth-Type attribute.  The server
242 #  will figure it out on its own, and will do the right thing.  The
243 #  most common side effect of erroneously setting the Auth-Type
244 #  attribute is that one authentication method will work, but the
245 #  others will not.
246 #
247 #  The common reasons to set the Auth-Type attribute by hand
248 #  is to either forcibly reject the user (Auth-Type := Reject),
249 #  or to or forcibly accept the user (Auth-Type := Accept).
250 #
251 #  Note that Auth-Type := Accept will NOT work with EAP.
252 #
253 #  Please do not put "unlang" configurations into the "authenticate"
254 #  section.  Put them in the "post-auth" section instead.  That's what
255 #  the post-auth section is for.
256 #
257 authenticate {
258         #
259         #  PAP authentication, when a back-end database listed
260         #  in the 'authorize' section supplies a password.  The
261         #  password can be clear-text, or encrypted.
262         Auth-Type PAP {
263                 pap
264         }
265
266         #
267         #  Most people want CHAP authentication
268         #  A back-end database listed in the 'authorize' section
269         #  MUST supply a CLEAR TEXT password.  Encrypted passwords
270         #  won't work.
271         Auth-Type CHAP {
272                 chap
273         }
274
275         #
276         #  MSCHAP authentication.
277         Auth-Type MS-CHAP {
278                 mschap
279         }
280
281         #
282         #  If you have a Cisco SIP server authenticating against
283         #  FreeRADIUS, uncomment the following line, and the 'digest'
284         #  line in the 'authorize' section.
285         digest
286
287         #
288         #  Pluggable Authentication Modules.
289 #       pam
290
291         #
292         #  See 'man getpwent' for information on how the 'unix'
293         #  module checks the users password.  Note that packets
294         #  containing CHAP-Password attributes CANNOT be authenticated
295         #  against /etc/passwd!  See the FAQ for details.
296         #
297         #  For normal "crypt" authentication, the "pap" module should
298         #  be used instead of the "unix" module.  The "unix" module should
299         #  be used for authentication ONLY for compatibility with legacy
300         #  FreeRADIUS configurations.
301         #
302         unix
303
304         # Uncomment it if you want to use ldap for authentication
305         #
306         # Note that this means "check plain-text password against
307         # the ldap database", which means that EAP won't work,
308         # as it does not supply a plain-text password.
309 #       Auth-Type LDAP {
310 #               ldap
311 #       }
312
313         #
314         #  Allow EAP authentication.
315         eap
316
317         #
318         #  The older configurations sent a number of attributes in
319         #  Access-Challenge packets, which wasn't strictly correct.
320         #  If you want to filter out these attributes, uncomment
321         #  the following lines.
322         #
323 #       Auth-Type eap {
324 #               eap {
325 #                       handled = 1  
326 #               }
327 #               if (handled && (Response-Packet-Type == Access-Challenge)) {
328 #                       attr_filter.access_challenge.post-auth
329 #                       handled  # override the "updated" code from attr_filter
330 #               }
331 #       }
332 }
333
334
335 #
336 #  Pre-accounting.  Decide which accounting type to use.
337 #
338 preacct {
339         preprocess
340
341         #
342         #  Session start times are *implied* in RADIUS.
343         #  The NAS never sends a "start time".  Instead, it sends
344         #  a start packet, *possibly* with an Acct-Delay-Time.
345         #  The server is supposed to conclude that the start time
346         #  was "Acct-Delay-Time" seconds in the past.
347         #
348         #  The code below creates an explicit start time, which can
349         #  then be used in other modules.  It will be *mostly* correct.
350         #  Any errors are due to the 1-second resolution of RADIUS,
351         #  and the possibility that the time on the NAS may be off.
352         #
353         #  The start time is: NOW - delay - session_length
354         #
355
356 #         update request {
357 #               FreeRADIUS-Acct-Session-Start-Time = "%{expr: %l - %{%{Acct-Session-Time}:-0} - %{%{Acct-Delay-Time}:-0}}"
358 #       }
359
360
361         #
362         #  Ensure that we have a semi-unique identifier for every
363         #  request, and many NAS boxes are broken.
364         acct_unique
365
366         #
367         #  Look for IPASS-style 'realm/', and if not found, look for
368         #  '@realm', and decide whether or not to proxy, based on
369         #  that.
370         #
371         #  Accounting requests are generally proxied to the same
372         #  home server as authentication requests.
373 #       IPASS
374         suffix
375 #       ntdomain
376
377         #
378         #  Read the 'acct_users' file
379         files
380 }
381
382 #
383 #  Accounting.  Log the accounting data.
384 #
385 accounting {
386         #
387         #  Create a 'detail'ed log of the packets.
388         #  Note that accounting requests which are proxied
389         #  are also logged in the detail file.
390         detail
391 #       daily
392
393         #  Update the wtmp file
394         #
395         #  If you don't use "radlast", you can delete this line.
396         unix
397
398         #
399         #  For Simultaneous-Use tracking.
400         #
401         #  Due to packet losses in the network, the data here
402         #  may be incorrect.  There is little we can do about it.
403         radutmp
404 #       sradutmp
405
406         #  Return an address to the IP Pool when we see a stop record.
407 #       main_pool
408
409         #
410         #  Log traffic to an SQL database.
411         #
412         #  See "Accounting queries" in sql.conf
413 #       sql
414
415         #
416         #  If you receive stop packets with zero session length,
417         #  they will NOT be logged in the database.  The SQL module
418         #  will print a message (only in debugging mode), and will
419         #  return "noop".
420         #
421         #  You can ignore these packets by uncommenting the following
422         #  three lines.  Otherwise, the server will not respond to the
423         #  accounting request, and the NAS will retransmit.
424         #
425 #       if (noop) {
426 #               ok
427 #       }
428
429         #
430         #  Instead of sending the query to the SQL server,
431         #  write it into a log file.
432         #
433 #       sql_log
434
435         #  Cisco VoIP specific bulk accounting
436 #       pgsql-voip
437
438         # For Exec-Program and Exec-Program-Wait
439         exec
440
441         #  Filter attributes from the accounting response.
442         attr_filter.accounting_response
443
444         #
445         #  See "Autz-Type Status-Server" for how this works.
446         #
447 #       Acct-Type Status-Server {
448 #
449 #       }
450 }
451
452
453 #  Session database, used for checking Simultaneous-Use. Either the radutmp 
454 #  or rlm_sql module can handle this.
455 #  The rlm_sql module is *much* faster
456 session {
457         radutmp
458
459         #
460         #  See "Simultaneous Use Checking Queries" in sql.conf
461 #       sql
462 }
463
464
465 #  Post-Authentication
466 #  Once we KNOW that the user has been authenticated, there are
467 #  additional steps we can take.
468 post-auth {
469         #  Get an address from the IP Pool.
470 #       main_pool
471
472         #
473         #  If you want to have a log of authentication replies,
474         #  un-comment the following line, and the 'detail reply_log'
475         #  section, above.
476 #       reply_log
477
478         #
479         #  After authenticating the user, do another SQL query.
480         #
481         #  See "Authentication Logging Queries" in sql.conf
482 #       sql
483
484         #
485         #  Instead of sending the query to the SQL server,
486         #  write it into a log file.
487         #
488 #       sql_log
489
490         #
491         #  Un-comment the following if you have set
492         #  'edir_account_policy_check = yes' in the ldap module sub-section of
493         #  the 'modules' section.
494         #
495 #       ldap
496
497         # For Exec-Program and Exec-Program-Wait
498         exec
499
500         #
501         #  Calculate the various WiMAX keys.  In order for this to work,
502         #  you will need to define the WiMAX NAI, usually via
503         #
504         #       update request {
505         #              WiMAX-MN-NAI = "%{User-Name}"
506         #       }
507         #
508         #  If you want various keys to be calculated, you will need to
509         #  update the reply with "template" values.  The module will see
510         #  this, and replace the template values with the correct ones
511         #  taken from the cryptographic calculations.  e.g.
512         #
513         #       update reply {
514         #               WiMAX-FA-RK-Key = 0x00
515         #               WiMAX-MSK = "%{EAP-MSK}"
516         #       }
517         #
518         #  You may want to delete the MS-MPPE-*-Keys from the reply,
519         #  as some WiMAX clients behave badly when those attributes
520         #  are included.  See "raddb/modules/wimax", configuration
521         #  entry "delete_mppe_keys" for more information.
522         #
523 #       wimax
524
525         #  If there is a client certificate (EAP-TLS, sometimes PEAP
526         #  and TTLS), then some attributes are filled out after the
527         #  certificate verification has been performed.  These fields
528         #  MAY be available during the authentication, or they may be
529         #  available only in the "post-auth" section.
530         #
531         #  The first set of attributes contains information about the
532         #  issuing certificate which is being used.  The second
533         #  contains information about the client certificate (if
534         #  available).
535 #
536 #       update reply {
537 #              Reply-Message += "%{TLS-Cert-Serial}"
538 #              Reply-Message += "%{TLS-Cert-Expiration}"
539 #              Reply-Message += "%{TLS-Cert-Subject}"
540 #              Reply-Message += "%{TLS-Cert-Issuer}"
541 #              Reply-Message += "%{TLS-Cert-Common-Name}"
542 #              Reply-Message += "%{TLS-Cert-Subject-Alt-Name-Email}"
543 #
544 #              Reply-Message += "%{TLS-Client-Cert-Serial}"
545 #              Reply-Message += "%{TLS-Client-Cert-Expiration}"
546 #              Reply-Message += "%{TLS-Client-Cert-Subject}"
547 #              Reply-Message += "%{TLS-Client-Cert-Issuer}"
548 #              Reply-Message += "%{TLS-Client-Cert-Common-Name}"
549 #              Reply-Message += "%{TLS-Client-Cert-Subject-Alt-Name-Email}"
550 #       }
551
552         #  Insert class attribute (with unique value) into response,
553         #  aids matching auth and acct records, and protects against duplicate
554         #  Acct-Session-Id. Note: Only works if the NAS has implemented
555         #  RFC 2865 behaviour for the class attribute, AND if the NAS
556         #  supports long Class attributes.  Many older or cheap NASes
557         #  only support 16-octet Class attributes.
558         #
559 #       insert_acct_class
560
561         #  Remove reply message if the response contains an EAP-Message
562         remove_reply_message_if_eap
563
564         #
565         #  Access-Reject packets are sent through the REJECT sub-section of the
566         #  post-auth section.
567         #
568         #  Add the ldap module name (or instance) if you have set 
569         #  'edir_account_policy_check = yes' in the ldap module configuration
570         #
571         Post-Auth-Type REJECT {
572                 # log failed authentications in SQL, too.
573 #               sql
574                 attr_filter.access_reject
575
576                 # Insert EAP-Failure message if the request was
577                 # rejected by policy instead of because of an
578                 # authentication failure
579                 eap
580
581                 #  Remove reply message if the response contains an EAP-Message
582                 remove_reply_message_if_eap
583         }
584 }
585
586 #
587 #  When the server decides to proxy a request to a home server,
588 #  the proxied request is first passed through the pre-proxy
589 #  stage.  This stage can re-write the request, or decide to
590 #  cancel the proxy.
591 #
592 #  Only a few modules currently have this method.
593 #
594 pre-proxy {
595 #       attr_rewrite
596
597         # Before proxing the request add an Operator-Name attribute identifying
598         # if the operator-name is found for this client.
599         # No need to uncomment this if you have already enabled this in 
600         # the authorize section.
601 #       operator-name
602
603         #  Uncomment the following line if you want to change attributes
604         #  as defined in the preproxy_users file.
605 #       files
606
607         #  Uncomment the following line if you want to filter requests
608         #  sent to remote servers based on the rules defined in the
609         #  'attrs.pre-proxy' file.
610 #       attr_filter.pre-proxy
611
612         #  If you want to have a log of packets proxied to a home
613         #  server, un-comment the following line, and the
614         #  'detail pre_proxy_log' section, above.
615 #       pre_proxy_log
616 }
617
618 #
619 #  When the server receives a reply to a request it proxied
620 #  to a home server, the request may be massaged here, in the
621 #  post-proxy stage.
622 #
623 post-proxy {
624
625         #  If you want to have a log of replies from a home server,
626         #  un-comment the following line, and the 'detail post_proxy_log'
627         #  section, above.
628 #       post_proxy_log
629
630 #       attr_rewrite
631
632         #  Uncomment the following line if you want to filter replies from
633         #  remote proxies based on the rules defined in the 'attrs' file.
634 #       attr_filter.post-proxy
635
636         #
637         #  If you are proxying LEAP, you MUST configure the EAP
638         #  module, and you MUST list it here, in the post-proxy
639         #  stage.
640         #
641         #  You MUST also use the 'nostrip' option in the 'realm'
642         #  configuration.  Otherwise, the User-Name attribute
643         #  in the proxied request will not match the user name
644         #  hidden inside of the EAP packet, and the end server will
645         #  reject the EAP request.
646         #
647         eap
648
649         #
650         #  If the server tries to proxy a request and fails, then the
651         #  request is processed through the modules in this section.
652         #
653         #  The main use of this section is to permit robust proxying
654         #  of accounting packets.  The server can be configured to
655         #  proxy accounting packets as part of normal processing.
656         #  Then, if the home server goes down, accounting packets can
657         #  be logged to a local "detail" file, for processing with
658         #  radrelay.  When the home server comes back up, radrelay
659         #  will read the detail file, and send the packets to the
660         #  home server.
661         #
662         #  With this configuration, the server always responds to
663         #  Accounting-Requests from the NAS, but only writes
664         #  accounting packets to disk if the home server is down.
665         #
666 #       Post-Proxy-Type Fail {
667 #                       detail
668 #       }
669 }
670