FreeRadius 在执行外部脚本时读取属性 [英] FreeRadius Reading attributes while executing external script

查看:52
本文介绍了FreeRadius 在执行外部脚本时读取属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能给我一个提示,如何修改 Freeradius 以从外部脚本读取其他属性.

Can someone give me a hint, how to modify Freeradius to read other attributes from an external script.

我有这个

update control {
        Auth-Type := `/usr/bin/php -f /web/auth.php '%{NAS-Identifier} %{Calling-Station-Id}'`
    }

但是现在的回复可以是only Access 或 Reject ,但我还想设置一些更像是对这个用户的带宽限制的属性

But the reply right now can be only Access or Reject , but I would like to set also some attributes more like a bandwidth limitation to this user like

输出

Accept
WISPr-Bandwidth-Max-Up: xxx
WISPr-Bandwidth-Max-Down: xxx
WISPr-Redirection-URL: http://google.com

我能做到吗?

系统:Ubuntu 14.04

System: Ubuntu 14.04

radiusd:FreeRADIUS 版本 2.2.5,用于主机 x86_64-unknown-linux-gnu,构建于 2014 年 8 月 6 日 15:08:48

radiusd: FreeRADIUS Version 2.2.5, for host x86_64-unknown-linux-gnu, built on Aug 6 2014 at 15:08:48

更新

preacctaccounting 部分怎么样?我看到一旦路由器重新启动,它必须记住"呼叫站,并在启动后重新对其进行身份验证.可以添加

How about preacct and accounting section ? I see that once router is rebooted it must keep Calling Station in "mind" and re-authenticate it once it will boot. It is possible to add

accounting {
    exec
    update control {
        Auth-Type := "%{reply:Auth-Type}"
    }
    ...
}

在那里?

推荐答案

嗯,这不是版本 2 的有效语法.你需要修改 raddb/modules/exec 并在授权部分调用它.

Hm, that's not valid syntax for version 2. You need to modify raddb/modules/exec and call it in the authorize section.

版本 2

对于你想要的 exec 模块配置:

For the exec module configuration you want:

wait = yes
program = "/usr/bin/php -f /web/auth.php '%{NAS-Identifier} %{Calling-Station-Id}'"
output_pairs = reply

然后在授权:

authorize {
    exec
    update control {
        Auth-Type := "%{reply:Auth-Type}"
    }
    ...
}

然后将您的脚本输出修改为:

Then modify your script output to be:

Auth-Type = Accept
WISPr-Bandwidth-Max-Up = xxx
WISPr-Bandwidth-Max-Down = xxx
WISPr-Redirection-URL = http://google.com

版本 3

版本 3 支持与您发布的内容类似的属性分配,但应该是:

Version 3 supports attribute assignment similar to what you've posted, but it'd be:

update {
    control: += `/usr/bin/php -f /web/auth.php '%{NAS-Identifier} %{Calling-Station-Id}'`
}

然后将您的脚本输出修改为:

Then modify your script output to be:

Auth-Type = Accept
reply:WISPr-Bandwidth-Max-Up = xxx
reply:WISPr-Bandwidth-Max-Down = xxx
reply:WISPr-Redirection-URL = http://google.com

这篇关于FreeRadius 在执行外部脚本时读取属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