SlideShare a Scribd company logo
1 of 25
Firewall
CSIE 基爾 @ NCU網路開源社
Updated: 12232013
課程
• 相關學分:OS、Security
• 等級:中
• 背景知識:FreeBSD基本操作、網路概念
• 課程目標:
• 了解軟硬體防火牆的不同
• 實作防火牆腳本
Firewall定義
定義
• 用來控制網路存取
• 通常具備多張網卡,能夠集中管理
• 全部拒絕,除了允許條件的之外。
分類
• 硬體防火牆:Packet filtering firewalls
• 軟體防火牆:Application layer firewalls (proxy firewalls)
• Hybrids
Comment
• 硬體防火牆是簡單的、軟體防火牆是複雜的。
• 除非你是網管,不然你不會有機會碰硬體防火牆。
• 因為軟體要模擬硬體,所以很難學,設定很複雜。
硬體防火牆 - Internet Accessible Systems
硬體防火牆 - Single Firewall
硬體防火牆 - Dual Firewalls
軟體防火牆 (又叫做personal firewall)
terminate
類似proxy的概念,單NIC模擬多NIC還需要支援NAT
知名的防火牆
• ipfw
• ufw
• iptables
• 各家防毒軟體
• windows內建
Limitations of Firewalls
• 無法防止內賊
• 無法對繞過防火牆的封包進行過濾或管制
• 無法阻擋“合法掩護非法”的攻擊 ex.VPN
• Palo Alto Networks:http://youtu.be/pBz2LNfthAg
• 0:58~1:28
parameter
規則構成如下
• Number – 第幾條規則
• Src IP – 來自何方
• Dst IP – 送往何方
• Port – 服務的埠號
• Protocol – 網路層協定
• Action – 行動
• Other
Example 軟或硬都差不多
Setting
守則
• first match algorithm
• The most specific rules to be placed at the top of the rule set.
• The least specific rules to be placed at the bottom of the rule set.
rc.conf設定檔
• firewall_enable="YES"
• firewall_logging="YES"
• firewall_script="/etc/ipfw.rules“
• Monitoring IPFW Logs
rc.firewall設定檔
• 個人電腦軟體防火牆越來越多,正常情況已經不需要改此檔案。
• (特殊需求ex. 限定頻寬)
CMD RULE_
NUMBER
ACTION LOGGING SELECTION STATEFUL
ipfw -q add [00001-
65535]
allow
accept
pass
permit
check-state
deny
drop
[log] @Next page check-state
Rule Syntax
ipfw.rules腳本 – 規則參數
udp | tcp | icmp – 哪種協定?
from src to dst – 從哪到哪?
port number – 哪個服務?
in | out – 出去還是近來?
via IF – 哪張網卡?
setup – 識別 session
keep-state – 動態規則
limit – 限制連線數目
uid – 誰?
官方example
讀取腳本 – 其實就是跑完全部指令
$ sh /etc/ipfw.rules
觀看指令
$ ipfw –a list
iptables example
さようなら~☆

More Related Content

Similar to Ch10 firewall(2013 ncu-nos_nm)

运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
ChinaNetCloud
 
Brochure ahn lab trusguard utm
Brochure ahn lab trusguard utmBrochure ahn lab trusguard utm
Brochure ahn lab trusguard utm
ahnlabchina
 
Module 08 防火牆
Module 08 防火牆Module 08 防火牆
Module 08 防火牆
rbk19871124
 
中国海运集团的虚拟化数据中心的安全方案建议
中国海运集团的虚拟化数据中心的安全方案建议中国海运集团的虚拟化数据中心的安全方案建议
中国海运集团的虚拟化数据中心的安全方案建议
Yunchao (Kevin) Wang
 
Windows Azure Virtual Machine Services for Developers
Windows Azure Virtual Machine Services for DevelopersWindows Azure Virtual Machine Services for Developers
Windows Azure Virtual Machine Services for Developers
Jeff Chu
 
分会场三赛门铁克 Data loss prevention产品介绍
分会场三赛门铁克 Data loss prevention产品介绍分会场三赛门铁克 Data loss prevention产品介绍
分会场三赛门铁克 Data loss prevention产品介绍
ITband
 
20130823 優網通產品發表會-hisb介紹
20130823 優網通產品發表會-hisb介紹20130823 優網通產品發表會-hisb介紹
20130823 優網通產品發表會-hisb介紹
HermesDDS
 
云端的数据库
云端的数据库云端的数据库
云端的数据库
thinkinlamp
 
Q con shanghai2013-[刘海锋]-[京东文件系统简介]
Q con shanghai2013-[刘海锋]-[京东文件系统简介]Q con shanghai2013-[刘海锋]-[京东文件系统简介]
Q con shanghai2013-[刘海锋]-[京东文件系统简介]
Michael Zhang
 
