FreeRADIUS WikiMain Page | About | Help | FAQ | Special pages | Log in

Printable version | Disclaimers | Privacy policy

Adding, Removing, Modifying Attributes for further processing

From FreeRADIUS Wiki

Hints file examples

Here are a couple of examples for what one might do with the hints file. These are used in one form or another on my servers and with some changes might be useful for others.

The entry below would look for requests from the localhost and rewrite the User-Name attribute by adding the realm to it. This modified (or radius_xlat) attribute would then be used for further processing.

    DEFAULT NAS-IP-Address == "127.0.0.1"
         User-Name := "%{User-Name}@realm.com"

This example checks to see if the "@" symbol, which denotes a realm, is present. If it is, leave the User-Name attrbute as is. If it is not present, add a realm.

    DEFAULT User-Name !~ ".*@", NAS-IP-Address == "192.168.1.254"
         User-Name := "%{User-Name}@realm.com"

This example demonstrates how to remove a realm from a User-Name attribute.

    DEFAULT User-Name =~ "^([^@]+)@realm.com", NAS-IP-Address == "127.0.0.1"
         User-Name := "%{1}"

Note the operator is of utmost importance in these instances.

See Operators for a full description of all operators.

Retrieved from "http://wiki.freeradius.org/Adding%2C_Removing%2C_Modifying_Attributes_for_further_processing"

This page has been accessed 10,648 times. This page was last modified 21:07, 24 November 2006.


Find
Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Donations
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Log in / create account
Special pages
New pages
File list
Statistics
Bug reports
More...