2010年7月2日 星期五

Cisco IOS firewall – Classical Firewall

 

CCSPv3 SNRS 中有介紹到 IOS firewall, 主要分為二大類

  1. Classical Firewall
  2. Zone-Based Policy Firewall

本篇描述的是 Classical Firewall。

由於 Cisco 實在是太會不停地替旗下產品(或功能)重新命名, 在學習的過程經常會被不同的 terms 搞的很因惑, 特別是在讀 SNRS vol. 3 的 IOS firewall 時, 覺得教材上實在是講的太有限了, 因此就找了這篇文章, 也解答了不少疑惑。

最早的 Cisco IOS firewall feature 出現於 11.2P (沒想到有這麼早), 早期的名稱是 CBAC (Context-Based Access Control)。 一開始的目的是克服 ACL 純粹只能以 packet 為單位來進行 filter, CBAC 可以由它的全名的第一個字 "Context" 得知, 它是會考量 packet 的前後關係(session/dialogue)來進行 filter 的。 

後來經過不斷的改善和強化, CBAC 從以 transport layer 來對照 packet 的 context 進行過濾, 進而升級到能深度檢查 application 層是否符合 protocol compliance 或依 application-level 的 service 來進行過濾。到了 12.3(4)T時, 還添加了 ACL Bypass feature, 更進一步提昇了 performance 和 stateful inspection architecture。 因此 Cisco 將其 rename 為 SPI (Stateful Packet Inspection)。雖然兩者 (CBAC 和 SPI) 常會被認為是同一個功能, 但是事實上 SPI 比 CBAC 還要進階許多。

CBAC 的運作方式如下圖所示。

image

CBAC 必需要和 ACL 搭配運作才行, 以下節錄自原文。

SPI inspects the packet after it passes the inbound ACL of an input interface if ip inspect in is applied, or after the outbound ACL of output interface if ip inspect out is used. Thus, outbound traffic must be permitted by input ACLs facing the source, and outbound ACLs facing the destination.

以上這段是說明 outbound 的 traffic 必需先被 ACL permit 才會被對應的 ip inspect in/out 檢查, 但是 return 的 traffice 呢?
CBAC 會建立 dynamic access control entries (ACEs) 並套用在回程的 traffic 會經過的地方去呼應原先被 permit 的 outbound traffic。換句話說, CBAC 並沒有 maintain 所謂的 firewall "session table", 而是利用 dynamic ACEs 來允許回程的封包(類似 IOS Reflexive ACL 的原理)。與 CBAC 不同的, SPI 則會 maintain 一份 session table 來記錄 active sessions。以下是原文說明 ACL Bypass feature 為何能提昇 SPI 的效能。

ACL Bypass improves firewall performance for two reasons. SPI is able to maintain a more efficient list to track active sessions, reducing the time required for session setup and verification. Also, return traffic is not subjected to ACLs on the return path, so when return traffic finds a matching entry in the session table, it is shunted past the ACLs in the packet path, reducing the CPU overhead the packet incurs as it moves through the router's processing.

功能升級之後的 IOS Firewall 除了 SPI 之外, 還有下述功能

  • Protection Against Attack (DoS Protection)
  • Alerts and Audit Trails
  • Authentication Proxy (HTTP, HTTPS, TELNET & FTP)
  • Synergy with NAT and PAM (Port-to-Application Mapping)
  • Application Inspection (appfw for http/pop3/imap/smtp/esmtp/im)
  • IOS Transparent Firewall (利用IRB來達成)

 

Reference:

http://www.cisco.com/en/US/prod/collateral/vpndevc/ps5708/ps5710/ps1018/product_implementation_design_guide09186a00800fd670.html