Theory Assignment 02
Theory Assignment 02
0
Firewall
What is a firewall?
Firewalls can be viewed as gated borders or gateways that manage the travel of permitted and
prohibited web activity in a private network. The term comes from the concept of physical walls
being barriers to slow the spread of fire until emergency services can extinguish it. By comparison,
network security firewalls are for web traffic management typically intended to slow the spread of
web threats.
Firewalls create 'choke points' to funnel web traffic, at which they are then reviewed on a set of
programmed parameters and acted upon accordingly. Some firewalls also track the traffic and
connections in audit logs to reference what has been allowed or blocked.
Firewalls are typically used to gate the borders of a private network or its host devices. As such,
firewalls are one security tool in the broader category of user access control. These barriers are
typically set up in two locations on dedicated computers on the network or the user computers and
other endpoints themselves (hosts).
1
Screening routers are specialized gateway computers placed on a network to segment it. They are
known as house firewalls on the network-level. The two most common segment models are the
screened host firewall and the screened subnet firewall:
Screened host firewalls use a single screening router between the external and internal
networks. These networks are the two subnets of this model.
Screened subnet firewalls use two screening routers— one known as an access router
between the external and perimeter network, and another known as the choke router
between the perimeter and internal network. This creates three subnets, respectively.
Both the network perimeter and host machines themselves can house a firewall. To do this, it is
placed between a single computer and its connection to a private network.
Network firewalls involve the application of one or more firewalls between external
networks and internal private networks. These regulate inbound and outbound network
traffic, separating external public networks—like the global internet—from internal
networks like home Wi-Fi networks, enterprise intranets, or national intranets. Network
firewalls may come in the form of any of the following appliance types: dedicated
hardware, software, and virtual.
Host firewalls or 'software firewalls' involve the use of firewalls on individual user devices
and other private network endpoints as a barrier between devices within the network. These
devices, or hosts, receive customized regulation of traffic to and from specific computer
applications. Host firewalls may run on local devices as an operating system service or an
endpoint security application. Host firewalls can also dive deeper into web traffic, filtering
based on HTTP and other networking protocols, allowing the management of what content
arrives at your machine, rather than just where it comes from.
A network firewall requires configuration against a broad scope of connections, whereas a host
firewall can be tailored to fit each machine's needs. However, host firewalls require more effort to
customize, meaning that network-based are ideal for a sweeping control solution. But the use of
both firewalls in both locations simultaneously is ideal for a multi-layer security system.
Filtering traffic via a firewall makes use of pre-set or dynamically learned rules for allowing and
denying attempted connections. These rules are how a firewall regulates the flow of web traffic
through your private network and private computer devices. Regardless of type, all firewalls may
filter by some combination of the following:
Source: Where an attempted connection is being made from.
Destination: Where an attempted connection is intended to go.
Contents: What an attempted connection is trying to send.
Packet protocols: What ‘language’ an attempted connection is speaking to carry its
message. Among the networking protocols that hosts use to ‘talk’ with each other, TCP/IP
protocols are primarily used to communicate across the internet and within intranet/sub-
networks.
Application protocols: Common protocols include HTTP, Telnet, FTP, DNS, and SSH.
2
Source and destination are communicated by internet protocol (IP) addresses and ports. IP
addresses are unique device names for each host. Ports are a sub-level of any given source and
destination host device, similar to office rooms within a larger building. Ports are typically
assigned specific purposes, so certain protocols and IP addresses using uncommon ports or
disabled ports can be a concern.
By using these identifiers, a firewall can decide if a data packet attempting a connection is to be
discarded-silently or with an error reply to the sender or forwarded.
Importance of firewalls
So, what is the purpose of a firewall and why are they important? Networks without protection are
vulnerable to any traffic that is trying to access your systems. Harmful or not, network traffic
should always be vetted.
Connecting personal computers to other IT systems or the internet opens up a range of benefits,
including easy collaboration with others, combining resources, and enhanced creativity. However,
this can come at the cost of complete network and device protection. Hacking, identity theft,
malware, and online fraud are common threats users could face when they expose themselves by
linking their computers to a network or the internet.
Once discovered by a malicious actor, your network and devices can easily be found, rapidly
accessed, and exposed to repeated threats. Around-the-clock internet connections increase the risk
of this (since your network can be accessed at any time).
Proactive protection is critical when using any sort of network. Users can protect their network
from the worst dangers by using a firewall.
3
Workplace web browsing restrictions: Employers can prevent employees from using
company networks to access certain services and content, such as social media.
Nationally controlled intranet: National governments can block internal residents' access
to web content and services that are potentially dissident to a nation's leadership or its
values.
However, firewalls are less effective at the following:
1. Identifying exploits of legitimate networking processes: Firewalls do not anticipate
human intent, so they cannot determine if a ‘legitimate’ connection is intended for
malicious purposes. For example, IP address fraud (IP spoofing) occurs because firewalls
don't validate the source and destination IPs.
2. Prevent connections that do not pass through the firewall: Network-level firewalls
alone will not stop malicious internal activity. Internal firewalls such as host-based ones
will need to be present in addition to the perimeter firewall, to partition your network and
slow the movement of internal ‘fires.’
3. Provide adequate protection against malware: While connections carrying malicious
code can be halted if not allowed, a connection deemed acceptable can still deliver these
threats into your network. If a firewall overlooks a connection as a result of being
misconfigured or exploited, an antivirus protection suite will still be needed to clean up
any malware that enter.
Types of firewalls
(Based On implementation)
Firewalls play a crucial role in network security, acting as a barrier between external threats and
protected systems. Let’s explore the different types of firewalls based on their implementation:
Hardware Firewalls:
These firewalls are physical devices that sit between your internal network and the external
world (such as the internet).
They operate at the network level (Layer 3) and can filter traffic based on IP addresses,
ports, and protocols.
Hardware firewalls are commonly used in corporate environments to protect entire
networks.
Software Firewalls:
Software firewalls run as applications or services on individual computers or servers.
They operate at the host level (Layer 7) and can control traffic based on specific
applications or services.
These firewalls are often installed on endpoints (e.g., laptops, desktops) to provide
localized protection.
4
Cloud-Based Firewalls:
Cloud firewalls are deployed in cloud environments (such as AWS, Azure, or Google
Cloud).
They protect virtual machines, containers, and other cloud resources.
Cloud firewalls can be managed centrally and scaled dynamically based on workload
demands.
Unified Threat Management (UTM):
UTM firewalls combine multiple security features into a single appliance.
They include functions like intrusion detection/prevention, antivirus, content filtering, and
VPN.
UTMs are suitable for small to medium-sized businesses.
Next-Generation Firewalls (NGFW):
NGFWs go beyond traditional packet filtering.
They inspect application-layer traffic, identify applications, and enforce granular policies.
NGFWs often include threat intelligence and intrusion prevention capabilities.
Web Application Firewalls (WAF):
WAFs specifically protect web applications from attacks.
They analyze HTTP/HTTPS traffic, detect and block malicious requests, and prevent
common web vulnerabilities.
Database Firewalls:
These firewalls secure databases by monitoring and controlling database traffic.
They prevent unauthorized access, SQL injection, and other database-related threats.
Container Firewalls:
Container firewalls protect containerized applications and microservices.
They ensure that communication between containers adheres to security policies.
Firewalls-as-a-Service (FWaaS):
FWaaS is a cloud-based firewall service provided by third-party vendors.
It offers scalable, subscription-based firewall protection without the need for on-premises
hardware.
Remember that choosing the right type of firewall depends on your specific use case, network
architecture, and security requirements
5
Types of firewalls
(Based on Operational Characteristics)
Static Packet Filtering Firewalls:
These firewalls make filtering decisions based on static rules defined by administrators.
They examine individual packets and allow or block them based on criteria such as source
and destination IP addresses, ports, and protocols.
Dynamic Packet Filtering Firewalls:
Unlike static packet filtering, these firewalls keep track of the state of active connections.
They maintain a state table to monitor the state of TCP connections and dynamically adjust
filtering rules accordingly, which enhances security by preventing certain types of attacks.
Proxy Firewalls:
Proxy firewalls act as intermediaries between internal and external networks. They
intercept and inspect incoming and outgoing traffic at the application layer. Instead of
allowing direct connections, they establish separate connections on behalf of clients,
providing additional security features such as content filtering and caching.
Next-Generation Firewalls (NGFW):
These advanced firewalls integrate traditional firewall features with additional capabilities
such as deep packet inspection, intrusion prevention, application-level filtering, and user
identity awareness. NGFWs offer granular control over network traffic and can make
intelligent security decisions based on application-specific context.
Stateful Inspection Firewalls:
Also known as dynamic packet filtering, these firewalls combine the functions of
traditional packet filtering with the ability to track the state of active connections. They
maintain a state table to monitor the state of TCP connections and make filtering decisions
based on the context of the traffic.
Intrusion Detection and Prevention Systems (IDPS):
While not strictly firewalls, IDPSs are often integrated with firewall functionality. They
monitor network and/or system activities for malicious activities or policy violations and
can take action to prevent or mitigate security incidents.
These classifications offer a comprehensive view of the diverse landscape of firewalls, each
serving different needs in network security based on their implementation and operational
characteristics.
6
Stateful firewall
A stateful firewall is a type of firewall that operates at the network layer, which is considered
layers 3 and 4 of the Open Systems Interconnection (OSI) model. Stateful firewalls work to
identify when unauthorized individuals try to access a client’s network and analyze data within
packets to check if they contain malicious code.
Stateful firewalls maintain a state table that records information about ongoing network
connections. When a packet arrives at the firewall, it is checked against the state table to determine
if it belongs to an established connection. If the packet matches an existing connection in the state
table, it is allowed to pass through. This process is often referred to as stateful packet inspection.
Improved security. By maintaining connection states, stateful firewalls can identify and
block unauthorized or suspicious network traffic. They can also prevent various types of
attacks, such as IP spoofing, port scanning, and connection hijacking. This can help quickly
identify problems with less work for your IT team and less downtime for your clients.
Simplified rule configuration. Stateful firewalls can allow returning packets for outgoing
connections without the need for explicit rules for each response packet. For MSPs, this
simplifies the process of rule management and reduces the chances of misconfigurations.
Enhanced performance. Stateful firewalls can process packets more efficiently by
leveraging the state information stored in the state table. They can quickly determine the
state of a packet and make forwarding decisions without extensive packet inspection for
each individual packet, which saves your team time while supporting your clients’ business
needs and goals.
Granular control. Stateful firewalls allow administrators to define policies based on the
state of a connection. This gives you granular control and greater visibility over network
traffic by allowing different rules for the initial connection establishment, ongoing
communication, and connection termination phases.
Stateless firewall
A stateless firewall is a type of firewall that filters network traffic based on individual packets
without storing information about the state or context of connections. When comparing stateless
vs. stateful firewalls, stateless firewalls make filtering decisions based only on the information
present in each packet as opposed to stateful firewalls, which maintain a state table.
Stateless firewalls are commonly deployed at the network perimeter to provide an initial level of
protection against unauthorized network traffic. However, for more advanced security
requirements or environments with complex networking needs, stateful firewalls or other security
technologies with deeper inspection and stateful capabilities may be more suitable.
7
A few benefits of stateless firewalls include:
Simplicity. In the stateless firewall vs. stateful firewall conversation, stateless is simpler
in design and operation, which can help you to configure and implement firewalls. Stateless
firewalls focus on filtering packets based on basic header information and do not require
the maintenance of connection states, streamlining your IT processes.
Efficiency. Stateless firewalls are generally more efficient in terms of performance
compared to stateful firewalls. Since they do not keep track of connection states, they
require that you provide fewer system resources and have lower processing overhead,
which can increase performance speed to help you serve your clients more quickly and
efficiently.
Scalability. With more limited data processing, a stateless firewall may be able to process
additional connections, making it more suitable when helping your clients scale their
business.
Cost. Since stateless firewalls are less complex, they may cost less than more complex
stateful firewalls. This cost benefit helps MSPs save money because you don’t have to
invest in more complex tools, which means cost savings can be passed onto clients.
8
network and transport layer information, making filtering decisions based on packet
headers rather than analyzing the content or behavior of higher-level protocols.
Complexity and flexibility. Stateful firewalls have more complex designs and operations
because of the need for connection state tracking. Stateful provides more advanced
functionality and flexibility, which can accommodate more dynamic networking
environments. Stateless firewalls are more suitable for basic packet filtering needs and
scenarios where performance is a critical factor. However, they may struggle to handle
complex networking requirements.
The choice between stateful vs. stateless firewalls will depend on the specific security
requirements, network environment, and performance considerations of your client’s organization.
Factors like secure remote work environments may play a role in the types of firewalls you use to
ensure the utmost protection.
Statistical Firewall
Statistical firewalls are a type of network security device that employs statistical analysis
techniques to identify patterns and anomalies in network traffic. Unlike traditional firewalls that
rely on static rules or signatures to filter traffic, statistical firewalls analyze the behavior and
characteristics of network traffic to detect potential threats.
9
patterns and analyzing network behavior, they can identify bottlenecks, optimize resource
allocation, and improve overall network performance.
Scalability: Statistical firewalls are often scalable and can handle large volumes of
network traffic efficiently. They are suitable for deployment in enterprise networks, data
centers, and other high-traffic environments.
Overall, statistical firewalls offer an advanced approach to network security by leveraging
statistical analysis techniques to detect and mitigate potential threats in real-time. They
complement traditional firewall technologies and enhance the overall security posture of an
organization's network infrastructure.
10
Rule-based access may be applied to more broad and overreaching scenarios, such as allowing all
traffic from specific IP addresses or during specific hours rather than simply from specific user
groups.
In some situations, it may be necessary to apply both rule-based and role-based access controls
simultaneously. For example, if you had a subset of data that could be accessed by Human
Resources team members, but only if they were logging in through a specific IP address (i.e. from
their office computer, on the office network). This would essentially prevent the data from being
accessed from anywhere other than a specific computer, by a specific person.
11
Now we can check in firewall inbound and outbound rules:
12
Block Websites using Python Scripts:
13
Block Ports using Python Scripts:
14
15