perl examples

A.L.M.Buxey at A.L.M.Buxey at
Mon Apr 8 14:32:24 CEST 2013


> There don't seem to be many examples relating to using  perl to access remote databases…. in fact there don't seem to be many perl examples at all.

thats because its a PERL issue not a FreeRADIUS one :-)

> In post-auth I want to 
> extract the nas-ip address and calling station-id of the client device
> open a db connection and perform a query that'll let me  decide what vlan-id to send back in the access-accept packet
> write radius attributes into the access-accept reply

you need to use DBI PERL to open the connection and then create the query.
for the query you can use values straight from the FreeRADIUS PERL hook - or assign
them to variables and use those variables, then run the query and look at
the results.  of course, you will need to verify that the connection was okay,
that the query was okay and that the results are okay. 

> Anyone got some form of template I could use for the above?

each case requires new code....but a quick Google will show you how to do the DB query
stuff...I can provide you some templte for assigning variables 


More information about the Freeradius-Users mailing list