Ch1.b hardware & hypervisor(2013 ncu-nos_nm)
Ch1.b   hardware & hypervisor(2013 ncu-nos_nm)Ch1.b   hardware & hypervisor(2013 ncu-nos_nm)
Ch1.b hardware & hypervisor(2013 ncu-nos_nm)
Kir Chou
 

Similar to Ch10 firewall(2013 ncu-nos_nm) (20)

Построение гиперболического параболоида
Построение гиперболического параболоидаПостроение гиперболического параболоида
Построение гиперболического параболоида
 
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
 
Brochure ahn lab trusguard utm
Brochure ahn lab trusguard utmBrochure ahn lab trusguard utm
Brochure ahn lab trusguard utm
 
Module 08 防火牆
Module 08 防火牆Module 08 防火牆
Module 08 防火牆
 
深入浅出 V cloud director
深入浅出 V cloud director深入浅出 V cloud director
深入浅出 V cloud director
 
中国海运集团的虚拟化数据中心的安全方案建议
中国海运集团的虚拟化数据中心的安全方案建议中国海运集团的虚拟化数据中心的安全方案建议
中国海运集团的虚拟化数据中心的安全方案建议
 
Some tips
Some tipsSome tips
Some tips
 
工业网络安全风险可视化探讨
工业网络安全风险可视化探讨工业网络安全风险可视化探讨
工业网络安全风险可视化探讨
 
網路安全防護
網路安全防護網路安全防護
網路安全防護
 
Windows Azure Virtual Machine Services for Developers
Windows Azure Virtual Machine Services for DevelopersWindows Azure Virtual Machine Services for Developers
Windows Azure Virtual Machine Services for Developers
 
EasyGame分布式网络游戏服务器解决方案
EasyGame分布式网络游戏服务器解决方案EasyGame分布式网络游戏服务器解决方案
EasyGame分布式网络游戏服务器解决方案
 
分会场三赛门铁克 Data loss prevention产品介绍
分会场三赛门铁克 Data loss prevention产品介绍分会场三赛门铁克 Data loss prevention产品介绍
分会场三赛门铁克 Data loss prevention产品介绍
 
20130823 優網通產品發表會-hisb介紹
20130823 優網通產品發表會-hisb介紹20130823 優網通產品發表會-hisb介紹
20130823 優網通產品發表會-hisb介紹
 
Shadow_Hunter Rootkit windows7 xcon2011 Scott
Shadow_Hunter Rootkit windows7 xcon2011 Scott Shadow_Hunter Rootkit windows7 xcon2011 Scott
Shadow_Hunter Rootkit windows7 xcon2011 Scott
 
云端的数据库
云端的数据库云端的数据库
云端的数据库
 
Side-channel-attack-101
Side-channel-attack-101Side-channel-attack-101
Side-channel-attack-101
 
Splunk資安智慧分析平台
Splunk資安智慧分析平台Splunk資安智慧分析平台
Splunk資安智慧分析平台
 
弹性计算云安全(Elastic Compute Cloud Security)
弹性计算云安全(Elastic Compute Cloud Security)弹性计算云安全(Elastic Compute Cloud Security)
弹性计算云安全(Elastic Compute Cloud Security)
 
Q con shanghai2013-[刘海锋]-[京东文件系统简介]
Q con shanghai2013-[刘海锋]-[京东文件系统简介]Q con shanghai2013-[刘海锋]-[京东文件系统简介]
Q con shanghai2013-[刘海锋]-[京东文件系统简介]
 
Ch1.b hardware & hypervisor(2013 ncu-nos_nm)
Ch1.b   hardware & hypervisor(2013 ncu-nos_nm)Ch1.b   hardware & hypervisor(2013 ncu-nos_nm)
Ch1.b hardware & hypervisor(2013 ncu-nos_nm)
 

More from Kir Chou

Spime - personal assistant
Spime - personal assistantSpime - personal assistant
Spime - personal assistant
Kir Chou
 
Ch9 package & port(2013 ncu-nos_nm)
Ch9 package & port(2013 ncu-nos_nm)Ch9 package & port(2013 ncu-nos_nm)
Ch9 package & port(2013 ncu-nos_nm)
Kir Chou
 
Ch8 file system management(2013 ncu-nos_nm)
Ch8   file system management(2013 ncu-nos_nm)Ch8   file system management(2013 ncu-nos_nm)
Ch8 file system management(2013 ncu-nos_nm)
Kir Chou
 
