Firewalls

A firewall represents a barrier between an "internal" network (assumed to be secure and trusted) and an "external" network (assumed to be insecure and untrusted). The purpose of a firewall is to prevent unwanted and unauthorized communications into or out of the internal network. Thus, security is aggregated at a single point.

Analogies

Design goals for a firewall

Other benefits of a firewall

Limitations of firewalls

The firewall cannot protect against attacks that bypass the firewall
No protection against internal threats

No protection against virus-infected programs or files
 

Types of Firewalls

Categorised by how far "up the stack" they go.

  1. Packet filter
  2. Application-level filter
  3. Circuit-level gateway


firewall types


Packet Filters

A set of rules is applied to each incoming IP packet to decide whether it will be forwarded or discarded. The TCP/IP packet is parsed and filtered based on information that is usually found in packet headers:

Packet filters are (almost) stateless:

Packet Filter Rules

Packets are matched against the rules in order. On match, take the corresponding action.
Example:

Type Source addr
Dest. addr
Source port Dest. port
Action
tcp
*
123.4.5.6
>1023
23
Permit
tcp *
123.4.5.7 >1023 25
Permit
tcp 129.6.254.48
123.4.5.8
>1023 119
Permit
udp
*
123.4.*.*
>1023 123
Permit
*
*

*
*
Deny

Well-known ports are used to identify applications (23=Telnet, 25=SMTP, 119=NNTP, 123=NTP, ...)


IP Fragmentation Problem


When an IP packet is fragmented, only the first fragment contains the transport (TCP or UDP) header!

Solution 1:

Solution 2


Packet filters are used and widely deployed, for several reasons:

Main weaknesses


Application gateways

An application-level gateway, also called proxy server, acts as a relay of application-level traffic

The gateway can be configured to support only specific features of an application that the network administrator considers acceptable, while denying others.

An application gateway relays TCP segments between the two TCP connections in the 2 directions

Client application may have to be modified, so that it conencts to the Proxy, not the Server

Benefits of application-level filtering

Application protocols can be filtered; e.g.

Keep logs at the application level


Circuit-level gateway

The circuit-level gateway is somehow an intermediate solution between the packet filter and the application gateway

Like an application gateway, the circuit-level gateway does not permit an end-to-end TCP connection

It does not examine the application data. A typical use:

Example: SOCKS

SOCKS is a networking proxy mechanism that enables hosts on one side of a SOCKS server to gain full access to hosts on the other side without requiring direct IP reachability.




Tunnels

Once a firewall is in place, you need to provide mechanisms to get through it!

Examples:

Secure shell (ssh)

Ssh is a protocol which enables a secure way of making a connection from a client to a server across a public network. It is designed to be lightweight and practical, yet secure.


ssh tunnels

ssh allows ports on the remote server to be mapped onto ports of the local client.

The unix command
ssh -L x:ServerHost:y IntermediateHost

specifies that port x on the local (client) host is to be forwarded to port y on ServerHost.  This works by allocating a socket on the Client to listen to port on the local side.  Whenever a connection is made to this port, the connection is forwarded over the secure channel to IntermediateServer, and a connection is made from there to port y of ServerHost.  Only the superuser can forward privileged ports.

Similarly, the command
ssh -R x:ServerHost:y IntermediateHost

specifies that the given port on the remote (server) host is to be forwarded to the given host and port on the local side.  This works by allocating a socket to listen to port on the remote side, and whenever a connection is made to this port, the connec‐tion is forwarded over the secure channel, and a connection is made to host port hostport from the local machine.

These commands can also be done using GUIs in Windows.  For example, see SoCS support pages.

Typical usage:
ssh -L2500:mail-relay.cs.bham.ac.uk:25 tw.cs.bham.ac.uk



Virtual Private Networks (VPNs)

A virtual private network (VPN) is a private communications network often used by companies or organizations, to communicate confidentially over a public network.

Similarly to ssh, VPNs allow

Compared with ssh, VPNs give a more comprehensive way of tunnelling through firewalls. They allow the home worker effectively to join the workplace network


ipconfig output


There are lots of ways to implement a VPN. Here, we mention two popular ones.

PPTP VPN

PPTP is widely used because it is easy to configure and is supported by MS WIndows since Windows 98. PPTP makes use of two underlying protocols.
PPTP protocol stack  
. . .
IP
PPP
GRE
IP
. . .


PPTP VPN is implemented on PPP, which in turn is run on GRE (the client initiates a connection to TCP port 1723).

Client authentication is done by MS-CHAP or EAP-TLS, within the PPP connection. A specification for PPTP was published as RFC 2637. Although popular and widely deployed (it is easy to configure and is supported by MS WIndows since Windows 98), PPTP has not been proposed or ratified as a standard by the IETF, perhaps because it is not fully secure.


L2TP IPSec VPN

In contrast with PPTP, L2TP/IPsec requires a shared key or public key certificates.

Using an existing connection, a client uses L2TP by making a UDP connection to server port 1701. This provides a virtual datalink layer for the VPN, over which PPP and IPSec may be run to provide a secure connection.  The combination of these two protocols is generally known as L2TP/IPsec.