Discussion:
MySQL accounting issue
Andy Smith
2008-01-20 19:19:40 UTC
Permalink
Hi List,

ok next issue I have :P

I have attempted to configure freeradius to write accounting data to MySQL, however currently its not working. No data is being written
to MySQL and the Radius client is complaining its not recieving a reply for accounting requests. I subsituted the "detail" setting in
the "accounting" config section of radiusd.conf for "sql" and modifyied the sql.conf as seemed necessary. As soon as I switch this
back to "detail" my Radius client starts recieving replies from freeradius once again :S

I can see from the MySQL log that radiusd is successfully establishing a connection to MySQL at startup:

080120 19:14:49 61 Connect ***@localhost on radius
62 Connect ***@localhost on radius
63 Connect ***@localhost on radius
64 Connect ***@localhost on radius
65 Connect ***@localhost on radius
65 Query SELECT * FROM nas

But after that there is no activity in the MySQL log :S And I have no errors logged from MySQL or radiusd, nor can I see any errors
when running "radiusd -Xf"

anyone any ideas what more I can do to identify the issue??

thanks Andy.
Alan DeKok
2008-01-21 10:55:13 UTC
Permalink
Post by Andy Smith
I have attempted to configure freeradius to write accounting data to
MySQL, however currently its not working. No data is being written
to MySQL and the Radius client is complaining its not recieving a reply
for accounting requests. I subsituted the "detail" setting in
the "accounting" config section of radiusd.conf for "sql" and modifyied
the sql.conf as seemed necessary. As soon as I switch this
back to "detail" my Radius client starts recieving replies from freeradius once again :S
So the sql module isn't logging anything.
Post by Andy Smith
But after that there is no activity in the MySQL log :S And I have no
errors logged from MySQL or radiusd, nor can I see any errors
when running "radiusd -Xf"
anyone any ideas what more I can do to identify the issue??
Post the output of radiusd -X here, as suggested in the FAQ, README,
INSTALL, and (almost) daily.

Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
A.smith
2008-01-21 12:59:28 UTC
Permalink
Hi,

ok this is an example of when its meant to do some accounting, in this
example I have both detail and sql set for accounting in radiusd.conf.

Nothing to do. Sleeping until we see a request.
rad_recv: Accounting-Request packet from host 89.107.16.10:35377, id=82,
length=145
Acct-Status-Type = Failed
Service-Type = IAPP-Register
Attr-102 = 0x00000194
Error-Cause = 32
Event-Timestamp = "Jan 21 2008 13:05:11 GMT"
Attr-105 = 0x61733738333035366464
Acct-Session-Id = "***@89.107.16.9"
Attr-108 = 0x38392e3130372e31362e39
Attr-109 = 0x35303630
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = 89.107.16.10
Processing the preacct section of radiusd.conf
modcall: entering group preacct for request 85
modcall[preacct]: module "preprocess" returns noop for request 85
rlm_realm: Proxy reply, or no User-Name. Ignoring.
modcall[preacct]: module "suffix" returns noop for request 85
modcall[preacct]: module "files" returns noop for request 85
modcall: leaving group preacct (returns noop) for request 85
Processing the accounting section of radiusd.conf
modcall: entering group accounting for request 85
radius_xlat:
'/usr/local/var/log/radius/radacct/89.107.16.10/detail-20080121'
rlm_detail:
/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands
to /usr/local/var/log/radius/radacct/89.107.16.10/detail-20080121
modcall[accounting]: module "detail" returns ok for request 85
rlm_sql (sql): Unsupported Acct-Status-Type = 15
modcall[accounting]: module "sql" returns noop for request 85
modcall: leaving group accounting (returns ok) for request 85
Sending Accounting-Response of id 82 to 89.107.16.10 port 35377
Finished request 85
Going to the next request


At startup I see this from radiusd

