Insert Realm in mysql

Rabidinov M.A. tuxper at mail.ru
Sat Mar 27 07:07:30 CET 2010


Hello, Freeradius-users.

I use freeradius 2.1.8 with MySQL.
Freeradius doesn't insert realm into radacct table.

Config:

iptv:~ # grep -v '#' /etc/raddb/sql/mysql/dialup.conf
.....
        accounting_start_query = " \
          INSERT INTO ${acct_table1} \
            (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, service_info) \
          VALUES \
            ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', \
             '%{SQL-User-Name}', \
             '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', \
             '%{NAS-Port-Type}', '%S', NULL, \
             '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}','%{Cisco-Service-Info}')"
.....

iptv:~ # grep -v '#' /etc/raddb/sites-enabled/default
authorize {
        preprocess
        chap
        mschap
        suffix
        sql
        expiration
        logintime
        pap
}

#############################################

Debug:
.........
rad_recv: Accounting-Request packet from host xx.xx.64.94 port 1646, id=219, length=191
        Acct-Session-Id = "0000029D"
        Framed-Protocol = PPP
        User-Name = "tuxper at un"
        Cisco-AVPair = "connect-progress=Call Up"
        Acct-Authentic = RADIUS
        Acct-Status-Type = Start
        Calling-Station-Id = "00-26-b6-11-7b-84"
        NAS-Port-Type = Virtual
        NAS-Port = 0
        NAS-Port-Id = "0/0/2/25"
        Cisco-AVPair = "client-mac-address=0026.b611.7b84"
        Service-Type = Framed-User
        NAS-IP-Address = xx.xx.64.94
        Acct-Delay-Time = 0
+- entering group preacct {...}
++[preprocess] returns ok
[acct_unique] Hashing 'NAS-Port = 0,Client-IP-Address = xx.xx.64.94,NAS-IP-Address = xx.xx.64.94,Acct-Session-Id = "0000029D",User-Name = "tuxper at un"'
[acct_unique] Acct-Unique-Session-ID = "cb3670aee40aafa5".
++[acct_unique] returns ok
[suffix] Looking up realm "un" for User-Name = "tuxper at un"
[suffix] No such realm "un"
++[suffix] returns noop
[ntdomain] No '\' in User-Name = "tuxper at un", looking up realm NULL
[ntdomain] No such realm "NULL"
++[ntdomain] returns noop
++[files] returns noop
+- entering group accounting {...}
[detail]        expand: /var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d -> /var/log/radius/radacct/xx.xx.64.94/detail-20100327
[detail] /var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d expands to /var/log/radius/radacct/xx.xx.64.94/detail-20100327
[detail]        expand: %t -> Sat Mar 27 12:08:37 2010
++[detail] returns ok
++[unix] returns ok
[radutmp]       expand: /var/log/radius/radutmp -> /var/log/radius/radutmp
[radutmp]       expand: %{User-Name} -> tuxper at un
++[radutmp] returns ok
[sql]   expand: %{User-Name} -> tuxper at un
[sql] sql_set_user escaped user --> 'tuxper at un'
[sql]   expand: %{Acct-Delay-Time} -> 0
[sql]   expand:            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, service_info)           VALUES             ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}',              '%{SQL-User-Name}',              '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}',              '%{NAS-Port-Type}', '%S', NULL,              '0', '%{Acct-Authentic}', '%{Connect-Info}',              '', '0', '0',              '%{Called-Station-Id}', '%{Calling-Station-Id}', '',              '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP
[sql]   expand: /var/log/radius/sqltrace.sql -> /var/log/radius/sqltrace.sql
rlm_sql (sql): Reserving sql socket id: 2
rlm_sql_mysql: 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, service_info)           VALUES             ('0000029D', 'cb3670aee40aafa5',              'tuxper at un',              '', 'xx.xx.64.94', '0/0/2/25',              'Virtual', '2010-03-27 12:08:37', NULL,              '0', 'RADIUS', '',              '', '0', '0',              '', '00-26-b6-11-7b-84', '',              'Framed-User', 'PPP', '',              '0', '0', '','')
rlm_sql (sql): Released sql socket id: 2
++[sql] returns ok
....


As seen, there is no any data in %{Realm}.

-- 
С уважением,
 Rabidinov                          mailto:tuxper at mail.ru





More information about the Freeradius-Users mailing list