This bash script automates the initial setup and hardening of CSF (ConfigServer Security & Firewall) on your Linux server.
- Disables test mode
- Blocks specific countries (CN, IN, BR)
- Limits concurrent connections (CT_LIMIT = 20)
- Enables brute force protection for cPanel & WHM
- Ensures CSF & LFD start on boot
- Provides notes for manually allowing/denying IPs
Before running this file, please open the file and change the value of CC_DENY = "CN,IN,BR" to the countries you want to restrict.
chmod +x csf-setup.sh
sudo ./csf-setup.shAfter running the script, you can:
-
Add allowed IPs:
nano /etc/csf/csf.allow -
Add denied IPs:
nano /etc/csf/csf.deny
This script is for educational/demo purposes. Always test on a staging server before applying to production.
Created with β€οΈ by Ela