Open In App

How To Install apf-firewall on Ubuntu

Last Updated : 21 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

APF, or Advanced Policy Firewall, is a firewall that is occasionally observed on Liquid Web servers. It is essentially an interface to iptables, which is Linux’s standard interface for controlling network ports. Interacting with iptables may be complicated and error-prone, but APF substantially simplifies it. APF, on the other hand, is still only accessible via ssh. Changes to APF cannot be made using WHM or cPanel. All APF configuration files are stored on your server in the /etc/apf subdirectory. They allow hosts.rules file in this folder contains all of the IP addresses that are whitelisted for the server, while the deny hosts.rules file contains all of the IP addresses that are prohibited by the firewall. Each IP address that is prohibited should contain a justification for the block in the denied hosts.rules file (most of them will be blocked by bfd, which blocks IPs attempting to brute force the server).

Features of APF-firewall:

  • The configuration file that is thorough and properly commented
  • User id-based outbound network filtering granular inbound and outbound network filtering
  • Network filtering based on applications 
  • Rule files based on trust with an optional enhanced syntax

Installation of apf-firewall on Ubuntu

On Ubuntu 20.04, there are 3 options for installing apf-firewall. 

  • Using apt-get to install  
  • Using apt to install  
  • Using aptitude to install 

Method 1: Using apt-get to install  

Step 1: Using the following command, update the apt database using apt-get.

sudo apt-get update

 

Step 2: After upgrading the apt database, we can use apt-get to install apf-firewall by performing the following command:

sudo apt-get -y install apf-firewall

 

Method 2: Using apt to install  

Step 1: The apt database will be updated with the command below.

sudo apt update

 

Step 2: After upgrading the apt database, we can use apt to install apf-firewall by performing the following command:

sudo apt -y install apf-firewall

 

Method 3: Using aptitude to install 

Step 1: If you want to use this method, you may need to install aptitude first because it is not normally installed by default on Ubuntu. Use the following command to update the apt database with aptitude.

sudo aptitude update

 

Step 2: After upgrading the apt database, we can use aptitude to install apf-firewall by performing the following command:

sudo aptitude -y install apf-firewall

 

Usage of apf-firewall on Ubuntu

Example 1: Load firewall Rules

This will load all the firewall configuration options.

apf -o

 

We have got the details of the firewall configuration.

 

Example 2: List of Firewall Rules

This command list all the firewall rules present in our Ubuntu Operating System.

apf -l

 

The below screenshot describes the list of available or present firewalls on the system.

 

Example 3: Status 

Show the status of output’s the firewall log.

apf -t

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads