2014-10-18 76 views
0

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

我有这个

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

但答复的内容现在可以访问或拒绝,但我想也多设置一些属性,如带宽限制到该用户喜欢

输出

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的未知Linux的GNU的,在15时08分48秒

更新

建于2014年8月6日

preacctaccounting节怎么样?我看到,一旦路由器重新启动,它必须使呼叫站保持“精神”,并在启动后重新验证它。 有可能加入

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

有吗?

回答

3

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

2版

对于执行模块配置你想要的:

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 
+0

工作了这一个,我已经更新了我的帖子 – Carca 2014-10-23 11:24:40

+0

再次检查我的帖子,preacct和会计怎么样? – Carca 2014-10-23 13:45:25

+0

我不明白你想用会计来实现什么 – 2014-10-23 15:34:32