CSC574 - Computer and Network Security Module: Firewalls

Similar documents
CS Computer and Network Security: Firewalls

CSE543 - Computer and Network Security Module: Firewalls

CS Computer and Network Security: Firewalls

Module: Firewalls. Professor Patrick McDaniel Spring CMPSC443 - Introduction to Computer and Network Security

CIS 433/533 - Computer and Network Security Firewalls

Firewalls, NAT and Intrusion Detection and Prevention Systems (IDS)

+ iptables. packet filtering && firewall

Firewalls. Chien-Chung Shen

Computer Firewalls. The term firewall was originally used with forest fires, as a means to describe the

Linux firewall. Need of firewall Single connection between network Allows restricted traffic between networks Denies un authorized users

CIT 480: Securing Computer Systems. Firewalls

Chapter 7. Firewalls

1:1 NAT in ZeroShell. Requirements. Overview. Network Setup

CIT 480: Securing Computer Systems. Firewalls

Linux Routers and Community Networks

Linux: 20 Iptables Examples For New SysAdmins

Netfilter. GNU/Linux Kernel version 2.4+ Setting up firewall to allow NIS and NFS traffic. January 2008

Track 2 Workshop PacNOG 7 American Samoa. Firewalling and NAT

Linux Firewalls (Ubuntu IPTables) II

Linux Firewall Wizardry. By Nemus

How To Understand A Firewall

Firewall Firewall August, 2003

How To Set Up An Ip Firewall On Linux With Iptables (For Ubuntu) And Iptable (For Windows)

Intro to Linux Kernel Firewall

Firewall. IPTables and its use in a realistic scenario. José Bateira ei10133 Pedro Cunha ei05064 Pedro Grilo ei09137 FEUP MIEIC SSIN

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

Main functions of Linux Netfilter

Definition of firewall

Netfilter / IPtables

Computer Security CS 426 Lecture 36. CS426 Fall 2010/Lecture 36 1

Internet Firewall CSIS Internet Firewall. Spring 2012 CSIS net13 1. Firewalls. Stateless Packet Filtering

Assignment 3 Firewalls

Network Security Exercise 10 How to build a wall of fire

Network Security Management

Protecting and controlling Virtual LANs by Linux router-firewall

Network security Exercise 9 How to build a wall of fire Linux Netfilter

Firewall implementation and testing

Firewalls. Pehr Söderman KTH-CSC

ipchains and iptables for Firewalling and Routing

TECHNICAL NOTES. Security Firewall IP Tables

Linux Networking: IP Packet Filter Firewalling

Building a Home Gateway/Firewall with Linux (aka Firewalling and NAT with iptables )

Firewalls (IPTABLES)

Focus on Security. Keeping the bad guys out

Optimisacion del ancho de banda (Introduccion al Firewall de Linux)

Firewalls and VPNs. Principles of Information Security, 5th Edition 1

Topics NS HS12 2 CINS/F1-01

Internet Firewall CSIS Packet Filtering. Internet Firewall. Examples. Spring 2011 CSIS net15 1. Routers can implement packet filtering

Lab Objectives & Turn In

How to protect your home/office network?

FIREWALL AND NAT Lecture 7a

How to Turn a Unix Computer into a Router and Firewall Using IPTables

Stateful Firewalls. Hank and Foo

Matthew Rossmiller 11/25/03

A host-based firewall can be used in addition to a network-based firewall to provide multiple layers of protection.

Cryptography and network security

Firewalls. Basic Firewall Concept. Why firewalls? Firewall goals. Two Separable Topics. Firewall Design & Architecture Issues

Overview. Firewall Security. Perimeter Security Devices. Routers

Using VyOS as a Firewall

How To Set Up A Network Map In Linux On A Ubuntu 2.5 (Amd64) On A Raspberry Mobi) On An Ubuntu (Amd66) On Ubuntu 4.5 On A Windows Box