Starting - reading configuration files ...
reread_config: reading radiusd.conf
Config: including file: /usr/local/etc/raddb/proxy.conf
Config: including file: /usr/local/etc/raddb/clients.conf
Config: including file: /usr/local/etc/raddb/snmp.conf
Config: including file: /usr/local/etc/raddb/sql.conf
main: prefix = "/usr/local"
main: localstatedir = "/usr/local/var"
main: logdir = "/usr/local/var/log/radius"
main: libdir = "/usr/local/lib"
main: radacctdir = "/usr/local/var/log/radius/radacct"
main: hostname_lookups = no
main: max_request_time = 30
main: cleanup_delay = 5
main: max_requests = 1024
main: delete_blocked_requests = 0
main: port = 0
main: allow_core_dumps = no
main: log_stripped_names = no
main: log_file = "/usr/local/var/log/radius/radius.log"
main: log_auth = no
main: log_auth_badpass = no
main: log_auth_goodpass = no
main: pidfile = "/usr/local/var/run/radiusd/radiusd.pid"
main: user = "(null)"
main: group = "(null)"
main: usercollide = no
main: lower_user = "no"
main: lower_pass = "no"
main: nospace_user = "no"
main: nospace_pass = "no"
main: checkrad = "/usr/local/sbin/checkrad"
main: proxy_requests = yes
proxy: retry_delay = 5
proxy: retry_count = 3
proxy: synchronous = no
proxy: default_fallback = yes
proxy: dead_time = 120
proxy: post_proxy_authorize = no
proxy: wake_all_if_all_dead = no
security: max_attributes = 200
security: reject_delay = 1
security: status_server = no
main: debug_level = 0
read_config_files: reading dictionary
read_config_files: reading naslist
Using deprecated naslist file. Support for this will go away soon.
read_config_files: reading clients
read_config_files: reading realms
radiusd: entering modules setup
Module: Library search path is /usr/local/lib
Module: Loaded expr
Module: Instantiated expr (expr)
Module: Loaded PAP
pap: encryption_scheme = "crypt"
pap: auto_header = no
Module: Instantiated pap (pap)
Module: Loaded CHAP
Module: Instantiated chap (chap)
Module: Loaded MS-CHAP
mschap: use_mppe = yes
mschap: require_encryption = no
mschap: require_strong = no
mschap: with_ntdomain_hack = no
mschap: passwd = "(null)"
mschap: ntlm_auth = "(null)"
Module: Instantiated mschap (mschap)
Module: Loaded System
unix: cache = no
unix: passwd = "/etc/passwd"
unix: shadow = "/etc/shadow"
unix: group = "/etc/group"
unix: radwtmp = "/usr/local/var/log/radius/radwtmp"
unix: usegroup = no
unix: cache_reload = 600
Module: Instantiated unix (unix)
Module: Loaded preprocess
preprocess: huntgroups = "/usr/local/etc/raddb/huntgroups"
preprocess: hints = "/usr/local/etc/raddb/hints"
preprocess: with_ascend_hack = no
preprocess: ascend_channels_per_line = 23
preprocess: with_ntdomain_hack = no
preprocess: with_specialix_jetstream_hack = no
preprocess: with_cisco_vsa_hack = no
preprocess: with_alvarion_vsa_hack = no
Module: Instantiated preprocess (preprocess)
Module: Loaded SQL
sql: driver = "rlm_sql_mysql"
sql: server = "localhost"
sql: port = ""
sql: login = "root"
sql: password = "password"
sql: radius_db = "radius"
sql: nas_table = "nas"
sql: sqltrace = yes
sql: sqltracefile = "/usr/local/var/log/radius/sqltrace.sql"
sql: readclients = yes
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-Gigawords:-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 ***@localhost:/radius
rlm_sql (sql): starting 0
rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
rlm_sql_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #4
rlm_sql (sql): Connected new DB handle, #4
rlm_sql (sql): - generate_sql_clients
rlm_sql (sql): Query: SELECT * FROM nas
rlm_sql (sql): Reserving sql socket id: 4
rlm_sql_mysql: query: SELECT * FROM nas
rlm_sql (sql): Read entry
nasname=89.107.16.10,shortname=OpenSER,secret=password
rlm_sql (sql): Adding client 89.107.16.10 (OpenSER) to clients list
rlm_sql (sql): Released sql socket id: 4
Module: Instantiated sql (sql)
Module: Loaded realm
realm: format = "suffix"
realm: delimiter = "@"
realm: ignore_default = no
realm: ignore_null = no
Module: Instantiated realm (suffix)
Module: Loaded files
files: usersfile = "/usr/local/etc/raddb/users"
files: acctusersfile = "/usr/local/etc/raddb/acct_users"
files: preproxy_usersfile = "/usr/local/etc/raddb/preproxy_users"
files: compat = "no"
Module: Instantiated files (files)
Module: Loaded detail
detail: detailfile =
"/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
detail: detailperm = 384
detail: dirperm = 493
detail: locking = no
Module: Instantiated detail (detail)
Module: Loaded radutmp
radutmp: filename = "/usr/local/var/log/radius/radutmp"
radutmp: username = "%{User-Name}"
radutmp: case_sensitive = yes
radutmp: check_with_nas = yes
radutmp: perm = 384
radutmp: callerid = yes
Module: Instantiated radutmp (radutmp)
Listening on authentication *:1812
Listening on accounting *:1813
Ready to process requests.


