This project is a Linux firewall automation and traffic monitoring solution developed using Bash scripting and UFW (Uncomplicated Firewall).
The objective of this project is to secure Linux server traffic by:
- allowing essential services,
- blocking vulnerable ports,
- monitoring firewall activity,
- and analysing traffic logs.
The project demonstrates practical Linux administration, firewall configuration, traffic monitoring, and basic security hardening techniques.
- Bash Scripting
- Kali Linux
- UFW Firewall
- Netcat
- Nmap
- Linux Kernel Logs
- Automated firewall configuration using Bash scripting
- Blocking insecure and vulnerable ports
- Allowing essential network services
- Firewall traffic monitoring
- Firewall log analysis
- Netcat-based traffic simulation
- Port scanning using Nmap
| Port | Service |
|---|---|
| 22 | SSH |
| 80 | HTTP |
| 443 | HTTPS |
| 25 | SMTP |
| 53 | DNS |
| Port | Reason |
|---|---|
| 3389 | RDP remote desktop access |
| 445 | SMB malware propagation risks |
| 23 | Insecure Telnet service |
| 137 | NetBIOS exposure risks |
| 135 | RPC vulnerabilities |
Netcat was used to simulate connection attempts to blocked ports in order to verify whether the firewall rules were working correctly.
Example commands:
nc -zv localhost 3389
nc -zv localhost 135nc→ Netcat networking utility-z→ Checks whether the port is open or blocked-v→ Displays detailed connection outputlocalhost→ Refers to the local Linux machine
These simulated traffic attempts help generate firewall log entries for monitoring and analysis.
Firewall activity was monitored using Linux kernel log files.
Example command:
grep UFW /var/log/kern.log | tail -n 5This command displays the latest firewall-related log entries from the Linux kernel log file.
linux-firewall-automation/
│
├── logs/
│ └── firewall_logs.txt
│
├── screenshots/
│ ├── firewall_logs.png
│ ├── netcat_test.png
│ ├── nmap_scan.png
│ └── ufw_status.png
│
├── scripts/
│ └── fwconfig.sh
│
└── README.md
Screenshots are available inside the screenshots/ directory.
Make the script executable:
chmod +x scripts/fwconfig.shRun the script:
./scripts/fwconfig.shThis project helped improve understanding of:
- Linux firewall administration
- Bash scripting
- Traffic monitoring
- Port security
- Linux logging mechanisms
- Basic security hardening concepts