3

I have freeRadius up and running with the mysql extension. Currently I am authenticating devices using their mac-address which is stored in a text file (as per http://wiki.freeradius.org/Mac-Auth). I would like to move the mac-addresses in to a mysql database. What is the best way of going about this? Any insight would be much appreciated.

karel
  • 13,706
Zack S.
  • 139

1 Answers1

5

Figured out a way using SQL xlat. The FreeRadius wiki has an extra " that was causing the sql xlat to fail. Here is the solution:

Go to the FreeRadius wiki. You can skip the sections labeled 'raddb/modules/file' and 'raddb/authorized_macs'. When you get to the final section 'raddb/sites-available/default post-auth{}' use the following code instead:

if("%{sql:SELECT COUNT(macaddr) FROM radmacauth WHERE macaddr ='%{User-Name}'}" > 0){
  ok
} 
else{
  reject
}

You will need to create a table named 'radmacauth' with a field named 'macaddr' in your radius database.

jonsca
  • 4,084
Zack S.
  • 139