打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
配置Steel-Belted Radius 和SQL Server 连接

配置Steel-Belted Radius 和SQL Server 连接

2007-04-22 10:25:41|  分类: 网络 |  标签: |字号 订阅

配置Steel-Belted Radius 和SQL Server 连接

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=sa;PWD=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]
at Reply-Message ='Please re-enter your password dot '
at Filter-Id ='3'

[Server]
;s1=2
;s2=2

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

;[Server/s2]
;Connect=DSN=<dsn_name_here>;UID=<username_for_dB>;PWD=<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 dot 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, at Acct-Input-Packets/n, @Acct-Output-Packets/n)


Sqlacct dot 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[/size]
  评论这张
转发至微博
0  分享到:         
阅读(196)| 评论(0)| 引用 (0) |举报
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
QT连接SQL Server(ODBC)
袖珍数据库连接查询手册
Delphi操作Excel的技巧
引用 QTP手动连接SQL Server/DB2/Oracle数据库的方法
Excel中如何调用SQL数据
Dreamweaver连接数据库教程(ASP类)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服