Removing prefix and suffix from User-Name

Jérémy Cluzel j.cluzel at online.fr
Fri Sep 2 02:04:38 CEST 2005


Hi,

I want to convert the User-Name recieved: 
"\host\login.server.domain.com" to "username".
What's the best way to do this ?

- using preprocess module and "hints" file:
DEFAULT    Prefix == "/host", Strip-User-Name = Yes
DEFAULT    Suffix == ".server.domain.com", Strip-User-Name = Yes

- using "proxy.conf" file:
realm server.domain.com {
    type        = radius
    authhost    = LOCAL
    accthost    = LOCAL
}

- using realm module:
    realm test {
        format = suffix
        delimiter = "."
        ignore_default = no
        ignore_null = no
    }

- using attr_rewrite module:
    attr_rewrite saneUserName {
        attribute = User-Name
        searchin = packet
        searchfor = "^(+.).server.domain.com"
        replacewith = "%{1}"
        ignore_case = yes
        new_attribute = no
        max_matches = 1
        append = no
    }

- or using preprocess module and "hints" file:
DEFAULT    Prefix == "/host", Strip-User-Name = Yes
DEFAULT    Suffix == ".server.domain.com", Strip-User-Name = Yes

Regards,

Jeremy



More information about the Freeradius-Users mailing list