1 # We check for this prefix to determine whether the class
2 # value was generated by this server. It should be changed
3 # so that it is globally unique.
4 class_value_prefix = 'ai:'
7 # Replacement for the old rlm_acct_unique module
11 # If we have a class attribute in the format
12 # 'auth_id:[0-9a-f]{32}' it'll have a local value
13 # (defined by insert_acct_class), this ensures
14 # uniqueness and suitability.
16 # We could just use the Class attribute as
17 # Acct-Unique-Session-Id, but this may cause problems
18 # with NAS that carry Class values across between
19 # multiple linked sessions. So we rehash class with
20 # Acct-Session-ID to provide a truely unique session
23 # Using a Class/Session-ID combination is more robust
24 # than using elements in the Accounting-Request,
25 # which may be subject to change, such as
26 # NAS-IP-Address, Client-IP-Address and
27 # NAS-Port-ID/NAS-Port.
29 # This policy should ensure that session data is not
30 # affected if NAS IP addresses change, or the client
31 # roams to a different 'port' whilst maintaining its
32 # initial authentication session (Common in a
33 # wireless environment).
35 if ("%{string:Class}" =~ /${policy.class_value_prefix}([0-9a-f]{32})/i) {
37 &Acct-Unique-Session-Id := "%{md5:%{1},%{Acct-Session-ID}}"
42 # Not All devices respect RFC 2865 when dealing with
43 # the class attribute, so be prepared to use the
44 # older style of hashing scheme if a class attribute
49 &Acct-Unique-Session-Id := "%{md5:%{User-Name},%{Acct-Session-ID},%{%{NAS-IPv6-Address}:-%{NAS-IP-Address}},%{NAS-Identifier},%{NAS-Port-ID},%{NAS-Port}}"
55 # Insert a (hopefully unique) value into class
59 &Class = "${policy.class_value_prefix}%{md5:%t,%I,%{Packet-Src-Port},%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}},%{NAS-IP-Address},%{Calling-Station-ID},%{User-Name}}"
64 # Merges Acct-[Input|Output]-Octets and Acct-[Input|Output]-Gigawords into Acct-[Input|Output]-Octets64
66 # If the &Attr-Foo doesn't exist, it's value is taken as zero.
68 acct_counters64.preacct {
70 &Acct-Input-Octets64 = "%{expr:(&Acct-Input-Gigawords << 32) | &Acct-Input-Octets}"
71 &Acct-Output-Octets64 = "%{expr:(&Acct-Output-Gigawords << 32) | &Acct-Output-Octets}"