Cisco AAA 详解
Authentication:用于驗證用戶的訪問,如login access,ppp network access等。
Authorization:在Autentication成功驗證后,Authorization用 于限制用戶可以執行什么操作,可以訪問什么服務。
Accouting:記錄Authentication及Authorization的 行為。
Part I.安全協議
1>Terminal Access Controller Access Control System Plus (TACACS+)
Cisco私有的協議。加密整個發給tacacs+ server的消息,用戶的keys。
支持模塊化AAA,可以將不同的AAA功能分布于不同的AAA Server甚至不同的 安全協議,從而可以實現不同的AAA Server/安全協議實現不同的AAA功能。
配置命令:
Router(config)# tacacs-server host IP_address [single-connection] [port {port_#}] [timeout {seconds}] [key {encryption_key}]
Router(config)# tacacs-server key {encryption_key} 注:
(1)single-connection:為Router與AAA Server的會話始終保留一條TCP鏈接,而不是默認的每次會話都打開/關閉TCP鏈接。
(2)配置兩個tacacs-server host命令可以實現tacacs+的 冗余,如果第一個server fail了,第二個server可 以接管相應的服務。第一個tacacs-server host命令指定的server為主,其它為備份。
(3)配置inbound acl時需要permit tacacs+的TCP port 49。
(4) 如果兩個tacacs-server使用不同的key,則需要 在tacacs-server host命令中指定不同的encryption_key,否 則可以使用tacacs-server key統一定制。但tacacs-server host命令中的key定義優先于tacacs-server key命令。
Troubleshooting:
命令:
#show tacacs
#debug tacacs 關于TACACS+的操作信息。
#debug tacacs events 比debug tacacs更詳細的信息,包括router上運行的 TACACS+ processes消 息。
Router# show tacacs
Tacacs+ Server??????????? : 10.0.0.10/49??????????????
Socket opens:????????? 3?????????????
Socket closes:????????? 3?????????????
Socket aborts:????????? 0?????????????
Socket errors:????????? 0???????????
Socket Timeouts:????????? 0???
Failed Connect Attempts:????????? 0????????
Total Packets Sent:????????? 42????????
Total Packets Recv:????????? 41??????????
Expected Replies:????????? 0??
No current connection
2>Remote Authentication Dial-In User Service (RADIUS)
RADIUS是一個開放的 標準,定義于RFC 2865和2865。
RADIUS使用一個共享的密鑰,并且只加密用戶的keys,而 不是TACACS+的整個AAA消息。用戶 的keys不會明文在網絡上傳遞。
RADIUS應 用范圍:
(1)使用multiple vendors設備,并且需要一個單獨的安全協議用于AAA。
(2)需要實現資源記錄,如跟蹤用戶登錄router多 長時間及用戶訪問網絡多長時間。
(3)smart card authentication systems只支持RADIUS。
(4)在 用戶初始化訪問一個設備時,對他進行preauthentication。
RADIUS的使用限制:
(1) 不支 持Apple Talk's Remote Access Protocol(ARAP),the NetBIOS Frame Control Protocol(NBFCP),NetWare's Asynchronous Serveices Interface(NASI)及X.25 PAD鏈接。
(2)RAIUDS不 支持模塊化AAA操作,即只可以使用RADIUS來 完成全部的AAA操作。
(3)只支 持one-way authentication.不支持two-way authentication(如:兩個router之 間的PPP CHAP Authentication).
(4)RADIUS將Authentication及Authorization功 能集成為"Authentication"。
配 置命令:
Router(config)# radius-server host IP_address [auth-port {port_#}] [acct-port {port_#}] [timeout {seconds}] [retransmit {retries}] [key {key_value}] [alias {hostname | IP_address}]
Router(config)# radius-server timeout {seconds}
Router(config)# radius-server retransmit {retries}
Router(config)# radius-server key {key_value}
注:
(1)RADIUS Server daemon監聽Authentication消息默認使用UDP 1645.Authorization消息默認使用UDP 1646.
(2)配置inbound acl以permit UDP 1645/1646。
(3)RFC 2026中指出,RADIUS也可能使用UDP 1812/1813,一些新的RADIUS Server同時監聽UDP 1645/1646及UDP 1812/1813。 所以配置router inbound acl以permit相 應的端口。
(4)RADIUS默認timeout為5s,retransmit為3.
Troubleshooting:
show radius statistics
debug radius [brief]
加上brief參數功能類似于debug tacacs命 令,不加則類似于debug tacacs event命令。
Router# show radius statistics
????????????????????????? Auth.????? Acct.?????? Both??????????
Maximum inQ length:??????? NA???????? NA????????? 1????????
Maximum waitQ length:??????? NA???????? NA????????? 1????????
Maximum doneQ length:??????? NA???????? NA????????? 1????????
Total responses seen:???????? 5????????? 0????????? 5??????
Packets with responses:???????? 5????????? 0????????? 5???
Packets without responses:???????? 0????????? 0????????? 0??
Average response delay(ms):????? 1880????????? 0?????? 1880??
Maximum response delay(ms):????? 6540????????? 0?????? 6540???
Number of Radius timeouts:???????? 0????????? 0????????? 0????????
Duplicate ID detects:???????? 0????????? 0????????? 0
3>Kerberos
其 中TACACS+及RADIUS全面支持AAA。Kerberos只支持Authentication。
| Item
|
TACACS+
|
RADIUS
|
Comparison
|
| Connection | TCP | UDP | UDP has less overhead; however, with TCP, TACACS+ more quickly can detect a failed server and switch over to a backup. TCP can do this by having the router look for an RST (closed connection) message or by using TCP keepalives. |
| Encryption | Payload | Passwords | TACACS+ is more secure because it encrypts the entire payload, which includes all user and AAA message information; RADIUS encrypts only passwords, so everything else, including usernames and other account information, is sent in clear text. |
| Authentication and authorization | Separate | Combined | RADIUS combines authentication and authorization functions, which means that you must use the same server or group for these functions. TACACS+ separates them, giving you more control over the server that handles these functions. |
| WAN protocols | PPP, ARAP, NetBIOS, NASI, and X.25 PAD | PPP and SLIP | TACACS+ is better suited for remote-access situations that involve multiple dialup protocols, whereas RADIUS supports only PPP and SLIP. |
| Router command authorization | Yes | No | TACACS+ enables you to control what commands an authenticated user can execute on a router; RADIUS does not. |
| Accounting | Basic | Advanced | The one big advantage that RADIUS has over TACACS+ is its robust accounting, which is why many ISPs use it to monitor PPP connections. |
Part II. Server Groupings
默認使用tacacs-server host或radius-server host命令配置的AAA Server都是按命令出現的順序分為主/備服 務器,可以使用aaa group server radius/tacacs+命令覆蓋實現部分 配置的host做為驗證server。同時 可以實現不同的aaa group實現不同的AAA功 能,如group1實現Authentication,group2實現Authorization等。
配置命令:
Router(config)# aaa group server radius | tacacs+ {group_name}
Router(config-sg)# server {IP_address | hostname} [auth-port {port_#}] [acct-port {port_#}]
注:
(1)不能在aaa group server中 混合使用多種安全協議。
Part III. Authentication
router支持authentication以 下兩種基本的訪問模式。
1>Character mode:用戶通過console, auxiliary, TTY, or VTY線路獲得到router的 user或privileged EXEC訪問。
2>Packet mode:用戶通過使用 PPP, SLIP, ARAP, NASI, NetBIOS, or X.25 PAD等遠程訪問協議建立一個data-link layer鏈 接。
Method lists:
指定一系列的認證方式。如group tacacs+,group radius,local,none等。
每個authentication命令最多只能 同時使用4種認證methods。
認證的結果:
Success:此method可達,且用戶通過驗證。
Fail:此mothod可達,但用戶驗證失敗。
Error:有 兩種情況
(1)此mothod中指定的aaa server group中 的一個AAA Server不可達,第二個AAA Server被嘗試。
(2) 此mothod指定的方式不存在,或AAA group中 的所有的servers都不可達。
注:
1>如果router試圖訪問的所有mothods結果都是unsuccessful,則router acl會自動deny以后的authentication request。
2>如 果指定的mothod是local,且沒有 與用戶提供的用戶名相匹配的username,則驗證結果為Error。
Authtication Command Syntax:
aaa authtication login {認證列表名稱} {驗證方 法}
{認 證列表名稱}
default:默 認的authentication認證方式。
name:指 定特定的認證方式列表,實現更具體的認證。
{驗證方法}
enable使用enable帳號密碼驗證
group:使用Server Group驗證
krb5:使用kerberos V驗證
krb5-telnet:使 用kerberos V驗證telnet
line:使 用線路密碼驗證
local:使用本地帳號密碼驗證
local-case:使 用本地帳號密碼驗證(區分大小寫)
none:不進行驗證
aaa authentication enable default {驗 證方法}
{驗 證方法}
enable
group
line
none
aaa authentication ppp {認證列表名稱} {驗證 方法}
{認 證列表名稱}
default:默 認的authentication認證方式。
name:指 定特定的認證方式列表,實現更具體的認證。
{驗證方法}
group
if-needed:如 果用戶已經通過tty線路身份驗證,則在此不驗證用戶身份,直接通過
krb5
local-case
local
none
Authtication Configuration:
Router(config)# aaa new-model
Router(config)# aaa authentication login {default | list_name} method1 [method2...]
Router(config)# aaa authentication enable default method1 [method2...]
Router(config)# line [aux | console | tty | vty] start_line_# [end_line_#]
Router(config-line)# login authentication {default | list_name}
Router(config-line)# timeout login response {seconds}
| Method Keyword
|
Description
|
| enable | The password in the enable secret or enable password commands is used to perform the authentication. |
| line | The line password command, on the line that the user is trying to access, is used to perform authentication. |
| local | The username commands are used to perform authentication. |
| local-case | The username commands are used to perform authentication. However, the username that the user enters is treated as case sensitive. |
| none | No authentication is performed. |
| group radius | All configured RADIUS servers can be used to perform authentication. |
| group tacacs+ | All configured TACACS+ servers can be used to perform authentication. |
| group group_name | Only servers in the specified aaa group server command are used to perform authentication. |
注:
1>aaa authentication login:User EXEC Authentication
2>aaa authentication enable:Privileged EXEC Authentication
3>timeout值 為cisco router等待多長時間將此認證method認 為是error。默認timeout為30s,取值范圍1~300s。
4>上圖列出的methods,aaa authentication enable不支持local和local-case。
Username and Password Prompts:
默認用戶登錄時,cisco會 給出這樣的提示符:
Username:
Password:
可以使用以 下命令修改這些默認的提示:
Router(config)# aaa authentication username-prompt {prompt_string} Router(config)# aaa authentication password-prompt {prompt_string}
注:
TACACS+/RADIUS Server也支持修改默認的提示符,如果同時配置aaa authentication username-prompt/password-prompt命令和TACACS+/RADIUS Server配置,則cisco優先使用TACACS+/RADIUS Server配置的prompt。
Login Banners:
可以使用aaa來代替默認用banner命令配置的登錄提示消 息:
Router(config)# aaa authentication banner {stop_character message stop_character} 注:最多支持2996個 字符。
也可以修改用戶在輸入無效的用戶名/密 碼時的提示:
Router(config)# aaa authentication fail-message {stop_character message stop_character}
注:最多支持2996個字符。
Login Attempts:
默認cisco router允許用戶嘗試3次登錄,最后disconnect用戶的鏈接。可以 使用以下命令修改允許嘗試的次數:
Router(config)# aaa authentication attempts login {#_of_attempts} 注:
1>可配置的次數為1~25。
2>推薦將網絡外接設備的login attempts次數修改為1,這樣可以減少對密碼暴力破解的機會。
Authentication Troubleshooting:
Router# debug aaa authentication
Part IV. Authorization
Authorization Command Syntax:
aaa authorization {授權類型} {授權列表名稱} {授 權方法}
{授權類型}
auth-proxy:當用戶成功通過authentication后, 此method允許用戶通過router/firewall建 立到鏈接的其它網絡的多個鏈接,具體的的鏈接數在AAA Server端配置實現。
commands:限制用戶可以在router上 執行的命令。
config-commands:限制用戶可以在router上執行的配置命令。
exec:限制 用戶到router的EXEC訪問。其主要 用于dialup環境,用戶使用PPP的PAP/CHAP認證方式,在通過認證后通過router訪 問網絡,此處可以限制其在通過認證后,只能實現網絡訪問,而不能EXEC到router。
network:當用戶通過authentication并獲得一個EXEC,其 就可以在一個dailup接口上建立一個PPP/SLIP連 接。此method用于限制此種行為。
reverse-access:在 通過authentication后,此method可 以限制用戶使用router的虛擬終端反向telnet到 其它設備上。
ipmobile:配置對mobile鏈 接的授權。
configuration:限制對AAA服 務的配置。
{授權列表名稱}
default:默認的authentication認 證方式。
name:指定特定的認證方式列表,實現更具體的認證。
{授權方法}
group
if-authtication:如果用戶通過了authentication,則允許它執行相應的操作。
local
none
Authorization Configuration:
Router(config)# aaa authorization commands {level_#} {default | list_name} [method1 [method2...]]
Router(config)# line [aux | console | tty | vty] start_line_# [end_line_#]
Router(config-line)# authorization commands {level_#} {default | list_name}
| Method Keyword
|
Description
|
| local | The username commands are used to perform authorization. |
| none | No authorization is performed. This parameter is typically not used. |
| group radius | All configured RADIUS servers can be used to perform authorization. |
| group tacacs+ | All configured TACACS+ servers can be used to perform authorization. |
| group group_name | Only servers in the specified aaa group server command are used to perform authorization. |
Configuration Mode Command Authorization:
一般情況使用aaa authorization后,用戶執行的每個命令都被aaa限制執行,這可能對configure termianl模式的命令有一些影響,可以使用下面命令使aaa authorization忽略對configure termianl模式的命令的限制:
Router(config)# no aaa authorization config-commands
Authorization Troubleshooting:
Router# debug aaa authorization
Part V. Accounting
配置accouting主 要有兩部分:
1>type of accouting:記錄哪些信息。
2>method:將記錄的信息發送到哪。
Accouting Command Syntax:
aaa accouting {統計類型} {統計列表名稱} {統計記錄方式} {統計方法}
{統計類型}
commands {level}:記 錄用戶執行的所有的命令,包括privilege/configuration mode命令。
connection:記錄router通過Telnet, LAT, TN32760, PAD, and rlogin等方式建立的到其它設備的鏈接 信息。信息包括建立鏈接的用戶名,日期/時間及在建立的鏈接上執行的命令。
exec:記錄router的EXEC會話信息。信息包括用戶名,會話起始日期和時間,用戶設備的IP。
network:記錄dialup鏈接的信 息,如PPP/SLIP。信息包括相應鏈接的packets數 目及bytes數目。
resource:記 錄dialup鏈接信息及phone call的 資源信息。
system:記錄system-level事 件。如接口up/down,router reload,accouting被啟用/禁止。
{統計列表名稱}
default:默認的authentication認 證方式。
name:指定特定的認證方式列表,實現更具體的認證。
{統計記錄方式}
start-stop:在事件開始和結束時都建立相應的記錄。先執行后記錄。
stop-only:只在事件結束時建立相應的記錄。
none:禁 用對特定服務的記錄。
wait -start:類似于start-stop,在事件開始和結束時都建立相應的記錄。不同的是此模式只在成功鏈接到AAA Server并能實現記錄時才允許用戶執行相應的事件,否則等待。即:先記錄后執行。(此模式在Cisco IOS 12.1及以后的版本中被移除,并不再支持)
{統 計方法}
group
Methods of Accounting:
RADIUS
TACACS+
注:
1>只 能使用以上兩種method在aaa accouting中。
2>Cisco的RADIUS實現不能 實現aaa accouting,只能使用TACACS+。
Accouting Configuration:
Router(config)# aaa accounting {system | network | exec | connection | commands level_#} {default | list_name} {start-stop | stop-only | none} [method1 [method2...]]
Router(config)# line [aux | console | tty | vty] line_# [ending_line_#]
Router(config-line)# accounting {arap | commands level_# | connection | exec} {default | list_name}
Router(config)# interface type [slot_#/]port_#
Router(config-if)# ppp accounting {default | list_name}
| Service Keyword
|
Description
|
| system | Enables accounting to capture system-level events, such as an interface status changing or the router reloading (only the default method list is supported for this service) |
| network | Enables accounting for all network services, such as SLIP, PPP, NCP, and ARAP |
| exec | Enables accounting for EXEC sessions, listing what users logged in and when they logged into and out of the router |
| connection | Enables accounting for outbound connections from the router, such as Telnet and TN3270 |
| commands level_# | Enables accounting for commands, listing the commands (and their privilege levels) that were executed by a user |
| resource | Enables accounting for dialup connections, listing resource information for them |
Suppressing Null Username Records:
當指定多種authentication mothods,并在最后使用none,且其它mothods都不可達,用戶通過none成功登錄router時,accouting仍然會產生一個相 應 的登錄記錄,不過沒有相應的登錄用戶名信息,因為none method不需要提供任何登錄信 息。這樣的記錄沒有太大意義,可以使用以下命令來使aaa accouting不記錄這樣的事件:
Router(config)# aaa accounting suppress null-username
Enabling Broadcast Accounting:
aaa accouting初始的限制就是在使用多個AAA Accouting Server實現日志記錄時,記錄信息只會發給Primary AAA Accouting Server,并于Primary Accouting Server發送給其它Servers。
可以使用以下命令,在aaa accouting命 令中加入broadcast參數,將日志信息一次性的廣播到所有的AAA Accouting Servers:
Router(config)# aaa accounting {system | network | exec | connection | commands level_#} {default | list_name} {start-stop | stop-only | (none} <broadcast> [method1 [method2...]]
Accounting Troubleshooting:
Router# debug aaa accounting
Router# show accounting
Router# show aaa user all
Part VI. IOS命令權限
所有有IOS命 令都被分為0~15的權限級別。
默 認Cisco Router只使用3個級 別:
0級:包括5個命令(disable,enable,exit,help,logou),現在未用于任何線路。
1級:用戶EXEC模式,所有用戶登錄后的默認 級別。
15級:特權EXEC模式。
1>所有用戶只可以執行其權限級別以下的命令。
2>指定用戶權限級別。
username {name} privilege {level} password {password}
3>查 看用戶權限級別。
show privilege
4>查 看用戶當前權限級別可以執行的命令。
?
5>修 改特定命令的權限級別。
privilege {configure|exec} level {level} {command}
例:
username sense privilege 7 password test
privilege configure level 7 snap-server host
privilege configure level 7 snap-enable traps
privilege exec level 7 ping
privilege exec level 7 configure terminal
轉載于:https://blog.51cto.com/yuxin/325467
總結
以上是生活随笔為你收集整理的Cisco AAA 详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OpenCV Stitching 工程搭
- 下一篇: Delphi 2007体验!