找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2734|回复: 3

[radius] 关于Steel Radius 的问题,高人帮助下

[复制链接]
发表于 2007-1-12 23:06:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
这个radius 怎么与SQL对接啊。我看说明里面说可以和SQL对接进行记费,可是一直不成功,看了论坛上的相关的帖子还是不成功,想问下谁有做成功了的经验,请分享下,谢谢
routeros
发表于 2007-1-15 17:26:23 | 显示全部楼层
Steel-Belted Radius 是一款多功能的Radius服务器,可以实现认证、计费等功能;它也可以和多种数据库相连接,实现其功能。我们就来看一下Steel-Belted Radius 和SQL Server连接的配置:

说明:本文采用的 Steel-Belted Radius版本为5.02.1335,SQL Server版本为SQL Server 2000 简体中文版。

一、建立系统DSN;

使用ODBC 数据源管理器建立连接SQL Server 的系统DSN,命名为LocalServer;

二、配置 Sqlauth.aut 实现认证功能

Steel-Belted Radius 默认并不支持SQL Server 连接,需要我们进行相应的设置,大部分都是在Sqlauth.aut中完成。以下是一个已完成的Sqlauth.aut

[Bootstrap]
LibraryName=sqlauth.dll
Enable=1
InitializationString=SQL Server

[Settings]
Connect=DSN=LocalServer;UID=saWD=123456
SQL=SELECT Password,Profile FROM userlist WHERE UserName = %name and Enable = 1
ParameterMarker=?
MaxConcurrent=30
ConcurrentTimeout=30
ConnectTimeout=25
QueryTimeout=25
WaitReconnect=2
MaxWaitReconnect=360
PasswordFormat = 0
DefaultResults = 0

[FailedSuccessResultAttributes]
@Reply-Message ='Please re-enter your password.'
@Filter-Id ='3'

[Server]
;s1=2
;s2=2

;[Server/s1]
;Connect=DSN=<dsn_name_here>;UID=<username_for_dB>WD=<password_for_dB>

;[Server/s2]
;Connect=DSN=<dsn_name_here>;UID=<username_for_dB>WD=<password_for_dB>

[Results]
Password=1
Profile=2
;UserName=3/40s
;Alias=2/48

[Failure]
Accept=1
Profile=xyz
FullName=Remote User

各字段含义如下:

Enable :是否启用SQL Server ;1为是 0为否;
InitializationString:SQL Server 连接的名称 ,值随意;
Connect:数据库连接设置 DSN为我们为我们第一步建立的系统DSN名称;UID和PWD为数据库连接的用户名和密码;
SQL:数据库查询语句,我们的用户认证就靠它了,其中%name为用户输入的用户名(用户输入的密码为%Password)。如果这条查询语句有值返回,则用户验证成功,否则验证失败,所以我们就可以构建查询语句来实现用户验证,例如我就增加了一个Enable字段来控制用户验证。
PasswordFormat:密码类型 0为自适应;

配置好Sqlauth.aut,然后重启Steel-Belted Radius;启动好后,用admin 连接到服务器,如果你在server的status中看到 SQL connection established ,恭喜你,你的Steel-Belted Radius已经和SQL Server 连接成功了,如果有问题的话,可以在Steel-Belted Radius安装目录的Service文件夹中查看日志文件,其中记录了连接失败的原因,日志文件是以年月日命名的。

三、配置 Sqlacct.acc 实现用户记帐

[Bootstrap]
LibraryName=sqlacct.dll
Enable=1
InitializationString=SQLAcc

[Settings]
Connect=DSN=LocalServer;UID=sa;PWD=123456
ParameterMarker=?
MaxConcurrent=20
ConcurrentTimeout=30
ConnectTimeout=25
QueryTimeout=25
WaitReconnect=2
MaxWaitReconnect=360
;LogLevel=2

;[Server]
;s1=2
;s2=2
;This achieves 50/50 duty

;[Server/s1]
;Connect=DSN=<dns_name_here>;UID=<username_for_dB>;PWD=<password_for_dB>

;[Server/s2]
;Connect=DSN=<dns_name_here>;UID=<username_for_dB>;PWD=<password_for_dB>

[Type]
1=User
2=User
3=User
;Packets of type 1,2, and 3 will be accounted as below

[Type/User]
SQL=INSERT INTO accounting (TransTime, FullName, Authenticator, NASName, NASAddress, Type, PacketsIn, PacketsOut) \
VALUES (%TransactionTime, %FullName/40s, %AuthType/40s, %NASName/40s, %NASAddress, %Type, @Acct-Input-Packets/n, @Acct-Output-Packets/n)


Sqlacct.acc中大部分配置和前面的Sqlauth.aut 相同,记帐功能同样也是靠SQL语句完成的,其中各个变量及其含义可以查看account.ini和 RFC2866  RADIUS 记帐协议。

通过对以上文件的配置,我们可以实现简单的用户认证记帐,各位网友也可以对其修改,实现其他各种功能

附:各字段的数据类型

/xs A text string of length x.
/s indicates a string with the default length of 256
/xb A binary data string of length x. A binary string is different from
an text string in that it is not NULL-terminated and is not
restricted to ASCII characters.
/b indicates a binary data string with the default length of 256.
/n 32-bit integer
/n8 8-bit integer
/n16 16-bit integer
/n32 32-bit integer (same as /n)
/t Timestamp
routeros
回复

使用道具 举报

发表于 2007-3-31 12:20:31 | 显示全部楼层
这段我还是看不明白谁能解释下或做个SQL文件

/xs A text string of length x.
/s indicates a string with the default length of 256
/xb A binary data string of length x. A binary string is different from
an text string in that it is not NULL-terminated and is not
restricted to ASCII characters.
/b indicates a binary data string with the default length of 256.
/n 32-bit integer
/n8 8-bit integer
/n16 16-bit integer
/n32 32-bit integer (same as /n)
/t Timestamp
routeros
回复

使用道具 举报

发表于 2007-4-2 10:13:33 | 显示全部楼层
顶下
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-6-2 20:40 , Processed in 0.055470 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表