#
if ("%{string:Class}" =~ /${policy.class_value_prefix}([0-9a-f]{32})/i) {
update request {
- Acct-Unique-Session-Id := "%{md5:%{1},%{Acct-Session-ID}}"
+ &Acct-Unique-Session-Id := "%{md5:%{1},%{Acct-Session-ID}}"
}
}
#
else {
update request {
- Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}"
+ &Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}"
}
}
}
#
insert_acct_class {
update reply {
- Class = "${policy.class_value_prefix}%{md5:%t,%I,%{Packet-Src-Port},%{Packet-Src-IP-Address},%{NAS-IP-Address},%{Calling-Station-ID},%{User-Name}}"
+ &Class = "${policy.class_value_prefix}%{md5:%t,%I,%{Packet-Src-Port},%{Packet-Src-IP-Address},%{NAS-IP-Address},%{Calling-Station-ID},%{User-Name}}"
}
}
#
acct_counters64.preacct {
update request {
- Acct-Input-Octets64 = "%{expr:(%{%{Acct-Input-Gigawords}:-0} * 4294967296) + %{%{Acct-Input-Octets}:-0}}"
- Acct-Output-Octets64 = "%{expr:(%{%{Acct-Output-Gigawords}:-0} * 4294967296) + %{%{Acct-Output-Octets}:-0}}"
+ &Acct-Input-Octets64 = "%{expr:(%{%{Acct-Input-Gigawords}:-0} * 4294967296) + %{%{Acct-Input-Octets}:-0}}"
+ &Acct-Output-Octets64 = "%{expr:(%{%{Acct-Output-Gigawords}:-0} * 4294967296) + %{%{Acct-Output-Octets}:-0}}"
}
}
split_username_nai {
if (&User-Name =~ /${policy.nai_regexp}/) {
update request {
- Stripped-User-Name := "%{1}"
- Stripped-User-Domain = "%{3}"
+ &Stripped-User-Name := "%{1}"
+ &Stripped-User-Domain = "%{3}"
}
# If any of the expansions result in a null
split_username_nai.post-proxy {
if (&proxy-reply:User-Name =~ /${policy.nai_regexp}/) {
update proxy-reply {
- Stripped-User-Name := "%{1}"
- Stripped-User-Domain = "%{3}"
+ &Stripped-User-Name := "%{1}"
+ &Stripped-User-Domain = "%{3}"
}
updated
}
rewrite_called_station_id {
if (&Called-Station-Id =~ /^${policy.mac-addr-regexp}(:(.+))?$/i) {
update request {
- Called-Station-Id := "%{tolower:%{1}-%{2}-%{3}-%{4}-%{5}-%{6}}"
+ &Called-Station-Id := "%{tolower:%{1}-%{2}-%{3}-%{4}-%{5}-%{6}}"
}
# SSID component?
if ("%{8}") {
update request {
- Called-Station-SSID := "%{8}"
+ &Called-Station-SSID := "%{8}"
}
}
updated
rewrite_calling_station_id {
if (&Calling-Station-Id =~ /^${policy.mac-addr-regexp}$/i) {
update request {
- Calling-Station-Id := "%{tolower:%{1}-%{2}-%{3}-%{4}-%{5}-%{6}}"
+ &Calling-Station-Id := "%{tolower:%{1}-%{2}-%{3}-%{4}-%{5}-%{6}}"
}
updated
}
#
do_not_respond {
update control {
- Response-Packet-Type := Do-Not-Respond
+ &Response-Packet-Type := Do-Not-Respond
}
handled
#
accept.authorize {
update control {
- Auth-Type := accept
+ &Auth-Type := accept
}
}
cui.authorize {
if ("%{client:add_cui}" == 'yes') {
update request {
- Chargeable-User-Identity := 0x00
+ &Chargeable-User-Identity := 0x00
}
}
}
cui.pre-proxy {
if (("%{request:Packet-Type}" == 'Access-Request') && ("%{client:add_cui}" == 'yes')) {
update proxy-request {
- Chargeable-User-Identity = 0x00
+ &Chargeable-User-Identity = 0x00
}
}
}
if (!&control:Proxy-To-Realm && &Chargeable-User-Identity && !&reply:Chargeable-User-Identity && \
(&Operator-Name || ('${policy.cui_require_operator_name}' != 'yes')) ) {
update reply {
- Chargeable-User-Identity = "%{sha1:${policy.cui_hash_key}%{tolower:%{User-Name}%{%{Operator-Name}:-}}}"
+ &Chargeable-User-Identity = "%{sha1:${policy.cui_hash_key}%{tolower:%{User-Name}%{%{Operator-Name}:-}}}"
}
}
if (&reply:Chargeable-User-Identity) {
# Force User-Name to be the User-Name from the request
update {
- reply:User-Name := &request:User-Name
+ &reply:User-Name := &request:User-Name
}
cuisql
}
if (&outer.request:Chargeable-User-Identity && \
(&outer.request:Operator-Name || ('${policy.cui_require_operator_name}' != 'yes'))) {
update reply {
- Chargeable-User-Identity := "%{sha1:${policy.cui_hash_key}%{tolower:%{User-Name}%{%{outer.request:Operator-Name}:-}}}"
+ &Chargeable-User-Identity := "%{sha1:${policy.cui_hash_key}%{tolower:%{User-Name}%{%{outer.request:Operator-Name}:-}}}"
}
}
}
#
if (!&Chargeable-User-Identity) {
update request {
- Chargeable-User-Identity := "%{cuisql:\
+ &Chargeable-User-Identity := "%{cuisql:\
SELECT cui FROM cui \
WHERE clientipaddress = '%{%{Packet-Src-IPv6-Address}:-%{Packet-Src-IP-Address}}' \
AND callingstationid = '%{Calling-Station-Id}' \
# Do some minor hacks to the request so that it looks
# like a RADIUS request to the SQL IP Pool module.
update request {
- User-Name = "DHCP-%{DHCP-Client-Hardware-Address}"
- Calling-Station-Id = "%{DHCP-Client-Hardware-Address}"
- NAS-IP-Address = "%{%{DHCP-Gateway-IP-Address}:-127.0.0.1}"
- Acct-Status-Type = Start
+ &User-Name = "DHCP-%{DHCP-Client-Hardware-Address}"
+ &Calling-Station-Id = "%{DHCP-Client-Hardware-Address}"
+ &NAS-IP-Address = "%{%{DHCP-Gateway-IP-Address}:-127.0.0.1}"
+ &Acct-Status-Type = Start
}
# Call the actual module
# actually allocated an address.
if (ok) {
update reply {
- DHCP-Your-IP-Address = "%{reply:Framed-IP-Address}"
+ &DHCP-Your-IP-Address = "%{reply:Framed-IP-Address}"
}
}
}
#
if (&control:State) {
update control {
- Cache-TTL := 0
+ &Cache-TTL := 0
}
cache_eap
update control {
- Cache-TTL !* ANY
- State !* ANY
+ &State !* ANY
}
}
remove_reply_message_if_eap {
if (&reply:EAP-Message && &reply:Reply-Message) {
update reply {
- Reply-Message !* ANY
+ &Reply-Message !* ANY
}
}
else {
#
if (&User-Name =~ / /) {
update reply {
- Reply-Message += "Rejected: Username contains whitespace"
+ &Reply-Message += 'Rejected: Username contains whitespace'
}
reject
}
#
if (&User-Name =~ /@.*@/ ) {
update reply {
- Reply-Message += "Rejected: Multiple @ in username"
+ &Reply-Message += 'Rejected: Multiple @ in username'
}
reject
}
#
if (&User-Name =~ /\\.\\./ ) {
update reply {
- Reply-Message += "Rejected: Username contains ..s"
+ &Reply-Message += 'Rejected: Username contains ..s'
}
reject
}
#
if ((&User-Name =~ /@/) && (&User-Name !~ /@(.+)\\.(.+)$/)) {
update reply {
- Reply-Message += "Rejected: Realm does not have at least one dot separator"
+ &Reply-Message += 'Rejected: Realm does not have at least one dot separator'
}
reject
}
#
if (&User-Name =~ /\\.$/) {
update reply {
- Reply-Message += "Rejected: Realm ends with a dot"
+ &Reply-Message += 'Rejected: Realm ends with a dot'
}
reject
}
#
if (&User-Name =~ /@\\./) {
update reply {
- Reply-Message += "Rejected: Realm begins with a dot"
+ &Reply-Message += 'Rejected: Realm begins with a dot'
}
reject
}
operator-name.authorize {
if ("%{client:Operator-Name}") {
update request {
- Operator-Name = "%{client:Operator-Name}"
+ &Operator-Name = "%{client:Operator-Name}"
}
}
}
operator-name.pre-proxy {
if (("%{request:Packet-Type}" == 'Access-Request') && "%{client:Operator-Name}") {
update proxy-request {
- Operator-Name := "%{client:Operator-Name}"
+ &Operator-Name := "%{client:Operator-Name}"
}
}
}
# Only the "authorize" section is needed.
#
authorize {
- if (GSS-Acceptor-Service-Name && (outer.request:GSS-Acceptor-Service-Name != GSS-Acceptor-Service-Name)) {
+ if (&GSS-Acceptor-Service-Name && (&outer.request:GSS-Acceptor-Service-Name != &GSS-Acceptor-Service-Name)) {
reject
}
- if (GSS-Acceptor-Service-Name || GSS-Acceptor-Realm-Name || GSS-Acceptor-Host-Name) {
+ if (&GSS-Acceptor-Service-Name || &GSS-Acceptor-Realm-Name || &GSS-Acceptor-Host-Name) {
update control {
- Chbind-Response-Code := success
+ &Chbind-Response-Code := success
}
#
# then they won't be copied to the reply.
#
update reply {
- GSS-Acceptor-Service-Name = &GSS-Acceptor-Service-Name
- GSS-Acceptor-Host-Name = &GSS-Acceptor-Host-Name
- GSS-Acceptor-Realm-Name = &GSS-Acceptor-Realm-Name
+ &GSS-Acceptor-Service-Name = &GSS-Acceptor-Service-Name
+ &GSS-Acceptor-Host-Name = &GSS-Acceptor-Host-Name
+ &GSS-Acceptor-Realm-Name = &GSS-Acceptor-Realm-Name
}
}
# By default, we just accept the request:
#
update config {
- Auth-Type := Accept
+ &Auth-Type := Accept
}
# Check the client certificate matches a string, and reject otherwise
#
-# if ("%{TLS-Client-Cert-Common-Name}" == "client.example.com") {
+# if ("%{TLS-Client-Cert-Common-Name}" == 'client.example.com') {
# update config {
-# Auth-Type := Accept
+# &Auth-Type := Accept
# }
# }
# else {
# update config {
-# Auth-Type := Reject
+# &Auth-Type := Reject
# }
# update reply {
-# Reply-Message := "Your certificate is not valid."
+# &Reply-Message := "Your certificate is not valid."
# }
# }
#
# Check the client certificate common name against the supplied User-Name
#
-# if ("host/%{TLS-Client-Cert-Common-Name}" == "%{User-Name}") {
+# if ("host/%{TLS-Client-Cert-Common-Name}" == &User-Name) {
# update config {
-# Auth-Type := Accept
+# &Auth-Type := Accept
# }
# }
# else {
# update config {
-# Auth-Type := Reject
+# &Auth-Type := Reject
# }
# }
# if (!(Ldap-Group == "Permitted-Laptops")) {
# update config {
-# Auth-Type := Reject
+# &Auth-Type := Reject
# }
# }
auth_log
}
-
-
-
}
# The contents here are invented. Change them!
update reply {
- DHCP-Domain-Name-Server = 127.0.0.1
- DHCP-Domain-Name-Server = 127.0.0.2
- DHCP-Subnet-Mask = 255.255.255.0
- DHCP-Router-Address = 192.0.2.1
- DHCP-IP-Address-Lease-Time = 86400
- DHCP-DHCP-Server-Identifier = 192.0.2.1
+ &DHCP-Domain-Name-Server = 127.0.0.1
+ &DHCP-Domain-Name-Server = 127.0.0.2
+ &DHCP-Subnet-Mask = 255.255.255.0
+ &DHCP-Router-Address = 192.0.2.1
+ &DHCP-IP-Address-Lease-Time = 86400
+ &DHCP-DHCP-Server-Identifier = 192.0.2.1
}
# Do a simple mapping of MAC to assigned IP.
# Or, allocate IPs from the DHCP pool in SQL. You may need to
# set the pool name here if you haven't set it elsewhere.
# update control {
-# Pool-Name := "local"
+# &Pool-Name := "local"
# }
# dhcp_sqlippool
# Response packet type. See DHCP-Discover section above.
update reply {
- DHCP-Message-Type = DHCP-Ack
+ &DHCP-Message-Type = DHCP-Ack
}
# The contents here are invented. Change them!
update reply {
- DHCP-Domain-Name-Server = 127.0.0.1
- DHCP-Domain-Name-Server = 127.0.0.2
- DHCP-Subnet-Mask = 255.255.255.0
- DHCP-Router-Address = 192.0.2.1
- DHCP-IP-Address-Lease-Time = 86400
- DHCP-DHCP-Server-Identifier = 192.0.2.1
+ &DHCP-Domain-Name-Server = 127.0.0.1
+ &DHCP-Domain-Name-Server = 127.0.0.2
+ &DHCP-Subnet-Mask = 255.255.255.0
+ &DHCP-Router-Address = 192.0.2.1
+ &DHCP-IP-Address-Lease-Time = 86400
+ &DHCP-DHCP-Server-Identifier = 192.0.2.1
}
# Do a simple mapping of MAC to assigned IP.
# Or, allocate IPs from the DHCP pool in SQL. You may need to
# set the pool name here if you haven't set it elsewhere.
# update control {
-# Pool-Name := "local"
+# &Pool-Name := "local"
# }
# dhcp_sqlippool
dhcp DHCP-Decline {
update reply {
- DHCP-Message-Type = DHCP-Do-Not-Respond
+ &DHCP-Message-Type = DHCP-Do-Not-Respond
}
reject
}
dhcp DHCP-Inform {
update reply {
- DHCP-Message-Type = DHCP-Do-Not-Respond
+ &DHCP-Message-Type = DHCP-Do-Not-Respond
}
reject
}
dhcp DHCP-Release {
update reply {
- DHCP-Message-Type = DHCP-Do-Not-Respond
+ &DHCP-Message-Type = DHCP-Do-Not-Respond
}
reject
}
dhcp DHCP-Discover {
update config {
# IP Address of the DHCP server
- DHCP-Relay-To-IP-Address := 192.0.2.2
+ &DHCP-Relay-To-IP-Address := 192.0.2.2
}
update request {
# IP Address of the DHCP relay (ourselves)
- DHCP-Gateway-IP-Address := 192.0.2.1
+ &DHCP-Gateway-IP-Address := 192.0.2.1
}
ok
}
dhcp DHCP-Request {
update config {
# IP Address of the DHCP server
- DHCP-Relay-To-IP-Address := 192.0.2.2
+ &DHCP-Relay-To-IP-Address := 192.0.2.2
}
update request {
- DHCP-Gateway-IP-Address := 192.0.2.2
+ &DHCP-Gateway-IP-Address := 192.0.2.2
}
ok
}
#
# Echo the IP address of the client.
- FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
# require_message_authenticator
- FreeRADIUS-Client-Require-MA = no
+ &FreeRADIUS-Client-Require-MA = no
# secret
- FreeRADIUS-Client-Secret = "testing123"
+ &FreeRADIUS-Client-Secret = "testing123"
# shortname
- FreeRADIUS-Client-Shortname = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-Shortname = "%{Packet-Src-IP-Address}"
# nas_type
- FreeRADIUS-Client-NAS-Type = "other"
+ &FreeRADIUS-Client-NAS-Type = "other"
# virtual_server
#
# virtual_server defined, then that is used,
# and there is no need to define this attribute.
#
- FreeRADIUS-Client-Virtual-Server = "something"
+ &FreeRADIUS-Client-Virtual-Server = "something"
}
update control {
#
# Echo the IP.
- FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
#
# Do multiple SELECT statements to grab
# the various definitions.
- FreeRADIUS-Client-Shortname = "%{sql: SELECT shortname FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
+ &FreeRADIUS-Client-Shortname = "%{sql: SELECT shortname FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
- FreeRADIUS-Client-Secret = "%{sql: SELECT secret FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
+ &FreeRADIUS-Client-Secret = "%{sql: SELECT secret FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
- FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
+ &FreeRADIUS-Client-NAS-Type = "%{sql: SELECT type FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
- FreeRADIUS-Client-Virtual-Server = "%{sql: SELECT server FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
+ &FreeRADIUS-Client-Virtual-Server = "%{sql: SELECT server FROM nas WHERE nasname = '%{Packet-Src-IP-Address}'}"
}
}
# for the NAS element. ie "password"
if ("%{ldap:ldap:///OU=Elements,OU=Radius,DC=ACME,DC=COM?ou?sub?cn=%{Packet-Src-IP-Address}}") {
update control {
- FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
+ &FreeRADIUS-Client-IP-Address = "%{Packet-Src-IP-Address}"
# Set the Client-Shortname to be the Location
# "l" just like in the Huntgroups, but this
# time to the shortname.
- FreeRADIUS-Client-Shortname = "%{ldap:ldap:///OU=Elements,OU=Radius,DC=ACME,DC=COM?l?sub?cn=%{Packet-Src-IP-Address}}"
+ &FreeRADIUS-Client-Shortname = "%{ldap:ldap:///OU=Elements,OU=Radius,DC=ACME,DC=COM?l?sub?cn=%{Packet-Src-IP-Address}}"
# Lookup and set the Shared Secret based on
# the "ou" attribute.
- FreeRADIUS-Client-Secret = "%{ldap:ldap:///OU=Elements,OU=Radius,DC=ACME,DC=COM?ou?sub?cn=%{Packet-Src-IP-Address}}"
+ &FreeRADIUS-Client-Secret = "%{ldap:ldap:///OU=Elements,OU=Radius,DC=ACME,DC=COM?ou?sub?cn=%{Packet-Src-IP-Address}}"
}
}
#
# Some example policies. See "man unlang" for more.
#
- if ("%{User-Name}" == "bob") {
+ if (&User-Name == 'bob') {
update control {
- Cleartext-Password := "bob"
+ &Cleartext-Password := 'bob'
}
}
Post-Auth-Type Reject {
update reply {
- Reply-Message = "This is only an example."
+ &Reply-Message = 'This is only an example.'
}
}
}
# "coa" list:
#
# update coa {
-# User-Name = "%{User-Name}"
-# Acct-Session-Id = "%{Acct-Session-Id}"
-# NAS-IP-Address = "%{NAS-IP-Address}"
+# &User-Name = "%{User-Name}"
+# &Acct-Session-Id = "%{Acct-Session-Id}"
+# &NAS-IP-Address = "%{NAS-IP-Address}"
# }
#
# And the CoA packet will be sent. You can also send Disconnect
# CoA packet:
#
# update control {
-# Send-CoA-Request = No
+# &Send-CoA-Request = No
# }
#
# The default destination of a CoA packet is the NAS (or client)
server originate-coa.example.com {
pre-proxy {
update proxy-request {
- NAS-IP-Address = 127.0.0.1
+ &NAS-IP-Address = 127.0.0.1
}
}
update control {
# You should update this to be one of your realms.
- Proxy-To-Realm := "example.com"
+ &Proxy-To-Realm := "example.com"
}
}
# You may want accounting policies here...
update control {
- Proxy-To-Realm := "acct_realm.example.com"
+ &Proxy-To-Realm := "acct_realm.example.com"
}
}
if (SoH-Supported == no) {
# client NAKed our request for SoH - not supported, or turned off
update config {
- Auth-Type = Accept
+ &Auth-Type = Accept
}
}
else {
# client replied; check something - this is a local policy issue!
if (SoH-MS-Windows-Health-Status =~ /antivirus (warn|error) /) {
update config {
- Auth-Type = Reject
+ &Auth-Type = Reject
}
update reply {
- Reply-Message = "You must have antivirus enabled & installed!"
+ &Reply-Message = "You must have antivirus enabled & installed!"
}
}
else {
update config {
- Auth-Type = Accept
+ &Auth-Type = Accept
}
}
}
#
# Some requests may not have a MAC address. Try to
# create one using other attributes.
- if (!VMPS-Mac) {
- if (VMPS-Ethernet-Frame =~ /0x.{12}(..)(..)(..)(..)(..)(..).*/) {
+ if (!&VMPS-Mac) {
+ if (&VMPS-Ethernet-Frame =~ /0x.{12}(..)(..)(..)(..)(..)(..).*/) {
update request {
- VMPS-Mac = "%{1}:%{2}:%{3}:%{4}:%{5}:%{6}"
+ &VMPS-Mac = "%{1}:%{2}:%{3}:%{4}:%{5}:%{6}"
}
}
else {
update request {
- VMPS-Mac = "%{VMPS-Cookie}"
+ &VMPS-Mac = &VMPS-Cookie
}
}
}
# required VMPS reply attributes
update reply {
- VMPS-Packet-Type = VMPS-Join-Response
- VMPS-Cookie = "%{VMPS-Mac}"
+ &VMPS-Packet-Type = VMPS-Join-Response
+ &VMPS-Cookie = &VMPS-Mac
- VMPS-VLAN-Name = "please_use_real_vlan_here"
+ &VMPS-VLAN-Name = "please_use_real_vlan_here"
#
# If you have VLAN's in a database, you can select
# the VLAN name based on the MAC address.
#
- #VMPS-VLAN-Name = "%{sql:select ... where mac='%{VMPS-Mac}'}"
+ #&VMPS-VLAN-Name = "%{sql:select ... where mac='%{VMPS-Mac}'}"
}
# correct reply packet type for reconfirmation requests
#
- if (VMPS-Packet-Type == VMPS-Reconfirm-Request){
+ if (&VMPS-Packet-Type == VMPS-Reconfirm-Request){
update reply {
- VMPS-Packet-Type := VMPS-Reconfirm-Response
+ &VMPS-Packet-Type := VMPS-Reconfirm-Response
}
}
}