Today, Linux hosting environments have become extremely vulnerable to cyber attacks. Therefore, effective security configuration is essential to close security gaps and protect your servers. In this article, we will address step-by-step the installation of Firewall, DDoS protection, and WAF (Web Application Firewall) to close security vulnerabilities on your Linux servers.
1. Firewall Installation
To set up a firewall on your Linux servers, you can use iptables or ufw (Uncomplicated Firewall). Below are step-by-step instructions for setting up a firewall using ufw:
Allow Web Server Access:sudo ufw allow 'Nginx Full' or sudo ufw allow 'Apache Full'
Check Status:sudo ufw status verbose
2. DDoS Protection Installation
To protect against DDoS attacks, you can use tools like fail2ban. Fail2ban blocks IP addresses after detecting too many failed attempts within a certain period.
Save Changes and Restart Fail2ban:sudo systemctl restart fail2ban
3. Web Application Firewall (WAF) Installation
A WAF is a security solution designed to protect web applications. ModSecurity is a popular WAF for Apache and Nginx.
Install ModSecurity: For Apache: sudo apt install libapache2-mod-security2 For Nginx: sudo apt install libnginx-mod-http-modsecurity
Enable ModSecurity: For Apache: sudo a2enmod security2 For Nginx: sudo nano /etc/nginx/nginx.conf and add include /etc/nginx/modsec/modsecurity.conf;
Load Rules:sudo nano /etc/modsecurity/modsecurity.conf and make sure SecRuleEngine On is active.
Restart Web Server: For Apache: sudo systemctl restart apache2 For Nginx: sudo systemctl restart nginx
Conclusion
By following the steps outlined above, you can protect your Linux hosting servers against security vulnerabilities. Remember that security is an ongoing process, and keeping your system updated is essential to counter new threats.