(RADIATOR) Probelm with Session DB

Tom Daly tomdaly at metro2000.net
Fri Aug 10 13:46:53 CDT 2001


Hugh,

I have finally achieved the SessonDB thing that I have wanted from day one. Take a look at this config.

<AuthBy GROUP>
        Identifier Metro2000Auth
        RewriteUsername s/^METRO2000\/(.*)$/$1/
        AuthByPolicy ContinueWhileReject   
        <AuthBy EMERALD>
                DBSource        dbi:FreeTDS:database=xxx;host=xxx.net;port=1433
                DBUsername      xxx
                DBAuth          xxx
        
                # You can add to or change these if you want.
                AccountingTable calls
                AcctColumnDef   UserName,User-Name
                AcctColumnDef   CallDate,Timestamp,integer-date
                AcctColumnDef   AcctStatusType,Acct-Status-Type,integer
                AcctColumnDef   AcctDelayTime,Acct-Delay-Time,integer
                AcctColumnDef   AcctInputOctets,Acct-Input-Octets,integer
                AcctColumnDef   AcctOutputOctets,Acct-Output-Octets,integer
                AcctColumnDef   AcctSessionId,Acct-Session-Id
                AcctColumnDef   AcctSessionTime,Acct-Session-Time,integer
                AcctColumnDef   AcctTerminateCause,Acct-Terminate-Cause,integer
                AcctColumnDef   NASIdentifier,NAS-IP-Address
                AcctColumnDef   UserService,Service-Type,integer
                AcctColumnDef   FramedProtocol,Framed-Protocol,integer
                AcctColumnDef   FramedAddress,Framed-IP-Address
                AcctColumnDef   NASPortType,NAS-Port-Type,integer
                AcctColumnDef   NASPortDNIS,Called-Station-Id
                AcctColumnDef   CallerID,Calling-Station-Id

                AuthSelect
        </AuthBy>

       <AuthBy SQL>
        DBSource        dbi:mysql:database=xxx;host=127.0.0.1;port=3306;
        DBUsername      xxx
        DBAuth          xxx
        AuthSelect select UName,UPass,SesLmt,SvcType,FrmProto,FrmIPAddr,FrmIPMask,FrmMTU,FrmCmpr,FrmRoute,IdleTtl,PortLmt fro$
        AuthColumnDef 0, User-Name, check
        AuthColumnDef 1, User-Password, check
        AuthColumnDef 2, Simultaneous-Use, check
        AuthColumnDef 3, Service-Type, reply
        AuthColumnDef 4, Framed-Protocol, reply
        AuthColumnDef 5, Framed-IP-Address, reply
        AuthColumnDef 6, Framed-IP-Netmask, reply
        AuthColumnDef 7, Framed-MTU, reply
        AuthColumnDef 8, Framed-Compression, reply
        AuthColumnDef 9, Framed-Route, reply
        AuthColumnDef 10, Idle-Timeout, reply
        AuthColumnDef 11, Port-Limit, reply
        DefaultSimultaneousUse 2
        </AuthBy>
                
        <AuthBy FILE>
        Filename %D/users
        DefaultSimultaneousUse 2
        </AuthBy>
                
        AuthLog g4logger
        AuthLog g4faillogger                
</AuthBy>

<Handler>
        RewriteUsername s/^(.*)$/METRO2000\/$1/
        AuthBy Metro2000Auth
</Handler>

This works great because now my session database shows METRO2000/username for every login, which seperates all of my wholesalers very very nicely. However, this broke simultaneous use checking. 

Take a look at this trace. 
        User-Name = "test"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        Called-Station-Id = "123456789"
        Calling-Station-Id = "987654321"
        NAS-Port-Type = Async
        User-Password = "<<158><25><141><188><238>>F[<19>o<166><170>3<161>L"

Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......3400/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......0286/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......0536/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......0540/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......1677/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......2776/ should be used to handle this request
Fri Aug 10 14:26:35 2001: DEBUG: Check if Handler Called-Station-Id=/......4932/ should be used to handle this request
--
Fri Aug 10 14:26:35 2001: DEBUG: Rewrote user name to METRO2000/test
Fri Aug 10 14:26:35 2001: DEBUG:  Deleting session for test, 203.63.154.1, 1234
Fri Aug 10 14:26:35 2001: DEBUG: do query is: delete from RADONLINE where NASIDENTIFIER='203.63.154.1' and NASPORT=01234

