CSF Firewall - Install & Configuration

Installing and Configuring CSF Firewall on Linux Server

ConfigServer Security & Firewall (CSF) is a popular firewall application for Linux servers. This guide outlines the steps to install CSF and provides a basic configuration to enhance the security of your server.

Content:

  1. Installation:

    • Connect to your server via SSH.
    • Download and install CSF:
      bash
      wget https://download.configserver.com/csf.tgz tar -xzf csf.tgz cd csf sh install.sh
  2. Configuration:

    • Edit CSF configuration file:
      bash
      nano /etc/csf/csf.conf
  3. Basic CSF Configuration:

    • TCP_IN, TCP_OUT, UDP_IN, UDP_OUT:

      • Define incoming and outgoing ports.
      • Example:
        makefile
        TCP_IN = "20,21,22,80,443" TCP_OUT = "20,21,22,25,43" UDP_IN = "53" UDP_OUT = "53"
    • LF_ Options (Login Failure Blocking):*

      • Configure settings to block IPs with excessive login failures.
      • Example:
        makefile
        LF_SSHD = "5" LF_SMTPAUTH = "3"
  4. Advanced Configuration (Optional):

    • SYNFLOOD, PORTFLOOD, CONNLIMIT:

      • Protection against SYN floods, port floods, and connection limits.
    • SMTP Restrictions:

      • Prevent unauthorized SMTP access.
      • Configure settings for SMTP_BLOCK, SMTP_ALLOWGROUP, etc.
    • Custom Firewall Rules:

      • Add custom rules using /etc/csf/csfpre.sh and /etc/csf/csfpost.sh.
  5. Testing Configuration:

    • Apply the configuration:

      csf -r
    • Check CSF status:

      csf -s
  6. Enabling CSF and LFD:

    • Start CSF and its Login Failure Daemon (LFD):
      csf -e
  7. Managing IP Blocks:

    • View and manage blocked IPs:
      php
      csf -g csf -dr <IP>
  8. Configuration File Changes:

    • CSF configuration changes are saved in /etc/csf/csf.conf.
    • Make modifications carefully and restart CSF to apply changes:
      csf -r
  9. Uninstallation:

    • To uninstall CSF and LFD:
      bash
      cd /etc/csf sh uninstall.sh

This guide walks you through the process of installing and configuring CSF firewall on your Linux server. Customizing the configuration to suit your specific needs will enhance your server's security by effectively filtering incoming and outgoing traffic.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Secure Your Linux Server

How to Secure Your Linux Server Introduction: Securing your Linux server is...

Essential Linux Commands Guide

Essential Linux Commands Guide for New Users  For newcomers to Linux server...

Troubleshooting Email Issues in WHM/cPanel

Troubleshooting Email Issues in WHM/cPanel Introduction: Email issues can...

What is a Unmanaged Server?

An unmanaged server, also known as a self-managed server, refers to a type of...

Managed vs Unmanaged Servers

Unmanaged and managed servers represent two different levels of server...