Firewalls. October 23, 2015



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

Linux Networking: IP Packet Filter Firewalling

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

Firewalls. Chien-Chung Shen

Linux Routers and Community Networks

+ iptables. packet filtering && firewall

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

Track 2 Workshop PacNOG 7 American Samoa. Firewalling and NAT

Linux Firewalls (Ubuntu IPTables) II

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

Linux Firewall Wizardry. By Nemus

Chapter 7. Firewalls

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

Intro to Linux Kernel Firewall

How To Understand A Firewall

Main functions of Linux Netfilter

CS Computer and Network Security: Firewalls

CS Computer and Network Security: Firewalls

CIT 480: Securing Computer Systems. Firewalls

Linux Firewall. Linux workshop #2.

CIT 480: Securing Computer Systems. Firewalls

CSC574 - Computer and Network Security Module: Firewalls

Linux: 20 Iptables Examples For New SysAdmins

Firewalls (IPTABLES)

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

Assignment 3 Firewalls

Network Security Exercise 10 How to build a wall of fire

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

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

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

Netfilter / IPtables

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

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

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

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

Linux Networking Basics

Lecture Objectives. Lecture 6 Mobile Networks: Nomadic Services, DHCP, NAT, and VPNs. Agenda. Nomadic Services. Agenda. Nomadic Services Functions

CSE543 - Computer and Network Security Module: Firewalls

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Firewall implementation and testing

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

ΕΠΛ 475: Εργαστήριο 9 Firewalls Τοίχοι πυρασφάλειας. University of Cyprus Department of Computer Science

ipchains and iptables for Firewalling and Routing

Security Technology: Firewalls and VPNs

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

How to protect your home/office network?

Linux Cluster Security Neil Gorsuch NCSA, University of Illinois, Urbana, Illinois.

Protecting and controlling Virtual LANs by Linux router-firewall

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

Focus on Security. Keeping the bad guys out

FIREWALL AND NAT Lecture 7a

Firewalls N E T W O R K ( A N D D ATA ) S E C U R I T Y / P E D R O B R A N D Ã O M A N U E L E D U A R D O C O R R E I A

Lab Objectives & Turn In

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

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

IMPLEMENTATION OF INTELLIGENT FIREWALL TO CHECK INTERNET HACKERS THREAT

Virtual private network. Network security protocols VPN VPN. Instead of a dedicated data link Packets securely sent over a shared network Internet VPN

CIS 433/533 - Computer and Network Security Firewalls

Internet Protocol: IP packet headers. vendredi 18 octobre 13

IP Address: the per-network unique identifier used to find you on a network

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

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

21.4 Network Address Translation (NAT) NAT concept

Definition of firewall

Firewall Implementation

TECHNICAL NOTES. Security Firewall IP Tables

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

Load Balancing Trend Micro InterScan Web Gateway

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

NAT REFERENCE GUIDE. VYATTA, INC. Vyatta System NAT. Title

Firewalls with IPTables. Jason Healy, Director of Networks and Systems

Load Balancing Sophos Web Gateway. Deployment Guide

Internet infrastructure. Prof. dr. ir. André Mariën

CSE331: Introduction to Networks and Security. Lecture 12 Fall 2006

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

Load Balancing Bloxx Web Filter. Deployment Guide

Evaluation guide. Vyatta Quick Evaluation Guide

Network Security. Internet Firewalls. Chapter 13. Network Security (WS 2002): 13 Internet Firewalls 1 Dr.-Ing G. Schäfer

netkit lab load balancer web switch 1.1 Giuseppe Di Battista, Massimo Rimondini Version Author(s)

Load Balancing Web Proxies Load Balancing Web Filters Load Balancing Web Gateways. Deployment Guide

Packet Filtering Firewall

Managing Multiple Internet Connections with Shorewall

Network Defense Tools

Network Address Translation (NAT)

Home Networking In Linux

Matthew Rossmiller 11/25/03

NAT & IP Masquerade. Internet NETWORK ADDRESS TRANSLATION INTRODUCTION. NAT & IP Masquerade Page 1 of 5. Internal PC

How to Secure RHEL 6.2 Part 2

pp=pod number, xxx=static IP address assigned to your pod

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

TECHNICAL NOTE. Technical Note P/N REV 03. EMC NetWorker Simplifying firewall port requirements with NSR tunnel Release 8.

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

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

Transcription:

Firewalls October 23, 2015 Administrative submittal instructions answer the lab assignment s questions in written report form, as a text, pdf, or Word document file (no obscure formats please) email to csci530l@usc.edu exact subject title must be firewallslab deadline is start of your lab session the following week reports not accepted (zero for lab) if late you did not attend the lab (except DEN or prior arrangement) email subject title deviates 1

