eWebtricity
08-24-2005, 12:46 AM
APF is a firewall for the Linux operating system. Though many people think that a firewall is instant protection that will do everything it really is not. A firewall will help prevent some things but it is not going to stop everything. It is just one piece of the security network that is being woven. I recommend advanced protection firewall (APF) by rfxnetworks. APF will block unused outgoing and incoming ports. It can also be configured to use information from some block lists. The below port list will work for Plesk.
Step 1:
Download the application from http://www.rfxnetworks.com/apf.php (http://www.rfxnetworks.com/apf.php)
[root@u15171818 src]#cd /usr/local/src
[root@u15171818 src]# wget http://rfxnetworks.com/downloads/apf-current.tar.gz
[root@u15171818 src]#tar -zxf apf-current.tar.gz
[root@u15171818 src]# cd apf-0.9.5-1/
[root@u15171818 apf-0.9.5-1]# ./install.sh
Installing APF 0.9.5-1: Completed.
Installation Details:
Install path: /etc/apf/
Config path: /etc/apf/conf.apf
Executable path: /usr/local/sbin/apf
AntiDos install path: /etc/apf/ad/
AntiDos config path: /etc/apf/ad/conf.antidos
DShield Client Parser: /etc/apf/extras/dshield/
Other Details:
Listening TCP ports: 21,22,25,53,80,106,110,143,443,465,880,993,995,844 3
Listening UDP ports: 53,68,32768
Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options.
[root@u15171818 apf-0.9.5-1]#
Step 2:
Now edit config file
[root@u15171818 apf-0.9.5-1]# vi /etc/apf/conf.apf
Scroll down to the "Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.
Plesk Control Panel Ports:
IG_TCP_CPORTS="20,21,22,25,53,67,68,80,110,143,443,465,993,995,84 43"
IG_UDP_CPORTS="37,53,67,68,873"
EGF="1"
EG_TCP_CPORTS="20,21,22,25,37,43,53,67,68,80,113,123,443,465,873, 5224"
EG_UDP_CPORTS="53,67,68,123,873"
Save the file and start apf
apf -s
Note: This applies to the new FC4/Plesk 8 image only. If APF fails complaining about not being able to load "ipt_state" then you can edit the /etc/apf/firewall script and comment out the "modinit" line on or around line 42. This is a poor workaround but it seems to work at least until I can figure out why this is happening. I think there was a change in the new kernel to ipt_state in the netfilter code and I suspect has been replaced by something bigger, better, faster.
Step 3:
If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!
DEVM="0"
If you want to integrate this firewall with the Port Scan Attack Detector (PSAD) later on you need to enable logging of the firewall traffic so you will need to turn on logging in the config file. Enabling this logging is an optional step but is required for integration with PSAD.
LOG_DROP="1"
Now restart APF
apf -r
Step 4
Now let's setup APF to start at boot time so when we reboot the firewall is automatically started
# chkconfig --add apf
# chkconfig --level 345 apf on
That's it, enjoy !
Step 1:
Download the application from http://www.rfxnetworks.com/apf.php (http://www.rfxnetworks.com/apf.php)
[root@u15171818 src]#cd /usr/local/src
[root@u15171818 src]# wget http://rfxnetworks.com/downloads/apf-current.tar.gz
[root@u15171818 src]#tar -zxf apf-current.tar.gz
[root@u15171818 src]# cd apf-0.9.5-1/
[root@u15171818 apf-0.9.5-1]# ./install.sh
Installing APF 0.9.5-1: Completed.
Installation Details:
Install path: /etc/apf/
Config path: /etc/apf/conf.apf
Executable path: /usr/local/sbin/apf
AntiDos install path: /etc/apf/ad/
AntiDos config path: /etc/apf/ad/conf.antidos
DShield Client Parser: /etc/apf/extras/dshield/
Other Details:
Listening TCP ports: 21,22,25,53,80,106,110,143,443,465,880,993,995,844 3
Listening UDP ports: 53,68,32768
Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options.
[root@u15171818 apf-0.9.5-1]#
Step 2:
Now edit config file
[root@u15171818 apf-0.9.5-1]# vi /etc/apf/conf.apf
Scroll down to the "Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.
Plesk Control Panel Ports:
IG_TCP_CPORTS="20,21,22,25,53,67,68,80,110,143,443,465,993,995,84 43"
IG_UDP_CPORTS="37,53,67,68,873"
EGF="1"
EG_TCP_CPORTS="20,21,22,25,37,43,53,67,68,80,113,123,443,465,873, 5224"
EG_UDP_CPORTS="53,67,68,123,873"
Save the file and start apf
apf -s
Note: This applies to the new FC4/Plesk 8 image only. If APF fails complaining about not being able to load "ipt_state" then you can edit the /etc/apf/firewall script and comment out the "modinit" line on or around line 42. This is a poor workaround but it seems to work at least until I can figure out why this is happening. I think there was a change in the new kernel to ipt_state in the netfilter code and I suspect has been replaced by something bigger, better, faster.
Step 3:
If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!
DEVM="0"
If you want to integrate this firewall with the Port Scan Attack Detector (PSAD) later on you need to enable logging of the firewall traffic so you will need to turn on logging in the config file. Enabling this logging is an optional step but is required for integration with PSAD.
LOG_DROP="1"
Now restart APF
apf -r
Step 4
Now let's setup APF to start at boot time so when we reboot the firewall is automatically started
# chkconfig --add apf
# chkconfig --level 345 apf on
That's it, enjoy !