Install APF Firewall on a cPanel sever

To install APF firewall login to your server as root and follow this tutorial

Type

cd /usr/src
wget http://rfxnetworks.com/downloads/apf-current.tar.gz
tar -xvzf apf-current.tar.gz
rm -f apf-current.tar.gz
cd apf-*
./install.sh
cd /etc/apf
nano conf.apf

Configure the ports

# Common ingress (inbound) TCP ports
IG_TCP_CPORTS=”20,21,22,25,53,80,110,143,443,465,993,995,2082,2083,2086,2087,2095,
2096,3306,10000,35000_35999″

please note that ports 2082 to port 2095 is mostly used by cpanel, and port 19638 is only use in
ensim.

# Common ingress (inbound) UDP ports
IG_UDP_CPORTS=”20,21,53,1040″[/green[

Exit nano and save and then restart apf
(ctrl+x)
y
(enter)

service apf start

If APF is functioning properly and you are not locked out edit the conf.apf again

nano conf.apf
Set the DEVM parameter to 0
DEVM=”0″

Once done Exit and save the file.
CTRL-x, y to save enter to confirm
Restart APF
service apf restart

Leave a Reply