How it is better to start a script in FreeRadius to change User-Name and realm at proxing?

Dmitry Lyubimkov loft at onego.ru
Sat Apr 22 13:06:04 CEST 2006


FreeRadius is used for proxing (user at realm) to others RADIUS servers.
Also we change the some attributes at proxing.
Некоторое время назад была задача при получении accounting менять
аттрибут User-Name в зависимости от аттрибутов User-Name, 
Calling-Station-ID, Called-Station-ID, ...
Some time there was a task to change User-Name attribute at reception of
accounting message (depending on  User-Name,Calling-Station-ID,
Called-Station-ID, ...)

We have written a script on python, and have added to preproxy_users
file 
DEFAULT
	User-Name := `%{exec:/usr/bin/python -u /path/to/script.py
%{Packet-Type} %{Acct-Status-Type} %u %i %{Called-Station-Id}}`
And write 
files
in pre-proxy section of radius.conf file
Now before sending proxied messages our script runs and changes
User-Name
It certainly is not so convenient because script runs always but it is
necessary for us only at accounting, but we considered it in a script.

Now the task became wider - before proxing it is necessary to replace
not only name of the subscriber (User-Name) but also it's realm.
The script we can alter easily. But the matter is that the used
mechanism of its start does not approach.
At the moment of start from pre-proxy FreeRadius were already determined
with proxing - on what RADIUS server it will send this message
And in User-Name attribute FreeRadius waits the name without realm.

Help me please where and how it is better to put script to have an
opportunity to change User-Name attribute before FreeRadius will make
decision about proxing?

Tnx
Dmirty








More information about the Freeradius-Users mailing list