Network Security

April 25, 2025, 8:23 p.m.

140 views

I. Network Security Involves protecting devices and systems connected within a network from cyber threats. Common devices included in security networking are: Firewalls, Computers, Routers, Servers, Switches, IDS, IPS, VPN , Network Monitoring Tools, Proxy Servers and Network Security Cameras& Io 1. What is a Firewall A firewall is a network security device (or software) that acts as a barrier between your trusted internal network and untrusted external sources like the internet. Think of it as a digital security guard that filters which data is allowed in and out based on predefined rules.
2. Why Do Firewalls Matter Without a firewall, your server or application could be open to anyone, including malicious actors. Firewalls protect your system by Blocking suspicious traffic Preventing unauthorized access Reducing the risk of malware and denial-of-service (DoS) attacks. They are essential for keeping confidential data safe and maintaining system availability.
3. Types of Firewalls a. Packet Filtering checks headers of each packet and blocks/allows based on IP, port, or protocol. b. Stateful Inspection tracks the state of active connections and makes decisions based on context. c. Proxy Firewalls act as intermediaries, processing requests before sending them to the destination.
II. packet filtering --- Security Groups — The First Line of Defense In AWS EC2, the first network-level security control I used was a Security Group. Think of it like a virtual firewall that filters traffic before it even touches my server. These work like packet filters:
My EC2 server is protected by AWS Security Groups, which are:
a. form of Packet Filtering Firewall
b. Operate at Layer 3 and 4 of the OSI model
c. Control traffic based on IP address, port number, and protocol
d. Stateless: No memory of past packets

Here is a screenshot form my blog:
This is my server running in AWS: (IF you don't know what AWS is contact me)

Description

Let’s break down the firewall rules I’ve set up on my EC2 server to protect the blog:

What Firewall Rules Are Applied Here are the key rules I’ve applied to my EC2 instance:
• ✅ Allow TCP on Port 443 (HTTPS) from 0.0.0.0/0
This allows anyone on the internet to access my blog securely. Port 443 is standard for HTTPS traffic.
• ✅ Allow TCP on Port 22 (SSH) from my specific IP
This permits only me to remotely access the server using SSH. It’s locked down to just my IP for security.
• ❌ Deny all other traffic (default)
Any traffic that doesn’t match the rules above is automatically blocked. This “deny by default” approach significantly reduces exposure to potential attacks.
Here is a screenshots from my AWS: as you can see there an inbound rules, means the traffic that is allowed.

image:
image:

Here is a short video for demonstration:
short video:
https://www.loom.com/share/3e537a6bbb764388b03b716eb15b954b?sid=f2217b32-4acc-4aa1-ac0c-f7081304c9a4

III. What Happens After the traffic reaches the actual server Once traffic passes the security group, it reaches the actual server. That’s where more components step in:

Virtual Firewall like ufw or firewalld
On the EC2 instance itself, I can run a virtual firewall like UFW (Uncomplicated Firewall) to add another layer of filtering. While AWS handles cloud-level protection, this protects at the operating system level.
Example:
• Allow only ports 22 and 443
• Block local brute-force attacks
• Monitor suspicious outbound connections
This is like saying: “Even if AWS lets you through, you still have to pass another checkpoint inside the house.”
Here is a real world example: I will show you the command to use to run virtual firewall.
After you SSH to the EC2 Linux Server: you will see the terminal:

and here is the command you have to use:

sudo ufw enable
this will lock you out. So you have to unlock yourself
because by default, you have this:
- Default incoming: deny
- Default outgoing: allow
After you enable the UFW, you have to this:
sudo ufw allow OpenSSH #allow yourself to SSH
sudo ufw allow 80 #HTTP allow people to visit website
sudo ufw allow 443 #HTTPS allow people to visit website

Short video for demonstration:
video:
https://www.loom.com/share/4bf5b184e3334b2e979b6d0512549821?sid=b83d20fb-986f-4101-9158-5a6a01a49572

Now that we've strengthened the server's basic security by configuring UFW (Uncomplicated Firewall) to control incoming traffic, the next critical step is to properly manage how our application handles and serves web requests. This is where Nginx and Gunicorn come into play, working together to efficiently and securely deliver content to users.
NGINX Reverse Proxy NGINX is a high-performance web server that I use as a reverse proxy. Its job is to:
• Accept incoming requests from users on the internet.
• Handle SSL (HTTPS) traffic.
• Forward valid requests to Gunicorn, which actually runs my blog application.
• Serve static files like CSS and JavaScript directly.

Gunicorn Python WSGI Server Gunicorn is the application server that runs my Django blog. Once NGINX sends it a request:
• Gunicorn runs the Python code that powers the blog.
• It generates the response (like an HTML page).
• The response goes back to NGINX, and then to the user.
Gunicorn is great at managing multiple user requests and making sure the blog stays responsive and fast.

🔄 Recap: The Layers of Network Security on My Blog

image:

List All The Posts




Leave a Comment

No comments yet. Be the first!

Your comment is awaiting approval by an admin.

Leave a Comment