Router 보안 - 안전한 라우터 운영을 위한 튜닝
IT Story/Network
2008/05/02 21:50
| 불필요한 Global Service 정지 Disabling service finger – Finger Service 정지 Disabling service pad – PAD(X.25) Service 정지 Disabling udp & tcp small servers – Echo,Discard,Chargen,Daytime Service 정지 Enabling service password encryption – Password 암호화 기능 구동 Enabling service tcp-keepalives-in/out – Session Keepalive Service 구동 Disabling the cdp protocol – CDP Service 정지 Disabling the bootp server – Bootp Server Service 정지 Disabling the http server – Http Server 기능 정지 Disabling source routing – IP 변조 방지를 위한 Source Routing 기능 정지 Disabling gratuitous arp – PPP connection,IP negotiation 등에 사용되는 ARP 도용 서비스 차단 Configuring aaa local authentication – AAA 생성 서비스 외부로 부터의 접속 강화 서비스 – Telnet,Console,Aux 등… Banner 자동 생성 기능 불필요한 Interface Service 정지 no ip redirects – icmp redirect message 차단 no ip proxy-arp – Proxy arp service 정지 no ip unreachables – ICMP unreachable service 정지 no ip directed-broadcast – Broadcast service 정지 no ip mask-reply – ICMP mask-reply 정지 성능 강화와 IP filtering CEF Enable Ingress Filtering – 사용하지 않는 사설 IP, IANA address uRPF - IP 변조방지 구성 “Auto Secure” 명령어를 통한 보안 강화 “One Touch” device lock down process – command 한줄로 라우터의 보안구성을 자동으로 실행 CPP 구성 CPP (Control Plane Policing) 구성 예제 ##Access-list 작성## Router(config)# access-list 141 permit icmp any any port-unreachable ##Class-Map 작성## Router(config)# class-map icmp-class Router(config-cmap)# match access-group 141 ##Policy-Map 작성## Router(config)# policy-map control-plane-out-policy Router(config-pmap)# class icmp-class Router(config-pmap-c)# police 80000 conform transmit exceed drop ##Control Plane 에 적용## Router(config)# control-plane Router(config-cp)# service-policy output control-plane-policy Port Security – MAC 변조 방지 기능 Switch(config)# interface fastethernet 5/12 Switch(config-if)# switchport mode access Switch(config-if)# switchport port-security Switch(config-if)# switchport port-security maximum 5 à 최대 허용 MAC Address Switch(config-if)# switchport port-security mac-address 1000.2000.3000 à 허용 MAC address Switch(config-if)# switchport port-security violation [protect/restrict/shutdown] à 규칙 위반 시 Action Port Security – MAC flooding 방어 Console> (enable) set port security 2/1 enable Console> (enable) set port security 2/1 enable 00-90-2b-03-34-08 à 허용 MAC address Console> (enable) set port security 2/1 maximum 20 à 최대 허용 MAC Address Console> (enable) set port security 2/1 violation [restrict/shutdown] à 규칙 위반 시 Action Port Security – 공격자 MAC 제어 기술 Attacker로 의심이 되는 특정 MAC Address 만을 Filtering 4500(config)# mac-address-table static 0050.3e8d.4444 vlan (해당vlan) drop à 해당 Vlan Interface에 올라오는 MAC Address Filtering 4500(config)# show mac-address-table dynamic à 현재 Switch로 올라오는 CAM Table 조회 명령 Console> (enable) set cam static filter 00-02-03-04-05-06 12(해당 Vlan 번호) à 해당 Vlan Interface에 올라오는 MAC Address Filtering Console> (enable) clear cam 00-02-03-04-05-06 12(해당 Vlan 번호) à filtering 해제 Console> show cam static à 현재 Switch로 올라오는 CAM Table 조회 명령 Multi/Broadcast Flooding 제어기술 : Storm Control (Bandwidth 대비 Percentage 적용) Router# configure terminal Router(config)# interface gigabitethernet 3/16 Router(config-if)# storm-control multicast level 70.5 à Multicast 70.5% 이상이면 억제 Console> (enable) set port broadcast 2/1 80% multicast enable à Multicast 70.5% 이상이면 억제 : default packet drop Console> (enable) clear port broadcast 2/1 à 구성 해제 Console> (enable) set port broadcast 4/6 90% violation errdisable à Broadcast 90% 이상 이면 Interface errdisable로 만듦 공격자 MAC 추적 기술 : L2 Trace (Cat OS, Native IOS 지원 : 특정 MAC이 연결된 장비 및 포트 현황 추적 기능 지원) Cat OS Layer 2 Trace를 통한 MAC address 추적 의심이 가는 Switch에서 Layer 2 trace 명령을 통한 추적 6509> (enable) l2trace 00-00-e8-34- 00-01-e6-27- detail l2trace vlan number is 222. Attention: Source 00-00-e8-34-d2-96 is not directly attached to this system. Source 00-00-e8-34- found in WS-C4006 : 100.248.2.254 WS-C4006 : cat4006 : 100.248.2.254: 4/27 10MB half duplex -> 2/1-2 1000MB full duplex WS-C6509 : cat6509 : 100.248.117.78: 3/14,4/14 1000MB full duplex -> 8/44 10MB half duplex Destination 00-01-e6-27- found in WS-C6509 named BB_6509 on port 8/44 10MB half duplex DHCP사용환경, IP Spoofing 시 유용한 추적 Cisco IOS Layer 2 Trace를 통한 MAC address 추적 의심이 가는 Switch에서 Layer 2 trace 명령을 통한 추적 Switch# traceroute mac 0000.0201.0601 0000.0201.0201 detail Source 0000.0201.0601 found on con6[WS-C3750-12T] (2.2.6.6) con6 / WS-C3750-12T / 2.2.6.6 : Gi0/0/2 [auto, auto] => Gi0/0/3 [auto, auto] con5 / WS-C2950G-24-EI / 2.2.5.5 : Fa0/3 [auto, auto] => Gi0/1 [auto, auto] con1 / WS-C3550-12G / 2.2.1.1 : Gi0/1 [auto, auto] => Gi0/2 [auto, auto] con2 / WS-C3550-24 / 2.2.2.2 : Gi0/2 [auto, auto] => Fa0/1 [auto, auto] Destination 0000.0201.0201 found on con2[WS-C3550-24] (2.2.2.2) Layer 2 trace completed. DHCP사용환경, IP Spoofing 시 유용한 추적 Snooping 방지 : Private VLAN Private Vlan : 동일 Vlan 내부에서의 불필요한 Traffic 제어 Community Vlan : C-vlan 간 Host만 통신이 가능 Isolated Vlan : I-Vlan 간 Host도 통신 불가 Promiscuous Port : 모든 Pvlan Host는 P-port를 통한 외부 통신 가능 Private VLAN 생성 및 Sub VLAN 역할 담당 vlan 65 private-vlan primary private-vlan association 651-653 vlan 651 private-vlan community vlan 652 private-vlan isolated vlan 653 private-vlan community Primary VLAN과 Secondary VLAN Association 구성 vlan 65 private-vlan association 651,652,653 interface vlan 65 private-vlan mapping add 651,652,653 물리적 포트에 secondary vlan 할당 Router(config)# interface fastethernet 9/1 Router(config-if)# switchport mode private-vlan host Router(config-if)# switchport private-vlan host-association 65 651 Layer 2 장비로 운용시 promiscuous port 할당 Router(config)# interface fast 9/48 Router(config-if)# switchport mode private-vlan promiscuous Router(config-if)# switchport private-vlan mapping 65,651,652,653 ※ Catalyst 4000 / 4500 series 는 Isolated VLAN 만 구성가능 / Community VLAN 구성 불가 Cat OS에서의 PVLAN 구성 방법 set vlan 65 pvlan-type primary : Pvlan Primary Vlan 생성 set vlan 651 pvlan-type community : Pvlan Secondary Vlan 생성 – Community Vlan set vlan 652 pvlan-type isolated : Pvlan Secondary Vlan 생성 – Isolated Vlan set vlan 65 651 9/1 : 물리적 Port에 Secondary Vlan 할당 set vlan 65 652 9/2 : 물리적 Port에 Secondary Vlan 할당 set vlan mapping 7 651 5/11 : Promiscuous 생성 및 할당 set vlan mapping 7 652 5/11 Private Vlan Edge 기능 Isolated Vlan : Protected기능을 통한 특정 Host 보호간 상호 독립 기능 Protected와 설정되지 않은 Port간, G/W를 통한 외부 통신 가능 Private VLAN edge 기능 구성 예제 3550(config)# interface gigabitethernet0/3 3550(config-if)# switchport protected 3550(config-if)# end 3550# show interfaces gigabitethernet0/3 switchport Name: Gi0/3 Switchport: Enabled <output truncated> Protected: True Unknown unicast blocked: disabled Unknown multicast blocked: disabled Broadcast Suppression Level: 100 Multicast Suppression Level: 100 IP 변조 방지 기능 : uRPF(Unicast Reverse Path Forwarding) DHCP request flooding 공격 방어 : DHCP snooping rate limit 기능 -> DHCP Scope Size 전체에 IP 할당을 요청하여, DHCP Server 과부하 발생 시킴 DHCP Request Flooding 공격 방어 구성 예제. Switch(config)# ip dhcp snooping à DHCP Snooping enable Switch(config)# ip dhcp snooping vlan 10 à DHCP Snooping 적용 Vlan 정의 Switch(config-if)# ip dhcp snooping limit rate 100(pps) à DHCP Request 허용 수치 제한 DHCP Server 위조 공격 방어 : DHCP snooping Trust 기능 -> DHCP Request 에 대해, 공격자가 거짓된 정보를 전달함 DHCP Request Flooding 공격 방어 구성 예제. Switch(config)# ip dhcp snooping à DHCP Snooping enable Switch(config)# ip dhcp snooping vlan 10 à DHCP Snooping 적용 Vlan 정의 Switch(config-if)# ip dhcp snooping trust à DHCP discover, request 등 메시지를 해당 Port만 수용 DHCP Snooping을 통한 MAC 변조 방지 기능 – ARP Inspection DHCP Snooping을 통한 IP 변조 방지 기능 – IP Source Guard -> ARP Inspection S1(config)# ip arp inspection vlan 1 S1(config-if)# ip arp inspection trust S1# show ip dhcp snooping binding MacAddress IpAddress Lease(sec) Type VLAN Interface ------------ --------- ---------- ---------- ---- ------------- 01:01:01:11 1.1.1.11 4993 dhcp-snooping 1 FastEthernet6/4 00:12:08: %SW_DAI-4-DHCP_SNOOPING_DENY: 2 Invalid ARPs (Req) on Fa6/4, vlan 1.([01.01.01.11/1.1.1.22/0000.0000.0000/0.0.0.0/02:42:35 UTC Tue Jul 10 2001]) -> IP Source Guard 구성 Switch(config)# ip dhcp snooping Switch(config)# ip dhcp snooping vlan 10 20 Switch(config-if)# no ip dhcp snooping trust Switch(config-if)# ip verify source vlan dhcp-snooping port-security Switch(config)# ip source binding ip-addr ip vlan number interface interface Switch# sh ip verify source interface f6/1 Interface Filter-type Filter-mode IP-address Mac-address Vlan ------- -------- ----------- ----------- ------------- ------- Fa6/1 ip-mac active 10.0.0.1 10 Fa6/1 ip-mac active deny-all 11-20 Packet filtering을 위한 ACL의 이해 – Nachi Worm 취약점 Blocking 일반적인 ACL 정의 Switch(config)#ip access-list extended worm_block Switch(config)# deny tcp any any 135 Switch(config)# deny tcp any any 139 Switch(config)# deny tcp any any 445 Switch(config)# deny tcp any any 4444 Switch(config)# deny tcp any any 707 Switch(config)# deny udp any any 69 Switch(config)# deny icmp any any echo Switch(config)# deny icmp any any echo-reply Switch(config)# permit ip any any à ICMP Echo Service 막을 경우 network 진단 방법이 어려워지므로, PBR을 권고 Vlan AccessMap 정의 Switch(config) #vlan access-map worm_vacl 10 Switch(config)#match ip address worm_block à 앞서 정의된 일반적인 ACL을 불러들임 Switch(config)#action forward à 일반적인 ACL에 정의된 내용에 대한 부분은 모두 Drop 해당 Vlan Interface에 적용 Switch(config)#vlan filter worm_vacl vlan-list 100 - 150 à VACL이 적용될 해당 Vlan을 선언해 주는 부분 -> Catalyst OS를 통한 VACL 구성 방법 Vlan 기반 ACL 정의 set security acl ip VACL deny udp any eq 4444 any set security acl ip VACL deny udp any any eq 4444 set security acl ip VACL deny tcp any eq 135 any set security acl ip VACL deny tcp any any eq 135 à Blaster Worm 관련 config set security acl ip VACL deny tcp any eq 707 any set security acl ip VACL deny tcp any any eq 707 à Nachi worm 관련 config set security acl ip VACL permit ip any any à Worm을 제외한 모든 traffic permit 정의된 VACL을 해당 Vlan에 적용 commit security acl VACL set security acl map VACL <적용하고자 하는 VLAN번호> VACL 해제 방법 clear security acl VACL commit secuirty acl VACL 유연한 ACL 구성 – Time Based ACL “ MSN Messenger 를 Work Time에만 사용토록 설정 “ “ 주말에는 모든 시간대에 사용토록 설정 “ Router#sh clock <- 현재 라우터 또는 스위치의 시간 설정 확인 16:58:53.719 KST Sat Nov 1 2003 Time-Based ACL 구성 방법 access-list 101 deny ip any 207.46.104.0 0.0.0.255 time-range msn access-list 101 deny tcp any any eq 1863 time-range msn access-list 101 deny tcp any any range 6891 6900 time-range msn access-list 101 deny udp any any eq 6901 time-range msn access-list 101 permit ip any any ACL 적용 interface fastethernet 0 --> 내부 이더넷 ip access-group 101 in Time Rule 설정 Router(config)#time-range msn Router(config-time-range)#periodic weekdays 09:00 to 18:00 --> 월요일 부터 금요일 까지 매일 아침 9시 부터 저녁 6시 까지만 적용 정상 작동 확인 Router#sh access-lists Extended IP access list 101 deny ip any 207.46.104.0 0.0.0.255 time-range msn (inactive) --> 현재 시각이 토요일 이므로 자동 비활성 deny tcp any any eq 1863 time-range msn (inactive) deny tcp any any range 6891 6900 time-range msn (inactive) deny udp any any eq 6901 time-range msn (inactive) permit ip any any Catalyst 4500 에서의 QoS를 통한 TCP Synflood Attack 방어 요령 qos aggregate-policer limit 32000 bps 4000 byte conform-action transmit exceed-action drop qos ! class-map match-all c_syn match access-group 101 ! policy-map p_syn class c_syn police aggregate limit ! interface FastEthernet4/34 switchport access vlan 45 switchport mode access qos vlan-based ! interface Vlan45 ip address 10.10.45.2 255.255.255.0 service-policy input p_syn ! ip classless ip route 0.0.0.0 0.0.0.0 10.10.45.1 no ip http server ! ! ip access-list extended syn_acl permit tcp any any syn ! access-list 101 permit tcp any any syn 잠재적인 공격 대비 QoS 구성 : Cat6500 Policing mls qos -> mls QoS enable access-list 113 permit icmp any any echo access-list 113 permit icmp any any echo-reply -> icmp attack marking access-list 111 permit tcp any any eq 135 access-list 111 permit tcp any any eq 4444 access-list 111 permit tcp any any eq 707 access-list 111 permit udp any any eq 69 -> Blaster worm,Nachi worm marking access-list 112 permit tcp any any syn -> syn flooding attack 방어 marking access-list 101 permit tcp any any syn -> syn flooding attack 방어 marking 해당 Class-map 정의 class-map match-all icmp_attack match access-group 113 class-map match-all Blaster_0815_attack match access-group 112 class-map match-all Blaster_Nachi match access-group 111 각 Class에 해당되는 ACL 포함시킴 policy-map QoS class icmp_attack police 32000 1000 1000 conform-action transmit exceed-action drop violate-action drop class Blaster_0815_attack police 32000 1000 1000 conform-action transmit exceed-action drop violate-action drop class Blaster_Nachi police 32000 1000 1000 conform-action transmit exceed-action drop violate-action drop -> 각 Class 모두 32Kbps 이상이면 모두 Drop 시킴 set qos enable à QoS 활성화 시키기 set qos policer aggregate policer_worm rate 32 policed-dscp erate 32 drop burst 4 eburst 4 à 32Kbps 이상 worm에 관련된 ACL이 들어올 경우 Drop 시킨다. set qos acl ip worm dscp 8 aggregate policer_worm tcp any any eq 135 set qos acl ip worm dscp 8 aggregate policer_worm tcp any any eq 4444 set qos acl ip worm dscp 8 aggregate policer_worm tcp any any eq 707 set qos acl ip worm dscp 8 aggregate policer_worm udp any any eq 69 set qos acl ip worm dscp 8 aggregate policer_worm icmp any any echo set qos acl ip worm dscp 8 aggregate policer_worm icmp any any echo-reply à Blaster worm, Nachi worm,ICMP Attack 관련 정의 활성화 및 적용/해제/Monitoring commit qos acl worm à QoS ACL 활성화 set qos acl map worm 100 à 적용하고자 하는 Vlan or Interface 적용 Clear qos acl worm Commit qos acl worm à QoS 해제 Cat6500> (enable) sh qos statistics aggregate-policer policer_worm QoS aggregate-policer statistics: Aggregate policer Allowed packet Packets exceed Packets exceed count normal rate excess rate ------------------------------- -------------- -------------- -------------- policer_worm 268 11 11 à 해당 QoS 에 적용되어 Drop 되는 packet monitoring NBAR(Network Based Application Recognition) – 어플리케이션 레벨의 특정 서비스 인지 ※ Virus Pattern 인식 – Code Red, Nimda -> 인지 후 DSCP Marking을 통해 Drop Action 가능 ※ 다양한 Service Protocol 인식을 통한 통계 분석 가능 ※ Core Router/Switch 구간의 NBAR Enable을 통한 P2P 통계치 분석 가능 -> MIB 지원, QPM, QDM 을 통한 GUI 환경의 사용자 기반 관리 도구 제공 DoS 방어를 위한 CAR Rate Limiting ※ Limit outbound ping to 256 Kbps interface xy rate-limit output access-group 102 256000 8000 8000 conform-action transmit exceed-action drop ! access-list 102 permit icmp any any echo access-list 102 permit icmp any any echo-reply ※ Limit inbound TCP SYN packets to 8 Kbps interface xy rate-limit input access-group 103 8000 8000 8000 conform-action transmit exceed-action drop ! access-list 103 permit tcp any any syn [출처] : http://blog.naver.com/okata0525/60016729021 [제브라] |






댓글을 달아 주세요