rewriting usernames

Michael Mitchell mitchell.michael at bigpond.com
Tue Nov 14 14:41:56 CET 2006


Christopher Carver wrote:
> Hello,
> 
> How do I rewrite the value of the User-Name attribute based on
> Called-Station-Id?  I need to do a series of these logical decisions and
> replace the username with username@<some-isp.com> based on what the value of
> Called-Station-Id is.
> 

hmm that is a tricky one! One possible solution (untried, so YMMV) may be an approach such as:

1) Define a local attribute "My-ISP-Realm" in etc/raddb/dictionary

2) In the users and/or acct_users file you could have default entries like:

   DEFAULT Calling-Station-Id == isp1, My-ISP-Realm := isp1.com

   DEFAULT Calling-Station-Id == isp2, My-ISP-Realm := isp2.com

3) Define an attr_rewrite module that has a replace string something like:

   replace = %{User-Name}@%{My-ISP-Realm}


As I said, un-tried and un-tested and un-guaranteed, but it may be somewhere to look if noone else comes up with a solution. I'm sure someone else will come up with something better though!

Goodluck!

cheers,
Mike
 



More information about the Freeradius-Users mailing list