2014年11月17日 星期一

CCNP-BCMSN Module 08 Mininizing Service Loss and Data Theft in a Campus Network (2)

DHCP Spoof Attacks
*網路中出現另一台非法的DHCP Server
1.DHCP的運作

*同一時間可能會有2台DHCP Server,以第一台回應DHCP Offer的DHCP Server優先
2.DHCP Snooping的防護:
(1)Cisco在配發IP前會先用ICMP-ping去檢查有無使用此IP
(2)DHCP Snooping使用Untrust及Trust 介面去區分要不要收到DHCP的封包
Untrusted不允許收到DHCP Offer封包
Trusted允許收到DHCP Offer
(3)啟用DHCP Snooping 預設全部介面為Untrust
(4)DHCP Snooping啟用在L2 的Access port
3.Config DHCP Snooping
image 
*Option 82可以插入DHCP與Client的相關參數,ex:VLAN / IP Phone address / config在哪邊 …
DHCP Relay Agent的功能
*當DHCP Server在不同VLAN時,需要在Router輸入下面指令
*把L2的Brocade的訊息轉換成unicast的資訊,送給DHCP server
在介面加入(config-if)#ip help-address x.x.x.x(DHCP server ip)
4.Show 的觀察
(1)show ip dhcp snooping
image
5.DHCP Buinlding DB(補充資料)
用來紀錄那一個MAC配發哪一個IP,用來讓後續的安全機制使用。
IP Source Guard
image
1.IP Snoofing Attack的型態
*在原本為10.0.0.1的設備,因為IP snoofing 偽裝成10.0.0.2,達到攻擊的效果
2.IP Source Guard的防護
(1)先要啟動DHCP Snooping,建立DHCP Burinding DB
(2)手動建立Static IP Source MAC Burinding DB
(3)只能設定L2的DHCP Untrust (Access port)介面上
(4)在DHCP Untrust Port 加上一條Port ACL(自動產生)
(5)IP Source Guard可以針對IP 及 MAC來防護
3.Config IP Source Guard
image
ARP Spoofing Attacks
image
1.ARP Spoofing Attacks定義
*攻擊者在同一個網段
*攻擊者把SW的ARP table變更目的地都往攻擊者PC送。
2.ARP Spoofing 的防護:
image
*必須有一個IP對應MAC的DB,故必須先啟動DHCP Snooping建立DHCP Burinding DB。
*也可以手動建立DHCP Burinding DB。
*啟用Dynamic ARP Inspection (DAI)。
*預設所有介面都是Untrust
3.Config Dynamic ARP Inspection
image
Protecting the Operation of STP
STP 3大防護機制
1.BPDU Guard
*STP運作的原理
1.STP Security保護的目標:
(1)預防收到意料外的BPDU
(2)預防沒有收到正常的BPDU
2.收到意料外的BPDU時使用的指令:
(1)BPDU Guard在PortFast的介面收到BPDU的封包,表示異常,介面會進入"Error-Disable"的狀態。
(2)BPDU Filter在介面啟用時,介面收到BPDU時,可以選擇把BPDU Filter掉或是尚失PortFast的功能。(不建議使用)
在global啟用時,會忽略incoming bpdu,停止送bpdu。
3.Config BPDU Guard & BPDU Filter
(1)設定BPDU Guard(也可以在glbal下設定)
image
(2)設定BPDU Filter(也可以在glbal下設定)
image
4.Show 的觀察
Show spanning-tree summary totals
(1)BPDU Guard
image
(2)BODU Filter
 image
2.Loop Guard
image
1.Loop Guard 保護的目標
*避免造成原本Bloack的Port變成Forwarding的狀態,導致行成Loop。
2.Loop Guard的特性
*預設關閉
*在每個介面上啟動
*在Root Port及Block Port上啟動,確定會收到BPDU
*偵測到Loop時,Root Port或Bloak Port會變成"loop-inconsistent"的狀態,防止Loop發生
*功能與Root Guard相反。
*沒有收到BPDU會自動恢復。
*不可以同時啟動Root Guard會有互斥性
3.Config Loop Guard
*可在Gabal的模式下設定,也可以在介面模式下設定
image
4.Show的觀察
*show spanning-tree guard int fa x/x
image
3.Root Guard
image
1.Root Guard保護的目標:
image
*避免外來的"PRI"比較小的SW搶走原本的RB
2.Root Guard的特性
*預設關閉 *需要在每個介面上啟動,當收到PRI較小的BPDU時,Port會出現"Root-Inconsistent"的狀態,表示新的SW會自己形成一個Domain,不會參與原本的STP競選,也無法傳送資訊。
*在沒有收到"PRI"較小的BPDU時會自動恢復。
*port上面的VLAN都參與Root Guard的保護。
*在原本Access SW的DP上啟動,防止外接SW。
*與Loop Guard有互斥性,不可以同時啟動。
3.Config Root Guard
image
BPDU Skew
用來偵測bpdu傳送的狀況,有通知的作用,他用syslog通知管理者
3.Show 的觀察
Show spanning-tree inconsistentport
image
UDLD(Uni-Direction Link Detertion)
image
1.發生Unidirectional Link Failure的狀況,大部分為SW的CPU Loading過高。
2.UDLD防護的機制
*Cisco專屬的功能
*像Keeplive的概念,SW間會互相傳送UDLD的訊息,告知還活著,UDLD 3次沒收到表示對方Link問題,STP會重算。
*UDLD使用的Destination MAC為01-00-0C-CC-CC-CC
*雙邊設備都要啟動UDLD
*有2種模式:
    -Aggressive mode:3次UDLD封包沒有收到,port會進入"error-disable"的狀態(建議值)。
    -Normal mode:3次UDLD封包沒有收到,只產生Syslog。
