new table and query

Fajar A. Nugraha list at fajar.net
Thu Aug 31 09:31:17 CEST 2017


On Thu, Aug 31, 2017 at 1:46 PM, Johansson, Daniel (GIS)
<Daniel.Johansson2 at sony.com> wrote:
> Hi
> I use FreeRADIUS Version 2.2.6
> I want to make a custom table and query for freeradius.
> sql is enabled in sites-enabled/default for 'post-auth {sql}'
> and postauth_query is populating radpostauth However my 'macuseradd_query ' is not run can anyone tell me why?

> I also added a entry in sql.conf
>         macauth_table = "authorizedmacs"
> Then I created query in dailup.conf 'macuseradd_query '
>
>         #######################################################################
>         # Authentication Logging Queries
>         #######################################################################
>         # postauth_query                - Insert some info after authentication
>         #######################################################################
>
>         postauth_query = "INSERT INTO ${postauth_table} \
>                           (username, pass, reply, authdate) \
>                           VALUES ( \
>                           '%{User-Name}', \
>                           '%{%{User-Password}:-%{Chap-Password}}', \
>                           '%{reply:Packet-Type}', '%S')"
>
>         macuseradd_query = "INSERT INTO ${macauth_table} \
>                                  (macaddress) \
>                                 VALUES ( \
>                                 '%{Calling-Station-Id}')"
>
> It would be much appreciated if anyone can tell me why macuseradd_query isn’t run as postauth_query is.

That's not how FR works. It won't call macuseradd_query simply because
you put it after postauth_query.

IIRC you can either:
- create a stored procedure (in mysql) to write data into the two
tables, and call that procedure in postauth_query. OR
- use rlm_perl to perform the inserts

-- 
Fajar



More information about the Freeradius-Users mailing list