Accounting-Request Re write Rule
Maile Halatuituia
maile.halatuituia at tcc.to
Thu Oct 25 05:17:19 CEST 2018
Hi Nathan
Thank you so much for the valuable info I will look in to it and feedback later
cheers
-----Original Message-----
From: Freeradius-Users <freeradius-users-bounces+maile.halatuituia=tcc.to at lists.freeradius.org> On Behalf Of Nathan Ward
Sent: Thursday, 25 October 2018 11:39 AM
To: FreeRadius users mailing list <freeradius-users at lists.freeradius.org>
Subject: Re: Accounting-Request Re write Rule
> On 25/10/2018, at 9:51 AM, Maile Halatuituia <maile.halatuituia at tcc.to> wrote:
>
> Hi
> I need to rewrite this attribute Cisco-AVPair = "acct-input-octets-ipv6=xxx" upon receiving it in the accounting request from my BRAS to my Radius Server so I can further process.
>
> I received this Cisco-AVPair = "acct-input-octets-ipv6=xxx"
>
> I have done this on the Radius Server /etc/freeradius/sites-available/default
>
> if( &Cisco-AVPair[*]=~/\(acct-input-octets-ipv6\)=\(\d+)/ ) {
> update request {
> &acct-input-octets-ipv6 := "%{2}"
> }
> }
This won’t work as acct-input-octets-ipv6 is not a standard RADIUS attribute. It is text as the value of a Cisco-AVPair attribute.
You will need to define this attribute if you want to be able to use it in your FreeRADIUS config.
> But I have this on my debug
>
> if ( &Cisco-AVPair[*]=~/\(acct-input-octets-ipv6\)=\(\d+)/ ) {
>
> (0) if ( &Cisco-AVPair[*]=~/\(acct-input-octets-ipv6\)=\(\d+)/ ) -> FALSE
>
Your regex is not correct. You are not escaping the trailing ), which I presume you need to do. You can test this regex with standard regex tools - you should make sure your regex is correct and matches examples you feed it. There are a bunch of “online” regex testers, if you don’t have other ways of doing this.
I don’t think you should have brackets around the acct-input-octets-ipv6 either - you are not extracting this text. You should only have brackets around the part you wish to capture (i.e. the \d), and then use %{1} not %{2}.
> Not sure if I can read it correctly but seem the rule does not matched ..
> Appreciate anyone comments if didn't do it correctly
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Confidentiality Notice: This email (including any attachment) is intended for internal use only. Any unauthorized use, dissemination or copying of the content is prohibited. If you are not the intended recipient and have received this e-mail in error, please notify the sender by email and delete this email and any attachment.
Confidentiality Notice: This email (including any attachment) is intended for internal use only. Any unauthorized use, dissemination or copying of the content is prohibited. If you are not the intended recipient and have received this e-mail in error, please notify the sender by email and delete this email and any attachment.
More information about the Freeradius-Users
mailing list