I have searched now for several weeks, but do not find a solution: Installed freeradius 1.1.7 on suse configured mysql on the same server I can start radiusd fine, I can login into nas, but I want accounting put into mysql and that just does not work. My DB-tables are empty, just accounting should be put into it. I do not need anything in usergroup for accounting etc, or do I? radiusd -X | grep sql : Config: including file: /usr/local/etc/raddb/sql.conf sql: driver = "rlm_sql_mysql" sql: server = "localhost" sql: port = "" sql: login = "root" sql: password = "" sql: radius_db = "radiusLOG" sql: nas_table = "nas" sql: sqltrace = no sql: sqltracefile = "/rzf/protokolle/radiusd/sqltrace.sql" sql: readclients = no sql: deletestalesessions = yes sql: num_sql_socks = 5 sql: sql_user_name = "%{User-Name}" sql: default_user_profile = "" sql: query_on_not_found = no sql: authorize_check_query = "SELECT id, UserName, Attribute, Value, op FROM radcheck WHERE Username = '%{SQL-User-Name}' ORDER BY id" sql: authorize_reply_query = "SELECT id, UserName, Attribute, Value, op FROM radreply WHERE Username = '%{SQL-User-Name}' ORDER BY id" sql: authorize_group_check_query = "SELECT radgroupcheck.id,radgroupcheck.GroupName,radgroupcheck.Attribute,radgroupcheck.Value,radgroupcheck.op FROM radgroupcheck,usergroup WHERE usergroup.Username = '%{SQL-User-Name}' AND usergroup.GroupName = radgroupcheck.GroupName ORDER BY radgroupcheck.id" sql: authorize_group_reply_query = "SELECT radgroupreply.id,radgroupreply.GroupName,radgroupreply.Attribute,radgroupreply.Value,radgroupreply.op FROM radgroupreply,usergroup WHERE usergroup.Username = '%{SQL-User-Name}' AND usergroup.GroupName = radgroupreply.GroupName ORDER BY radgroupreply.id" sql: accounting_onoff_query = "UPDATE radacct SET AcctStopTime='%S', AcctSessionTime=unix_timestamp('%S') - unix_timestamp(AcctStartTime), AcctTerminateCause='%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time}' WHERE AcctSessionTime=0 AND AcctStopTime=0 AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStartTime <= '%S'" sql: accounting_update_query = " UPDATE radacct SET FramedIPAddress = '%{Framed-IP-Address}', AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = '%{Acct-Input-Gigawords:-0}' << 32 | '%{Acct-Input-Octets:-0}', AcctOutputOctets = '%{Acct-Output-Gigawords:-0}' << 32 | '%{Acct-Output-Octets:-0}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'" sql: accounting_update_query_alt = " INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, XAscendSessionSvrKey) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', DATE_SUB('%S', INTERVAL (%{Acct-Session-Time:-0} + %{Acct-Delay-Time:-0}) SECOND), '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Acct-Input-Gigawords: -0}' << 32 | '%{Acct-Input-Octets:-0}', '%{Acct-Output-Gigawords:-0}' << 32 | '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', '%{X-Ascend-Session-Svr-Key}')" sql: accounting_start_query = " INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay, XAscendSessionSvrKey) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', '%S', '0', '0', '%{Acct-Authentic}', '%{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '% {Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time:-0}', '0', '%{X-Ascend-Session-Svr-Key}')" sql: accounting_start_query_alt = "UPDATE radacct SET AcctStartTime = '%S', AcctStartDelay = '%{Acct-Delay-Time}', ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'" sql: accounting_stop_query = " UPDATE radacct SET AcctStopTime = '%S', AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = '%{Acct-Input-Gigawords:-0}' << 32 | '%{Acct-Input-Octets:-0}', AcctOutputOctets = '%{Acct-Output-Gigawords:-0}' << 32 | '%{Acct-Output-Octets:-0}', AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStopDelay = '%{Acct-Delay-Time:-0}', ConnectInfo_stop = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}'" sql: accounting_stop_query_alt = " INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, AcctStopDelay) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', DATE_SUB('%S', INTERVAL (%{Acct-Session-Time:-0} + %{Acct-Delay-Time:-0}) SECOND), '%S', '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Connect-Info}', '%{Acct-Input-Gigawo rds:-0}' << 32 | '%{Acct-Input-Octets:-0}', '%{Acct-Output-Gigawords:-0}' << 32 | '%{Acct-Output-Octets:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', '%{Acct-Delay-Time:-0}')" sql: group_membership_query = "SELECT GroupName FROM usergroup WHERE UserName='%{SQL-User-Name}'" sql: connect_failure_retry_delay = 60 sql: simul_count_query = "" sql: simul_verify_query = "SELECT RadAcctId, AcctSessionId, UserName, NASIPAddress, NASPortId, FramedIPAddress, CallingStationId, FramedProtocol FROM radacct WHERE UserName='%{SQL-User-Name}' AND AcctStopTime = 0" sql: postauth_query = "INSERT into radpostauth (user, pass, reply, date) values ('%{User-Name}', '%{User-Password:-Chap-Password}', '%{reply:Packet-Type}', NOW())" sql: safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked rlm_sql (sql): Attempting to connect to root@localhost:/radiusLOG rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_mysql #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_mysql #1 rlm_sql (sql): Connected new DB handle, #1 rlm_sql (sql): starting 2 rlm_sql (sql): Attempting to connect rlm_sql_mysql #2 rlm_sql (sql): Connected new DB handle, #2 rlm_sql (sql): starting 3 rlm_sql (sql): Attempting to connect rlm_sql_mysql #3 rlm_sql (sql): Connected new DB handle, #3 rlm_sql (sql): starting 4 rlm_sql (sql): Attempting to connect rlm_sql_mysql #4 rlm_sql (sql): Connected new DB handle, #4 Module: Instantiated sql (sql) rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 1 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 2 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 3 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 4 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 5 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 6 rlm_sql (sql): sql_set_user escaped user --> 'kristin' rlm_sql (sql): There are no DB handles to use! skipped 0, tried to connect 0 modcall[accounting]: module "sql" returns fail for request 7 .... I tried to create and put sqltrace into my db. That was no problem at all. But whats the Problem of radiusd? It connects to DB, but cannot insert when accounting-Data comes in!? I do not know where else to look at. Please help me! -- View this message in context: http://www.nabble.com/Freeradius-1.1.7-no-DB-handles-tf4757305.html#a1360431... Sent from the FreeRadius - User mailing list archive at Nabble.com.
Hi,
My DB-tables are empty, just accounting should be put into it. I do not need anything in usergroup for accounting etc, or do I?
you are probably running more radius threads than you have DB handles - change the value in sql.conf - and make sure you enable enough max_connections in your mysql (my.cnf) file alan
I set max_connections to 200, but that didnt help. That cannt really be a reason, because I am the only user by now. My partner gave up on this Problem. But I need to get this thing running! Maybe its the mysql-Version? We run mysql 3.23 on suse 8.1... Any Ideas? A.L.M.Buxey wrote:
Hi,
My DB-tables are empty, just accounting should be put into it. I do not need anything in usergroup for accounting etc, or do I?
you are probably running more radius threads than you have DB handles - change the value in sql.conf - and make sure you enable enough max_connections in your mysql (my.cnf) file
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- View this message in context: http://www.nabble.com/Freeradius-1.1.7-no-DB-handles-tf4757305.html#a1371277... Sent from the FreeRadius - User mailing list archive at Nabble.com.
Hi,
I set max_connections to 200, but that didnt help. That cannt really be a reason, because I am the only user by now. My partner gave up on this Problem. But I need to get this thing running! Maybe its the mysql-Version? We run mysql 3.23 on suse 8.1... Any Ideas?
can freeradius actually USE the MySQL? ie if you put values into the tables - check values, or username - or even use the naslist, does freeradius show such tables being put to use? ..does the accouting table get filled as you use the system? have you get eg selinux running? if so, check the logs...change it to warn mode instead and check the logs... alan
Everybody can connect, I started mysql even with skip-grants... The mysql-log tells me "Connect on radiusLOG" when I start radiusd, but nothing else when I login into the switch. A.L.M.Buxey wrote:
Hi,
I set max_connections to 200, but that didnt help. That cannt really be a reason, because I am the only user by now. My partner gave up on this Problem. But I need to get this thing running! Maybe its the mysql-Version? We run mysql 3.23 on suse 8.1... Any Ideas?
can freeradius actually USE the MySQL? ie if you put values into the tables - check values, or username - or even use the naslist, does freeradius show such tables being put to use? ..does the accouting table get filled as you use the system?
have you get eg selinux running? if so, check the logs...change it to warn mode instead and check the logs...
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- View this message in context: http://www.nabble.com/Freeradius-1.1.7-no-DB-handles-tf4757305.html#a1371381... Sent from the FreeRadius - User mailing list archive at Nabble.com.
Hi, I made a change in sql.c now, but do not really understand the problem: function sql_get_socket .... if (pthread_mutex_trylock(&cur->mutex) != 0) { radlog(L_INFO, "rlm_sql (%s): goto next %d", inst->config->xlat_name, cur->id); /* goto next; */ } /* else we now have the lock */ .... The radius inserts accountingdata now into my DB, but this cannot really be a solution. What happens now when there is no socket free? What is the problem of pthread_mutex_trylock()? Any ideas? steven meyer wrote:
Everybody can connect, I started mysql even with skip-grants... The mysql-log tells me "Connect on radiusLOG" when I start radiusd, but nothing else when I login into the switch.
A.L.M.Buxey wrote:
Hi,
I set max_connections to 200, but that didnt help. That cannt really be a reason, because I am the only user by now. My partner gave up on this Problem. But I need to get this thing running! Maybe its the mysql-Version? We run mysql 3.23 on suse 8.1... Any Ideas?
can freeradius actually USE the MySQL? ie if you put values into the tables - check values, or username - or even use the naslist, does freeradius show such tables being put to use? ..does the accouting table get filled as you use the system?
have you get eg selinux running? if so, check the logs...change it to warn mode instead and check the logs...
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- View this message in context: http://www.nabble.com/Freeradius-1.1.7-no-DB-handles-tf4757305.html#a1374256... Sent from the FreeRadius - User mailing list archive at Nabble.com.
Hi,
if (pthread_mutex_trylock(&cur->mutex) != 0) { radlog(L_INFO, "rlm_sql (%s): goto next %d", inst->config->xlat_name, cur->id); /* goto next; */ } /* else we now have the lock */ .... The radius inserts accountingdata now into my DB, but this cannot really be a solution. What happens now when there is no socket free? What is the problem of pthread_mutex_trylock()? Any ideas?
ouch. looks like your system is having problems with allowing access to a DB handle in a thread. what happens, eg when you run radius in non-threaded mode? alan
Hey, non-threaded works! Is it a problem of the server or mysql? I don't really know, what non-threaded means. Can I run the server in non-threaded mode or is that just for testing? A.L.M.Buxey wrote:
Hi,
if (pthread_mutex_trylock(&cur->mutex) != 0) { radlog(L_INFO, "rlm_sql (%s): goto next %d", inst->config->xlat_name, cur->id); /* goto next; */ } /* else we now have the lock */ .... The radius inserts accountingdata now into my DB, but this cannot really be a solution. What happens now when there is no socket free? What is the problem of pthread_mutex_trylock()? Any ideas?
ouch. looks like your system is having problems with allowing access to a DB handle in a thread. what happens, eg when you run radius in non-threaded mode?
alan - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- View this message in context: http://www.nabble.com/Freeradius-1.1.7-no-DB-handles-tf4757305.html#a1374374... Sent from the FreeRadius - User mailing list archive at Nabble.com.
steven meyer wrote:
Hey, non-threaded works! Is it a problem of the server or mysql? I don't really know, what non-threaded means. Can I run the server in non-threaded mode or is that just for testing?
You can run it in non-threaded mode. It looks like there are issues with your system. Other people use MySQL with FreeRADIUS and threads, so the problem is likely *not* the code. Alan DeKok.
participants (3)
-
A.L.M.Buxey@lboro.ac.uk -
Alan DeKok -
steven meyer