*Cisco 光纖的設備預設啟動
*Cisco 非光纖的設備需要手動啟動
3.Config UDLD
*可在Gabal的模式下設定,也可以在介面模式下設定
*雙邊都需要設定
(1)Global 模式
image
(2)介面 模式
*雙邊都需要設定
image
(3)重置UDLD
image
4.Show的觀察
*Show udld 觀察UDLD有沒有啟動
*show udld interface fa x/x
Root Guard / Loop Guard / UDLD 比較表
Loop GuardRoot GuardUDLD
ConfigurationPer portPer PortPer Port
使用的介面RP & Block PortDP所有介面
Action GranularityPer VLANPer VLANPer Port
違規的狀態Loop-Inconsistent
(Blocking)
Root-Inconsistet
(Blocking)
Error-Disable
(Shutdown)
Auto-recoveryYesYesNo
需要手動reset UDLD或
設定Error-disable timeout 的功能
可否偵測STP的狀況YesYesNo
可否偵測Link的狀況NoNoYes
CDP Attacks
image
1.CDP的特性
*Cisco專屬協定
*CDP傳輸都是明文
*不需要認證
*預設啟動
*建議在特定的介面關閉CDP
2.Config CDP
Router(config-if)#no cdp enable (關閉CDP)
SSH(Security Shell Protocol)
1.SSH的特性
*建議使用SSH version2
*傳送資料會加密
*可以搭配ACL使用
2.Config SSH
(1)設定ACL限制SSH的範圍
(2)設定IP Domain Name
    Router(config)#ip domain -name xxxx
(3)設定RSA Key
    Router(config)#cryto key zeroize(移除之前的Key)
    Router(config)#cryto key generte rsa (建議大於1024,會較安全)
(4)建議ID/PW
   使用Local or AAA
(5)只允許SSH,關閉Telnet
   Router(config)#line vty 0 4
   Router(config-line)#transport input none
   Router(config-line)#transport input ssh
(6)修改SSH版本
    Router(config)#ip ssh version 2
(7)Login 的方式
    Router(config)#ssh -l name -v 2 ip address
3.Show的觀察
(1)show ip ssh
(2)show cryto key
DHCP Server設定(補充)
Config DHCP Server
(1)設定DHCP Pool
    Router(config)#ip dhcp pool name
(2)設定DHCP網段
    Router(dhcp-config)#network A.B.C.D/xx
(3)設定DHCP Gateway
    Router(dhcp-config)#default-router A.B.C.D
(4)設定DNS Server
    Router(dhcp-config)#dns-server A.B.C.D
(5)設定IP租期
    Router(dhcp-config)#lease x x
(6)設定排除的IP
    Router(config)#ip shcp exclud A.B.C.D

2009 年 05 月 14 日

CCNP-BCMSN Module 08 Mininizing Service Loss and Data Theft in a Campus Network (1)

