Docsity

Applied Security: 3rd Programming Assignment - Firewalls and IDS using IPTables and Snort, Assignments of Computer Science

Toggle sidebar
bg1
APPLIED SECURITY—SPRING 2007
BRENO DE MEDEIROS, INSTRUCTOR.
3rd Programming Assignment. DUE on 04/03
Points: 100
Introduction to Firewalls and IDS using IPTables and Snort
The goal of this lab is to implement a firewall solution using IPTables, and to write and to
customize new rules to achieve security. You will need to turn in your IPTables rule file for
this assignment.
Before You Begin
1. Deactivate Windows Firewall.
2. Revert the applied security template in Windows XP to “setup security” or “compatws.”
3. Make sure that all of the components under networking Services are enabled and running.
4. Make sure the following services are running on your Linux machine:
a. SSH
b. Nessusd is running on port 1241
Installation of IPTables
Download and install iptables-1.3.7 from
http://netfilter.org/projects/iptables/downloads.html#iptables-1.3.7
Documentation of IPTables
http://www.netfilter.org/documentation/
Configuring the Network Topology
In order for the network to function properly, the Linux box will serve as a router for your
Windows XP machine. There are three requirements:
1. The Linux machine will require 2 ethernet network interfaces (provided by the Systems
Group)
2. The Linux machine will require a crossover CAT5 cable (you will make these
yourselves).
a. A crossover cable crosses over pins 1 and 2 to 3 and 6 and visa versa. The
standard crossover color configuration is as follows.
i. OS O GS BL BLS G BRS BR -> GS G OS BL BLS O BRS BR.
ii. Notice that the orange and orange striped pins change to the green and
green striped pins.
pf3
pf4
pf5

Partial preview of the text

Download Applied Security: 3rd Programming Assignment - Firewalls and IDS using IPTables and Snort and more Assignments Computer Science in PDF only on Docsity!

APPLIED SECURITY—SPRING 2007

BRENO DE MEDEIROS, INSTRUCTOR.

3 rd^ Programming Assignment. DUE on 04/ Points: 100

Introduction to Firewalls and IDS using IPTables and Snort

The goal of this lab is to implement a firewall solution using IPTables, and to write and to customize new rules to achieve security. You will need to turn in your IPTables rule file for this assignment. Before You Begin

  1. Deactivate Windows Firewall.
  2. Revert the applied security template in Windows XP to “setup security” or “compatws.”
  3. Make sure that all of the components under networking Services are enabled and running.
  4. Make sure the following services are running on your Linux machine: a. SSH b. Nessusd is running on port 1241 Installation of IPTables Download and install iptables-1.3.7 from http://netfilter.org/projects/iptables/downloads.html#iptables-1.3. Documentation of IPTables http://www.netfilter.org/documentation/ Configuring the Network Topology In order for the network to function properly, the Linux box will serve as a router for your Windows XP machine. There are three requirements:
  5. The Linux machine will require 2 ethernet network interfaces (provided by the Systems Group)
  6. The Linux machine will require a crossover CAT5 cable (you will make these yourselves). a. A crossover cable crosses over pins 1 and 2 to 3 and 6 and visa versa. The standard crossover color configuration is as follows. i. OS O GS BL BLS G BRS BR -> GS G OS BL BLS O BRS BR. ii. Notice that the orange and orange striped pins change to the green and green striped pins.
  1. You will need to configure NATing so the network traffic to the Windows machine will route properly through the Linux machine (this MUST BE performed after IPTables is installed). a. Assign eth0 on the Linux machine the IP address of your Windows machine. b. Create a sub-interface on eth0 on the Linux machine and assign it the former IP address of eth0. c. Assign your Windows machine an IP address from any of the private address ranges. d. Assign eth1 on your Linux machine a private IP address that resides in the same subnet as the Windows machine’s IP address. e. Make the IP address of eth1 the default gateway on your Windows machine. f. Run the following commands from the command prompt and add the following lines to your S99local file for rc3 and rc5: i. touch /var/lock/subsys/local ii. echo 1 > /proc/sys/net/ipv4/ip_forward g. Activate NAT routing (where x is the fourth octet of the Linux box IP address on eth0): i. iptables –t nat –A POSTROUTING –o eth0 –s YOUR WINDOWS BOX IP/32 –j SNAT --to-source 192.168.10.x ii. iptables –t nat –A PREROUTING –i eth0 –d 192.168.10.x/32 –j DNAT --to-destination YOUR WINDOWS BOX IP Further Reference http://www.netfilter.org/documentation/index.html#documentation-howto http://www.faqs.org/docs/iptables/howaruleisbuilt.html http://www.google.com (google is your friend) Firewall rules location: /etc/sysconfig/iptables
  2. Examine this file and understand its layout.
  3. Make a copy of the rules file and rename it (in case an insurmountable problem occurs, you can restore your firewall to a usable state). General Information on IPTables The rules in IPTables are written to deal 3 different scenarios:
  4. Those packets entering your machine that are destined for your machine. (INPUT)
  5. Those packets leaving your machine. (OUTPUT)
  6. Those packets entering your machine, but are destined for another machine and will pass through your machine (FORWARD). In Iptables, these scenarios are referred to as INPUT , OUTPUT , and FORWARD , respectively.

