Added new "policy.conf" to permit simplified configuration of
[freeradius.git] / raddb / policy.conf
1 # -*- text -*-
2 ##
3 ## policy.conf  -- FreeRADIUS server configuration file.
4 ##
5 ##      http://www.freeradius.org/
6 ##      $Id$
7 ##
8
9 #
10 #  Policies are virtual modules, similar to those defined in the
11 #  "instantate" section of radiusd.conf.
12 #
13 #  Defining a policy here means that it can be referenced in multiple
14 #  places as a *name*, rather than as a series of conditions to match,
15 #  and actions to take.
16 #
17 #  Policies are something like subroutines in a normal language, but
18 #  they cannot be called recursively.  They MUST be defined in order.
19 #  If policy A calls policy B, then B MUST be defined before A.
20 #
21 #
22 policy {
23         #
24         #       Forbid all EAP types.
25         #
26         forbid_eap {
27                 if ("%{EAP-Message}") {
28                         reject
29                 }
30         }
31
32         #
33         #       Forbid all non-EAP types outside of an EAP tunnel.
34         #
35         permit_only_eap {
36                 if (!"%{EAP-Message}") {
37                         #  We MAY be inside of a TTLS tunnel.
38                         #  PEAP and EAP-FAST require EAP inside of
39                         #  the tunnel, so this check is OK.
40                         #  If so, then there MUST be an outer EAP message.
41                         if (!"%{outer.request:EAP-Message}") {
42                                 reject
43                         }
44                 }
45         }
46
47         #
48         #       Forbid all attempts to login via realms.
49         #
50         deny_realms {
51                 if ("%{User-Name}" =~ /@|\\/) {
52                         reject
53                 }
54         }
55 }