rewriting the User-Name attr

Matteo Faleschini Matteo.Faleschini at fisica.unimi.it
Fri Aug 5 23:52:44 CEST 2005



Hi,

i'm looking for some help to rewrite the User-Name attribute.

My problem is:

my organisation has to proxy to two different realms on two different 
servers.
one realm is students, the other is professors (some users are handled 
locally).
The User-Name of professors is name at professors so it was easy to 
prepare a real in proxy.conf named professors
The students realm is not explicetely found in the User-Name attributes 
but I can distinguish the students by the presence of a '.' point in the 
username.

(I used this rule in the users file
DEFAULT User-Name =~ "\\.", Proxy-To-Realm := encrypt)

My problem is now that I want to change the User-Name attr for students 
only, to name.surname at students before proxying it to the other radius 
server.

I was planning to use rlm_attr_rewrite and I see 2 ways to do it:
1) I recognaize the realm by the Proxy-To-Real attr, but I don't know haw 
to tell it to the attr_rewrite module

        attr_rewrite studenti {
                attribute = User-Name
                # may be "packet", "reply", "proxy", "proxy_reply" or 
"config"
                searchin = proxy
                searchfor = "$"
                replacewith = "@students"
                ignore_case = no
                new_attribute = no
                max_matches = 10
		append = no
         }

2) I recognaize once again the packet by the presence of a '.' point in 
the name but I don't know if I can use a perlish/awkish expression like

        attr_rewrite studenti {
                attribute = User-Name
                # may be "packet", "reply", "proxy", "proxy_reply" or 
"config"
                searchin = proxy
                searchfor = "\(*\\.*\)"
                replacewith = "$1 at students"
                ignore_case = no
                new_attribute = no
                max_matches = 10
                append = no
        }

Can you address me in the right direction?

Thank you,
  matteo faleschini






More information about the Freeradius-Users mailing list