Firewall Drop 1
Firewall Drop 1
files: https://github.com/frankwxu/digital-forensics-lab/tree/main/Networking_Forensics/lab_files/firewall
What is Firewall
• A firewall is a network security device that acts as a barrier between a
private network and the public internet or other networks.
• Its primary purpose is to monitor and control incoming and outgoing
network traffic based on predetermined security rules.
• Intrusion detection and prevention
• Malware detection, and content filtering.
U of Baltimore Internet
Network-based
The importance of a firewall
• Protect the network from unauthorized access, data breaches, and
other security threats.
• Approach
• Blocking or allowing traffic based on specific criteria, such as IP addresses,
ports, protocols, and applications
Firewalls Deploying Methods
• Network-based firewall
• A device that sits between the internal network and the external network (usually the internet)
and filters traffic based on predefined rules.
• It provides a centralized security solution for the entire network and can control traffic from
multiple hosts.
• Network-based firewalls are effective at protecting against external threats, such as hackers and
malware, but they may not be as effective at controlling internal traffic.
• Host-based firewall
• installed on individual hosts (such as servers or workstations) and filters traffic on a per-host
basis.
• It provides a more granular level of control and can be customized for each host's specific needs.
• Host-based firewalls are effective at protecting against internal threats, such as unauthorized
access by insiders or malware that has already infected a host, but they may not be as effective
at protecting against external threats.
Linux Firewall (iptables)
Host-based Routing Process
We focus on
Host-based Firewall
reject X
modify
/
• iptables is a software firewall
• pre-installed on most Linux-based operating systems.
• Linux Firewall defines a set of rules that determine how network traffic is
allowed or blocked on a system
• These rules are organized into chains, which are lists of rules that are evaluated in
sequence.
• Each rule can match packets based on various criteria
• such as the source or destination IP address, the protocol, and the port number.
• When a rule matches a packet, it can perform an action
• such as accepting, rejecting, or modifying the packet.
• The "iptables" command-line utility is used to manage the firewall rules
• it provides a powerful and flexible way to control network traffic on a Linux system.
iptables vs. ufw
Create the directory first
disable ufw to
void conflits
with iptables
before the lab
Chains in iptables
Input/forward/output chains
Add a firewall rule to Kali
Adds a new rule to the INPUT chain that matches incoming traffic from the IP address
136.160.215.15 and sends it to a Netfilter queue with ID 1 for further processing.
• sudo - runs the command as the superuser, which is necessary since iptables requires elevated privileges
to modify the firewall rules.
• iptables – a command-line tool to configure Netfilter, the Linux firewall system.
• -A INPUT - appends a new rule to the INPUT chain.
• -s 136.160.215.15 - the source IP address for the rule. The rule will only match traffic that comes from
this IP address.
• -j NFQUEUE - the target for the rule. The NFQUEUE target sends matching packets to a Netfilter queue
for further processing.
• --queue-num 1 - the ID of the Netfilter queue to use. In this case, we're using queue ID 1.
View the newly added firewall rule
wget https://raw.githubusercontent.com/frankwxu/digital-forensics-lab/main/Networking_Forensics/lab_files/firewall/iptables_handle_packets_drop.py
Intercept the drop packets if a packet’s IP address 136.160.215.194
1. Listening and
intercepting. It will
generate a rule
wget https://raw.githubusercontent.com/frankwxu/digital-forensics-lab/main/Networking_Forensics/lab_files/firewall/hello.html
sudo cp hello.html /var/www/html/.
Make sure to use
Before enable a rule of firewall to drop package private windows to
avoid caches
Start the firewall and trigger the rule!