By Smitha Soman, Bobcares.com
bash# wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz
bash# tar -zxf apf-current.tar.gz
bash# cd apf-0.9.3_3
bash# ./install.sh
bash# vi /etc/apf/conf.apf
# Common ingress (inbound) TCP ports IG_TCP_CPORTS=" 20,21,22,25,26,53,80,110,143,443,465,993,995,2082, 2083,2086,2087,2095,2096,3306,6666" # Common ingress (inbound) UDP ports IG_UDP_CPORTS="21,53,465,873" # Common ICMP (inbound) types IG_ICMP_TYPES="3,5,11,0,30,8"
Change the line: EGF="0" to EGF="1"
# Common egress (outbound) TCP ports EG_TCP_CPORTS="21,22,25,26,37,43,53,80,110,113,443,465,873,2089,3306" # Common egress (outbound) UDP ports EG_UDP_CPORTS="20,21,53,465,873" # Common ICMP (outbound) types EG_ICMP_TYPES="all"
bash# /usr/local/sbin/apf -s
bash# vi /etc/apf/conf.apf
bash# /usr/local/sbin/apf -r
bash# chkconfig --add apf bash# chkconfig --level 2345 apf on
bash# chkconfig --del apf
Change value of USE_AD (in /etc/apf/conf.apf) to 0/1 to disable or enable [0 = Disabled / 1 = Enabled]
proto:flow:[s/d]=port:[s/d]=ip(/mask) s - source , d - destination , flow - packet flow in/out Examples: inbound to destination port 22 from 24.202.16.11 - tcp:in:d=22:s=24.202.16.11
bash #/usr/local/sbin/apf [OPTION] -s|--start ............. load firewall policies -r|--restart ........... flush & load firewall -f|--flush|--stop ...... flush firewall -l|--list .............. list chain rules -st|--status ........... firewall status -a HOST|--allow HOST ... add host (IP/FQDN) to allow_hosts.rules and immediately load new rule into firewall -d HOST|--deny HOST .... add host (IP/FQDN) to deny_hosts.rules and immediately load new rule into firewall
- Option: DEVM="1"
Definition: APF comes default in dev. mode; meaning the firewall rules
will be flushed every 5 minutes. This is intended to prevent you from
being locked out of your system in the event of undesired results from APF.
Set the DEVM="1" option to zero (0) once APF is operating as desired.
Do NOT! leave this option enabled on a permanent basis, or you defeat
the purpose of using a firewall.
- Option: FWPATH="/etc/apf"
Definition: Absolute install path to APF; should not be changed usually.
- Option: IF="eth0"
Definition: Network interface visable too the Internet/Intranet.
- Option: NET=`ifconfig $IF | grep inet | cut -d : -f 2 | cut -d \ -f 1`
Definition: IP Address that $IF holds; either define the IP in this value
or leave it as-is to autodetect.
- Option: IPTLOG="/var/log/apf_log"
Definition: Location that APF should log status information to.
- Option: DROP_LOG="1"
Definition: Control toggle to enable/disable netfilter kernel log chains.
These chains appear in the default syslog kernel log; /var/log/messages.
- Option: LRATE="60"
Definition: Limiting toggle to increase or decrease the max iptables
logging events per/minute. This should be left high but may be decreased
to preserve disk space and logging overhead.
- Option: EGF="0"
Definition: Toggle on or off the egress packet filtering; when off APF will
operate as traditional older versions did with just input filtering.
[0 = Disabled / 1 = Enabled]
- Option: USE_DS="0"
Definition: DShield.org's "block" list of top networks that have exhibited
suspicious activity. [0 = Disabled / 1 = Enabled]
Hope this article helps you install, configure and customize APF firewall for your CPanel system.
More Articles by Smitha Soman
/Web/apf_cpanel.html copyright January 2006 Smitha Soman All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar