rewrite or unlang problem
Hi I'm trying to change access-request: rad_recv: Access-Request packet from host 192.168.3.171 port 39838, id=98, length=142 NAS-Port-Type = Ethernet NAS-Port = 2200961369 Calling-Station-Id = "1:0:24:81:44:41:1f" Called-Station-Id = "dhcp1" User-Name = "00:24:81:44:41:1F" User-Password = "" Agent-Remote-Id = "\000\006\000\025w\262\234\260" Agent-Circuit-Id = "\000\004\000\001\001\013" NAS-Identifier = "MikroTik" NAS-IP-Address = 192.168.3.171 I need to change User-Name similar to this statement: update request { User-Name := %{request:Agent-Remote-Id} } but radiusd prints this: expand: %{User-Name} -> %{request:Agent-Remote-Id} and is searching in sql this string, not correct "\000\006\000\025w\262\234\260" Is there a way to reach this issue in freeradius similar to gnu-radius as shown below? string decode_agent_remote_id() { string agent; string newagent; agent = gsub("%"," ",tohex(%[Agent-Remote-Id])); newagent =field(agent,3)+":"+field(agent,4)+":"+field(agent,5)+":"+field(agent,6)+":"+field(agent,7)+":"+field(agent,8); %[Orig-User-Name] = %[User-Name]; %[User-Name] = newagent+"port:"+field(gsub("%","",tohex(%[Agent-Circuit-Id])),6); return 0; } thanks for advice Libor
I need to auth clients dependent on switch mac address and switch port: agent-remote-id and agend-circuit-id from dhcp option 82 insertion. I used this User-Name := %{request:Agent-Remote-Id}, because I don't know, how to pass the value of Agent-Remote-Id from access-request and I tried more options, for example: User-Name := "%{request:Agent-Remote-Id}" User-Name := "%{Agent-Remote-Id}" and so on.
------------ Původní zpráva ------------ Od: Alan Buxey <A.L.M.Buxey@lboro.ac.uk> Předmět: Re: rewrite or unlang problem Datum: 18.12.2009 22:19:30 ---------------------------------------- Hi,
I need to change User-Name similar to this statement:
update request { User-Name := %{request:Agent-Remote-Id} }
User-Name := "%{request:Agent-Remote-Id}"
?
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Once again, thank for your advice, I tried to pass for example "%{NAS-Port}" and it passed. So I created this access-request with text data: NAS-Port-Type = Ethernet NAS-Port = 2200961418 calling-Station-Id = "1:0:24:81:44:41:1f" Called-Station-Id = "dhcp1" User-Name = "00:24:81:44:41:1F" User-Password = "" Agent-Remote-Id = "tik" Agent-Circuit-Id = "tak" NAS-Identifier = "MikroTik" NAS-IP-Address = 192.168.3.171 and tried User-Name := "%{request:Agent-Circuit-Id}" and it passed too. With the previews packet not, but I know, that these data in Agent........Id should be in binary format directly from dhcp server option 82. Is there a workaround, how to convert this binary data to text in unlang or a way, how to pass these data to perl or python, when this string from binary seems to be empty ? Libor
------------ Původní zpráva ------------ Od: Alan Buxey <A.L.M.Buxey@lboro.ac.uk> Předmět: Re: rewrite or unlang problem Datum: 18.12.2009 22:19:30 ---------------------------------------- Hi,
I need to change User-Name similar to this statement:
update request { User-Name := %{request:Agent-Remote-Id} }
User-Name := "%{request:Agent-Remote-Id}"
?
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Libor Astalos wrote:
With the previews packet not, but I know, that these data in Agent........Id should be in binary format directly from dhcp server option 82. Is there a workaround, how to convert this binary data to text in unlang or a way, how to pass these data to perl or python, when this string from binary seems to be empty ?
Edit the "dictionary.redback" file. Change Agent-Remote-Id and Agent-Circuit from "string" to "octets". Alan DeKok.
participants (3)
-
Alan Buxey -
Alan DeKok -
Libor Astalos