Proxy / reply translation
Hi We are looking to tun an LNS for a customer who has their own radius - we will effectively proxy the radius requests to them. However we need to 'translate' the reply to work with our LNS devices and wondered if someone could provide some pointers. Their radius will currently return something like: Framed-IP-Address = 1.2.3.1 Framed-IP-Netmask = 255.255.255.240 Cisco-AVPair = "ip:route=1.2.3.1 255.255.255.240" Service-Type = Framed-User However we need Framed-IP-Address = 1.2.3.1 Framed-IP-Netmask = 255.255.255.240 Framed-Route = "1.2.3.1/28" Service-Type = Framed-User It does not matter IF the Cisco-AVPair is in place or not. As we don't hold the radius data here (and I am not convinced 100% that they can easily amend this their side I was wondering how easy ulang or similar could parse this and amend the reply on the proxy Is this relatively easy to do ? Thanks in advance Richard Palmer | Director | Merula Limited Company Registered in England and Wales No. 3243995 5 Avro Court, Huntingdon, Cambridgeshire, PE29 6XS Phone 01480 222940 | Support 0845 330 0666 Support Email support@merula.net
On Thu, 2017-11-09 at 10:20 +0000, Richard J Palmer wrote:
* Framed-IP-Address = 1.2.3.1 Framed-IP-Netmask = 255.255.255.240 Cisco-AVPair = "ip:route=1.2.3.1 255.255.255.240" Service-Type = Framed-User
However we need
Framed-IP-Address = 1.2.3.1 Framed-IP-Netmask = 255.255.255.240 Framed-Route = "1.2.3.1/28" Service-Type = Framed-User
Is this relatively easy to do ?
Match on regex should work, something like if (&Cisco-AVPair =~ /ip:route=([^ ]+) /) { update reply { Framed-Route := "%{1}/28" } } if the netmasks aren't all the same you'll need to change that as well of course - I don't think there's anything to convert the netmask into the number of bits, but a switch statement should do it easily for the limited number of cases. -- Matthew
participants (2)
-
Matthew Newton -
Richard J Palmer