Class attribute in accounting record.
My access provider is setting and sending me the "Class" attribute in an accounting record... I use MySQL to store such info in... and I'm using freeradius 1.1.6 in order to Capture the value - I modified all accounting "Insert" statements to.... (as an example) 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, Class) 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}', '%{Telkom-Access-Type:-!SAIX} %{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0', '%{Class}')" This captures the info fine.... (yes - also changed the MySQL table) | RadAcctId | 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 | Class | +-----------+----------------------+------------------+---------------------------------+--------------+--------------+------------+-------------+---------------------+---------------------+-----------------+---------------+-------------------+------------------+-----------------+------------------+-----------------+------------------+--------------------+-------------+----------------+-----------------+----------------+---------------+----------+ | 21488415 | 7/0/0/2.157_13B0EB0F | 32161edf2c7a5dec | xxxxxxxxxxxxxxx@xxxxxxxxxxx | realmname | 1.2.3.4 | 1879179421 | Virtual | 2007-10-29 16:15:07 | 0000-00-00 00:00:00 | 0 | RADIUS | DSL AutoShapedVC | | 0 | 0 | | | | Framed-User | PPP | 1.2.4.99 | 0 | 0 | 0x4e5331 | ... However - I get a Hex String ... 0x4e5331 - where I was expecting "NS1" Reading the RFC's (with FreeRadius documentation) - this should be a Char Octets kindof field... Should the access provider sent the string in ASCII rather? Did something in FreeRadius convert the ASCII to Hex? What can I do to convert this on the fly into ASCII - save a bit of space in my Database - etc. Reading the mailing-lists archives - I see that it can contain binary data - thus the Hex. Which is "better" - to change the dictionary definition from octet to string or some sort of mysql function call? (better ==> less things to remember/patch between updates) The access provider states that the info provided will always be ascii (or translate to ascii - if decoded). -- . . ___. .__ Posix Systems - Sth Africa /| /| / /__ mje@posix.co.za - Mark J Elkins, SCO ACE, Cisco CCIE / |/ |ARK \_/ /__ LKINS Tel: +27 12 807 0590 Cell: +27 82 601 0496
Hi Mark, The provider is obviously SAIX (ZA based ISP), Looks like SAIX are sending it through as ASCII text, on my side? Tue Sep 18 14:25:53 2007 Acct-Session-Id = "7/0/2/20.557_30429449" Framed-Protocol = PPP Framed-IP-Address = 41.242.121.175 User-Name = "XXXXXXX@dsl512.tradepage.co.za" X-Ascend-Connect-Progress = 60 Acct-Authentic = RADIUS Acct-Status-Type = Start NAS-Port-Type = Virtual NAS-Port = 1913913901 NAS-Port-Id = "7/0/2/20.557" Connect-Info = "AutoShapedVC" Class = "NS1" Service-Type = Framed-User NAS-IP-Address = 196.43.27.23 Check you /share/freeradius/dictionary file and check what you have for the Class Attribute. I have the following: dictionary:ATTRIBUTE Class 25 string Kind Regards, Michael da Silva Pereira Tradepage ;) -----Original Message----- From: Mark J Elkins <mje@posix.co.za> Reply-To: FreeRadius users mailing list <freeradius-users@lists.freeradius.org> To: freeradius-users@lists.freeradius.org Subject: Class attribute in accounting record. Date: Mon, 29 Oct 2007 16:45:14 +0200 My access provider is setting and sending me the "Class" attribute in an accounting record... I use MySQL to store such info in... and I'm using freeradius 1.1.6 in order to Capture the value - I modified all accounting "Insert" statements to.... (as an example) 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, Class) 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}', '%{Telkom-Access-Type:-!SAIX} %{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0', '%{Class}')" This captures the info fine.... (yes - also changed the MySQL table) | RadAcctId | 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 | Class | +-----------+----------------------+------------------+---------------------------------+--------------+--------------+------------+-------------+---------------------+---------------------+-----------------+---------------+-------------------+------------------+-----------------+------------------+-----------------+------------------+--------------------+-------------+----------------+-----------------+----------------+---------------+----------+ | 21488415 | 7/0/0/2.157_13B0EB0F | 32161edf2c7a5dec | xxxxxxxxxxxxxxx@xxxxxxxxxxx | realmname | 1.2.3.4 | 1879179421 | Virtual | 2007-10-29 16:15:07 | 0000-00-00 00:00:00 | 0 | RADIUS | DSL AutoShapedVC | | 0 | 0 | | | | Framed-User | PPP | 1.2.4.99 | 0 | 0 | 0x4e5331 | ... However - I get a Hex String ... 0x4e5331 - where I was expecting "NS1" Reading the RFC's (with FreeRadius documentation) - this should be a Char Octets kindof field... Should the access provider sent the string in ASCII rather? Did something in FreeRadius convert the ASCII to Hex? What can I do to convert this on the fly into ASCII - save a bit of space in my Database - etc. Reading the mailing-lists archives - I see that it can contain binary data - thus the Hex. Which is "better" - to change the dictionary definition from octet to string or some sort of mysql function call? (better ==> less things to remember/patch between updates) The access provider states that the info provided will always be ascii (or translate to ascii - if decoded). This email and all its contents are subject to the following disclaimer: "http://www.tradepage.net/disclaimer.aspx"
You can use CHAR() in the sql statement if you recieving Class attribute ASCII encoded. Ivan Kalik Kalik Informatika ISP Dana 29/10/2007, "Mark J Elkins" <mje@posix.co.za> piše:
My access provider is setting and sending me the "Class" attribute in an accounting record...
I use MySQL to store such info in... and I'm using freeradius 1.1.6
in order to Capture the value - I modified all accounting "Insert" statements to.... (as an example)
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, Class) 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}', '%{Telkom-Access-Type:-!SAIX} %{Connect-Info}', '', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '%{Acct-Delay-Time}', '0', '%{Class}')"
This captures the info fine.... (yes - also changed the MySQL table)
| RadAcctId | 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 | Class | +-----------+----------------------+------------------+---------------------------------+--------------+--------------+------------+-------------+---------------------+---------------------+-----------------+---------------+-------------------+------------------+-----------------+------------------+-----------------+------------------+--------------------+-------------+----------------+-----------------+----------------+---------------+----------+ | 21488415 | 7/0/0/2.157_13B0EB0F | 32161edf2c7a5dec | xxxxxxxxxxxxxxx@xxxxxxxxxxx | realmname | 1.2.3.4 | 1879179421 | Virtual | 2007-10-29 16:15:07 | 0000-00-00 00:00:00 | 0 | RADIUS | DSL AutoShapedVC | | 0 | 0 | | | | Framed-User | PPP | 1.2.4.99 | 0 | 0 | 0x4e5331 |
.... However - I get a Hex String ... 0x4e5331 - where I was expecting "NS1"
Reading the RFC's (with FreeRadius documentation) - this should be a Char Octets kindof field...
Should the access provider sent the string in ASCII rather? Did something in FreeRadius convert the ASCII to Hex? What can I do to convert this on the fly into ASCII - save a bit of space in my Database - etc.
Reading the mailing-lists archives - I see that it can contain binary data - thus the Hex. Which is "better" - to change the dictionary definition from octet to string or some sort of mysql function call? (better ==> less things to remember/patch between updates) The access provider states that the info provided will always be ascii (or translate to ascii - if decoded).
-- . . ___. .__ Posix Systems - Sth Africa /| /| / /__ mje@posix.co.za - Mark J Elkins, SCO ACE, Cisco CCIE / |/ |ARK \_/ /__ LKINS Tel: +27 12 807 0590 Cell: +27 82 601 0496
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Mon, 2007-10-29 at 16:45 +0200, Mark J Elkins wrote:
My access provider is setting and sending me the "Class" attribute in an accounting record...
I use MySQL to store such info in... and I'm using freeradius 1.1.6
Wisdom prevails.. (touching the dictionaries is probably a bad* thing to do...) I'm using ... accounting_stop_query_alt = "INSERT.... , UNHEX(SUBSTR('%{Class}',3)))" .. which keeps personal changes to one place (sql.conf and files in /etc/raddb) and saves me from upsetting Alan DeKok's karma* - a bad thing to do. -- . . ___. .__ Posix Systems - Sth Africa /| /| / /__ mje@posix.co.za - Mark J Elkins, Cisco CCIE / |/ |ARK \_/ /__ LKINS Tel: +27 12 807 0590 Cell: +27 82 601 0496
Mark Elkins wrote:
.. which keeps personal changes to one place (sql.conf and files in /etc/raddb) and saves me from upsetting Alan DeKok's karma* - a bad thing to do.
<shrug> The files are editable for a reason. If all you see is ASCII "Class" attributes, add the following to the bottom of raddb/dictionary: ATTRIBUTE Class 25 string Alan DeKok.
participants (5)
-
Alan DeKok -
Mark Elkins -
Mark J Elkins -
Michael da Silva Pereira -
tnt@kalik.co.yu