________________________________________________
Message sent using UK Grid Webmail 2.7.9


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
t***@kalik.co.yu
2008-01-21 13:22:38 UTC
Permalink
And what accounting is it suposed to do with the failed packet???

That value (15) most likely isn't defined in the freeradius dictionary.
And even if it was no sql query is defined in sql.conf for the failed
packet. And most likely no logic in rlm_sql.

Ivan Kalik
Kalik Informatika ISP
Post by A.smith
Hi,
ok this is an example of when its meant to do some accounting, in this
example I have both detail and sql set for accounting in radiusd.conf.
Nothing to do. Sleeping until we see a request.
rad_recv: Accounting-Request packet from host 89.107.16.10:35377, id=82,
length=145
Acct-Status-Type = Failed
Service-Type = IAPP-Register
Attr-102 = 0x00000194
Error-Cause = 32
Event-Timestamp = "Jan 21 2008 13:05:11 GMT"
Attr-105 = 0x61733738333035366464
Attr-108 = 0x38392e3130372e31362e39
Attr-109 = 0x35303630
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = 89.107.16.10
Processing the preacct section of radiusd.conf
modcall: entering group preacct for request 85
modcall[preacct]: module "preprocess" returns noop for request 85
rlm_realm: Proxy reply, or no User-Name. Ignoring.
modcall[preacct]: module "suffix" returns noop for request 85
modcall[preacct]: module "files" returns noop for request 85
modcall: leaving group preacct (returns noop) for request 85
Processing the accounting section of radiusd.conf
modcall: entering group accounting for request 85
'/usr/local/var/log/radius/radacct/89.107.16.10/detail-20080121'
/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands
to /usr/local/var/log/radius/radacct/89.107.16.10/detail-20080121
modcall[accounting]: module "detail" returns ok for request 85
rlm_sql (sql): Unsupported Acct-Status-Type = 15
modcall[accounting]: module "sql" returns noop for request 85
modcall: leaving group accounting (returns ok) for request 85
Sending Accounting-Response of id 82 to 89.107.16.10 port 35377
Finished request 85
Going to the next request
At startup I see this from radiusd
Starting - reading configuration files ...
reread_config: reading radiusd.conf
Config: including file: /usr/local/etc/raddb/proxy.conf
Config: including file: /usr/local/etc/raddb/clients.conf
Config: including file: /usr/local/etc/raddb/snmp.conf
Config: including file: /usr/local/etc/raddb/sql.conf
main: prefix = "/usr/local"
main: localstatedir = "/usr/local/var"
main: logdir = "/usr/local/var/log/radius"
main: libdir = "/usr/local/lib"
main: radacctdir = "/usr/local/var/log/radius/radacct"
main: hostname_lookups = no
main: max_request_time = 30
main: cleanup_delay = 5
main: max_requests = 1024
main: delete_blocked_requests = 0
main: port = 0
main: allow_core_dumps = no
main: log_stripped_names = no
main: log_file = "/usr/local/var/log/radius/radius.log"
main: log_auth = no
main: log_auth_badpass = no
main: log_auth_goodpass = no
main: pidfile = "/usr/local/var/run/radiusd/radiusd.pid"
main: user = "(null)"
main: group = "(null)"
main: usercollide = no
main: lower_user = "no"
main: lower_pass = "no"
main: nospace_user = "no"
main: nospace_pass = "no"
main: checkrad = "/usr/local/sbin/checkrad"
main: proxy_requests = yes
proxy: retry_delay = 5
proxy: retry_count = 3
proxy: synchronous = no
proxy: default_fallback = yes
proxy: dead_time = 120
proxy: post_proxy_authorize = no
proxy: wake_all_if_all_dead = no
security: max_attributes = 200
security: reject_delay = 1
security: status_server = no
main: debug_level = 0
read_config_files: reading dictionary
read_config_files: reading naslist
Using deprecated naslist file. Support for this will go away soon.
read_config_files: reading clients
read_config_files: reading realms
radiusd: entering modules setup
Module: Library search path is /usr/local/lib
Module: Loaded expr
Module: Instantiated expr (expr)
Module: Loaded PAP
pap: encryption_scheme = "crypt"
pap: auto_header = no
Module: Instantiated pap (pap)
Module: Loaded CHAP
Module: Instantiated chap (chap)
Module: Loaded MS-CHAP
mschap: use_mppe = yes
mschap: require_encryption = no
mschap: require_strong = no
mschap: with_ntdomain_hack = no
mschap: passwd = "(null)"
mschap: ntlm_auth = "(null)"
Module: Instantiated mschap (mschap)
Module: Loaded System
unix: cache = no
unix: passwd = "/etc/passwd"
unix: shadow = "/etc/shadow"
unix: group = "/etc/group"
unix: radwtmp = "/usr/local/var/log/radius/radwtmp"
unix: usegroup = no
unix: cache_reload = 600
Module: Instantiated unix (unix)
Module: Loaded preprocess
preprocess: huntgroups = "/usr/local/etc/raddb/huntgroups"
preprocess: hints = "/usr/local/etc/raddb/hints"
preprocess: with_ascend_hack = no
preprocess: ascend_channels_per_line = 23
preprocess: with_ntdomain_hack = no
preprocess: with_specialix_jetstream_hack = no
preprocess: with_cisco_vsa_hack = no
preprocess: with_alvarion_vsa_hack = no
Module: Instantiated preprocess (preprocess)
Module: Loaded SQL
sql: driver = "rlm_sql_mysql"
sql: server = "localhost"
sql: port = ""
sql: login = "root"
sql: password = "password"
sql: radius_db = "radius"
sql: nas_table = "nas"
sql: sqltrace = yes
sql: sqltracefile = "/usr/local/var/log/radius/sqltrace.sql"
sql: readclients = yes
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-Gigawords:-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 =
rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
rlm_sql (sql): starting 0
rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
rlm_sql_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #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_mysql: Starting connect to MySQL server for #4
rlm_sql (sql): Connected new DB handle, #4
rlm_sql (sql): - generate_sql_clients
rlm_sql (sql): Query: SELECT * FROM nas
rlm_sql (sql): Reserving sql socket id: 4
rlm_sql_mysql: query: SELECT * FROM nas
rlm_sql (sql): Read entry
nasname=89.107.16.10,shortname=OpenSER,secret=password
rlm_sql (sql): Adding client 89.107.16.10 (OpenSER) to clients list
rlm_sql (sql): Released sql socket id: 4
Module: Instantiated sql (sql)
Module: Loaded realm
realm: format = "suffix"
realm: ignore_default = no
realm: ignore_null = no
Module: Instantiated realm (suffix)
Module: Loaded files
files: usersfile = "/usr/local/etc/raddb/users"
files: acctusersfile = "/usr/local/etc/raddb/acct_users"
files: preproxy_usersfile = "/usr/local/etc/raddb/preproxy_users"
files: compat = "no"
Module: Instantiated files (files)
Module: Loaded detail
detail: detailfile =
"/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
detail: detailperm = 384
detail: dirperm = 493
detail: locking = no
Module: Instantiated detail (detail)
Module: Loaded radutmp
radutmp: filename = "/usr/local/var/log/radius/radutmp"
radutmp: username = "%{User-Name}"
radutmp: case_sensitive = yes
radutmp: check_with_nas = yes
radutmp: perm = 384
radutmp: callerid = yes
Module: Instantiated radutmp (radutmp)
Listening on authentication *:1812
Listening on accounting *:1813
Ready to process requests.
________________________________________________
Message sent using UK Grid Webmail 2.7.9
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
A.smith
2008-01-21 13:19:37 UTC
Permalink
Ah,

