How to setup firewall on Cloud Server

Introduction

Does your server have a firewall running? A firewall is like a security gate – if it is not closed and locked, anyone can get in. Firewalls are essential in protecting your data and preventing unauthorised intruders by establishing a barrier between a secure internal network and a non-trusted network. For safe, stable and secure servers, firewalls need to be installed and configured correctly.

How to set up a firewall on your Linux server

ConfigServer Security and Firewall (CSF) is a firewall that is supported by most Operating Systems, including Linux. If you have a dedicated server, you may want to use a hardware based firewall, but with CSF or other software based firewalls, you can install the firewall within your server. It still regulates traffic based on the rule sets you create, but it operates from within the server. Here are the steps to install CSF on your Linux based server, with the commands you should enter:

  1. Create the directory to install CSF: mkdir /usr/local/src
  2. Change your location on the server to the newly created directory: cd /usr/local/src
  3. Download the CFS software to your server: wget http://www.configserver.com/free/csf.tgz
  4. Extract the software: tar xfz csf.tgz
  5. Change your location on the server to the CSF directory: cd csf
  6. Install the CSF firewall: ./install.sh

Configuring your firewall to your needs

After installation, CSF will add a pre-set rule list onto your server. These rules can be configured directly within the csf.conf file. You can configure ports for inbound and outbound. You may also want to limit the number of connections each user can make to your server. This is done by changing CT Limit in your csf.conf to the specific number you want. For security, you can also remove port 22 from TCP_IN and setting your SSH config file to public key authentication only. This will allow only people who have SSH keys installed in your server to gain access when using SSH, effectively locking your server from the outside. There are several other ways to add security layers and personal configurations to your server with CSF. Contact Cloud.co.za to learn more about how to setup firewall on a cloud server.

Articles you may enjoy

Looking for further info, or perhaps a how-to guide?