Fri Aug 10 14:26:35 2001: DEBUG: Handling with Radius::AuthGROUP
Fri Aug 10 14:26:35 2001: DEBUG: Rewrote user name to test
Fri Aug 10 14:26:35 2001: DEBUG: Handling with Radius::AuthEMERALD
Fri Aug 10 14:26:35 2001: DEBUG: Handling with Radius::AuthSQL
Fri Aug 10 14:26:35 2001: DEBUG: Handling with Radius::AuthSQL
Fri Aug 10 14:26:35 2001: DEBUG: Query is: select UName,UPass,SesLmt,SvcType,FrmProto,FrmIPAddr,FrmIPMask,FrmMTU,FrmCmpr,FrmRoute,IdleTtl,PortLmt from auth where UName = 'test'

Fri Aug 10 14:26:35 2001: DEBUG: Radius::AuthSQL looks for match with test
Fri Aug 10 14:26:35 2001: DEBUG: Query is: select NASIDENTIFIER, NASPORT, ACCTSESSIONID, FRAMEDIPADDRESS from RADONLINE where USERNAME= 'test'

Fri Aug 10 14:26:35 2001: DEBUG: Radius::AuthSQL ACCEPT: 
Fri Aug 10 14:26:35 2001: DEBUG: Access accepted for test
Fri Aug 10 14:26:35 2001: DEBUG: Packet dump:
*** Sending to 216.177.0.15 port 1142 ....
Code:       Access-Accept
Identifier: 46
Authentic:  1234567890123456
Attributes:
        Framed-IP-Address = 255.255.255.254
        Idle-Timeout = 1200
        Port-Limit = 1
        Service-Type = 2
        Framed-Protocol = 1
        Framed-IP-Netmask = 255.255.255.255
        Framed-MTU = 1500
        Framed-Compression = 0

--
        User-Name = "test"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Start
        Called-Station-Id = "123456789"
        Calling-Station-Id = "987654321"
        Framed-IP-Address = 255.255.255.254

Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......3400/ should be used to handle this request
Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......0286/ should be used to handle this request
Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......0536/ should be used to handle this request
Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......0540/ should be used to handle this request
Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......1677/ should be used to handle this request
--
Fri Aug 10 14:26:36 2001: DEBUG: Rewrote user name to METRO2000/test
Fri Aug 10 14:26:36 2001: DEBUG:  Adding session for test, 203.63.154.1, 1234
Fri Aug 10 14:26:36 2001: DEBUG: do query is: delete from RADONLINE where NASIDENTIFIER='203.63.154.1' and NASPORT=01234

Fri Aug 10 14:26:36 2001: DEBUG: do query is: insert into RADONLINE (USERNAME, NASIDENTIFIER, NASPORT, ACCTSESSIONID, TIME_STAMP, FRAMEDIPADDRESS,NASPORTTYPE, SERVICETYPE, CLID, DNIS) values ('METRO2000/test', '203.63.154.1', 1234, '00001234', 997467996, '255.255.255.254', 'Async', 'Framed-User','987654321','123456789')

Fri Aug 10 14:26:36 2001: DEBUG: Handling with Radius::AuthGROUP
Fri Aug 10 14:26:36 2001: DEBUG: Rewrote user name to test
Fri Aug 10 14:26:36 2001: DEBUG: Handling with Radius::AuthEMERALD
Fri Aug 10 14:26:36 2001: DEBUG: Handling accounting with Radius::AuthEMERALD
Fri Aug 10 14:26:36 2001: DEBUG: do query is: insert into calls
                (UserName, CallDate, AcctStatusType, AcctSessionId, NASIdentifier, NASPort, UserService, FramedAddress, NASPortType, NASPortDNIS, CallerID) 
                values 
                ('test', 'Aug 10, 2001 14:26', 1, '00001234', '203.63.154.1', 1234, 2, '255.255.255.254', 0, '123456789', '987654321')

