[Attrs Regex]

Alan DeKok aland at deployingradius.com
Tue May 12 15:38:39 CEST 2015


On May 12, 2015, at 8:53 AM, Thomas Fagart <tfagart at brozs.net> wrote:
> Thanks a lot for your answer, so this is not a feature :-). (I don't know how this could have worked  then :-(), I could send trace if you want, because this has been working for many years with more than 20 requests /secondes).

  You probably had the Realm attribute set to the string "~\^\(.+\)\\.telco$".  Which mean that string matching worked.

  Or, someone made local patches to the server.

> We will try to code such a module in perl.
> 
> Is there any other way we could do that (eg regex on keys) using existing modules ?

  Perhaps you could explain the goal, instead of talking about a particular solution.

  You could put the regular expression into unlang, and then go from there:

	if (Realm =~ /^(.+)\.telco$/) {
		update request {
			My-Filter-Realm := "DEFAULT"
		}
	}
	else {
		update request {
			My-Filter-Realm := "%{Realm}"
		}
	}

  Then add My-Filter-Realm to raddb/dictionary as a "string" attribute.  And make the attr_filter module key off of My-Filter-Realm instead of Realm.

  Alan DeKok.




More information about the Freeradius-Users mailing list