Firewalls. ITS335: IT Security. Sirindhorn International Institute of Technology Thammasat University ITS335. Firewalls. Characteristics.

Firewalls. Contents. ITS335: IT Security. Firewall Characteristics. Types of Firewalls. Firewall Locations. Summary

Open Source Bandwidth Management: Introduction to Linux Traffic Control

Firewall. Vyatta System. REFERENCE GUIDE IPv4 Firewall IPv6 Firewall Zone Based Firewall VYATTA, INC.

How to Secure RHEL 6.2 Part 2

Linux Firewall. Linux workshop #2.

Telematics. 14th Tutorial - Proxies, Firewalls, P2P

Worksheet 9. Linux as a router, packet filtering, traffic shaping

Introduction to Firewalls

allow all such packets? While outgoing communications request information from a

CSCE 465 Computer & Network Security

Packet Filtering using the ADTRAN OS firewall has two fundamental parts:

INTRODUCTION TO FIREWALL SECURITY

CSCI Firewalls and Packet Filtering

Network Defense Tools

Introduction to Firewalls Open Source Security Tools for Information Technology Professionals

SFWR ENG 4C03 Class Project Firewall Design Principals Arash Kamyab March 04, 2004

Chapter 15. Firewalls, IDS and IPS

ΕΠΛ 674: Εργαστήριο 5 Firewalls

Firewall Configuration and Assessment

Linux MDS Firewall Supplement

Firewalls. Test your Firewall knowledge. Test your Firewall knowledge (cont) (March 4, 2015)

Manuale Turtle Firewall

Security Technology: Firewalls and VPNs

Firewall. Vyatta System. REFERENCE GUIDE IPv4 Firewall IPv6 Firewall Zone Based Firewall VYATTA, INC.

Packet filtering with Linux

FIREWALLS & CBAC. philip.heimer@hh.se

What is a Firewall? Computer Security. Firewalls. What is a Firewall? What is a Firewall?

Firewalls. Firewall types. Packet filter. Proxy server. linux, iptables-based Windows XP s built-in router device built-ins single TCP conversation

GregSowell.com. Mikrotik Security

Firewalls. Firewalls. Idea: separate local network from the Internet 2/24/15. Intranet DMZ. Trusted hosts and networks. Firewall.

Packet Filtering Firewall

Firewalls. Chapter 3

UNIVERSITY OF BOLTON CREATIVE TECHNOLOGIES COMPUTING AND NETWORK SECURITY SEMESTER TWO EXAMINATIONS 2014/2015 NETWORK SECURITY MODULE NO: CPU6004

Security+ Guide to Network Security Fundamentals, Fourth Edition. Chapter 6 Network Security

Firewalls. Ingress Filtering. Ingress Filtering. Network Security. Firewalls. Access lists Ingress filtering. Egress filtering NAT

Com.X Router/Firewall Module. Use Cases. White Paper. Version 1.0, 21 May Far South Networks

Transcription:

CSC574 - Computer and Network Security Module: Firewalls Prof. William Enck Spring 2013 1

Firewalls A firewall... is a physical barrier inside a building or vehicle, designed to limit the spread of fire, heat and structural collapse. 2

Filtering: Firewalls Filtering traffic based on policy Policy determines what is acceptable traffic Access control over traffic Accept or deny Application May perform other duties Network Logging (forensics, SLA) Flagging (intrusion detection) Link QoS (differentiated services) 3

IP Firewall Policy Specifies what traffic is (not) allowed Maps attributes to address and ports Example: HTTP should be allowed to any external host, but inbound only to web-server 4

X-Listing Blacklisting - specifying specific connectivity that is explicitly disallowed E.g., prevent connections from badguys.com Whitelisting - specifying specific connectivity that explicitly allowed E.g., allow connections from goodguys.com These is useful for IP filtering, SPAM mitigation, Q: What access control policies do these represent? 5

