
ConfigServer Security & Firewall (CSF) is a popular VPS security tool for Linux. It provides a simple interface for iptables to protect Linux servers. CSF comes with multiple features: a stateful packet inspection firewall (SPI), intrusion detection, a login failure daemon, DDOS protection, and control panel integration. This tutorial covers installation, basic configuration, and essential commands for CSF on Ubuntu 20.04.
Ubuntu 20.04 comes with UFW firewall by default, which must be removed before installing CSF.
Install the CSF dependencies.
CSF requires Sendmail to send alerts to the administrator.
Change to /usr/src
Download the CSF distribution.
Extract CSF.
Change to /usr/src/csf
Run the install script.
Verify the required iptables modules for CSF are available.
Confirm that all tests report OK, and you see the following result.
Verify CSF status after installation.
You should see a result similar to:
CSF runs in TESTING mode by default. Edit /etc/csf/csf.conf to disable TESTING mode.
Locate the line TESTING = "1", and change the value to "0".
Locate the line RESTRICT_SYSLOG = "0", and change the value to "3". This means only members of the RESTRICT_SYSLOG_GROUP may access syslog/rsyslog files.
Save the configuration file.
Stop and reload CSF with the -ra option.
You must restart CSF each time the configuration file changes.
Edit /etc/csf/csf.conf
Locate the following lines and add the required ports.
Restart CSF for the changes to take effect.
Use the -d option to deny by IP, for example, 192.0.2.123.
Use the -a option to allow by IP, for example, 192.0.2.123.
Remove IP from the allow list.
Remove IP from the deny list.
Block IPs by adding a entry to /etc/csf/csf.deny.
Add trusted IPs to /etc/csf/csf.allow.
Check all listening ports with the -p option.
For more information about VPS security, see the CSF website.
0 Comments
Be the first to comment and share your perspective with the community.