蓝色动力网络

 找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 3454|回复: 0

配置Steel-Belted Radius 和SQL Server 连接

[复制链接]
发表于 2010-12-27 18:37:49 | 显示全部楼层 |阅读模式
配置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=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]
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
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

蓝色动力网络微信平台
网站管理,业务合作联系邮箱: admin#lansedongli.com    QQ:13412492 限网站业务问题.
网站帐号、密码、密保找回请使用注册邮箱,发送邮件至 password#lansedongli.com ,否则不予受理.
免责声明:本论坛所有文字和图片仅代表其个人观点.
本站某些资料或文章来自于互联网,不代表本站观点,如果侵犯了您的权益,请来信告知,我们会在三天内删除.
为了给大家一个更好的交流场所,请勿在本论坛发表与中华人民共和国法律相抵触的言论,请合作,谢谢!
Copyright © 2007-2019 Corporation Powered by网吧系统 版权所有    转载请注明!
浙ICP备11043737号-1 程序:Discuz! x3.4

湘公网安备 43018102000145号

手机版|Archiver|蓝色动力网络   

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