ok, now I see the other post regarding this. The problem is OpenSER and
this status type:

rlm_sql (sql): Unsupported Acct-Status-Type = 15

Whats the latest on this? Has the incompatibility been addressed in
freeradius 2.0?

thanks Andy.

________________________________________________
Message sent using UK Grid Webmail 2.7.9


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Alan DeKok
2008-01-21 14:02:33 UTC
Permalink
Post by A.smith
ok, now I see the other post regarding this. The problem is OpenSER and
rlm_sql (sql): Unsupported Acct-Status-Type = 15
Whats the latest on this? Has the incompatibility been addressed in
freeradius 2.0?
No. OpenSER has chosen to ignore the RFC's, and to send garbage
accounting packets to FreeRADIUS.

If you want this to work, you will need to patch the SQL module.

Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Andy Smith
2008-01-21 15:40:25 UTC
Permalink
Ok, Im seeing this from radiusd:

rad_recv: Accounting-Request packet from host 89.107.16.10:35563, id=252,
length=145
Acct-Status-Type = Failed
Service-Type = IAPP-Register
Attr-102 = 0x00000194
Error-Cause = 32
Event-Timestamp = "Jan 21 2008 15:53:44 GMT"
Attr-105 = 0x61733264636462613764
Acct-Session-Id = "***@89.107.16.9"
Attr-108 = 0x38392e3130372e31362e39
Attr-109 = 0x35303630
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = 89.107.16.10
Processing the preacct section of radiusd.conf
modcall: entering group preacct for request 0
modcall[preacct]: module "preprocess" returns noop for request 0
rlm_acct_unique: WARNING: Attribute User-Name was not found in request,
unique ID MAY be inconsistent
rlm_acct_unique: Hashing 'NAS-Port = 5060,Client-IP-Address =
89.107.16.10,NAS-IP-Address = 89.107.16.10,Acct-Session-Id =
"***@89.107.16.9",'
rlm_acct_unique: Acct-Unique-Session-ID = "df36632bb92d5086".
modcall[preacct]: module "acct_unique" returns ok for request 0
rlm_realm: Proxy reply, or no User-Name. Ignoring.
modcall[preacct]: module "suffix" returns noop for request 0
modcall[preacct]: module "files" returns noop for request 0
modcall: leaving group preacct (returns ok) for request 0
Processing the accounting section of radiusd.conf
modcall: entering group accounting for request 0
modcall[accounting]: module "unix" returns noop for request 0
radius_xlat: '/usr/local/var/log/radius/radutmp'
rlm_radutmp: NAS OpenSER port 5060 unknown packet type 15)
modcall[accounting]: module "radutmp" returns noop for request 0
radius_xlat: ''
radius_xlat: ''
radius_xlat: '/usr/local/var/log/radius/sqltrace.sql'
rlm_sql (sql): Reserving sql socket id: 3
rlm_sql (sql): Released sql socket id: 3
modcall[accounting]: module "sql" returns ok for request 0
modcall: leaving group accounting (returns ok) for request 0
Sending Accounting-Response of id 252 to 89.107.16.10 port 35563
Finished request 0
Going to the next request
--- Walking the entire request list ---
Waking up in 6 seconds...
--- Walking the entire request list ---
Cleaning up request 0 ID 252 with timestamp 4794be17
Nothing to do. Sleeping until we see a request.

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
A.smith
2008-01-21 13:42:52 UTC
Permalink
Also, regarding radius 1.x I now have a patch which allows this type of
record.
However next issue is that with accounting set to sql in radiusd.conf the
SQL statements are being written just to
/usr/local/var/log/radius/sqltrace.sql
and nothing is actually put in the database... What have I done wrong? :P

