Regex remove realm from username

Eric Martell workoutexcite at yahoo.com
Mon Oct 13 21:03:03 CEST 2008


Thanks so much for the reply.

I tried as Alex mentioned as realm base routing and it is working fine.

realm google.com {
        type    =       radius
	authhost        = LOCAL
	accthost        = LOCAL
	strip
}

Thanks so much.
Regards.

--- On Sat, 10/11/08, Arran Cudbard-Bell <A.Cudbard-Bell at sussex.ac.uk> wrote:
From: Arran Cudbard-Bell <A.Cudbard-Bell at sussex.ac.uk>
Subject: Re: Regex remove realm from username
To: "FreeRadius users mailing list" <freeradius-users at lists.freeradius.org>
Cc: workoutexcite at yahoo.com
Date: Saturday, October 11, 2008, 2:12 PM

-----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-----



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20081013/9f433edb/attachment.html>


More information about the Freeradius-Users mailing list