Kernel of Truth

What Is a Firewall?

🔥 What Is a Firewall?

Your First Line of Defence in Cybersecurity

A firewall is a security device or software that monitors and controls incoming and outgoing network traffic based on predefined security rules. Think of it as a digital security guard — deciding who gets in, who gets out, and who gets blocked.


🧱 Why Are Firewalls Important?

Firewalls form a critical layer of a defence-in-depth strategy. Without one, your network is wide open to attacks, scans, malware, and unauthorised access.

🔐 Purpose✅ Benefit
Block Unwanted TrafficPrevent attackers from reaching vulnerable services
Permit Legitimate AccessAllow business-critical services to communicate
Control Internal SegmentationPrevent lateral movement between departments
Log & Alert Suspicious ActivityHelp with visibility, auditing, and incident response

🧰 Types of Firewalls

TypeDescriptionUse Case
Packet-Filtering FirewallInspects headers (IP, port, protocol) — stateless.Fast and basic filtering.
Stateful Inspection FirewallTracks connection state — allows return traffic.Most common in enterprise edge firewalls.
Next-Gen Firewall (NGFW)Adds deep packet inspection, IDS/IPS, app awareness.Stops threats based on payload & behaviour.
Web Application Firewall (WAF)Protects web servers from OWASP Top 10 threats.Required for public-facing web apps.
Host-Based FirewallInstalled on endpoints/servers (e.g. Windows Defender Firewall).Local protection on individual devices.
Cloud FirewallFirewall-as-a-Service (e.g. AWS Security Groups, Azure NSG).Needed for virtual/cloud environments.

🔎 How Firewalls Work (Simplified)

  1. Incoming packet arrives
  2. Rules are checked (source IP, destination port, protocol)
  3. Decision made:
    • ✅ Allow
    • ❌ Deny
    • 🕵️ Log/Alert

Example rule:
Allow TCP traffic from 10.1.1.5 to 192.168.0.100 on port 443


🛠️ What Do Firewalls Protect Against?

Threat TypeFirewall Defence
Port scanningDrop unsolicited probes
Malware C2Block access to known malicious IPs
Exploit deliveryBlock traffic to vulnerable services
Lateral movementControl internal network access
Data exfiltrationDetect & stop unexpected outbound traffic

⚙️ Real-World Firewall Tools

PlatformExample
EnterprisePalo Alto, Fortinet, Cisco ASA
Open-SourcepfSense, OPNsense, iptables
Cloud-NativeAWS NACLs, Azure NSGs, GCP Firewall Rules
Host-LevelWindows Firewall, UFW (Linux)

📋 Best Practices for Firewall Configuration

✅ Apply the principle of least privilege
✅ Maintain a clean, documented rule set
✅ Group rules by business function
✅ Regularly review for shadowed/unused rules
✅ Enable logging for alerting and forensics
✅ Protect the firewall admin interface with MFA and access controls
✅ Perform periodic audits and test with tools like nmap


🧪 Example: Basic iptables Rule (Linux)

# Allow HTTP and HTTPS, deny everything else
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT<br>iptables -A INPUT -j DROP

🧯 What Firewalls Don’t Do (Alone)

  • They don’t scan for malware inside payloads (unless NGFW or WAF)
  • They don’t stop phishing attacks
  • They can’t protect against internal threats without segmentation
  • They won’t detect post-exploit activity unless integrated with EDR or SIEM

🧱 Final Word

Firewalls are foundational, but must be configured wisely and combined with:

  • Endpoint protection
  • Intrusion detection/prevention
  • Zero trust principles
  • Ongoing monitoring