server error in 3.0.11/ unknown column
I have my users in a local mysql database and want to send logs to a central mysql database via sql-relay. This works fine. Now as the central log db uses a radpostauth table with an extended structure compared to the default table available on every radius server installation, I want to provide additional information for the service desk people. Unfortunately, when I change the default post-auth in mods-config/sql/main/mysql/queries.conf from: post-auth { # Write SQL queries to a logfile. This is potentially useful for bulk inserts # when used with the rlm_sql_null driver. # logfile = ${logdir}/post-auth.sql query = "\ INSERT INTO ${..postauth_table} \ (username, pass, reply, authdate) \ VALUES ( \ '%{SQL-User-Name}', \ '%{%{User-Password}:-%{Chap-Password}}', \ '%{reply:Packet-Type}', \ '%S')" To: post-auth { # Write SQL queries to a logfile. This is potentially useful for bulk inserts # when used with the rlm_sql_null driver. # logfile = ${logdir}/post-auth.sql query = "\ INSERT INTO ${..postauth_table} \ (username, pass, reply, authdate, nasname, nasipaddress,radiusip,switchtype,machinetype,nasport,modulefailmes,csi,vlan) \ VALUES ( \ '%{SQL-User-Name}', \ '%{%{User-Password}:-%{Chap-Password}}', \ '%{reply:Packet-Type}', \ '%S','%{NAS-Identifier}','%{Client-IP-Address}','${RADIP}','%{request:Virtua l-Server}','%{request:usergroup}','%{NAS-Port-Id}','%{Module-Failure-Message }','%{Calling-Station-Id}','%{control:switchvlan}')" } I get a server error: ... (0) sqldef: --> INSERT INTO radpostauth (username, pass, reply, authdate, nasname, nasipaddress,radiusip,switchtype,machinetype,nasport,modulefailmes,csi,vlan) VALUES ( '000d60d11c1e', '000d60d11c1e', 'Access-Accept', '2016-07-20 07:34:36','','123.45.163.93','sapold','cisco','other','','MAC based auth','','') (0) sqldef: EXPAND /usr/local/freeradius-3.0.11/var/log/radius/post-auth.sql (0) sqldef: --> /usr/local/freeradius-3.0.11/var/log/radius/post-auth.sql (0) sqldef: Executing query: INSERT INTO radpostauth (username, pass, reply, authdate, nasname, nasipaddress,radiusip,switchtype,machinetype,nasport,modulefailmes,csi,vlan) VALUES ( '000d60d11c1e', '000d60d11c1e', 'Access-Accept', '2016-07-20 07:34:36','','123.45.163.93','sapold','cisco','other','','MAC based auth','','') (0) sqldef: ERROR: rlm_sql_mysql: ERROR 1054 (Unknown column 'nasipaddress' in 'field list'): 42S22 (0) sqldef: SQL query returned: server error This could probably be solved by modifying the radpostauth table on every radius server, but this is something I really would like to avoid if possible on production systems. Any other idea? Norbert Wegener
On Jul 20, 2016, at 9:55 AM, Wegener, Norbert <norbert.wegener@atos.net> wrote:
I have my users in a local mysql database and want to send logs to a central mysql database via sql-relay.
You should use the rlm_sql_null driver to log SQL queries to disk. The queries will be created and written to disk, without checking any local database.
I get a server error: ... (0) sqldef: --> INSERT INTO radpostauth (username, pass, reply, authdate, nasname, ... (0) sqldef: ERROR: rlm_sql_mysql: ERROR 1054 (Unknown column 'nasipaddress' in 'field list'): 42S22 (0) sqldef: SQL query returned: server error
That only happens because you're writing to *both* a local SQL database, and also to disk. If you configure one SQL module to write to a local DB, without logging, it will work. Then, configure another SQL module using the rlm_sql_null driver. Have it log to disk, and it won't write to any local DB. Alan DeKok.
participants (2)
-
Alan DeKok -
Wegener, Norbert