Stateful, Proxy, and Transparent Single packet contains insufficient data to make access control decision Stateful: allows historical context consideration Firewall collects data over time e.g., TCP packet is part of established session Firewalls can affect network traffic Transparent: appear as a single router (network) Proxy: receives, interprets, and reinitiates communication (application) Transparent good for speed (routers), proxies good for complex state (applications) 6

DMZ (De-militarized Zone) (servers) Internet LAN LAN Zone between LAN and Internet (public facing) 7

Practical Issues and Limitations Network layer firewalls are dominant DMZs allow multi-tiered fire-walling Tools are widely available and mature Personal firewalls gaining popularity Issues Network perimeters not quite as clear as before E.g., telecommuters, VPNs, wireless, Every access point must be protected E.g., this is why war-dialing is effective Hard to debug, maintain consistency and correctness Often seen by non-security personnel as impediment E.g., Just open port X so I can use my wonder widget SOAP - why is this protocol an issue? 8

The Wool firewall study.. 12 error classes No default policy, automatic broad tools NetBIOS (the very use of the Win protocol deemed error) Portmapper protocols Use of any wildcards Lack of egress rules Interesting questions: Is the violation of Wool s errors really a problem? DNS attack comment? Why do you think more expensive firewalls had a higher occurrence of errors? Take away: configurations are bad 9

Practical Firewall Implementations Primary task is to filter packets But systems and requirements are complex Consider All the protocols and services Stateless vs. stateful firewalls Network function: NAT, forwarding, etc. Practical implementation: Linux iptables http://www.netfilter.org/documentation/howto/packet-filtering- HOWTO.html http://linux.web.cern.ch/linux/scientific3/docs/rhel-rg-en-3/chiptables.html 10

Netfilter hook Series of hooks in Linux network protocol stack An iptable rule set is evaluated at each PREROUTING : before routing INPUT : inbound to local destination FORWARD : inbound but routed off host OUTPUT : outbound to remote destination POSTROUTING : after routing Preroute Routing Forward Postroute Input Output 11

iptables Concepts The iptables firewall looks in the firewall table to seek if the chain associated with the current hook matches a packet, and executes the target if it does. Table: allows policies to be cleanly separated by purpose (default: -t filter, also: -t nat, -t mangle and -t raw ) Each table as a set of default chains. Chain: list of rules associated with the chain identifier, e.g., hook name (INPUT, OUTPUT, etc) Match: when all a rule s field match the packet Target: operation to execute on a packet given a match 12

Table/Chain Traversal http://www.linuxtopia.org/linux_firewall_iptables/c951.html 13

iptables Commands iptables [-t <table_name>] <cmd> <chain> <plist> Commands Append rule to end or specific location in chain (-A) Delete a specific rule in a chain (-D) Replace a rule (-R) Flush a chain (-F) List a chain (-L) Set a default chain policy (-P) Create a new user-specified chain (-N) Remove an empty (user-specified) chain (-X) 14

iptables Rule Parameters Things you can match on Destination/Source IP address range and netmask Protocol of packet ICMP, TCP, etc Fragmented only Incoming/outgoing interface Target on rule match 15

Test it out PING on localhost ping -c 1 127.0.0.1 Add iptables rule to block iptables -A INPUT -s 127.0.0.1 -p icmp -j DROP Try ping Delete the rule iptables -D INPUT 1 iptables -D INPUT -s 127.0.0.1 -p icmp -j DROP iptables -F INPUT 16

Testing Use loopback to test the rules locally on your machine IP address 127.0.0.1 ICMP submit ping requests to 127.0.0.1 as above TCP submit requests to 127.0.0.1 at specific port server nc -l 3750 listen at port 3750 client nc -p 3000 localhost 3750 send from port 3000 to localhost at port 3750 17

Per Protocol Options Specialized matching options for rules Specific to protocol TCP Source/destination ports SYN TCP flags 18

