![](https://hackmd.io/_uploads/BkWcqWbYn.jpg) ## Firewall -> is a security policy enforement point. -> 是一個設備,類似城門功能,管理人員進出。 ### 任務 - pass - reject - encrypt - log ### why are needed - 防止被攻擊 - 資料完整性 ### goals - 防止被滲透 ### protect - Data - Resources ## 發展過程 ![](https://hackmd.io/_uploads/rkQfAWbF2.jpg) 1. packet filter : 進出管制 2. Application Proxy : 較packet filter嚴格,封包進入內部不能直接進出,需要透過中間人。 3. stateful Inspection : 每次有新的封包進入都會記錄在state table中,當封包進入後會先檢查是否已經有紀錄,可以減少CPU執行,檢查完後會確認封包有沒有建立連線,可以排除惡意的封包進入。 ### Traditional packet filter : 最普遍最多。 - 優點 : 快速。 缺點 : only check low-level attributes。 - 注意 - source/destination IP adress - source/destination port - TCP flag bits - TCP/UDP(all block)/ICMP - direction - router interface #### Access control list(ACL) - 有先後順序。 - 每一個介面都有自己的ACL->會造成從A介面可以通過,B介面可能會被阻擋的情況。 #### Network Address Translation(NAT) - 把內部IP轉成外部IP。 - 好處 : 1.可隱藏內部IP。2.更多設備可連線。 - 靜態NAT , 一對一 , 內部資源可以開放給外部使用,因為外部IP可以知道與他相連的內部IP。 - 動態NAT , 多對多 , 可以用較少的外部IP,但因為內部是動態IP所以不能夠給外部使用。 #### **Advantages** - One router can protect entire network。 - 因為packet filter在router裡面制定規則。 - Can be efficient if filtering rules are kept simple。 - ACL,simple有效率因為比對快速。 - widely available - 市面很多router,很容易建置使用。 #### **Disadvantages** - Can possibly be penetrated -> 改rule - Cannot enforce some policies -> rule是死的,但是IP如果變動會有問題。 - Rules can get complicated and difficult to test。-> 規則會越設越多,會變更複雜,又有優先順序影響,所以設定會越難。 ### Application Level Firewall - Application proxies,provide the most secure type of data connection。 - Examine every layer of the communication,including the application data。 - The connection from a client to a server is intercepted by the proxy。 - client to a server : 從 application layer 看封包內容,高安全性但速度慢。 (C->P->S) ### SOCKS Proxy Protocol。(還有其他的?跟其他有甚麼差異?) - Http、FTP、telnet、ssl... ![](https://hackmd.io/_uploads/B1nybEWYh.jpg) #### Proxy gateways - **Advantages** - log 儲存 - catch - filter based on content -> 可以看所有內容 - user-level authentication -> 動態IP會有問題,靠帳密做認證。 - **Disadvantages** - Not all services have proxied versions。 - May need different proxy server for each service。 -> 都建立在同一個,本來速度很慢了,會變更慢。 - Requires modification of client。??? - performance。1.封包內容的檢查。2.2邊建連線 ### Firewall Architectures 1. Screenig Router(ACL) ![](https://hackmd.io/_uploads/H1NcNVbY2.jpg) 2. Simple Firewall ![](https://hackmd.io/_uploads/S1YcVV-Y3.jpg) - 2個介面 3. Multi-Legged firewall ![](https://hackmd.io/_uploads/Byp9V4bth.jpg) - DMZ : Demilitarized Zone ,非監視區。 #### firewall 設備 1. 雙介面主機架構 ![](https://hackmd.io/_uploads/ByYZP4bth.png) - ASA主機昂貴,但防火牆做得比較完整。(漏洞少) - 缺點 : 封包過濾/代理程式擇一,有漏洞容易被攻破。 ![](https://hackmd.io/_uploads/r1LyDV-t2.png) - 屏蔽路由器與防禦主機分開,工作明確,安全性提高。 ![](https://hackmd.io/_uploads/r1jyPEZt2.png) - 多內部路由器,由2道安全機制,安全性更高。 #### 縱深防禦NAC - iptable - filter : chains - input - output - forward - NAT - MANGLE