Fri Aug 10 14:26:36 2001: DEBUG: Accounting accepted
Fri Aug 10 14:26:36 2001: DEBUG: Packet dump:
*** Sending to 216.177.0.15 port 1142 ....
Code:       Accounting-Response
Identifier: 47
Authentic:  <221><194>E<20><243><145><9><184><4>r<0><210><127><170><226>S
Attributes:

Fri Aug 10 14:26:36 2001: DEBUG: SNMPAgent: received request 129, 1840502690, metro2000private
Fri Aug 10 14:26:36 2001: DEBUG: Packet dump:
*** Received from 216.177.0.15 port 1142 ....
Code:       Accounting-Request
Identifier: 48
Authentic:  <253><251><217>7<223>Bj<136>G<5><140><152>ky4<203>
--
        User-Name = "test"
        Service-Type = Framed-User
        NAS-IP-Address = 203.63.154.1
        NAS-Port = 1234
        NAS-Port-Type = Async
        Acct-Session-Id = "00001234"
        Acct-Status-Type = Stop
        Called-Station-Id = "123456789"
        Calling-Station-Id = "987654321"
        Framed-IP-Address = 255.255.255.254
        Acct-Delay-Time = 0
        Acct-Session-Time = 1000
        Acct-Input-Octets = 20000
        Acct-Output-Octets = 30000

Fri Aug 10 14:26:36 2001: DEBUG: Check if Handler Called-Station-Id=/......3400/ should be used to handle this request
--
Fri Aug 10 14:26:36 2001: DEBUG: Rewrote user name to METRO2000/test
Fri Aug 10 14:26:36 2001: DEBUG:  Deleting session for test, 203.63.154.1, 1234
Fri Aug 10 14:26:36 2001: DEBUG: do query is: delete from RADONLINE where NASIDENTIFIER='203.63.154.1' and NASPORT=01234

Fri Aug 10 14:26:36 2001: DEBUG: Handling with Radius::AuthGROUP
Fri Aug 10 14:26:36 2001: DEBUG: Rewrote user name to test
Fri Aug 10 14:26:36 2001: DEBUG: Handling with Radius::AuthEMERALD
Fri Aug 10 14:26:36 2001: DEBUG: Handling accounting with Radius::AuthEMERALD
Fri Aug 10 14:26:36 2001: DEBUG: do query is: insert into calls
                (UserName, CallDate, AcctStatusType, AcctDelayTime, AcctInputOctets, AcctOutputOctets, AcctSessionId, AcctSessionTime, NASIdentifier, NASPort, UserService, FramedAddress, NASPortType, NASPortDNIS, CallerID) 
                values 
                ('test', 'Aug 10, 2001 14:26', 2, 0, 20000, 30000, '00001234', 1000, '203.63.154.1', 1234, 2, '255.255.255.254', 0, '123456789', '987654321')


These are my SessionDB Queries: 

CountQuery select NASIDENTIFIER, NASPORT, ACCTSESSIONID, FRAMEDIPADDRESS from RADONLINE where USERNAME= '%u'
        
AddQuery insert into RADONLINE (USERNAME, NASIDENTIFIER, NASPORT, ACCTSESSIONID, TIME_STAMP, FRAMEDIPADDRESS,\
NASPORTTYPE, SERVICETYPE, CLID, DNIS) values ('%n', '%N', %{NAS-Port}, '%{Acct-Session-Id}', %{Timestamp}, \
'%{Framed-IP-Address}', '%{NAS-Port-Type}', '%{Service-Type}','%{Calling-Station-Id}','%{Called-Station-Id}')


Now, I believe the problem here is the point at which the CountQuery happens. The AddQuery occurs between the time just after I add METRO2000\ to the username, but the CountQuery happens after the METRO2000\ is stripped off in the AuthBy Metro2000Auth Section. Is there a way to modify this so I can fix my simultaneous use checking?

Any help would be great, Thanks in advance,

Tom Daly
Network Operations Administrator
G4 Communications Corp. / Metro2000 Internet Services
V: 603.296.4413 / F: 603.647.7576
E: tomdaly at metro2000.net / W3: www.metro2000.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.open.com.au/pipermail/radiator/attachments/20010810/d93803f4/attachment.html>


More information about the radiator mailing list