配置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] 评论这张
历史上的今天相关文章
|
|