Old-style Acct-Unique-Session-Id hashing
Lotkov Svyatoslav
ellezdi at gmail.com
Tue Oct 6 12:23:18 CEST 2015
Hello everybody.
I wrote a policy fo FR 3.x that hashes Acct-Unique-Session-ID like in FR 2.x
This helps me migrate from 2.x to 3.x
Is there any reason to commit this code to 3.x branches ?
The code is: (in raddb/policy.d/acct_unique_fr2)
#
# Old rlm_acct_unique style hashing
# This code does the same thing, as in FR 2.x
# Written by Svyatoslav Lotkov, 2015
#
acct_unique2 {
#
# The default settings in modules/acct_unique looks like:
#
# acct_unique {
# key = "User-Name, Acct-Session-Id, NAS-IP-Address, NAS-Port"
# }
#
# We have to list values for the key in reverse order plus add the
0x00 in the end of string. Then calculate md5
#
#
update request {
&Tmp-Octets-0 := "NAS-Port = %{NAS-Port},NAS-IP-Address =
%{NAS-IP-Address},Acct-Session-Id = \"%{Acct-Session-ID}\",User-Name =
\"%{User-Name}\""
&Tmp-String-0 := "%{&Tmp-Octets-0}00"
&Tmp-Octets-1 := "%{string:&Tmp-String-0}"
&Tmp-String-1 := "%{md5:&Tmp-Octets-1}"
}
if ( &Tmp-String-1 =~ /(.{1,16})/i ) {
update request {
&Acct-Unique-Session-Id := "%{1}"
}
}
}
More information about the Freeradius-Users
mailing list