new table and query

Alan Buxey alan.buxey at gmail.com
Thu Aug 31 11:51:53 CEST 2017


No. You can't just make up syntax. FR won't call that function because it
doesn't use it that way. All you need to do is use some unlang in the
post-auth section with your insert statement in a simple %sql: wrapper , no
need for perl or stored procedures etc

alan

On 31 Aug 2017 7:47 am, "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 have inserted a new table to my mysql for radius 'authorizedmacs'.
> mysql> show tables;
> +------------------+
> | Tables_in_radius |
> +------------------+
> | authorizedmacs   |
> | radacct          |
> | radcheck         |
> | radgroupcheck    |
> | radgroupreply    |
> | radpostauth      |
> | radreply         |
> | radusergroup     |
> +------------------+
>
> mysql> describe authorizedmacs;
> +------------+----------------------+------+-----+----------
> ---------+-----------------------------+
> | Field      | Type                 | Null | Key | Default           |
> Extra                       |
> +------------+----------------------+------+-----+----------
> ---------+-----------------------------+
> | id         | smallint(5) unsigned | NO   | PRI | NULL              |
> auto_increment              |
> | macaddress | varchar(12)          | NO   | MUL | NULL              |
>                          |
> | created    | timestamp            | NO   |     | CURRENT_TIMESTAMP | on
> update CURRENT_TIMESTAMP |
> +------------+----------------------+------+-----+----------
> ---------+-----------------------------+
>
> 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.
>
> BR
> /Daniel
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/
> list/users.html


More information about the Freeradius-Users mailing list