unlang modify attribute

Matthew Newton mcn at freeradius.org
Fri Feb 18 11:02:35 UTC 2022



On 18/02/2022 07:09, Москалев Артем Сергеевич wrote:
> I have some question about unlang. How can I modify attribute? Example: I have attribute (&User-Name = "94de80658a92") its mac address, I will check this mac address in DB, but format must be like (&User-Name = "94:de:80:65:8a:92"), how format existing attribute or create new with needed format?

There is a policy "rewrite_calling_station_id" which nearly does that 
already - see raddb/policies.d/canonicalization

Copy that to e.g. rewrite_user_name_mac and change it to use User-Name, 
and to use ':'s instead of '-'s, then call it from your authorize{} section.

If you don't want to change User-Name, add your own attribute to 
raddb/dictionary and alter the update to use that instead.

-- 
Matthew


More information about the Freeradius-Users mailing list