首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rlm_rest模块自由计算

rlm_rest模块自由计算
EN

Server Fault用户
提问于 2016-03-22 12:11:54
回答 1查看 2.7K关注 0票数 0

我在Coova Chilli和Freeradius的热点项目工作。我在最新的稳定版本3.0.11中使用FreeRADIUS。

我根据以下文章创建了我的rest和启用站点的配置文件:配置rlm_FreeRadius中的rest模块

遗憾的是,没有关于通过rest设置会计的信息,因此我尝试如下:启用站点/默认设置:

代码语言:javascript
复制
accounting {
    rest
    detail
    unix
    exec
    attr_filter-accounting_response
}

mods-启用/休息:

代码语言:javascript
复制
accounting {
        uri = "${..connect_uri}/aaa/accounting/sessions/%{Acct-Unique-Session-ID}"
        method = 'post'
        body = 'json'
}

但是没有数据被发送到我的REST服务。只是一根空的绳子.

在FreeRadius调试模式(radiusd -X)中,打印了以下内容:

代码语言:javascript
复制
(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

如果我尝试这样的测试(只是rest模块的JSON规范中的一个不完整的示例):

代码语言:javascript
复制
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

一切都很好,所以我的休息服务似乎有效.

其他部分(认证等)正在使用方法=‘get’,一切都很好。

有谁实现了这个功能,并能帮助我吗?

按照serverfaul.com上的答案,也许Arran Cudbard-Bell有答案?

我期待着你的帮助!

EN

回答 1

Server Fault用户

发布于 2017-05-03 14:42:59

rest配置中缺少属性data

在mods中-启用/休息:

代码语言:javascript
复制
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"]} }'
}

注必须用FreeRadius提供的属性替换示例数据,如%{User-Name}

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/765290

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档