Help pls: How to strip REALM but insert it from a username at MAC onto an MySQL DB

Alan DeKok aland at
Tue Jan 26 08:43:21 CET 2010

Lucio Godoy wrote:
> I have created this rule on the file sites-available/default on the
> authorize section:
> if("%{User-Name}"){

  Or just:

	if (User-Name) {

  The "unlang" docs say that means check if the attribute exists.

>         if ("%{User-Name}" =~ /^([^@]*)(@([-[:alnum:].]+))?$/){

  Why not just:

  That's a lot simpler.

  You may need to put two '$$' in.

> I am getting the user to authenticate as "user @ MAC_ADDRESS", and the
> REGEX is doing what is supposed to do, but the field Realm on the
> radacct table is not being updated with the MAC_ADDRESS it is empty, is
> the Digest-Realm the right attribute to be updated for the realm?

  No.  You need to update the "Realm" attribute.

  Alan DeKok.

More information about the Freeradius-Users mailing list