Using FreeRADIUS with SQL backend and advanced configuration
Hi! I've just set up FreeRADIUS with SQL backend and dynamic VLAN assignment, and it works great. I'm using it to put different users into different VLANs based on their username/password, using EAP. However, I want to expand on this to be able to put the clients into another VLAN if also the calling station MAC address matches. If I did this using the flat file "users", I'd suspect it'd be something like this: testuser Cleartext-Password := "example", Calling-Station-Id := "A0-A8-CD-60-AF-C2" Tunnel-Medium-Type := "IEEE-802", Tunnel-Private-Group-ID := 3, Tunnel-Type := "VLAN" testuser Cleartext-Password := "example" Tunnel-Medium-Type := "IEEE-802", Tunnel-Private-Group-ID := 4, Tunnel-Type := "VLAN" The theory here is that if the user "testuser" logs in with the password "example" from the device with MAC address "a0:a8:cd:60:af:c2", then he should be placed into the VLAN 3, if not, into VLAN 4. Is this possible with FreeRADIUS and specifically when using the SQL backend? -- Marius
Hi,
The theory here is that if the user "testuser" logs in with the password "example" from the device with MAC address "a0:a8:cd:60:af:c2", then he should be placed into the VLAN 3, if not, into VLAN 4. Is this possible with FreeRADIUS and specifically when using the SQL backend?
yes - using radcheck and radgroupreply etc as per normal. alan
Hi Alan, Could you possibly provide a more elaborate example than that? How do I differentiate between the different groups of requests? As the tables look like this:
desc radcheck; +-----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+------------------+------+-----+---------+----------------+ | id | int(11) unsigned | NO | PRI | NULL | auto_increment | | username | varchar(64) | NO | MUL | | | | attribute | varchar(64) | NO | | | | | op | char(2) | NO | | == | | | value | varchar(253) | NO | | | | +-----------+------------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)
desc radgroupreply; +-----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+------------------+------+-----+---------+----------------+ | id | int(11) unsigned | NO | PRI | NULL | auto_increment | | groupname | varchar(64) | NO | MUL | | | | attribute | varchar(64) | NO | | | | | op | char(2) | NO | | = | | | value | varchar(253) | NO | | | | +-----------+------------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec)
How do I then "tie" together the different attribute checks? And the same regarding the radgroupreply: how do I tell which reply belongs to which check? -- Marius Den 09.12.2015 23:11, skrev A.L.M.Buxey@lboro.ac.uk:
Hi,
The theory here is that if the user "testuser" logs in with the password "example" from the device with MAC address "a0:a8:cd:60:af:c2", then he should be placed into the VLAN 3, if not, into VLAN 4. Is this possible with FreeRADIUS and specifically when using the SQL backend?
yes - using radcheck and radgroupreply etc as per normal.
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Hi,
Could you possibly provide a more elaborate example than that? How do I differentiate between the different groups of requests? As the tables look like this:
http://wiki.freeradius.org/guide/SQL%20HOWTO look at usergroup - that assigns a username to a group...the groupreply can then be used.... as just one example.... personally I wouldnt use most of the default bits because unlang is much better for defining policy.....so you could use unlang to pull a group out of a DB and then use unlang to pull out VLAN assignments based on eg username/MAC address from another table and use those values...the power of %{sql:.....} alan
On 9 Dec 2015, at 19:47, A.L.M.Buxey@lboro.ac.uk wrote:
Hi,
Could you possibly provide a more elaborate example than that? How do I differentiate between the different groups of requests? As the tables look like this:
http://wiki.freeradius.org/guide/SQL%20HOWTO
look at usergroup - that assigns a username to a group...the groupreply can then be used.... as just one example....
personally I wouldnt use most of the default bits because unlang is much better for defining policy.....so you could use unlang to pull a group out of a DB and then use unlang to pull out VLAN assignments based on eg username/MAC address from another table and use those values...the power of %{sql:.....}
Or if you want to jump on the v3.1.x bandwagon, as a number of people are doing (maybe the message about CIT, and releases not being magical is finally getting through ;) ), you can use the mapping syntax: map sql "SELECT * FROM `my_table` WHERE user = '%{User-Name}'" { &Tunnel-Private-Group-ID := 'vlan' # Map column vlan to Tunnel-Private-Group-ID &Service-Type := 'service_level' # Map column service_level to service-type attribute } Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS development team FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
participants (3)
-
A.L.M.Buxey@lboro.ac.uk -
Arran Cudbard-Bell -
Marius Flage