ThaiFight Posted December 24, 2015 Report Posted December 24, 2015 (edited) IntroductionAdvanced Policy Firewall or APF is iptable based firewall system which is a free distribution, this firewall is designed to meet today’s security based essential needs.The firewall is designed to be very informative and present the user with an easy to use follow process.Features HighlightThe filters perfromed by APF can be catagourised in three partsstatic rule based policy.It define how firewall should handle certain traffic in specific conditions while giving access to certain port or adding some ip address as trusted one.Connection based stateful policyFirewall will identify valid/legitimated packets from the different types of connections and will allow only valid connections which are allowed in firewall rules and other will be rejected.Sanity based policyCan identify network attacks by screening or scrutinizing packets, it will discard and log any data which is considered as inappropriate.InstallationIt is recommended to have at least 2 LAN cards, 4 GB RAM, dual core processor and 1 GB free disk space to dedicate your system as APF firewall.Update Ubuntu 15.10# apt-get updateDownload package :# wget http://www.rfxn.com/downloads/apf-current.tar.gzExtract package :# tar -xvf apf-current.tar.gzExtract and install package : # cd apf-9.7-2/# ./install.shSample output :Installing APF 9.7-2: Completed.Installation Details: Install path: /etc/apf/ Config path: /etc/apf/conf.apf Executable path: /usr/local/sbin/apfOther Details: Listening TCP ports: 53,631 Listening UDP ports: 53,68,631,5353,23566,47956 Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options.Now have a look in /etc/apf/conf.apf# The installation path of APF; this can be changed but it is not recommended.INSTALL_PATH="/etc/apf"# Untrusted Network interface(s); all traffic on defined interface will be# subject to all firewall rules. This should be your internet exposed# interfaces. Only one interface is accepted for each value.IFACE_IN="eth0"IFACE_OUT="eth0"# Trusted Network interface(s); all traffic on defined interface(s) will by-pass# ALL firewall rules, format is white space or comma separated list.IFACE_TRUSTED="eth0"# This option will allow for all status events to be displayed in real time on# the console as you use the firewall. Typically, APF used to operate silent# with all logging piped to $LOG_APF. The use of this option will not disable# the standard log file displayed by apf --status but rather compliment it.SET_VERBOSE="1"Let us explain some of the important parameters which are important in this configuration fileIFACE_IN=”eth0? IFACE_OUT=”eth0?Interface in and interface out define which interface you will be using for firewall as inbound and outboundDEVEL_MODE=”1?Keep Developer mode as 1IG_TCP_CPORTSDefine allowed TCP portsIG_UDP_CPORTSDefine allowed UDP portsCommand ExamplesTo start firewall :# apf -sTo stop firewall# apf -fOutput :apf(7480): {glob} flushing & zeroing chain policiesapf(7480): {glob} firewall offlineTo restart firewall : # apf -rTo dump current status of firewall on terminal :# apf -stTo deny some host :# apf -a 192.168.1.1It will add IP ADDR to trusted address and entries goes to /etc/apf/allow_hosts.rules# apf -d 192.168.1.1Above command will add IP ADDR to deny, entries goes to /etc/apf/deny_hosts.rules# apf -u 192.168.1.1Remove entries either from trsuted or from deny hosts rulesNow your firewall is ready to work in an easy to use and deploy manner.Source How to configure APF Firewall with ubuntu 15.10 | Unixmen Edited December 24, 2015 by ThaiFight Quote