Mac Auth and post-auth logging to SQL

Phil Mayers p.mayers at
Tue Mar 29 22:09:20 CEST 2011

On 03/29/2011 08:52 PM, Jason Antman wrote:
> This makes MUCH more sense, thanks! Now the next (relatively
> new-to-radius) person won't end up as confused as I was.
> I have MAC auth working with a SQL data source and custom XLAT to check
> for some special field values in SQL, based on a somewhat custom schema
> (more from the one-row-per-MAC standpoint than using radcheck and

Yeah, we do a similar thing with a database stored procedure to allocate 
an appropriate vlan by mac & location combo; it's basically along the 
lines of:

update control {
   Tmp-String-0 := "%{sql:select .. from proc('%{Calling-Station-Id}')"
if (control:Tmp-String-0 =~ /...regexp for SQL result.../) {
   update reply {
     # vlan
     Tunnel-Private-Group-Id := "%{1}"
     Other-Stuff := "%{2}"

FreeRadius is damn clever when you grasp it ;o)

> radreply), as well as xlat to include a Username in the reply message.
> When I'm finished with it and have it working, I'll be more than willing
> to pass along my code.

Alan can probably give you a wiki account if you want to document it there.

More information about the Freeradius-Users mailing list