Ch7 user management(2013 ncu-nos_nm)
Ch7   user management(2013 ncu-nos_nm)Ch7   user management(2013 ncu-nos_nm)
Ch7 user management(2013 ncu-nos_nm)
Kir Chou
 
Knowledge Management in Distributed Agile Software Development
Knowledge Management in Distributed Agile Software DevelopmentKnowledge Management in Distributed Agile Software Development
Knowledge Management in Distributed Agile Software Development
Kir Chou
 
Webapp(2014 ncucc)
Webapp(2014 ncucc)Webapp(2014 ncucc)
Webapp(2014 ncucc)
Kir Chou
 
廢除雙二一議題 保留方論點 (2013ncu全幹會)
廢除雙二一議題   保留方論點 (2013ncu全幹會)廢除雙二一議題   保留方論點 (2013ncu全幹會)
廢除雙二一議題 保留方論點 (2013ncu全幹會)
Kir Chou
 
Ch6 ssh(2013 ncu-nos_nm)
Ch6   ssh(2013 ncu-nos_nm)Ch6   ssh(2013 ncu-nos_nm)
Ch6 ssh(2013 ncu-nos_nm)
Kir Chou
 
Ch5 network basic(2013 ncu-nos_nm)
Ch5   network basic(2013 ncu-nos_nm)Ch5   network basic(2013 ncu-nos_nm)
Ch5 network basic(2013 ncu-nos_nm)
Kir Chou
 

More from Kir Chou (20)

Learn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard wayLearn from LL(1) to PEG parser the hard way
Learn from LL(1) to PEG parser the hard way
 
Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!Time travel: Let’s learn from the history of Python packaging!
Time travel: Let’s learn from the history of Python packaging!
 
Python パッケージの影響を歴史から理解してみよう!
Python パッケージの影響を歴史から理解してみよう!Python パッケージの影響を歴史から理解してみよう!
Python パッケージの影響を歴史から理解してみよう!
 
The str/bytes nightmare before python2 EOL
The str/bytes nightmare before python2 EOLThe str/bytes nightmare before python2 EOL
The str/bytes nightmare before python2 EOL
 
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史) PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
 
Introduction of CTF and CGC
Introduction of CTF and CGCIntroduction of CTF and CGC
Introduction of CTF and CGC
 
PyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PY
PyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PYPyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PY
PyCon TW 2017 - Why do projects fail? Let's talk about the story of Sinon.PY
 
GCC
GCCGCC
GCC
 
Spime - personal assistant
Spime - personal assistantSpime - personal assistant
Spime - personal assistant
 
Ch9 package & port(2013 ncu-nos_nm)
Ch9 package & port(2013 ncu-nos_nm)Ch9 package & port(2013 ncu-nos_nm)
Ch9 package & port(2013 ncu-nos_nm)
 
Ch8 file system management(2013 ncu-nos_nm)
Ch8   file system management(2013 ncu-nos_nm)Ch8   file system management(2013 ncu-nos_nm)
Ch8 file system management(2013 ncu-nos_nm)
 
Ch7 user management(2013 ncu-nos_nm)
Ch7   user management(2013 ncu-nos_nm)Ch7   user management(2013 ncu-nos_nm)
Ch7 user management(2013 ncu-nos_nm)
 
Knowledge Management in Distributed Agile Software Development
Knowledge Management in Distributed Agile Software DevelopmentKnowledge Management in Distributed Agile Software Development
Knowledge Management in Distributed Agile Software Development
 
Cms part2
Cms part2Cms part2
Cms part2
 
Cms part1
Cms part1Cms part1
Cms part1
 
Sitcon2014 community by server (kir)
Sitcon2014   community by server (kir)Sitcon2014   community by server (kir)
Sitcon2014 community by server (kir)
 
Webapp(2014 ncucc)
Webapp(2014 ncucc)Webapp(2014 ncucc)
Webapp(2014 ncucc)
 
廢除雙二一議題 保留方論點 (2013ncu全幹會)
廢除雙二一議題   保留方論點 (2013ncu全幹會)廢除雙二一議題   保留方論點 (2013ncu全幹會)
廢除雙二一議題 保留方論點 (2013ncu全幹會)
 
Ch6 ssh(2013 ncu-nos_nm)
Ch6   ssh(2013 ncu-nos_nm)Ch6   ssh(2013 ncu-nos_nm)
Ch6 ssh(2013 ncu-nos_nm)
 
Ch5 network basic(2013 ncu-nos_nm)
Ch5   network basic(2013 ncu-nos_nm)Ch5   network basic(2013 ncu-nos_nm)
Ch5 network basic(2013 ncu-nos_nm)
 

Ch10 firewall(2013 ncu-nos_nm)