Installing APF (Advanced Policy Firewall)

APF is a policy based IP tables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteranLinux user and the novice alike. Packaged in .tar.gz and RPM formats, APF is ideal for deployment in any linux server environment.

How to Install the APF Firewall

1. Type cd /usr/local/src

2. wget

3. tar -xvzf apf-current.tar.gz

4. cd apf-x.x/ (the x.x stands for the apf version)

5. ./
The message below will appear once APF is installed.

.: APF installed
Install path: /etc/apf
Config path: /etc/apf/conf.apf
Executable path: /usr/local/sbin/apf

6. pico /etc/apf/conf.apf

Note: The settings below are recommend for cPanel servers.

Common ingress (inbound) ports
IG_TCP_CPORTS=”21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,30000_35000″

Common ingress (inbound) UDP ports

Common egress (outbound) TCP ports

Common egress (outbound) UDP ports

7. Simply press Crtl + X then Y to save & quit.

8. Starting the firewall
/usr/local/sbin/apf -s

9. If everything is fine after the firewall is being started, key in
pico /etc/apf/conf.apf

Change DEVM=”1″ to DEVM=”0″

10. Again, press Ctrl+X then Y

11. To restart the firewall, type /usr/local/sbin/apf -r

For more quality articles, technical guides and discussions, visit