Administrative remaining calendar Administrative when to do firewall lab do it on DETER during Fri 10/23 Mon 11/2 inclusive (there is a node reservation for CS530 for that interval) no meeting for it in OHE406, since it is remote instead 2

DETER activity timing machine quotas in place for our whole class software-enforced by DETER timed to match our assignment schedule formal reservation intervals in DETER s schedule database per next slide assignments to be done during those intervals due dates per earlier slide (same for all students on the DETER exercises) DETER calendar (3 labs) Fri lecture Topic DETER-enforced interval to do lab* familiarization exercise** current, if you need it 10/23 Firewalls 10/23 11/2 (inclusive) 10/30 Intrusion detection non-deter 11/6 Tunnels and VPNs tba (to-be-announced) 11/13 Computer forensics tba *when we have machine reservations in place with DETER administration; machine quantities are controlled by class quota, so please attempt the exercises early in their assigned calendar interval in case you can t get in you will have time to try again. ** at http://www-scf.usc.edu/~csci530l/instructions/lab-deter-account.htm 3

Firewall types Packet filter linux, iptables-based Windows XP s built-in router device built-ins single TCP conversation Proxy server specialized server program on internal machine client talks to it instead of desired external server it conducts conversation with external server for client and plays relay middleman between them subject to policy 2 separate TCP conversations Linux Netfilter Firewalling Packet filter, not proxy Centerpiece command: iptables Starting point: packet structure details 4

IP packet structure Source Address Destination Address Protocol Number IP s Data Payload Payload types - subprotocols Src Dest 17 UDP (17) datagram Src Dest 1 ICMP (1) message Src Dest 6 TCP (6) packet and others 5

UDP datagram structure Source Port Destination Port UDP s Data Payload TCP packet structure Source Port Sequence # Destination Port Acknowledgment TCP s Data Payload 6

ICMP message structure ICMP-type Code Checksum header of subject/wayward IP packet or other ICMP-type dependent payload Firewall = ruleset An in-memory datastructure by whose elements packets that appear at interfaces are evaluated A corresponding series of commands, each invocation of which populates the table with a single element Elements are called rules 7

Firewall - iptables iptables single invocation creates single rule firewall is product of multiple invocations Iptables organization Tables (have chains) filter table nat table Chains (contain rules) filter nat INPUT chain OUTPUT FORWARD PREROUTING chain POSTROUTING 8

An Individual Rule condition - examines and qualifies a packet action - operates on the packet if it qualifies compare programming language if structure What a Rule says If a packet s header looks like this, then here s what to do with the packet looks like this e.g. goes to a certain (range of) address(es) or uses the telnet port, 23 or is an ICMP packet what to do e.g. pass it discard it 9

iptables -t t filter -A OUTPUT -o o eth1 -p tcp --sport 23 --dport 1024:65535 -s s 192.168.4.0/24 -d d 0.0.0.0/0 j j ACCEPT Table for this rule Rule action -A add rule to chain/list -D delete rule from chain/list -P default policy for chain/list Rule chain/list (tables contain chains) INPUT OUTPUT FORWARD PREROUTING POSTROUTING Packet qualifiers by interface and direction protocol source port number(s) destination port number(s) source address (range) destination address (range) Packet disposition ACCEPT DROP REJECT SNAT DNAT What a Chain is ordered checklist of regulatory rules Multiple rules, for packets with particular characteristics Single rule for default (catch-all) policy operation Packet tested against rules in succession First matching rule determines what to do to packet If packet matches no rule Chain s default policy determines what to do to packet 10

Operationally comparable if [ condition A ] action Alpha; exit endif if [condition B ] action Beta; exit endif if [condition C ] action Gamma; exit endif... action <default>; exit What happens? action for first true condition (if any) otherwise default action Multiple chains Input chain When arriving at an interface, do we let a packet come in? Output chain When departing from an interface, do we let a packet go out? Forwarding chain When traversing this machine to another, do we let a packet pass between interfaces? 11

Filter traversal by packets incoming routing decision FORWARD outgoing INPUT OUTPUT local process local process A 4-rule 4 filtering firewall iptables -t t filter -A INPUT -i i eth1 -p tcp --sport 1024:65535 --dport 23 -s s 0.0.0.0/0 -d d 192.168.4.1/32 j j ACCEPT iptables -t t filter -A OUTPUT -o o eth1 -p tcp --sport 23 --dport 1024:65535 -s s 192.168.4.1/32 -d d 0.0.0.0/0 j j ACCEPT iptables -t t filter -P INPUT DROP iptables -t t filter -P OUTPUT DROP Executed in chronological sequence as shown, resultant 2-chain firewall permits telnet access between this machine 192.168.4.1 and others via eth1. And nothing else. (0.0.0.0/0 matches any address; aa.bb.cc.dd/32, the single address aa.bb.cc.dd) 12

