文章轉載自:百度空間
RADIUS服務器軟件可以從多個地方獲得。使用FreeRADIUS(請參閱參考資料獲得相關鏈接),FreeRADIUS是來自開放源碼社區的一種強大的Linux上的RADIUS服務器,可用於如今的分佈式和異構計算環境。FreeRADIUS 1.0.2 支持LDAP、MySQL、PostgreSQL和Oracle數據庫,並與諸如EAP和Cisco LEAP之類的網絡協議兼容。FreeRADIUS目前被部署在很多大型生產網絡系統中。
下面的步驟演示如何在Red Hat Enterprise Linux Advanced Server 3.0上安裝和測試FreeRADIUS 1.0.2:
清單1 安裝和測試FreeRADIUStar -zxvf freeradius-1.0.2.tar.gz - extract it with gunzip and tar./configuremakemake install - run this command as rootradiusd or - start RADIUS serverradiusd -X - start RADIUS server in debug moderadtest test test localhost 0 testing123 - test RADIUS
server
如果radtest收到一個響應,則表明FreeRADIUS服務器工作正常。
配置FreeRADIUS
RADIUS服務器的配置包括對服務器、客戶機和用戶的配置(都是用於驗證和授權)。出於不同的需要,對RADIUS服務器可以有不同的配置。幸運的是,大多數配置都是類似的。
* 配置服務器
FreeRADIUS配置文件通常位於/etc/raddb文件夾下。首先,我們需要像下面這樣修改radiusd.conf文件。
清單2 修改radiusd.conf1) Global settings:log_auth = yes - log authentication requests to the log filelog_auth_badpass = no - don't log passwords if request rejectedlog_auth_goodpass = no - don't log passwords if request accepted2) LDAP Settings:modules { ldap { server = "bluepages.ibm.com"
- the hostname or IP address of the LDAP server port = 636 - encrypted communications basedn = "ou=bluepages,o=ibm.com" - define the base Distinguished Names (DN), - under the Organization (O) "ibm.com", - in the Organization Unit (OU) "bluepages" filter =
"(mail=%u)" - specify search criteria base_filter = "(objectclass=person)" - specify base search criteria }authenticate { - enable authentication against LDAP Auth-Type LDAP { ldap }
參數被設爲使用 IBM BluePages,這是LDAP服務的一個實例。對於其他LDAP服務器,參數可能有所不同。
* 配置客戶機
客戶機是在/etc/raddb/clients.conf 文件中配置的。有兩種方式可用於配置RADIUS客戶機。您可以按IP subnet將NAS分組(清單 3),或者可以按主機名或 IP 地址列出NAS(清單4)。如果按照第二種方法,可以定義shortname和nastype。
清單3 按IP subnet將NAS分組client 192.168.0.0/24 { secret = mysecret1 - the "secret" should be the same as configured on NAS shortname = mylan - the "shortname" can be used for logging nastype = cisco - the "nastype" is used for checkrad and is optional}
清單4 按主機名或 IP 地址列出 NASclient 192.168.0.1 { secret = mysecret1 shortname = myserver nastype = other}
* 爲驗證而配置用戶
文件 /etc/raddb/user 包含每個用戶的驗證和配置信息。
清單5 /etc/raddb/user 文件1) Authentication type:Auth-Type := LDAP - authenticate against LDAPAuth-Type := Local, User-Password == "mypasswd" - authenticate against the - password set in /etc/raddb/userAuth-Type := System - authenticate against the system password file - /etc/passwd
or /etc/shadow2) Service type:Service-Type = Login, - for administrative login
* 爲授權而配置用戶
下面的驗證服務器屬性-值對(AV)應該爲用戶授權而進行配置。在驗證被接受後,這個屬性-值對被返回給NAS,作爲對管理員登錄請求的響應。
對於Cisco路由器,有不同的權限級別:
級別1是無特權(non-privileged)。提示符是 router>,這是用於登錄的默認級別。
級別15是特權(privileged)。 提示符是 router#,這是進入 enable 模式後的級別。
級別2到14 在默認配置中不使用。
下面的命令可以使一個用戶從網絡訪問服務器登錄,並獲得對EXEC命令的立即訪問:
cisco-avpair ="shell:priv-lvl=15"
下面的代碼處理相同的任務,這一次是對於Cisco無線訪問點:
Cisco:Avpair= "aironet:admin-capability=write+snmp+ident+firmware+admin"
任何功能組合都和這個屬性一起返回:
Cisco:Avpair = "aironet:admin-capability=ident+admin"
Cisco:Avpair = "aironet:admin-capability=admin"
請與 Cisco 聯繫,以獲得關於這些命令的更多信息。
配置網絡訪問服務器
接下來我們將配置NAS,首先是配置一個Cisco路由器,然後輪到一個Cisco WAP。
對於Cisco IOS 12.1路由器,我們將啓用AAA,然後配置驗證、授權和記帳。
清單6 啓用AAAaaa new-modelradius-server host 192.168.0.100radius-server key mysecret1
AAA 在路由器上應該被啓用。然後,指定能爲 NAS 提供 AAA 服務的 RADIUS 服務器的列表。加密密鑰用於加密 NAS 和 RADIUS 服務器之間的數據傳輸。它必須與 FreeRADIUS 上配置的一樣。
清單7 配置驗證aaa authentication login default group radius localline vty 0 4login authentication default
在這個例子中,網絡管理員使用 RADIUS 驗證。如果 RADIUS 服務器不可用,則使用 NAS 的本地用戶數據庫密碼。
清單8 配置授權aaa authorization exec default group radius if-authenticated
允許用戶在登錄到 NAS 中時運行 EXEC shell。
清單9 配置記帳aaa accounting system default start-stop group radiusaaa accounting network default start-stop group radiusaaa accounting connection default start-stop group radiusaaa accounting exec default stop-only group radiusaaa accounting commands 1 default stop-only
group radiusaaa accounting commands 15 default wait-start group radius
必須對路由器進行特別的配置,以使之發送記帳記錄到RADIUS服務器。使用清單9中的命令記錄關於NAS系統事件、網絡連接、輸出連接、EXEC操作以及級別1和級別15上的命令的記帳信息。
這樣就好了。現在讓我們看看爲Cisco無線訪問點而進行的配置。下面的配置適用於帶有Firmware 12.01T1的Cisco 1200 Series AP。如圖2中的屏幕快照所示,您:
* 輸入服務器名或 IP 地址和共享的祕密。
* 選擇“Radius”作爲類型,並選中“User Authentication”。
實際上,在這裏您還可以配置EAP Authentication,使FreeRADIUS可用於驗證無線LAN的一般用戶。
記帳:工作中的RADIUS
現在所有配置都已經完成,FreeRADIUS服務器可以開始記錄NAS發送的所有信息,將該信息存儲在/var/log/radius/radius.log文件中,就像這樣:
清單10 /var/log/radius/radius.log文件Thu Mar 3 21:37:32 2005 : Auth: Login OK: [David] (from client mylan port 1 cli 192.168.0.94)Mon Mar 7 23:39:53 2005 : Auth: Login incorrect: [John] (from client mylan port 1 cli 192.168.0.94)
詳細的記帳信息被存放在/var/log/radius/radacct目錄中。清單11表明,David在2005年3月4日19:40到19:51這段時間裏從 192.168.0.94登錄到了路由器192.168.0.1。這麼詳細的信息對於正在調查安全事故以及試圖維護易於審計的記錄的管理員來說無疑是一大幫助。
清單11 RADIUS 提供的記帳細節示例Fri Mar 4 19:40:12 2005 NAS-IP-Address = 192.168.0.1 NAS-Port = 1 NAS-Port-Type = Virtual User-Name = "David" Calling-Station-Id = "192.168.0.94" Acct-Status-Type = Start Acct-Authentic = RADIUS Service-Type = NAS-Prompt-User Acct-Session-Id = "00000026"
Acct-Delay-Time = 0 Client-IP-Address = 192.168.0.1 Acct-Unique-Session-Id = "913029a52dacb116" Timestamp = 1109936412Fri Mar 4 19:51:17 2005 NAS-IP-Address = 192.168.0.1 NAS-Port = 1 NAS-Port-Type = Virtual User-Name = "David" Calling-Station-Id = "192.168.0.94"
Acct-Status-Type = Stop Acct-Authentic = RADIUS Service-Type = NAS-Prompt-User Acct-Session-Id = "00000026" Acct-Terminate-Cause = Idle-Timeout Acct-Session-Time = 665 Acct-Delay-Time = 0 Client-IP-Address = 192.168.0.1 Acct-Unique-Session-Id = "913029a52dacb116"
Timestamp = 1109937077
結束語
通過遵循本文中列出的簡單步驟,您可以建立一個Remote Authentication Dial-In User Service服務器,該服務器使用一個外部的LDAP服務器來處理爲網絡安全問題而進行的驗證、授權和記帳。