CSF (ConfigServer Security & Firewall) is a popular firewall configuration tool for Linux servers, especially on cPanel/WHM setups. Administrators may need to fix CSF firewall issues to ensure features like blocking incoming traffic based on IP addresses, limiting login attempts, and protecting the server from attacks work correctly.
However, CSF can sometimes encounter issues that prevent it from functioning as expected. Whether you’re facing issues with configuration, blocked ports, or IP blocks, this guide will walk you through common CSF firewall issues on a Linux server and provide troubleshooting solutions.
Preliminary Steps Before Fixing CSF Firewall

Before diving into the troubleshooting or fixing CSF Firewall issue, ensure that CSF is installed and the firewall is properly running on your server.
Verify CSF Installation
Check if CSF is installed on your server:
csf -v
If CSF is not installed, you can install it by following the official installation guide. Generally, you can use the following commands to install CSF:
sudo apt-get install wget
cd /usr/src
sudo wget https://download.configserver.com/csf.tgz
sudo tar -xvzf csf.tgz
cd csf
sudo sh install.sh
For RHEL/CentOS-based systems:
sudo yum install wget
cd /usr/src
sudo wget https://download.configserver.com/csf.tgz
sudo tar -xvzf csf.tgz
cd csf
sudo sh install.sh
Verify CSF Status
To check if CSF is running properly, use the following command:
sudo systemctl status csf
If the service is not running, start it with:
sudo systemctl start csf
To enable CSF to start on boot:
sudo systemctl enable csf
Check CSF Logs
If you’re encountering issues with CSF, checking the logs can help identify the root cause. CSF logs are typically stored in /var/log/lfd.log
. You can check the logs by running:
sudo tail -f /var/log/lfd.log
Look for error messages, warnings, or blocked IP addresses that may be causing issues.
Identifying Common CSF Firewall Issues
Several issues can arise with the CSF firewall on Linux servers. These include misconfigurations, blocked ports, or issues related to CSF’s relationship with other services (like cPanel or Apache). Below are some common issues you may encounter:
- CSF Not Blocking Traffic Properly
Sometimes, CSF may not block traffic as expected, even when rules are configured.
- Ports Blocked by CSF
You might find that certain ports are blocked by CSF, which may prevent services (like web servers or email) from functioning properly.
- IP Blocking or DDoS Protection Issues
CSF is often used to block malicious IPs or prevent DDoS attacks. However, it may block legitimate IP addresses or trigger false positives, causing accessibility issues.
- CSF Configuration Errors
Misconfigured settings in CSF can result in improper functioning of the firewall or unexpected traffic blocking.
Fix CSF Firewall Issue on Linux Server: Step-by-Step Solutions
Let’s walk through some common solutions for resolving issues with CSF.
Restart CSF and LFD
If CSF is not functioning properly, restarting the firewall and login failure daemon (LFD) may help resolve the issue.
To restart both services, use the following commands:
sudo systemctl restart csf
sudo systemctl restart lfd
After restarting, check the status to ensure they are running:
sudo systemctl status csf
sudo systemctl status lfd
Check and Modify CSF Configuration Files
CSF’s configuration files can sometimes contain incorrect settings or misconfigurations that cause issues with the firewall.
- Open the CSF Configuration File:
The main configuration file for CSF is located at /etc/csf/csf.conf
. Open it for editing:
sudo nano /etc/csf/csf.conf
- Check Common Settings:
Some key settings to check in the configuration file include:
TCP_IN and TCP_OUT:
These settings define which incoming and outgoing ports are allowed. Make sure the necessary ports are open.
Example:
TCP_IN = "20,21,22,80,443,10000" TCP_OUT = "20,21,22,80,443"
Add or remove ports as necessary. For instance, if you need to open port 8080 for a web application, add it to the TCP_IN
and TCP_OUT
lists.
LF_TRIGGER:
If CSF isn’t blocking IPs correctly, ensure the rate-limiting settings under LF_TRIGGER are configured properly. This setting is used to detect brute-force login attempts:
LF_TRIGGER = "10"
Testing Mode (TESTING):
If CSF is not working as expected, make sure TESTING
is set to 0
(disabled), as testing mode disables the firewall:
TESTING = "0"
- Save and Apply Changes:
After modifying the configuration file, save your changes and restart CSF:
sudo systemctl restart csf
Unblock Ports Blocked by CSF
If a port is blocked by CSF and is preventing a service from working (such as HTTP/HTTPS or SMTP), you can unblock it manually.
- Allow Specific Ports:
You can allow a specific port (e.g., port 8080) in the TCP_IN
or TCP_OUT
settings in /etc/csf/csf.conf
.
- Open Ports via CSF:
To open a port directly using the command line, use the following command:
sudo csf -a 8080
This command will allow incoming traffic on port 8080. If you need to open a range of ports, use a comma-separated list:
sudo csf -a 10000,10001,10002
- Restart CSF:
After modifying the firewall, restart CSF to apply the changes:
sudo systemctl restart csf
Fix CSF Firewall IP Blocks and DDoS Protection
If CSF is blocking legitimate IP addresses or triggering false positives for DDoS protection, you may need to review the IP block list and adjust CSF’s security settings.
- View Blocked IPs:
You can view blocked IPs in CSF by running:
sudo csf -g <IP address>
Replace <IP address>
with the IP you want to check.
- Unblock an IP Address:
If you identify an IP address that was mistakenly blocked, you can unblock it using the following command:
sudo csf -dr <IP address>
Replace <IP address>
with the actual IP that is being blocked.
Adjust DDoS Protection Settings:
CSF has settings for DDoS protection that you may need to adjust if you’re experiencing false positives. Review and modify the following settings in /etc/csf/csf.conf
:
- LF_DDOS:
Adjust the DDoS protection settings to prevent legitimate users from being blocked.
LF_DDOS = "0" # 0 = Disabled, 1 = Enabled
- LF_LIMIT:
If the number of allowed connections is too low, increase the value to prevent triggering the DDoS protection.
LF_LIMIT = "200"
After modifying these settings, restart CSF:
sudo systemctl restart csf
Check for Connection Limitations
CSF has connection rate-limiting settings to protect against brute-force attacks and DDoS. If you’re seeing connection issues, it may be caused by overly aggressive limits.
- Adjust Connection Limits:
Open the configuration file and review the rate-limiting settings:
sudo nano /etc/csf/csf.conf
Look for parameters such as LF_TCPIN
and LF_TCB
that limit the number of concurrent connections. Adjust them as necessary based on your server’s load. Example:
LF_TCPIN = "300" LF_TCB = "200"
- Restart CSF:
After adjusting the connection limits, restart CSF:
sudo systemctl restart csf
Test CSF Configuration and Check for Errors
After making changes to CSF, it’s important to verify that the firewall is working as expected. Run the following command to test the configuration:
sudo csf -t
This command checks for errors in the configuration file and makes sure the firewall is operating correctly.
Conclusion
Fixing CSF on a Linux server involves verifying the configuration, ensuring that ports and services are properly allowed, and reviewing logs to identify issues with IP blocks or misconfigurations. By following the troubleshooting steps in this guide, you should be able to resolve most common issues with CSF and restore the firewall to optimal functionality. Regular monitoring of firewall logs and connection limits will help ensure that your server remains secure while minimizing service interruptions.