Filed under: CCNP-BCMSN Module 08 — nkongkimo @ 15:18:40
Switch Attack 種類
種類定義防護方法
MAC Layer AttackMAC flooding Attack(灌爆MAC Addr. Table)
若MAC Addr. table被灌爆,SW就像Hub一樣,用flooding傳送資料。
使用Port Security
VLAN AttackVLAN Hoping,在不同VLAN中跳躍。使用Prival VLAN / 關閉DTP / Trunk allow VLAN的過慮
Spoofing Attack1.DHCP Spoofing Attack,防止區域內有人使用DHCP功能的設備介接。
2.防止有人把介接SW,導致STP(VLAN Spanning Tree)重新計算。
3.MAC Spoofing Attack
使用Root Guard / BPDU Guard / Dynamic ARP Inspection / port Security
Attack in switch devices使用CDP的竊聽,設備的訊息並找出弱點攻擊關閉CDP / 使用SSH / ACL設定授權範圍
MAC Layer Attacker
image
1.MAC table概念:(1)MAC addr.的欄位:
VLANMAC Addr.TypePort
(2)CAM-table大部分可存8000筆(8K)
(3)CAM-table的運作模式:要完全相同的資訊才會從特定介面傳送出去,否則會用flooding的方式送出。
(4)TCAM-table的運作模式:部份相同就可以傳送。
(5)系統/靜態 CAM-table不會被移除
(6)動態產生的CAM-table會被移除。
(7)MAC Addr. MAX Age為300 sec或Interface Down,會移除CAM table
2.防護機制:
(1)Port Security*用在限制每一個port可以存取的MAC及學習到MAC的數量。
*主要是針對特定/重要的設備(ex:DG、Router、Server…)
*Port Security的方法:
1.Static MAC Entery設定
2.Port Security Secured MAC(在MAC會以"static"的方式出現)
    -手動設定的Static Secured MAC: 已CLI的方式存在Running-config中
    -學習來的Dynamic Secured MAC:
        -Dynamic Secured MAC: 只存在RAM中,但重開機或介面down會消失
        -Dynamic Sticky MAC: Dynamic Secured + Auto產生Config的機制,重開機會繼續存在Running-config中,show run可以看到
(2)Port Security Violtion
(限制)
1.啟用Port Security介面學習到超過設定"Maxium"數量的MAC,若超過max的數量會shutdown。
2.Secured MAC出現在非原關聯的介面時(另外的介面)(設定FHRP要注意,建議使用use-bia的方法),若出現會被shutdown。
(3)Port Security Violation
Reaction(動作)
1.Protect:(不建議用)
只讓合法的Frame通過(src=Secured MAC),Drop other Sicencely(drop的動作會靜靜的執行),沒有任何通報機制。
2.Restrict:
Protect功能+產生Syslog / SNMP Trap 通報。
3Shutdown:(default值)
將該介面進入"Error-disable"的狀態
3.Config Port Security:
*預設每個介面是disable,所以要先啟動port security。
*只可以使用在Access port上。
*預設Violtion值=1
*手動設定Allow MAC Address
1.啟用Port Security
image
2.設定Port Violtion
image
3.設定Allow MAC Address
image
4.設定Reaction值
image
4.Show的觀察
1.Show port security
image
2.Show port-security interface x/x
*正常狀況下
image
*違背的狀況下
image
3.Show port-security address
image
4.show mac-address-table
*與port-serurity定義的不同,show mac-addr-table表示這一個port是用不使用DTP協商的。
image
AAA Network Configutation
image
1.AAA的定義:
(1)Authentication(認證):認證你是誰
(2)Authorization(授權):授權你可以做甚麼事
(3)Accounting(計量):記錄你做了甚麼事(監控、紀錄、稽核)
2.AAA注意事項:
(1)預設為Disale,啟動使用aaa new-model
(2)有預設的method-list->default
     自動啟用並套用到每一個可以套用的地方(console / AUX / telent / SSH…)
(3)Method-list:
     使用aaa authentication login name method去制定AAA的使用項目
image
3.Config AAA:
(1)建立Local Database的User Account
    (config)#user xxx pass xxx
(2)啟用AAA服務
    (config)#aaa new-model
(3)修改Default-list
    (config)#aaa authentication login default none (不使用default的方法)
(4)建立Methold-list
     (config)#aaa authentication login NAME local enable none
(5)套用到VTY / Console / AUX
      (config)#line vty 0 4
      (config-line)#login authentication NAME(list name)
4.Show 的觀察
show aaa methold-list authentication
image
5.RADIUS 與 TACACS+1比較
RADIUSTACACS+
標準公開的標準Cisco標準
portCisco->1645/1646 UDP
MS IAS->1812/1813 UDP
49/TCP
認證方法
授權方法
認證+授權
使用1645 or 1812 UDP
可在同一個TCP49的session或個別的TCP 49的session
ex:
認證使用TACACS+ 走TCP49
授權使用TACACS+走TCP 49
計量使用RADIUS 走TCP 49
計量方法計量
使用1646 / 1813 UDP
加密只加密payload整個packet加密
802.1x Port-based Authentication
image
1.802.1x特性
(1)認證Server只支援RADIUS。
(2)未認証成功之前在Switch port上只有802.1x的控制訊號傳輸,且不行傳送Data資料。
(3)Client端需要支援802.1x,導致不普及。
(4)Client與NAS有3種認證方法:
    -MD5
    -TLS(憑證)
    -OTP
