network firewalls
play

Network Firewalls the outside world is a poten7al aCack - PDF document

4/29/14 CSE/ISE 311: Systems Administra5on CSE/ISE 311: Systems Administra5on Firewalls: An Essen7al Tool Previous Lectures: Every service on a system visible


  1. 4/29/14 ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Firewalls: ¡An ¡Essen7al ¡Tool ¡ • Previous ¡Lectures: ¡Every ¡service ¡on ¡a ¡system ¡visible ¡to ¡ Network ¡Firewalls ¡ the ¡outside ¡world ¡is ¡a ¡poten7al ¡aCack ¡vector ¡ • Observa7ons: ¡ ¡ Don ¡Porter ¡ – It ¡is ¡really ¡hard ¡to ¡police ¡every ¡single ¡system ¡for ¡insecure ¡ soIware ¡(although ¡you ¡should ¡do ¡this) ¡ – Some ¡network ¡services ¡are ¡intended ¡only ¡for ¡use ¡inside ¡your ¡ network ¡ • Idea: ¡Filter ¡incoming ¡network ¡connec7ons ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Example ¡ Example ¡ 80 ¡ 80 ¡ Da’ ¡ Da’ ¡ Public ¡web ¡server ¡ Public ¡web ¡server ¡ Internet ¡ Internet ¡ 3306 ¡ 3306 ¡ Router ¡ Switch ¡ Router ¡ Switch ¡ Super-­‑Secret ¡ Super-­‑Secret ¡ Incoming : ¡ Internal ¡Database ¡Server ¡ Internal ¡Database ¡Server ¡ Allow: ¡Web ¡server, ¡port ¡80 ¡ Else ¡Deny ¡ ¡ Outgoing: ¡ Allow ¡all ¡ How ¡to ¡let ¡users ¡access ¡database, ¡but ¡not ¡bad ¡guy? ¡ Direct ¡outside ¡connec7ons ¡to ¡database ¡blocked ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Example ¡Recap ¡ Types ¡of ¡Firewalls ¡ • A ¡firewall ¡(aka ¡packet ¡filter) ¡looks ¡at ¡packet ¡headers ¡ • Most ¡personal ¡computers ¡include ¡firewall ¡soIware ¡ and ¡filters ¡them ¡based ¡on ¡aCributes ¡such ¡as ¡IP ¡ – Linux: ¡iptables ¡ address ¡and ¡port ¡number ¡ – Windows: ¡part ¡of ¡MicrosoI ¡Security ¡Essen7als ¡ • Can ¡filter ¡incoming ¡and ¡outgoing ¡traffic ¡ • For ¡enterprise ¡deployments, ¡you ¡can ¡buy ¡stand-­‑ alone ¡firewall ¡boxes ¡from ¡companies ¡like ¡Cisco ¡ • Can ¡log ¡dodgy ¡packets ¡for ¡further ¡inspec7on ¡ • For ¡smaller ¡deployments, ¡a ¡Linux ¡system ¡can ¡also ¡act ¡ as ¡a ¡firewall, ¡using ¡same ¡soIware ¡ – In ¡fact, ¡many ¡personal ¡router/firewall/access ¡point ¡boxes ¡ run ¡a ¡lightweight ¡Linux ¡build ¡+ ¡iptables ¡ 1 ¡

  2. 4/29/14 ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ More ¡Layered ¡Security ¡ Refinement: ¡DMZ ¡ • Some ¡servers ¡are ¡intended ¡to ¡be ¡publicly ¡accessible ¡ • Idea: ¡Put ¡a ¡second ¡firewall ¡between ¡public ¡and ¡ (e.g., ¡the ¡web ¡server) ¡ private ¡services ¡ • Others ¡are ¡for ¡internal-­‑use ¡only ¡and ¡contain ¡sensi7ve ¡ • We ¡call ¡the ¡public ¡part ¡of ¡the ¡network ¡the ¡ informa7on ¡(e.g., ¡the ¡database ¡server) ¡ Demilitarized ¡Zone ¡(DMZ) ¡ • What ¡happens ¡if ¡the ¡web ¡server ¡is ¡compromised? ¡ – Web ¡server ¡is ¡inside ¡the ¡firewall ¡ – Can ¡access ¡the ¡sensi7ve ¡database ¡server ¡ – ACacker ¡can ¡use ¡web ¡server ¡to ¡aCack ¡database ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Example ¡ DMZ ¡Recap ¡ Deny ¡All ¡in ¡ • Best ¡prac7ce: ¡2 ¡firewalls ¡ DMZ ¡ Allow ¡80 ¡in ¡ – One ¡between ¡you ¡and ¡internet ¡ Da’ ¡ – One ¡between ¡public ¡and ¡private ¡servers ¡ Router ¡ Switch ¡ Switch ¡ Internet ¡ • Limits ¡damage ¡if ¡your ¡web ¡server ¡is ¡compromised ¡ 3306 ¡ 80 ¡ Public ¡web ¡server ¡ Super-­‑Secret ¡ DMZ ¡ Internal ¡Database ¡Server ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Incoming ¡Traffic ¡Caveats ¡ Firewall ¡Overview ¡Summary ¡ • As ¡presented, ¡the ¡rules ¡are ¡preCy ¡simple: ¡ ¡ • Placing ¡packet ¡filters ¡near ¡your ¡router ¡can ¡protect ¡ your ¡network ¡ – E.g., ¡block ¡everything ¡except ¡traffic ¡to ¡web ¡server ¡ • But ¡what ¡about ¡responses ¡to ¡external ¡traffic? ¡ – Block ¡access ¡to ¡private ¡systems ¡ – Mi7gate ¡risk ¡of ¡user ¡running ¡a ¡vulnerable ¡service ¡without ¡ – E.g., ¡hCp ¡GET ¡of ¡www.google.com? ¡ your ¡knowledge ¡ • Firewalls ¡generally ¡track ¡some ¡connec7on-­‑level ¡ • Mul7ple ¡firewalls ¡can ¡be ¡useful ¡ state, ¡allow ¡incoming ¡responses ¡to ¡requests ¡from ¡ – DMZ ¡ inside ¡the ¡firewall ¡ – Host-­‑level ¡firewall ¡ – Some7mes ¡called ¡stateful ¡inspec7on ¡ • Only ¡one ¡piece ¡of ¡the ¡puzzle! ¡ – States ¡of ¡note: ¡Established ¡and ¡Related ¡ – Disabling ¡vulnerable ¡services, ¡security ¡patches, ¡etc., ¡s7ll ¡ maCer ¡ 2 ¡

  3. 4/29/14 ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ iptables ¡ ¡ Key ¡abstrac7ons ¡ • Let’s ¡walk ¡through ¡how ¡you ¡might ¡configure ¡iptables ¡ • Rules : ¡If ¡packet ¡matches ¡X, ¡take ¡ac7on ¡Y ¡ on ¡a ¡Linux ¡machine ¡ • Examples: ¡ -p tcp --dport 80 –j ACCEPT • (If ¡the ¡packet ¡is ¡a ¡TCP ¡packet ¡des7ned ¡for ¡port ¡80, ¡allow) ¡ -s 87.84.250.101 –j DROP • (If ¡the ¡packet ¡comes ¡from ¡IP ¡address ¡87.84.250.101, ¡silently ¡drop) ¡ -p icmp --limit 2/sec –j ACCEPT • (Limit ¡incoming ¡pings ¡to ¡2 ¡per ¡second) ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Key ¡Abstrac7ons ¡ Key ¡Abstrac7ons ¡ • Chains : ¡An ¡ordered ¡list ¡of ¡rules ¡ • Tables: ¡Collec7on ¡of ¡chains ¡ – Evalua7on ¡stops ¡on ¡a ¡match ¡ – Each ¡chain ¡applied ¡to ¡different ¡stages ¡of ¡packet ¡processing ¡ • Generally ¡has ¡the ¡structure: ¡ • Default ¡table: ¡“filter”, ¡has ¡3 ¡chains: ¡ If ¡A, ¡Accept ¡ – INPUT ¡– ¡chain ¡of ¡rules ¡for ¡packets ¡coming ¡into ¡local ¡ machine ¡ If ¡B, ¡Accept ¡ – OUTPUT ¡– ¡chain ¡of ¡rules ¡for ¡packets ¡leaving ¡the ¡local ¡ … ¡(more ¡accept ¡rules) ¡ machine ¡(and ¡that ¡originated ¡on ¡the ¡machine) ¡ Drop ¡everything ¡else ¡ – FORWARD ¡– ¡chain ¡of ¡rules ¡for ¡routed ¡packets ¡ ¡ • I.e., ¡packets ¡that ¡enter ¡one ¡device ¡and ¡leave ¡on ¡another ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ Detailed ¡Example ¡(command ¡line) ¡ How ¡to ¡automa7cally ¡reload? ¡ iptables -F • You ¡can ¡just ¡type ¡ sudo iptables -L to ¡see ¡ current ¡state ¡ iptables -P INPUT DROP • You ¡can ¡dump ¡the ¡current ¡iptables ¡state ¡using: ¡ iptables –P FORWARD DROP sudo iptables-save > saved-rules ¡ iptables -P OUTPUT ACCEPT • You ¡can ¡restore ¡the ¡same ¡rules ¡again ¡using: ¡ iptables –A INPUT –-state RELATED,ESTABLISHED -j ACCEPT sudo iptables-restore < saved-rules ¡ ¡ iptables –A INPUT –p icmp --limit 2/sec –j ACCEPT iptables –A INPUT –i lo –j ACCEPT Iptables –p tcp --dport 22 –j ACCEPT 3 ¡

  4. 4/29/14 ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ CSE/ISE ¡311: ¡Systems ¡Administra5on ¡ As ¡part ¡of ¡boot… ¡ Summary ¡ • You ¡can ¡generally ¡configure ¡rules ¡when ¡a ¡machine ¡is ¡ • Firewalls ¡can ¡harden ¡your ¡network ¡ brought ¡up ¡in ¡/etc/network/interfaces ¡ – But ¡are ¡not ¡a ¡panacea ¡ – This ¡is ¡the ¡standard ¡network ¡configura7on ¡file ¡ • In ¡fact, ¡use ¡2 ¡firewalls, ¡and ¡have ¡a ¡DMZ ¡for ¡public ¡ – Direc7ve: ¡pre-­‑up ¡ systems ¡ • Example: ¡ • Iptables ¡is ¡good ¡to ¡have ¡in ¡your ¡toolbox ¡ auto eth0 iface eth0 inet dhcp pre-up iptables-restore < /etc/iptables.up.rules 4 ¡

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend