Log a Vendor-Specific Value
Hi, I have some problems with radius. I want to log the Value (an integer) in my Vendor-Specific attribute to a mysql database. I use %'{Vendor-Specific}' as variable to write it to the database but it always writes 0x25ce0000010630390000 to the database instead of the Value. At the system where you have to authenticate I put the following variables into the radiuspacket: Vendor-Id = 9678 --> is registered at http://beta.iana.org/assignments/enterprise-numbers Vendor-Type<http://beta.iana.org/assignments/enterprise-numbers%0AVendor-Type> = 1 Vendor-Length = 6 Vendor-Value = 12345 When I use radsniff at the radius server, I can see: Packet number 1 has just been sniffed From: 10.0.2.1:55822 To: 10.0.2.2:1813 Type: Accounting-Request Acct-Status-Type = Interim-Update NAS-Port = 167772161 Service-Type = Framed-User Framed-IP-Address = 10.0.0.1 Acct-Input-Octets = 4249838 Acct-Output-Octets = 4056840 Acct-Input-Packets = 5326 Acct-Output-Packets = 2655 NAS-Identifier = "bcrouter" Acct-Session-Id = "167772161" User-Name = "stage/stage" ------>Vendor-Specific = 0x25ce0000010630390000<------ Packet number 2 has just been sniffed From: 10.0.2.2:1813 To: 10.0.2.1:55822 Type: Accounting-Response If you disassamble 0x25ce0000010630390000: (25ce)16 -> (9678)10 (00 0001)16 -> (1)10 (06)16 -> (6)10 30390000 -> (0000 3039)16 -> (12345)10 So this seems to be right. Somewhere it's logic that if you use %'{Vendor-Specific}' as variable in the query, that you will store 0x25ce0000010630390000. But how am I able to store 12345 into the database? I also tried to use %'{KULeuven-Test}' and just %'{Test}', but those variables are just empty... This is my dictionary: VENDOR KULeuven 9678 BEGIN-VENDOR KULeuven ATTRIBUTE KULeuven-Test 1 integer VALUE KULeuven-Test Test 12345 END-VENDOR KULeuven Thank you in advance, -- Jeroen Vanderauwera
Hi, I have some problems with radius. I want to log the Value (an integer) in my Vendor-Specific attribute to a mysql database. I use %'{Vendor-Specific}' as variable to write it to the database but it always writes 0x25ce0000010630390000 to the database instead of the Value.
That *is* the value of that attribute. Use perl module to decode the attribute. Place decoded value in the attribute you created in raddb/dictionary (or in one of the temporary attributes defined in dictionary.freeradius.internal) and write that into the database. Ivan Kalik Kalik Informatika ISP
Jeroen Vanderauwera wrote:
I have some problems with radius. I want to log the Value (an integer) in my Vendor-Specific attribute to a mysql database. I use %'{Vendor-Specific}' as variable to write it to the database but it always writes 0x25ce0000010630390000 to the database instead of the Value.
That is the value of %{Vendor-Specific}
At the system where you have to authenticate I put the following variables into the radiuspacket: Vendor-Id = 9678 --> is registered at http://beta.iana.org/assignments/enterprise-numbers Vendor-Type <http://beta.iana.org/assignments/enterprise-numbers%0AVendor-Type> = 1 Vendor-Length = 6 Vendor-Value = 12345
You've created the dictionary file entry for that... but aren't using the dictionary name you created. Why?
So this seems to be right. Somewhere it's logic that if you use %'{Vendor-Specific}' as variable in the query, that you will store 0x25ce0000010630390000.
Yes, that *IS* the value of Vendor-Specific.
But how am I able to store 12345 into the database? I also tried to use %'{KULeuven-Test}' and just %'{Test}', but those variables are just empty...
Because that isn't the correct format. Really. Why are you using %{Vendor-Specific}, and %'{KULeuven-Test}' ? Why the *extra* quotes in your VSA? Why not just %{KULeuven-Test} ? Adding the extra quote marks '..' is breaking it. Alan DeKok.
Hi, I'm sorry I mistyped. I meant '%{KULeuven}' instead of %'{KULeuven}'. So you guys think I need to use that variable? Here's my query: accounting_update_query_alt = " \ INSERT INTO ${acct_table1} \ (acctsessionid, acctuniqueid, username, \ realm, nasipaddress, nasportid, \ nasporttype, acctstarttime, acctsessiontime, \ acctauthentic, connectinfo_start, acctinputoctets, \ acctoutputoctets, calledstationid, callingstationid, \ servicetype, framedprotocol, framedipaddress, \ acctstartdelay, xascendsessionsvrkey, \ vendorspecific, acctinputpackets, acctoutputpackets) \ 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}', \ '%{KULeuven-Test}', '%{Acct-Input-Packets}', \ '%{Acct-Output-Packets}')" With freeradius -X, I see in the queries that are printed out, that this variable is empty... On Fri, May 15, 2009 at 3:14 PM, Alan DeKok <aland@deployingradius.com>wrote:
Jeroen Vanderauwera wrote:
I have some problems with radius. I want to log the Value (an integer) in my Vendor-Specific attribute to a mysql database. I use %'{Vendor-Specific}' as variable to write it to the database but it always writes 0x25ce0000010630390000 to the database instead of the Value.
That is the value of %{Vendor-Specific}
At the system where you have to authenticate I put the following variables into the radiuspacket: Vendor-Id = 9678 --> is registered at http://beta.iana.org/assignments/enterprise-numbers Vendor-Type <http://beta.iana.org/assignments/enterprise-numbers%0AVendor-Type> = 1 Vendor-Length = 6 Vendor-Value = 12345
You've created the dictionary file entry for that... but aren't using the dictionary name you created.
Why?
So this seems to be right. Somewhere it's logic that if you use %'{Vendor-Specific}' as variable in the query, that you will store 0x25ce0000010630390000.
Yes, that *IS* the value of Vendor-Specific.
But how am I able to store 12345 into the database? I also tried to use %'{KULeuven-Test}' and just %'{Test}', but those variables are just empty...
Because that isn't the correct format. Really.
Why are you using %{Vendor-Specific}, and %'{KULeuven-Test}' ?
Why the *extra* quotes in your VSA? Why not just
%{KULeuven-Test}
?
Adding the extra quote marks '..' is breaking it.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
'%{KULeuven-Test}' and %'{KULeuven-Test}' instead of '%{KULeuven}' and %'{KULeuven}', sorry again. On Fri, May 15, 2009 at 3:52 PM, Jeroen Vanderauwera <bcrouterproject@gmail.com> wrote:
Hi, I'm sorry I mistyped. I meant '%{KULeuven}' instead of %'{KULeuven}'. So you guys think I need to use that variable? Here's my query:
accounting_update_query_alt = " \ INSERT INTO ${acct_table1} \ (acctsessionid, acctuniqueid, username, \ realm, nasipaddress, nasportid, \ nasporttype, acctstarttime, acctsessiontime, \ acctauthentic, connectinfo_start, acctinputoctets, \ acctoutputoctets, calledstationid, callingstationid, \ servicetype, framedprotocol, framedipaddress, \ acctstartdelay, xascendsessionsvrkey, \ vendorspecific, acctinputpackets, acctoutputpackets) \ 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}', \ '%{KULeuven-Test}', '%{Acct-Input-Packets}', \ '%{Acct-Output-Packets}')" With freeradius -X, I see in the queries that are printed out, that this variable is empty...
On Fri, May 15, 2009 at 3:14 PM, Alan DeKok <aland@deployingradius.com> wrote:
Jeroen Vanderauwera wrote:
I have some problems with radius. I want to log the Value (an integer) in my Vendor-Specific attribute to a mysql database. I use %'{Vendor-Specific}' as variable to write it to the database but it always writes 0x25ce0000010630390000 to the database instead of the Value.
That is the value of %{Vendor-Specific}
At the system where you have to authenticate I put the following variables into the radiuspacket: Vendor-Id = 9678 --> is registered at http://beta.iana.org/assignments/enterprise-numbers Vendor-Type <http://beta.iana.org/assignments/enterprise-numbers%0AVendor-Type> = 1 Vendor-Length = 6 Vendor-Value = 12345
You've created the dictionary file entry for that... but aren't using the dictionary name you created.
Why?
So this seems to be right. Somewhere it's logic that if you use %'{Vendor-Specific}' as variable in the query, that you will store 0x25ce0000010630390000.
Yes, that *IS* the value of Vendor-Specific.
But how am I able to store 12345 into the database? I also tried to use %'{KULeuven-Test}' and just %'{Test}', but those variables are just empty...
Because that isn't the correct format. Really.
Why are you using %{Vendor-Specific}, and %'{KULeuven-Test}' ?
Why the *extra* quotes in your VSA? Why not just
%{KULeuven-Test}
?
Adding the extra quote marks '..' is breaking it.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
'%{KULeuven-Test}' and %'{KULeuven-Test}' instead of '%{KULeuven}' and %'{KULeuven}', sorry again.
None of them are sent in the accounting request. But you say you can calculate them from attribute Vendor-Specific that is sent. So calculate them in perl and store them in the database (it will be something like '%{control:KULeuven}'). Or send them in the accounting packet. Ivan Kalik Kalik Informatika ISP
Jeroen Vanderauwera wrote:
I'm sorry I mistyped. I meant '%{KULeuven}' instead of %'{KULeuven}'. So you guys think I need to use that variable?
Perhaps my message wasn't clear. You need to use the name that YOU DEFINED in the dictionary. Using ANOTHER name means that you are not referring to the attribute that YOU DEFINED in the dictionary. Using another name means that you are referring to an attribute that DOES NOT EXIST. In addition, READ THE FAQ. See "it doesn't work". Run the server in debugging mode. Look at the Access-Request. If the VSA that YOU DEFINED shows up by name, then refer to it USING THAT NAME. If it doesn't show up, then either the NAS isn't sending it, *or* you didn't edit the dictionaries properly. Alan DeKok.
participants (3)
-
Alan DeKok -
Ivan Kalik -
Jeroen Vanderauwera