配置Steel-Belted Radius 和SQL Server 連接2007-04-22 10:25:41| 分類: 網(wǎng)絡(luò) | 標(biāo)簽: |字號大中小 訂閱 配置Steel-Belted Radius 和SQL Server 連接
Steel-Belted Radius 是一款多功能的Radius服務(wù)器,可以實(shí)現(xiàn)認(rèn)證、計(jì)費(fèi)等功能;它也可以和多種數(shù)據(jù)庫相連接,實(shí)現(xiàn)其功能。我們就來看一下Steel-Belted Radius 和SQL Server連接的配置: 說明:本文采用的 Steel-Belted Radius版本為5.02.1335,SQL Server版本為SQL Server 2000 簡體中文版。 一、建立系統(tǒng)DSN; 使用ODBC 數(shù)據(jù)源管理器建立連接SQL Server 的系統(tǒng)DSN,命名為LocalServer; 二、配置 Sqlauth.aut 實(shí)現(xiàn)認(rèn)證功能 Steel-Belted Radius 默認(rèn)并不支持SQL Server 連接,需要我們進(jìn)行相應(yīng)的設(shè)置,大部分都是在Sqlauth.aut中完成。以下是一個(gè)已完成的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:數(shù)據(jù)庫連接設(shè)置 DSN為我們?yōu)槲覀兊谝徊浇⒌南到y(tǒng)DSN名稱;UID和PWD為數(shù)據(jù)庫連接的用戶名和密碼; SQL:數(shù)據(jù)庫查詢語句,我們的用戶認(rèn)證就靠它了,其中%name為用戶輸入的用戶名(用戶輸入的密碼為%Password)。如果這條查詢語句有值返回,則用戶驗(yàn)證成功,否則驗(yàn)證失敗,所以我們就可以構(gòu)建查詢語句來實(shí)現(xiàn)用戶驗(yàn)證,例如我就增加了一個(gè)Enable字段來控制用戶驗(yàn)證。 PasswordFormat:密碼類型 0為自適應(yīng); 配置好Sqlauth dot aut,然后重啟Steel-Belted Radius;啟動好后,用admin 連接到服務(wù)器,如果你在server的status中看到 SQL connection established ,恭喜你,你的Steel-Belted Radius已經(jīng)和SQL Server 連接成功了,如果有問題的話,可以在Steel-Belted Radius安裝目錄的Service文件夾中查看日志文件,其中記錄了連接失敗的原因,日志文件是以年月日命名的。 三、配置 Sqlacct.acc 實(shí)現(xiàn)用戶記帳 [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語句完成的,其中各個(gè)變量及其含義可以查看account.ini和 RFC2866 RADIUS 記帳協(xié)議。 通過對以上文件的配置,我們可以實(shí)現(xiàn)簡單的用戶認(rèn)證記帳,各位網(wǎng)友也可以對其修改,實(shí)現(xiàn)其他各種功能 附:各字段的數(shù)據(jù)類型 /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] 評論這張
歷史上的今天相關(guān)文章
|
|
|