cheers Andy.

________________________________________________
Message sent using UK Grid Webmail 2.7.9


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
t***@kalik.co.yu
2008-01-21 14:26:49 UTC
Permalink
Post by A.smith
Also, regarding radius 1.x I now have a patch which allows this type of
record.
However next issue is that with accounting set to sql in radiusd.conf the
SQL statements are being written just to
/usr/local/var/log/radius/sqltrace.sql
and nothing is actually put in the database... What have I done wrong? :P
cheers Andy.
________________________________________________
Message sent using UK Grid Webmail 2.7.9
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
t***@kalik.co.yu
2008-01-21 14:27:52 UTC
Permalink
Again, send a debug with the Start and Stop packets.

Ivan Kalik
Kalik Informatika ISP
Post by A.smith
Also, regarding radius 1.x I now have a patch which allows this type of
record.
However next issue is that with accounting set to sql in radiusd.conf the
SQL statements are being written just to
/usr/local/var/log/radius/sqltrace.sql
and nothing is actually put in the database... What have I done wrong? :P
cheers Andy.
________________________________________________
Message sent using UK Grid Webmail 2.7.9
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Andy Smith
2008-01-21 18:48:58 UTC
Permalink
Anyone any ideas? I repost this as the posts are in a messed up order on the
forum page...