Rule Example 4: iptables –A OUTPUT –p icmp --icmp-type echo-request –j ACCEPT iptables –A INPUT –p icmp --icmp-type echo-reply -j ACCEPT These two rules allow ICMP echo traffic (PING) to pass through. Creating Rules Each team should know:

  1. Its team number. I assigned these #s early in the semester. I will call it self Group ID (self- GID).
  2. The IP address of the Linux machine for the teams with GID = self-GID + 4 (mod 11) and GID= self-GID + 8 (mod 11). For instance, the group with GID = 5 should learn the IP address of the Linux machines for groups with GID = 9 and GID = 2. I will call these IP address IP+ and IP+8, respectively. Create the following firewall rules:
  1. Allow SSH traffic to your Linux machine from IP+4 and IP+8.
  2. Allow remote desktop traffic to your Windows XP machine from IP+4 and IP+8.
  3. Allow ICMP echo traffic to your Linux machine from IP+4 and IP+8.
  4. Drop ICMP echo traffic to your Windows machine from IP+4 and IP+8.
  5. Allow file sharing traffic to your Windows machine from IP+4 and IP+8.
  6. Allow your Windows box to only communicate web traffic to and from IP+4 and IP+8.
  7. Allow both machines to accept DNS packets only from 128.186.120.179.
  8. Drop all incoming TCP, UDP, and ICMP packets from other addresses. After creating the above rules, perform some research and create 3-5 additional rules that might be necessary if you had other services or applications running. For example, your systems might be running applications for online gaming, P2P, streaming Internet video, etc. After adding these rules to your iptables rule file, explain their purpose. NIDS Aspects 1. Install Snort and all the required components on your Windows machine (a tutorial is given below, and available in Winsort.com). You need to complete the Snort installation at least one week before the deadline to complete the other aspects of the assignment. 2. Once you have installed Snort, you need to instruct the teams with GID = selfGID+4 and GID = self-GID+8 (mod 11). They will then launch a remote NESSUS scan of your Windows machine. (Refer to the lockdown assignments.) 3. Once you have been scanned, use BASE to parse your Snort logs. a. List the alerts that Snort created.

b. Briefly describe any vulnerabilities that are associated with the Snort allerts.

4. Write IPTables rules to block these attacks. Log the packets dropped by these extra rules. 5. Notify the teams with GID = self-GID+4 and selfGID+8 again to re-do their NESSUS scans. 6. Turn in a copy of your BASE summary and your IPTables rules.conf.