Pull fix from branch_1_1, so proxied EAP replies work
[freeradius.git] / raddb / policy.txt
1 #
2 #       Sample of a policy language.
3 #       There's no documentation other than this file.
4 #       The syntax is odd, but it works.
5 #       It's not intended for production use.
6 #       Use it if you want obscure error messages and possibly server crashes.
7 #
8 #       $Id$
9 #
10 #  Debugging statements
11 #
12 #debug print_tokens     # as we're parsing this file
13 debug print_policy      # once the file has been parsed
14 debug evaluate          # print limited information during evaluation
15
16 #
17 #  A named policy.
18 #
19 policy 3pm {
20 if (Time-Of-Day < "15:00") {
21    reply .= {
22       # Use ARAP-Password for testing because it's an attribute
23       # no one cares about.
24       ARAP-Password = "< 15:00"
25    }
26 }
27
28 }
29
30 #
31 #  A named policy, executed during the "authorize" phase,
32 #  because it's named "authorize". 
33 #
34 policy authorize {
35   if (CHAP-Password) {
36      if (!(CHAP-Challenge)) {
37         print "Adding CHAP-Challenge = %{request:Packet-Authentication-Vector}\n"
38
39         #
40         #  Append all attributes to the specified list.
41         #  The per-attribute operators MUST be '='
42         #
43         request .= {
44            CHAP-Challenge = "%{request:Packet-Authentication-Vector}"
45         }
46      }
47
48      #
49      #  Use per-attribute operators to do override, replace, etc.
50      #  It's "control", not "check items", because "check items"
51      #  is a hold-over from the "users" file, and we no longer like that.
52      #
53      control = {
54           Auth-Type := CHAP
55      }
56   }
57
58 #
59 #  This could just as well be "%{ldap: query...}" =~ ...
60 #
61 #  if ("%{User-Name}" =~ "^(b)") {
62 #     reply .= {
63 #          Arap-Password = "Hello, %{1}"
64 #     }
65 #  }
66
67   #
68   #  Execute "3pm", as if it was in-line here.
69   #
70 #  call 3pm
71 }