X
X

Select Your Currency

Türk Lirası $ US Dollar
X
X

Select Your Currency

Türk Lirası $ US Dollar

Closing Security Vulnerabilities for Linux Hosting: Step-by-Step Guide

HomepageArticlesSecurityClosing Security Vulnerabilities fo...

Introduction

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:

  • Install Ufw: sudo apt install ufw
  • Enable Ufw: sudo ufw enable
  • Set Default Policies: sudo ufw default deny incoming
    sudo ufw default allow outgoing
  • Allow SSH Access: sudo ufw allow ssh
  • 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.

  • Install Fail2ban: sudo apt install fail2ban
  • Start Fail2ban: sudo systemctl start fail2ban
  • Enable Fail2ban: sudo systemctl enable fail2ban
  • Edit Default Settings:
    sudo nano /etc/fail2ban/jail.local
  • Add the Following Settings:
    [sshd]
    enabled = true
    port = ssh
    filter = sshd
    logpath = /var/log/auth.log
    maxretry = 5
    findtime = 600
    bantime = 3600
  • 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.


Top