I work on a Hotspot Project with Coova Chilli and Freeradius.
I Use FreeRADIUS in the latest stable Version 3.0.11.I created my rest and sites-enabled config file according to this post:
Configuring rlm_rest module in FreeRadiusSadly, there is no Information about setting up accounting via rest, so i tried following:
sites-enabled/default:accounting { rest detail unix exec attr_filter-accounting_response }
mods-enabled/rest:
accounting { uri = "${..connect_uri}/aaa/accounting/sessions/%{Acct-Unique-Session-ID}" method = 'post' body = 'json' }
But no Data is send to my REST Service. There is just an empty String given…
In FreeRadius debug mode (radiusd -X) following is printed:
(10) accounting { rlm_rest (rest): Reserved connection (13) (10) rest: Expanding URI components (10) rest: EXPAND http://SERVERIP:PORT (10) rest: --> http://SERVERIP:PORT (10) rest: EXPAND /radius/rest/aaa/accounting/sessions/%{Acct-Unique-Session-ID} (10) rest: --> /radius/rest/aaa/accounting/sessions/8f7d662e6afaaa0427598e03cc908379 (10) rest: Sending HTTP POST to "http://SERVERIP:PORT/radius/rest/aaa/accounting/sessions/8f7d662e6afaaa0427598e03cc908379" (10) rest: Encoding attribute "User-Name" (10) rest: Encoding attribute "NAS-IP-Address" (10) rest: Encoding attribute "Service-Type" (10) rest: Encoding attribute "Called-Station-Id" (10) rest: Encoding attribute "Calling-Station-Id" (10) rest: Encoding attribute "NAS-Identifier" (10) rest: Encoding attribute "NAS-Port-Type" (10) rest: Encoding attribute "Acct-Status-Type" (10) rest: Encoding attribute "Acct-Input-Octets" (10) rest: Encoding attribute "Acct-Output-Octets" (10) rest: Encoding attribute "Acct-Session-Id" (10) rest: Encoding attribute "Acct-Session-Time" (10) rest: Encoding attribute "Acct-Input-Packets" (10) rest: Encoding attribute "Acct-Output-Packets" (10) rest: Encoding attribute "Acct-Input-Gigawords" (10) rest: Encoding attribute "Acct-Output-Gigawords" (10) rest: Encoding attribute "Event-Timestamp" (10) rest: Encoding attribute "ChilliSpot-Version" (10) rest: Returning 1022 bytes of JSON data (buffer full or chunk exceeded) (10) rest: Encoding attribute "ChilliSpot-Max-Total-Gigawords" (10) rest: Encoding attribute "FreeRADIUS-Acct-Session-Start-Time" (10) rest: Encoding attribute "WISPr-Location-ID" (10) rest: Encoding attribute "WISPr-Location-Name" (10) rest: Encoding attribute "Acct-Unique-Session-Id" (10) rest: Encoding attribute "Attr-26.14559.40" (10) rest: Encoding attribute "Attr-26.14559.41" (10) rest: Encoding attribute "Attr-26.14559.42" (10) rest: Processing response header (10) rest: Status : 100 (Continue) (10) rest: Continuing... (10) rest: Processing response header (10) rest: ERROR: Malformed HTTP header: Missing HTTP version (10) rest: ERROR: Received 19 bytes of response data: Content-Length: 0 (10) rest: ERROR: Request failed: 23 - Failed writing received data to disk/application (10) rest: ERROR: Server returned no data rlm_rest (rest): Released connection (13) rlm_rest (rest): Need 1 more connections to reach 10 spares rlm_rest (rest): Opening additional connection (15), 1 of 30 pending slots used rlm_rest (rest): Connecting to "http://SERVERIP:PORT/radius/rest" (10) [rest] = fail (10) } # accounting = fail
If i try a test like this (just a incomplete sample in the JSON specification of rest module):
curl -X POST -H "Content-Type: application/json" --data '{ "User-Name": {"type":"string","value":["elise"]}, "NAS-IP-Address": {"type":"ipaddr","value":["10.1.0.1"]}, "NAS-Port": {"type":"integer","value":["1"]}, "Framed-IP-Address": {"type":"ipaddr","value":["10.1.0.177"]}, "Called-Station-Id": {"type":"string","value":["B8-AC-6F-8D-00-CA"]}, "NAS-Identifier": {"type":"string","value":["nas01"]}, "Acct-Status-Type": {"type":"integer","value":[1]}, "Acct-Session-Id": {"type":"string","value":["56f00f8100000000"]}, "Event-Timestamp": {"type":"date","value":["Jul 29 2015 16:06:40 CEST"]}, "WISPr-Location-ID": {"type":"string","value":["isocc=,cc=,ac=,network=MeteringService_GmbH,"]}, "WISPr-Location-Name": {"type":"string","value":["KomDSL_Hotspot"]}, "Acct-Unique-Session-Id": {"type":"string","value":["8f7d662e6afaaa0427598e03cc908379"]} } ' http://SERVER_PATH/aaa/accounting/sessions/8f7d662e6afaaa0427598e03cc908379
everything is fine, so my REST service seems to work….
The other Sections (authenticate etc.) are working with method=’get’ and everything is fine.
Has anybody implemented this feature and can help me?
Following the answers on serverfaul.com maybe Arran Cudbard-Bell has an answer?
I’m looking forward for your help!
Answer
The attribute data
is missing in rest configuration.
In mods-enabled/rest:
accounting {
uri = "${..connect_uri}/aaa/accounting/sessions/%{Acct-Unique-Session-ID}"
method = 'post'
body = 'json'
data = '{ "User-Name": {"type":"string","value":["elise"]}, "NAS-IP-Address": {"type":"ipaddr","value":["10.1.0.1"]}, "NAS-Port": {"type":"integer","value":["1"]}, "Framed-IP-Address": {"type":"ipaddr","value":["10.1.0.177"]}, "Called-Station-Id": {"type":"string","value":["B8-AC-6F-8D-00-CA"]}, "NAS-Identifier": {"type":"string","value":["nas01"]}, "Acct-Status-Type": {"type":"integer","value":[1]}, "Acct-Session-Id": {"type":"string","value":["56f00f8100000000"]}, "Event-Timestamp": {"type":"date","value":["Jul 29 2015 16:06:40 CEST"]}, "WISPr-Location-ID": {"type":"string","value":["isocc=,cc=,ac=,network=MeteringService_GmbH,"]}, "WISPr-Location-Name": {"type":"string","value":["KomDSL_Hotspot"]}, "Acct-Unique-Session-Id": {"type":"string","value":["8f7d662e6afaaa0427598e03cc908379"]} }'
}
Note you must substitute the example data by the Attributes provided by FreeRadius, like %{User-Name}
Attribution
Source : Link , Question Author : Lukas S , Answer Author : user413592