100% found this document useful (1 vote)
52 views10 pages

Understanding Firewalls

This document summarizes a project report on configuring and testing a firewall on Linux. It discusses implementing a firewall using iptables and testing it using the nmap scanning tool. Various network address spaces were scanned, including the DMZ and LAN address spaces. Technologies used in the project environment included User Mode Linux (UML) for running virtual machines, the MLN tool for managing UML networks, and iptables for packet filtering and network address translation.

Uploaded by

sajisha123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
52 views10 pages

Understanding Firewalls

This document summarizes a project report on configuring and testing a firewall on Linux. It discusses implementing a firewall using iptables and testing it using the nmap scanning tool. Various network address spaces were scanned, including the DMZ and LAN address spaces. Technologies used in the project environment included User Mode Linux (UML) for running virtual machines, the MLN tool for managing UML networks, and iptables for packet filtering and network address translation.

Uploaded by

sajisha123
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Abstract
  • Background
  • Theoretical Methods
  • Practical Methods
  • Environments
  • Solution and Analysis
  • References
  • Conclusions

Firewall Configuration and Testing.

pdf (Size:
204.72 KB / Downloads: 78)

Presented By:
Mohamed Amer, Qamar Nazir
Project Report for Information Security Course
Linköpings universitetet, Sweden

h 
Firewall is one of the important security
software that protects your system from other
network. Well configured firewall gives
confidence to the administrator that his system
is protected from malicious attacks. Realizing
good firewall configuration is a matter of testing.
In this project paper we will configure and test a
firewall, and discover how costly can
the testing process be. We also present some
technologies, environments and a way of
doing firewall configuration and testing using
some of the basic rules and included these
results in our report.


 
c
Firewall is the set of rules which protects the
networked computer system from unauthorized
access. It can be implemented on software or
hardware or both.
All messages entering or leaving to system is
through firewall. It allows accessing only those
messages which are allowed by the firewall and
block the others which are not allowed to enter.
Firewall can defend your one system from whole
network or the whole network from the other
network.
There is special security criteria are defined in
the firewall. So every message enter to the
system must meet that specified security criteria
to enter that system.
In this paper we will explain how we will
configure firewall on LINUX environment. After
completing the configuration at first level we will
test it on the same system, and then to the other
systems. This report will contain the results of
our tests and some of our experiences.
Further in section 2 represent the background of
the project, section 3 represent some practical
work, section 4 represent some of the related
work in firewall implementation and finally
section 5 conclude the whole report.



Now a day's Internet is a dangerous place for
your computer but it is not so few years before.
Few years before people can happily do their
business on the web without any protection.
There is very less chance of virus attack,
malware or hacking. Now it is impossible.
Increasing number of Internet users also
increase number viruses and malware. Many of
these don't need permission to execute on your
system.
To protect your computer from today Internet
environment: your pc should have effective
antivirus, antivirus updates and firewall. Linux
operating system includes firewall protection to
enhance security. Properly configured firewall
can definitely increase the security of a network.
This report will cover using a Linux computer as
a firewall between private network, a DMZ
network and Internet. Iptables is the firewall
implementation that is used throughout the
configuration and testing process.

  
Firewall testing is very important, it gives
confidence to the administrator that the firewall
rules they write are working properly. The right
packet is accepted and right packet is dropped.
Firewall testing is difficult because there are
many parameters which resulting is huge
number of possible parameter combination.
There are number of possible combination
of test cases can be used to test firewall rules.
Typically each test case is viewed as a row in a
table or in database term, a relation. So the
main problems are:
1. Test case selection: which test cases should
be applied? Different mathematical calculation
can be used for it.
2. Test case execution: After selecting test
cases, what method should be applied to
execute it?
For first problem an efficient algorithm will be
sufficient. For second there are libraries to factor
out the many details of packet generation,
transmission and reception [1].
Yong Du and Daniel Hoffman have presented
tools and techniques for testing iptables, the
methods and tools also apply to other firewall
products.
Iptables are used for packet filtering based on
header fields e.g., IP address, TCP and UDP
port and TCP flag. Four main features of
iptables are stateless filtering, state full filtering,
network address/port translation, and
logging.
The syntax of iptables is simple. Typically rule is
ACCEPT or DROP. The rules work like C switch
statement. If Pi matches, then ai is invoked. If
no predicate matches, default action is make
(ACCEPT or DROP). Usually default DROP is
chosen for security reason. Iptables are
implemented using Linux command line.
Testing configuration consist of two PCs- the
driver and system under test (SUT)- The
SUT configured so that traffic enter from eth1
with destination IP address and routed to eth2
and vice versa. ARP (Address Resolution
Protocol) packets are used to map IP (Internet
Protocol) address to MAC (Medium Access
Control) addresses.
The first issue is how to generate, send, and
receive frames on the drivers eth1 and eth2
interface. They have developed a raw socket
library which makes the resulting test
cases much easier to understand and modify.
So at the end result is a simple
open/close/read/write interface, much like the
Linux raw I/O interface.
They created test template by providing different
combination of parameters. There are three
strategies they used for Tuple generation:
Cartesian product generation, boundary value
generation and pair wise generation.
The testing framework for iptables has been
implement in a tool called PBit (Pattern Based
iptables tester). The useful feature of PBit is that
you can modify the test configuration at run time
[1].

 
In this section we will describe
the testing method implementation, like
Programming language or a scripting language
that is used to implement an automated test
method