(5)建議要有2種以上的認證機制(two-factor)
(6)預設沒有啟動802.1x
(7)要先認證才可使用
(8)只能設定在Access Port上
(9)不可以設定在Etherchannel / Tunmk port / Span port(Sniff port)
(10)可以給予不同VLAN,就可以套用不同的QoS設定
2.802.1x的流程圖
image
3.Config 802.1x步驟
image

指定RADIUS server
Switch(config)#radius-server host x.x.x.x key xx
補充:
AAA Authorization
 
設定方法
image

觀察等級的方法:
show privilege
VLAN Hopping Attack & Dobule Tagging
image
1.VLAN Hopping的定義:
(1)設備可以在不同VLAN傳送資料
(2)Attacker與其他VLAN可以傳送資料
2.防護方法
(1)手動設定SW port為Access port
(2)關閉DTP,不自動形成Trunk
(3)使用無Data traffic的VLAN成為Native VLAN
(4)設定ACL去區分存取的範圍
VLAN Hoppint with Dobule Tagging
image
1.VLAN Hopping with Dobule Tagging的定義:
(1)Native VLAN設定與Data的VLAN相同
(2)Attacker的Frame有2個Tag,在經過第一個SW會把Native Vlan移除,就會造成不同VLAN可以互相溝通
2.防護方法
(1)手動設定Switch port為Access port
(2)使用無Data traffic的VLAN成為Native VLAN
ACL的種類
image 
1.ACL的種類
種類定義
Port ACL*L2 ACL,最優先檢查,只針對Inbound的方向
*適用於IP-ACL & MAC-ACL
VLAN ACL
(VLAN access map)
*L2 ACL,用在VLAN上,沒有方向,進出都檢查,設定較複雜
*適用於IP-MAC & MAC-ACL
*以VLAN access-map去過濾
*VLAN access map沒有任何match就表示都permit,若有定義但沒有match表示都drop
Routed ACL*L3 ACL,有In/Out的方向
*只用於IP-ACL
*經過Router介面才會檢查
2.VLAN ACL(VACL)設定方法
image 
3.VALN ACL範例
image
Private VLAN(Sub-VLAN)
1.Private VLAN角色定義
角色定義
Primary VLAN
(Parent VLAN)
最外層的VLAN,就是原本的VLAN
Second VLAN
(Child VLAN)
(Private VLAN)
再區分2種VLAN
1.Community VLAN:
*可以有多個Community Member
*被歸類在Community VLAN的host可以互通。
2.Isolated(隔離) VLAN:
*只有一個Isolated Member
*被歸類為Isolated VLAN的host不可以互通。
2.Private VLAN port種類
image
種類定義
Isolated port*Isolated Port 的PC彼此不互通
*可與Promiscuous port互通
Promiscuous port*成為Primary Port,可以與其他port互通
*也是大家的default Gateway
Community port可與Community port互通
3.Private VLAN注意事項
(1)關閉VTP
(2)不可以為Port Security介面
(3)可以使用在Etherchannel
(4)使用在VLAN 1006~4096
(5)不可以是SPAN port
(6)大部分是用在Virtual Mechin上,在Data Sation上較常用。
4.設定的方法
Step1:
image
Step2:
image
Step3:(GW在上層設備)
image
Step4:(GW在本機上面)
image  
5.設定範例:

Step1: Configuring and Associating VLANs in a Private VLAN

Switch(config)# vlan 20
Switch(config-vlan)# private-vlan primary
Switch(config)# vlan 501
Switch(config-vlan)# private-vlan isolated
Switch(config)# vlan 502
Switch(config-vlan)# private-vlan community
Switch(config)# vlan 20
Switch(config-vlan)# private-vlan association 501-502
Switch# show vlan private vlan 


Step 2: Configuring a Layer 2 Interface as a Private-VLAN Host Port

Switch(config)# interface fastethernet0/22
Switch(config-if)# switchport mode private-vlan host
Switch(config-if)# switchport private-vlan host-association 20 501 

Step 3: Configuring a Layer 2 Interface as a Private-VLAN Promiscuous Port

(Default Gsteway在上層設備上)

Switch(config)# interface fastethernet0/2
Switch(config-if)# switchport mode private-vlan promiscuous
Switch(config-if)# switchport private-vlan mapping 20 add 501-503
Switch#show vlan private-vlan
Switch#sh interfaces status 

Step 4: Mapping Secondary VLANs to a Primary VLAN Layer 3 VLAN Interface

(Default Gsteway在本機上)

Switch(config)# interface vlan 20
Switch(config-if)# private-vlan mapping 501-502 

*L2的設備可使用protect port達到同vlan的port不通的功能,如同Isolated的功能

沒有留言:

張貼留言