Regex remove realm from username
Arran Cudbard-Bell
A.Cudbard-Bell at sussex.ac.uk
Sat Oct 11 20:12:08 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alex French wrote:
> 2008/10/10 Eric Martell <workoutexcite at yahoo.com>:
>> Hi..
>> I searched thru the forums but not getting the right username after using
>> regex.
>> The request I am getting is : test at google.com and I need to strip everything
>> after @ and pass the username as test.
>
> Is there some reason you don't just create a local realm in proxy.conf
> and use the 'strip' keyword?
>
> realm google.com {
> type = radius
> authhost = LOCAL
> accthost = LOCAL
> strip
> }
>
>
> Thanks,
>
We use:
if("%{User-Name}"){
if("%{User-Name}" =~ /^([^@]*)(@([-[:alnum:].]+))?$/){
update request {
Stripped-User-Name := "%{1}"
}
# User Names not containing a domain default to
# <default>
update request {
Stripped-User-Domain = "%{%{3}:-<default>}"
}
}
# Username in unrecognised format
else{
reject
}
}
Thanks,
Arran
> Alex
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
- --
Arran Cudbard-Bell (A.Cudbard-Bell at sussex.ac.uk),
Authentication, Authorisation and Accounting Officer,
Infrastructure Services (IT Services),
E1-1-08, Engineering 1, University Of Sussex, Brighton, BN1 9QT
DDI+FAX: +44 1273 873900 | INT: 3900
GPG: 86FF A285 1AA1 EE40 D228 7C2E 71A9 25BB 1E68 54A2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkjw7HgACgkQcaklux5oVKIwGgCfZovEGnbvxft69Td8PcfRw5oK
Y78An0KNXZYmeXh2kb6IuSsOBQZhbbAt
=LKbU
-----END PGP SIGNATURE-----
More information about the Freeradius-Users
mailing list