The test was performed using the nmap tool by


executing manually a set of nmap scans and
collecting results. The types of scans [6]
performed were:
¢ TCP scan
¢ SYN scan
¢ FIN scan
¢ Null scan
¢ Xmas tree scan
¢ UDP scan
¢ IP protocol scan
¢ ACK Scan
¢ OS Fingerprinting

¢ Window Scan
¢ RPC Scan
¢ List Scan
¢ Version Detection

Each scan command was executed for each


network address space, the DMZ address space
and the LAN address space.


 
In this section we will describe the technologies
that are using in the project environment like
UML "User Mode Linux", MLN tool and iptables
So we will start with the "UML". UML is a port of
Linux to the Linux system call interface, and
allows users to run any number
of virtual systems (UML instances) without the
need for special privileges. The "UML" system
also includes basic facilities for
networking virtual machines. [4]
To simplify setup of networks of UML instances,
a tool called "MLN" is use. MLN (Manage Large
Networks) is a virtual machine administration
tool designed to build and run virtual machine
networks based on Xen, VMWare Server and
User-Mode Linux. It is ideal for
creating virtual network labs for
education, testing, hosting or simply playing
around with virtual machines. The goal is to
ease the configuration and management
of virtual networks. Xen and User-Mode Linux
are widely used as tools for testing, learning
and virtual hosting. MLN builds and configures
file system templates based on its descriptive
and easy programming language and stores
them in an organized manner. It also generates
start and stop scripts for each virtual host,
enabling you to manage a
running virtual network by stopping
individual virtual machines within a network and
starting them again. MLN makes it possible to
have several separate networks, projects, at
once and even connect them together to create
larger networks. [5]
Ipchains are the most common firewall/Nat
packages running on linux. Iptables are the
enhanced product of ipchains by net filter
organization.
Iptables is packet filtering firewall software.
Packets inspected by iptables are passing
through sequence of rules.
There are total three types of tables.
¢ Mangle table
¢ Filter queue
¢ Nat queue
Mangle table is responsible for alteration of
quality of service bit in TCP header. This is very
rarely used in satellite offices and home offices
(SOHO) environment. Filter queue is
responsible for packet filtering. It contains three
built-in chains where we can put rules. These
are:

Forward chain, Input chain and output chain.


Nat queue contains two built-in chains. Which
are pre-routing and is responsible for Network
address translation. It post-routing? [2]

Queue Type Queue Function Packet


Transformation Chain in Queue Chain Function
Mangle TCP header modificatio n
PREROUTING
POSTROUTING
OUTPUT
INPUT
FORWARD Modification of the TCP packet
quality of service bits before routing occurs.
(Rarely used in SOHO environments)
Filter Packet filtering FORWARD Filters packets
to servers accessible by another NIC on the
firewall.
INPUT Filters packets destined to the firewall.
OUTPUT Filters packets originating from the
firewall
Nat Network Address Translation
PREROUTING Address translation occurs
before routing. Facilitates the transformation of
the destination IP address to be compatible with
the firewall's routing table. Used with NAT of the
destination IP address, also known as
destination NAT or DNAT.
POSTROUTING Address translation occurs
after routing. This implies that there was no
need to modify the destination IP address of the
packet as in pre-routing. Used with NAT of the
source IP address using either one-to-one or
many-to-one NAT. This is known as source
NAT, or SNAT.
OUTPUT Networks address translation for
packets generated by the firewall. (Rarely used
in SOHO environments)
Table 1. Processing For Packet Routed By the
Firewall

