freeradius- update radacct

Oguzhan Kayhan oguzhank at bilkent.edu.tr
Tue Oct 28 12:13:22 CET 2008


Hello,
I have freeradius virtual configurations.
Until today all were working without a problem.
But today i created a new one and i have a tiny problem about it.
It doesnt update sql queries until the user logs off. SO i can not track
the statistics of online users and transferred data etc via mysql.
But as i see freeradius gets the following packets below in normal intervals
And if it was an error about sql.conf i think it wont write the data when
user disconnected too.It just does not update the online users data..and i
wonder why..Seems like it does not create user data at the begining so it
can not update the data too.



-----------------------------------------------------------------
expand:            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}') ->            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             ('4906e32a00000001',
'83f3f3b94fce6dc1',              '7798-1',              '',
'192.168.182.1', '1',              'Wireless-802.11',             
DATE_SUB('2008-10-28 13:01:21',                       INTERVAL (3401 +    
                            0) SECOND),                       '3401',     
        '', '',              '0' << 32 |              '34293752',         
    '0' << 32 |              '1270253',              '00-0E-0C-6E-6E-7C',
'00-14-22-A1-BB-AB',              '', '',              '192.168.182.2',   
          '0', '')
        NAS-IP-Address = 192.168.182.1
--------------------------------------------------

This is the virtual config and sql.conf parameters i am using (which are
same of the previous virtual servers actually)


-------------------------
server lojnet {

authorize {
                                preprocess
                                files
                                update control {
                                     Auth-Type := perl
                                              }
                                perl_lojnet
                        }

                authenticate {

                        Auth-Type Perl       {
                                        perl_lojnet
                                        }
                             }


                preacct  {
                                acct_unique
                                files
                         }



                accounting {
                                detail
                                unix
                                sql_lojnet
                           }
                session {
                        sql_lojnet
                        }

                post-auth {
                        exec
                        Post-Auth-Type REJECT {
                        attr_filter.access_reject
                                              }
                         }

-----------------------------------

and the sql part belongs to this virtual server

--------------------------------------
sql sql_lojnet {
        database = "mysql"

        driver = "rlm_sql_${database}"

        # Connection info:
        server = "xxxxxxxxx"
        login = "xxxxxxxxx"
        password = "xxxxxxxxxx"

        # Database table configuration for everything except Oracle
        radius_db = "lojnet"

        acct_table1 = "radacct"
        acct_table2 = "radacct"

        # Allow for storing data after authentication
        postauth_table = "radpostauth"

        authcheck_table = "radcheck"
        authreply_table = "radreply"

        groupcheck_table = "radgroupcheck"
        groupreply_table = "radgroupreply"

       # Table to keep group info
        usergroup_table = "usergroup"

        # If set to 'yes' (default) we read the group tables
        # If set to 'no' the user MUST have Fall-Through = Yes in the
radreply table
        # read_groups = yes

        # Remove stale session if checkrad does not see a double login
        deletestalesessions = yes

        # Print all SQL statements when in debug mode (-x)
        sqltrace = no
        sqltracefile = ${logdir}/sqltrace.sql

        # number of sql connections to make to server
        num_sql_socks = 5

        # number of seconds to dely retrying on a failed database
        # connection (per_socket)

       # number of seconds to dely retrying on a failed database
        # connection (per_socket)
        connect_failure_retry_delay = 60

        #readclients = yes

         # Table to keep radius client info
        nas_table = "nas"

        # Read driver-specific configuration
        $INCLUDE sql/${database}/dialup.conf
}







More information about the Freeradius-Users mailing list