Deploying a fresh Linux VPS or dedicated server without comprehensive hardening leaves it vulnerable to automated SSH brute-force bots, kernel exploits, and open port scans within minutes.
server-hardening-toolkit is a battle-tested collection of automated Bash and Ansible scripts designed to securely configure production servers in under 5 minutes.
seotarek
/
server-hardening-toolkit
Production-tested Bash and Ansible automation scripts for Linux, CloudLinux, and web server security hardening.
Server Hardening Toolkit 🛡️
Production-tested modular automation scripts for Linux, CloudLinux, and web server security hardening.
Developed by Tarek Mohamed (@seotarek)
📌 Included Modules
-
scripts/harden-ssh.sh:- Disables root SSH login.
- Enforces public-key authentication only.
- Sets strict brute-force thresholds (
MaxAuthTries 3). - Automatically tests configuration syntax before restarting
sshd.
-
scripts/setup-firewall.sh:- Configures
ufwwith rate-limiting on SSH. - Default deny incoming, allow outgoing.
- Opens only ports 80, 443, and custom SSH port.
- Configures
-
scripts/sysctl-tuning.sh:- Hardens kernel network parameters against SYN floods, IP spoofing, and malicious ICMP redirects.
🚀 Quick Usage
git clone https://github.com/seotarek/server-hardening-toolkit.git
cd server-hardening-toolkit
# Make executable
chmod +x scripts/*.sh
# Run hardening scripts (requires root)
sudo ./scripts/harden-ssh.sh
sudo ./scripts/setup-firewall.sh 22
sudo ./scripts/sysctl-tuning.sh
📜 License
Licensed under the MIT License.
🛡️ What Does It Harden?
- SSH Hardening: Disables root login, enforces Ed25519 public key authentication, changes standard ports, and configures aggressive Fail2ban jails.
- Kernel & Sysctl Tuning: Protects against SYN flood attacks, disables IP forwarding, and restricts access to kernel dmesg logs.
- Automated Firewall (UFW / CSF): Locks down all ports by default, allowing only necessary web and management traffic.
- CloudLinux & LVE Optimization: Configures resource limits (CPU/RAM/IO) to prevent single-tenant server overload.
View the scripts and contribute on GitHub:
👉 https://github.com/seotarek/server-hardening-toolkit
Top comments (0)