For every firewall rule, user needs to specify


iptables and ipchain. As most of the rules are
related to filtering, so if user mentions any rule
without an associated table then it will be
considered as a part of the filter table. So we
can say filter table is a default table.
In the figure 2 [2] packets arrives from Network
and handled by the firewall to create a data
connection.
The packet is first examined by the mangle table
PREROUTING chain, then it is pass through nat
table PREROUTING chain to check, it DNAT of
not. Then its sent for routing. If it is defined to
protected network then it passes through.
FORWARD chain of mangle table for quality
purpose then it is filtered by the rules of the filter
table in its forward chain and if necessary it
goes for
SNAT in POSTROUTING chain of mangle table
and
then it arrives to network B. If the destination
wants to apply, it will follow the same sequence.
If packet is passed through the firewall then it
through INPUT chain of the mangle table, then it
is filtered by a INPUT chain of the filter table.
Then it passes to the firewall application for
some processing.
If firewall reply then packet is sent for the routing
and it is inspected by OUTPUT chain of the
mangle table, if any.




 h 

h
is required then OUTPUT chain rule of filter
table are applied to that packet.
Finally POSTROUTING chain of mangle checks
the QoS of packet and then POSTROUTING
chain of nat
table check SNAT of the packet.

 !
"
#

The environment on which we have performed
the firewall configuration and testing was a linux
workstation that has virtual network of virtual
computers that are managed by the MLN tool.
The network schema is described in the lab
document. The tests are done using external
and internal UML instances.
Aggressive OS guesses: T-Home Speedport W
501V WAP (96%), Linux 2.6.12 - 2.6.20 (94%),
Linux 2.6.9 -2.6.26 (94%), Linux 2.6.18 - 2.6.22
(93%), DD-WRT
v24 (Linux 2.6.22) (93%), Linux 2.6.22 - 2.6.23
(93%),
Linksys WRT300N wireless broadband router
(92%), Linux 2.6.19 - 2.6.24 (Gentoo) (92%), D-
Link DWL-G700AP WAP (91%), Linux 2.6.20
(91%)
7- Service detection is performed on the DMZ
network with the following results: Interesting
ports on [Link]: Not shown: 999 filtered
ports
$%h!%!$& '!&!$% 
80/tcp open http Thy httpd 0.9.4 (Debian;
GnuTLS
1.0.16; zlib 1.2.2) Service Info: OS: Linux
3. Solution and Analysis 3.1 Firewall testing
results
After performing a testing using nmap tool and
using it to scan and probe the other group
firewall we found the following:
1- The firewall Mac Address which
is FE:FD:00:00:ED 6.
2- the open port, the protocol and the service of
the
[Link] server:
$%h!%!$& '!
80/tcp open http
3- The number of the up hosts on the dmz
network, which are two hosts.
4- The available open services on the firewall
external interface eth0, Lan interface eth1 and
DMZ interface eth2 which are:
$'(%h!%!$& '!
1 open icmp
5- Identified unfiltered ports on the [Link]
server
which are:
PORT STATE SERVICE
80/tcp unfiltered http
6- OS detection is performed on the DMZ
network
with the following results:
Device type: WAP|general
purpose|printer|router
Running (JUST GUESSING) : T-Home
embedded
(96%), Linux 2.6.X|2.4.X (94%), FON Linux
2.6.X
(93%), Linksys embedded (92%), D-Link
embedded
(91%), Xerox embedded (90%), Enterasys
embedded (89%), Netgear embedded (89%)

$ ) 
In School of Computer Science,
Telecommunication and Information System [3]
they implemented the new efficient techniques
for firewall testing. In their techniques they avoid
exhaustive and pure random testing
Using their approach, their evaluation study
shows better accuracy and performance than
the random testing. Their approach is also
shown to be robust as it maintains better results
than random sampling even when there is a
small correlation between estimated segments
weight and the probability of error. When
policies of different styles and segmentation
sizes are implemented in their evaluation it
shows that their approach is far better than all
test cases. It is also proved that segmentation
approach has more advantage as rule
interaction.
Currently there research is still in progress.
Studying different segmentation behavior for
several policy styles need further investigation.

*'
 