Targets Define what to do with the packet at this time ACCEPT/DROP QUEUE for user-space application LOG any packet that matches REJECT drops and returns error packet RETURN enables packet to return to previous chain <user-specified> passes packet to that chain ## Create chain which blocks new connections, except if coming from inside. # iptables -N block # iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A block -m state --state NEW -i! ppp0 -j ACCEPT # iptables -A block -j DROP ## Jump to that chain from INPUT and FORWARD chains. # iptables -A INPUT -j block # iptables -A FORWARD -j block 19

Examples iptables -A INPUT -s 200.200.200.2 -j ACCEPT iptables -A INPUT -s 200.200.200.1 -j DROP iptables -A INPUT -s 200.200.200.1 -p tcp -j DROP iptables -A INPUT -s 200.200.200.1 -p tcp --dport telnet -j DROP iptables -A INPUT -p tcp --destination-port telnet -i ppp0 -j DROP 20

Best Rule Placement? An iptable rule set is evaluated at each PREROUTING : before routing INPUT : inbound to local destination FORWARD : inbound but routed off host OUTPUT : outbound to remote destination POSTROUTING : after routing Preroute Routing Forward Postroute Input Output 21

Example: Gateway/DMZ Firewalls Assume you have two firewalls (FW1 and FW2), each with two ethernet interfaces (eth0 and eth1). eth0 FW1 eth1 FW2 eth0 eth1 FW1 protects the DMZ, and FW2 protects the LAN Define an iptables policy for FW1 that Allows new Internet traffic to reach port 80 on 10.0.1.13 Does not allow traffic to reach the LAN (10.0.2.0/24) Define an iptables policy for FW2 that Allows internal hosts to reach the webserver, but nothing else in the DMZ (10.0.1.0/24) Prevents DMZ hosts from initiating connections to LAN 22

Example: Gateway/DMZ Firewalls FW1 Policy # iptables -F INPUT # iptables -F OUTPUT # iptables -F FORWARD # iptables -P INPUT ACCEPT # iptables -P OUTPUT ACCEPT # iptables -P FORWARD DROP # iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A FORWARD -i eth0 -o eth1 -m state --state NEW -d 10.0.1.13 --dport 80 -j ACCEPT # iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT FW2 Policy # iptables -F INPUT # iptables -F OUTPUT # iptables -F FORWARD # iptables -P INPUT ACCEPT # iptables -P OUTPUT ACCEPT # iptables -P FORWARD DROP # iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A FORWARD -i eth1 -o eth0 -m state --state NEW -d 10.0.1.13 --dport 80 -j ACCEPT # iptables -A FORWARD -i eth1 -o eth0 -d! 10.0.1.0/24 -j ACCEPT 23

Example: Host Firewall Assume you have a host with one network interface (eth0). You are running SSH (port 22) and want to allow access by external hosts. You are also running Apache for Web development, and only want it to be accessed by other hosts on the LAN (10.0.2.0/24) 24

Example: Host Firewall Assume you have a host with one network interface (eth0). You are running SSH (port 22) and want to allow access by external hosts. You are also running Apache for Web development, and only want it to be accessed by other hosts on the LAN (10.0.2.0/24) # iptables -F INPUT # iptables -F OUTPUT # iptables -F FORWARD # iptables -P INPUT DROP # iptables -P OUTPUT ACCEPT # iptables -P FORWARD DROP # iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # iptables -A INPUT -i eth0 -m state --state NEW --dport 22 -j ACCEPT # iptables -A INPUT -i eth0 -m state --state NEW -s 10.0.2.0/24 --dport 80 -j ACCEPT 24

Deep Packet Inspection Deep packet inspection looks into the internals of a pack to look for some application/content context e.g., inspect HTTP for URLs that point to malicious websites Can have serious privacy issues if done by, say COMCAST To specify a match in iptables iptables -A INPUT -p tcp -m string --algo bm --string exe matches to packet with content containing exe iptables -A INPUT -p tcp -m length --length 10:100 matches to packet with length between 10 and 100 bytes Also, can specify greater than 10 by 10: 25