As per my previous mail, my current issue is that with accounting set to sql
in radiusd.conf
the SQL statements are being written just to
/usr/local/var/log/radius/sqltrace.sql
and nothing is actually put in the database... What have I done wrong?

thank u!

----- Original Message -----
From: "Andy Smith" <***@ukgrid.net>
To: "FreeRadius users mailing list" <freeradius-***@lists.freeradius.org>
Sent: Monday, January 21, 2008 4:40 PM
Subject: Re: MySQL accounting issue
Post by Andy Smith
rad_recv: Accounting-Request packet from host 89.107.16.10:35563, id=252,
length=145
Acct-Status-Type = Failed
Service-Type = IAPP-Register
Attr-102 = 0x00000194
Error-Cause = 32
Event-Timestamp = "Jan 21 2008 15:53:44 GMT"
Attr-105 = 0x61733264636462613764
Attr-108 = 0x38392e3130372e31362e39
Attr-109 = 0x35303630
NAS-Port = 5060
Acct-Delay-Time = 0
NAS-IP-Address = 89.107.16.10
Processing the preacct section of radiusd.conf
modcall: entering group preacct for request 0
modcall[preacct]: module "preprocess" returns noop for request 0
rlm_acct_unique: WARNING: Attribute User-Name was not found in request,
unique ID MAY be inconsistent
rlm_acct_unique: Hashing 'NAS-Port = 5060,Client-IP-Address =
89.107.16.10,NAS-IP-Address = 89.107.16.10,Acct-Session-Id =
rlm_acct_unique: Acct-Unique-Session-ID = "df36632bb92d5086".
modcall[preacct]: module "acct_unique" returns ok for request 0
rlm_realm: Proxy reply, or no User-Name. Ignoring.
modcall[preacct]: module "suffix" returns noop for request 0
modcall[preacct]: module "files" returns noop for request 0
modcall: leaving group preacct (returns ok) for request 0
Processing the accounting section of radiusd.conf
modcall: entering group accounting for request 0
modcall[accounting]: module "unix" returns noop for request 0
radius_xlat: '/usr/local/var/log/radius/radutmp'
rlm_radutmp: NAS OpenSER port 5060 unknown packet type 15)
modcall[accounting]: module "radutmp" returns noop for request 0
radius_xlat: ''
radius_xlat: ''
radius_xlat: '/usr/local/var/log/radius/sqltrace.sql'
rlm_sql (sql): Reserving sql socket id: 3
rlm_sql (sql): Released sql socket id: 3
modcall[accounting]: module "sql" returns ok for request 0
modcall: leaving group accounting (returns ok) for request 0
Sending Accounting-Response of id 252 to 89.107.16.10 port 35563
Finished request 0
Going to the next request
--- Walking the entire request list ---
Waking up in 6 seconds...
--- Walking the entire request list ---
Cleaning up request 0 ID 252 with timestamp 4794be17
Nothing to do. Sleeping until we see a request.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Loading...