Priority of chronology = priority of effect iptables -t t filter -A INPUT -i i eth1 -p tcp --sport 1024:65535 --dport 23 -s s 64.1.1.1/32 -d d 192.168.4.1/32 j j DROP iptables -t t filter -A INPUT -i i eth1 -p tcp --sport 1024:65535 --dport 23 -s s 0.0.0.0/0 -d d 192.168.4.1/32 j j ACCEPT iptables -t t filter -A OUTPUT -o o eth1 -p tcp --sport 23 --dport 1024:65535 -s s 192.168.4.1/32 -d d 0.0.0.0/0 j j ACCEPT iptables -t t filter -P INPUT DROP iptables -t t filter -P OUTPUT DROP EXCEPT no telnet from machine 64.1.1.1, because first rule eclipses second since it preceded it. (Second not reached, never applied.) nat table: rules that alter packet Masquerading iptables -t nat -A POSTROUTING -o o eth1 -s s 10.0.0.0/8 -j j SNAT --to 216.83.185.193 Pinholing (port forwarding) iptables -t nat -A PREROUTING -i i eth1 -d d 216.83.185.193/32 -p tcp --dport 5631 -j j DNAT --to 10.0.0.15 13

Parallel ways to do the same thing (port forward) iptables -t nat -A PREROUTING -i i eth1 -d d 216.83.185.193/32 -p tcp --dport 5631 -j j DNAT --to 192.168.1.15:22 Firewall ruleset philosophies Optimistic/lax that which is not expressly prohibited is permitted set everything open apply selective closures Pessimistic/strict that which is not expressly permitted is prohibited set everything closed apply selective openings 14

Setting everything closed policy iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD DROP Looking further conventional filter criteria limited to header fields only two further kinds of possible criteria SPI stateful packet inspection DPI deep packet inspection SPI interrelates packets can tie an incoming packet to an earlier outgoing request, accept for that reason DPI penetrates and examines payload (higher prototcol data) can see use of port 80 for non-http traffic, drop for that reason can see use of e.g. peer-to-peer file sharing, drop for that reason tends to overlap with function of intrusion detection software 15

Firewall persistence firewall is memory-resident volatile across reboot reconstruct at bootime by init script containing individual iptables commands or iptables-restore and iptables-save Start at boot - init script basics Unix has a conventional method to uniformly start/stop services (SysV init, systemd in some recent distros, launchd in Apple) one script per service in /etc/rc.d/init.d (distro dependent) scripts accept parameters start, stop, or restart if firewall s script is: /etc/rc.d/init.d/firewall start it with: /etc/rc.d/init.d/firewall start, or service firewall start 16

Avoid vulnerability interval first, call script to erect firewall /etc/rc.d/init.d/firewall only then, call script to activate/address NICs /etc/rc.d/init.d/network calling order controlled by numbering of symbolic links found in /etc/rc.d/rc?.d directories * * newer systemd replacement for SysV init in some linux distributions has a similar After/Before dependency system for ordering startup units Other packet filter firewalls same all are software all construct a reference data structure all compare packets to structure for decisions interfaces differ 17

Windows XP built-in in an INPUT firewall that s pessimistic with exceptions equivalent to iptables -P INPUT DROP with additional iptables -A INPUT -j ACCEPT rules for point permission Netgear WGR614 router built-in in 1. Is a computer* 2. Plugs in to two LANs Network A / internal Network B / external * a router is a computer. It contains a CPU, operating system, memory. It runs software (e.g. firewall!!) This one has 2 NIC interfaces. Don t be deceived by the lack of keyboard and monitor. option to pass through A-to-B & B-to-A FIREWALL HERE 18

Netgear WGR614 router built-in in an in-to-out FORWARD firewall that s optimistic with exceptions equivalent to iptables -P FORWARD ACCEPT with additional iptables -A FORWARD -j DROP rules for point obstruction Filter traversal by packets incoming routing decision FORWARD outgoing INPUT OUTPUT local process local process in the router appliance, firewall is here in the Windows machine, firewall is here 19

What do these 2 firewalls protect? Windows the very machine itself that s running Windows Netgear router not the router itself machines networked to the router raises concept of firewall architecture what wiring connection geometry do you adopt? on which of the computers do you run a firewall? to protect which computers? Architectures screened subnet 20

Architectures merged routers Netgear WGR614 router the router is not the firewall this is (the interface to) the firewall 21

Why do they call it a hardware firewall? it s a firewall it s inside a box the box is hard Hardware firewalls http://www.pdhonline.org/courses/g125/g125.htm 22

But in computer science Firewalls are software! get it? it s not so hard. Please see http://www.iptables.org/ Linux Firewalls, Michael Rash, No Starch Press, 2007 Older favorites I learned from, still useful: Linux Firewalls, 2 nd edition, Robert Zeigler, New Riders, 2002 Building Internet Firewalls, Zwicky et.al., O Reilly, 2000 23