0

有人可以给我一个提示,如何修改 Freeradius 以从外部脚本读取其他属性。

我有这个

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

但是现在的回复只能是 Access 或 Reject ,但我还想设置一些属性,更像是对该用户的带宽限制,例如

输出

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

我能做到这一点吗?

系统:Ubuntu 14.04

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

更新

preacctaccounting部分怎么样?我看到,一旦路由器重新启动,它必须“记住”呼叫站并在启动后重新验证它。可以添加

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

那里?

4

1 回答 1

3

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

版本 2

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

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}"
    }
    ...
}

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

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

版本 3

版本 3 支持类似于您发布的属性分配,但它是:

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

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

Auth-Type = Accept
reply:WISPr-Bandwidth-Max-Up = xxx
reply:WISPr-Bandwidth-Max-Down = xxx
reply:WISPr-Redirection-URL = http://google.com
于 2014-10-18T20:55:58.170 回答