In this paper, we have explained importance of
firewall, how we can configure firewall of linux
based operating system using iptables but the
main focus on this paper is on firewall testing. It
gives confidence to the administrator that
firewall is working fine and system is secure.
Before that we described the usage of iptables.
Then we described testing methods. The
technologies we used in our project environment
are UML, MLN and iptables. After applying
method to some of these environments we get
some results.
Our findings were that firewall testing should be
given more planning and resources; because
there are many variables involved in the testing
process and for each variable there are many
values, and for both variables and values there
are many combinations to test.


$

[1] Yong Du and Daniel Hoffman. "PBit-A
Pattern-Based Testing Framework for iptables",
Proceedings of the Second Annual Conference
on Communication Networks and Services
Research (CNSR'04), IEEE (2008),
[2] Linux Home Networking,
"[Link]
.php/Quick_HOWTO_:_Ch14_:_Linux_Firewall
s_Using_iptables", (28, April 2009).
[3] Adel El-Atawy, Khaled Ibrahim, Hazem
Hamed, and Ehab Al-Shaer. "Policy
Segmentation for Intelligent Firewall Testing",
Secure Network Protocols, 2005. (NPSec), 1st
IEEE ICNP Workshop on 6 Nov. 2005
Page(s):67 - 72.
[4] The User-mode Linux Kernel Home Page,
"[Link]", (30
April
2009).
[5] The Manage Large Networks project,
"[Link]", (2 May 2009).
[6] Andrew J. Bennieston,"NMAP - A Stealth
Port Scanner", [Link]
tutorial/, (3
May 2009).

Reference: [Link]
report#ixzz19OBGMDT9c

u0001u0002u0003u0004u0005u0006u0007u0007b	
u000bu0002f
u0003u0006u000eu0002	
u0006
u000fu0010u0004u0011u000eu0002
fu0012u0013u000fu000bu0014u0015u0002u0016u0004u0017u0018u0019u001au0012u001bu0018u001cu001du001eu001f	u0005
u0007	u0006u000fu0011u0017u001b !"u0003u0004u0011u0004
u000eu0004u000fu001d#u0017$	%u0006&u0004u000f'&u0004u0003()u0006&u0006u0003*u0006u0016u0002u0003"u0003	+u0004,u000e-u0004u0013	u0003u000eu000b	u0003.
u000b	u0003&u0006u000eu0002	
u0015
u0005	u00030(u0011u0004,u000eu0002	
u001au0003u0004u0013u0003u0004u0011u0004
u000eu0011	&u0004	u000bu000e%u0004u0003u0004u0007u0006u000eu0004u000fu0005	u00030u0002
u000bu0002u0003u0004u0005u0006u0007u0007u0002&u0013u0007u0004&u0004
u000eu0006u000eu0002	
u0006
u000fu000bu0002
u0006u0007u0007#u0011u0004,u000eu0002	
<,	
,u0007
u000fu0004u000e%u0004u0005%	u0007u0004u0003u0004u0013	u0003u000eu0012u0006
u000fbu0006u0010u0004u0005u0011u0012u0003u000b
f*	u0005
u000eu000e%u0004&u0006
#u000fu0004u000eu0006u0002u0007u0011	u000bu0013u0006,0u0004u000efu0004
u0004u0003u0006u000eu0002	
(u000eu0003u0006
u0011&u0002u0011u0011u0002	
u0006
u000fu0003u0004,u0004u0013u000eu0002	
A?Bu0012C	
fu001f
u0006
u000fu001fu0006
u0002u0004u0007D	u000bu000b&u0006
%u00065u0004u0013u0003u0004u0011u0004
u000eu0004u000fu000e		u0007u0011u0006
u000fu000eu0004,%
u0002E
u0004u0011u000b	u0003u000eu0004u0011u000eu0002
u000e%u0004u000eu0004u0011u000eu0002
f&u0004u000e%	u000fu0002&u0013u0007u0004&u0004
u000eu0006u000eu0002	
(u0007u00020u0004"u0003	fu0003u0006&&u0002
fu0007u0006
f
u0006fu0004	u0003u0006u0011,u0003u0002u0013u000eu0002
fu0007u0006
f
u0006fu0004u000e%u0006u000eu0002u0011
u0011u0004u000fu000e	u0002&u0013u0007u0004&u0004
u000eu0006
u0006
u000e	&u0006u000eu0004u000fu000eu0004u0011u000e&u0004u000e%	u000fu0010%u0004u000eu0004u0011u000eu0005u0006
u0004u0006u0011u0004u000e%u0004,	
u000bu0002f
u0003u0006u000eu0002	
u0006
u000f&u0006
u0006fu0004&u0004
u000e	u000b5u0002u0003u000e
u0006u0007
u0004u000eu0005	u00030u0011u0012:u0004
u0006
u000f9u0011u0004u0003H$	u000fu0004/u0002

8u0006u0003u0004u0005u0002u000fu0004u0007#
u0011u0004u000fu0006u0011u000e		u0007u0011u000b	u0003u000eu0004u0011u000eu0002
f(u0007u0004u0006u0003
u0002
fu0006
u000f5u0002u0003u000e
u0006u0007%	u0011u000eu0002
E
u0006u0007u0002u000e#	u000bu0011u0004u00035u0002,u00047u0002u000eu00117u0004u000b	u0003u0004u0003	
u000eu0002
f	,,
u0003u0011u0012u0014-u0006u0003u0004u0007#
u0011u0004u000fu0002
u0015GDGu0004
5u0002u0003	
&u0004
u000eu0011!u0001u0002u0007u000eu0004u0003"u0006,0u0004u000eu000bu0002u0007u000eu0004u0003u0002
fu0001G-6'-u001fu0001u0002u0007u000eu0004u0003u0011u0013u0006,0u0004u000eu0011u000e	u0011u0004u00035u0004u0003u0011u0006,,u0004
u000e%u0004
u0002u000eu0006u0003u0003u00025u0004u0011u000e	
u0004u000eu0005	u00030u001du0012.u000bu000e%u0004u000fu0004u0011u000eu0002
u0006u000eu0002	
u0005u0006
u000eu0011u000e	u0006u0013u0013u0007#(u0002u000eu0005u0002u0007u0007u000b	u0007u0007	u0005u000e%u0004u0011u0006&u0004u0011u0004E
u0004
,u0004u0012.u000bu0013u0006,0u0004u000eu0002u0011u0013u0006u0011u0011u0004u000fu000e%u0003	
f%u000e%u0004u000bu0002u0003u0004u0005u0006u0007u0007u000e%u0004
u0002u000eu000e%u0003
;u0012u0015	u0007
u000eu0002	
u0006
u000f'
u0006u0007#u0011u0002u0011;u0012?u0001u0002u0003u0004u0005u0006u0007u0007u000eu0004u0011u000eu0002
fu0003u0004u0011
u0007u000eu0011'u000bu000eu0004u0003u0013u0004u0003u000b	u0003&u0002
fu0006u000eu0004u0011u000eu0002
f
u0011u0002
f
&u0006u0013u000e		u0007u0006
u000f
u0011u0002
fu0002u000eu000e	u0011,u0006
u0006
u000fu0013u0003	7u0004u000e%u0004	u000e%u0004u0003fu0003	
u0013u000bu0002u0003u0004u0005u0006
u0011%	u0005
u000e	7u0004u0003	7
u0011u000eu0006u0011u0002u000e&u0006u0002
u000eu0006u0002
u00117u0004u000eu000eu0004u0003u0003u0004u0011
u0007u000eu0011u000e%u0006
u0003u0006
u000f	&u0011u0006&u0013u0007u0002
fu00045u0004
u0005%u0004
u000e%u0004u0003u0004u0002u0011u0006u0011&u0006u0007u0007,	u0003u0003u0004u0007u0006u000eu0002	
7u0004u000eu0005u0004u0004
u0004u0011u000eu0002&u0006u000eu0004u000fu0011u0004f&u0004
u000eu0011u0005u0004u0002f%u000eu0006
u000fu000e
u0015u0004,
u0003u0004*u0004u000eu0005	u00030"u0003	u000e	,	u0007u0011(u0018u0019u0019<u0012u0014*"u0015u0004,!(?u0011u000e.FFF.b*"6	u00030u0011%	u0013	
I*	5u0012u0018u0019u0019<"u0006fu0004u0014u0011!u0017Iu001bHu001bu0018u0012Au001aBu0010%u00049u0011u0004u0003H&	u000fu0004/u0002

8u001cu0004u0003
u0004u0007D	&u0004"u0006fu0004(Lu0005u0005u0005u0012
u0011u0004u0003H

You might also like