Sorry, me again. While reading this https://networkradius.com/doc/3.0.10/unlang/regex.html I noticed the i for matching the regex in a non case-sensitive way. I played a bit and then I tried sending a request as user@tenAnt101.bic.local; the catch-group was tenAnt101 and there was still a match for >> realm "tenant101" << in the proxy.conf, though the catch was not based on the case. So, are all the variables that relate to the username always treated as case-insensitive? To which other strings does this rule apply? Thanks, Alex On Wed, Apr 26, 2023 at 5:40 PM Alex Zetaeffesse <fzetafs@gmail.com> wrote:
Thanks Alan,
indeed I should have written (still not using it the right way as you pointed out)
switch "%{User-Name}" { case "/@tenant101\.bic\.local/" {update control{Proxy-To-Realm := "tenant101"}} case "/@tenant102\.bic\.local/" {update control{Proxy-To-Realm := "tenant102"}} ... }
BTW, I think this is called back-reference, isn't it? I'm pointing this out, just for anybody who may read this mail thread looking for the same feature.
Thanks for your fast reply!
Alex
On Wed, Apr 26, 2023 at 5:30 PM Alan DeKok <aland@deployingradius.com> wrote:
On Apr 26, 2023, at 11:03 AM, Alex Zetaeffesse <fzetafs@gmail.com> wrote:
Is there a more compact way to state what follows?
switch { ("%{User-Name}" =~ /@tenant101\.bic\.local/) {update control{Proxy-To-Realm := "tenant101"}
That's not correct configuration syntax, but OK...
In general things like this are best done with regular expressions. Especially if the data you're trying to use is part of the input packet.
if (&User-Name =~ /([^.]+)\.bic\.local) { update control { &Proxy-To-Realm := "%{1}" } }
You also don't have to put quotes around references to User-Name. Just use &User-Name. This works, and that's what the documentation says to do. I have no idea why so many people use constructs like "%{User-Name}". It's just not necessary.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html