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