<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EZPZ Hosting Blog &#187; Installation Guides</title>
	<atom:link href="http://www.ezpzhosting.co.uk/blog/category/installation-guides/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ezpzhosting.co.uk/blog</link>
	<description></description>
	<lastBuildDate>Thu, 01 Dec 2011 16:07:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Guide: Installing BFD (Brute Force Detection)</title>
		<link>http://www.ezpzhosting.co.uk/blog/2009/04/05/guide-installing-bfd-brute-force-detection/</link>
		<comments>http://www.ezpzhosting.co.uk/blog/2009/04/05/guide-installing-bfd-brute-force-detection/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 16:23:12 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Installation Guides]]></category>

		<guid isPermaLink="false">http://www.ezpzhosting.co.uk/blog/?p=39</guid>
		<description><![CDATA[BFD is a shell script which parses security logs and detects authentication failures. It is a brute force implementation without much complexity, and it works in conjunction with a APF (Advanced Policy-based Firewall). ## Get the latest source and untar. # cd /usr/src/utils # wget http://rfxnetworks.com/downloads/bfd-current.tar.gz # tar xfz bfd-current.tar.gz # cd bfd-* # ./install.sh [...]]]></description>
			<content:encoded><![CDATA[<p>BFD is a shell script which parses security logs and detects authentication failures. It is a brute force implementation without much complexity, and it works in conjunction with a APF (Advanced Policy-based Firewall).</p>
<p>## Get the latest source and untar.<br />
# cd /usr/src/utils<br />
# wget http://rfxnetworks.com/downloads/bfd-current.tar.gz<br />
# tar xfz bfd-current.tar.gz<br />
# cd bfd-*<br />
# ./install.sh</p>
<p>Read the README file, and edit the configuration file located in /usr/local/bfd/conf.bfd.<br />
Find ALERT=&#8221;0&#8243; and replace it with ALERT=&#8221;1&#8243;<br />
Find EMAIL_USR=&#8221;root&#8221; and replace it with EMAIL_USR=&#8221;username@yourdomain.com&#8221;</p>
<p>Edit /usr/local/bfd/ignore.hosts file, and add your own trusted IPs. BFD uses APF and hence it orverrides allow_hosts.rules, so it is important that you add trusted IP addresses to prevent yourself from being locked out.</p>
<p>## Start the program.<br />
#  /usr/local/sbin/bfd -s</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ezpzhosting.co.uk/blog/2009/04/05/guide-installing-bfd-brute-force-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guide: How to install APF Firewall</title>
		<link>http://www.ezpzhosting.co.uk/blog/2009/03/29/how-to-install-apf-firewall/</link>
		<comments>http://www.ezpzhosting.co.uk/blog/2009/03/29/how-to-install-apf-firewall/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 15:19:56 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Installation Guides]]></category>

		<guid isPermaLink="false">http://www.ezpzhosting.co.uk/blog/2009/03/29/how-to-install-apf-firewall/</guid>
		<description><![CDATA[What is APF (Advanced Policy Firewall)? APF Firewall APF is a policy based iptables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteran Linux user and the novice alike. Packaged in tar.gz format and RPM formats, make APF ideal for deployment in many server environments [...]]]></description>
			<content:encoded><![CDATA[<p>What is APF (Advanced Policy Firewall)? APF Firewall<br />
APF is a policy based iptables firewall system designed for ease of use and configuration. It employs a subset of features to satisfy the veteran Linux user and the novice alike. Packaged in tar.gz format and RPM formats, make APF ideal for deployment in many server environments based on Linux. APF is developed and maintained by R-fx Networks: http://www.rfxnetworks.com/apf.php</p>
<p>This guide will show you how to install and configure APF firewall, one of the better known Linux firewalls available.</p>
<p><span id="more-35"></span></p>
<p>Requirements:<br />
- Root SSH access to your server</p>
<p>Lets begin!<br />
Login to your server through SSH and su to the root user.</p>
<p>1. cd /root/downloads or another temporary folder where you store your files.</p>
<p>2. wget http://www.rfxnetworks.com/downloads/apf-current.tar.gz</p>
<p>3. tar -xvzf apf-current.tar.gz</p>
<p>4. cd apf-0.9.5-1/ or whatever the latest version is.</p>
<p>5. Run the install file: ./install.sh<br />
You will receive a message saying it has been installed</p>
<p>Installing APF 0.9.5-1: Completed.</p>
<p>Installation Details:<br />
  Install path:         /etc/apf/<br />
  Config path:          /etc/apf/conf.apf<br />
  Executable path:      /usr/local/sbin/apf<br />
  AntiDos install path: /etc/apf/ad/<br />
  AntiDos config path:  /etc/apf/ad/conf.antidos<br />
  DShield Client Parser:  /etc/apf/extras/dshield/</p>
<p>Other Details:<br />
  Listening TCP ports: 1,21,22,25,53,80,110,111,143,443,465,993,995,2082,2083,2086,2087,2095,2096,3306<br />
  Listening UDP ports: 53,55880<br />
  Note: These ports are not auto-configured; they are simply presented for information purposes. You must manually configure all port options.</p>
<p>6. Lets configure the firewall: pico /etc/apf/conf.apf<br />
We will go over the general configuration to get your firewall running. This isn&#8217;t a complete detailed guide of every feature the firewall has. Look through the README and the configuration for an explanation of each feature.</p>
<p>We like to use DShield.org&#8217;s &#8220;block&#8221; list of top networks that have exhibited<br />
suspicious activity.<br />
FIND: USE_DS=&#8221;0&#8243;<br />
CHANGE TO: USE_DS=&#8221;1&#8243;</p>
<p>7. Configuring Firewall Ports:</p>
<p>Cpanel Servers<br />
We like to use the following on our Cpanel Servers</p>
<p>Common ingress (inbound) ports<br />
# Common ingress (inbound) TCP ports -3000_3500 = passive port range for Pure FTPD<br />
IG_TCP_CPORTS=&#8221;21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,3000_3500&#8243;<br />
#<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS=&#8221;53&#8243;</p>
<p>Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF=&#8221;1&#8243;</p>
<p># Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS=&#8221;21,25,80,443,43,2089&#8243;<br />
#<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS=&#8221;20,21,53&#8243;</p>
<p>Ensim Servers<br />
We have found the following can be used on Ensim Servers &#8211; although we have not tried these ourselves as I don&#8217;t run Ensim boxes.</p>
<p>Common ingress (inbound) ports<br />
# Common ingress (inbound) TCP ports<br />
IG_TCP_CPORTS=&#8221;21,22,25,53,80,110,143,443,19638&#8243;<br />
#<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS=&#8221;53&#8243;</p>
<p>Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF=&#8221;1&#8243;</p>
<p># Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS=&#8221;21,25,80,443,43&#8243;<br />
#<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS=&#8221;20,21,53&#8243;</p>
<p>Save the changes: Ctrl+X then Y</p>
<p>8. Starting the firewall<br />
/usr/local/sbin/apf -s</p>
<p>Other commands:<br />
usage ./apf [OPTION]<br />
-s|&#8211;start &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. load firewall policies<br />
-r|&#8211;restart &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.. flush &#038; load firewall<br />
-f|&#8211;flush|&#8211;stop &#8230;&#8230;&#8230;&#8230;&#8230;&#8230; flush firewall<br />
-l|&#8211;list &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.. list chain rules<br />
-st|&#8211;status &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.. firewall status<br />
-a HOST CMT|&#8211;allow HOST COMMENT &#8230; add host (IP/FQDN) to allow_hosts.rules and<br />
                                     immediately load new rule into firewall<br />
-d HOST CMT|&#8211;deny HOST COMMENT &#8230;. add host (IP/FQDN) to deny_hosts.rules and<br />
                                     immediately load new rule into firewall</p>
<p>9. After everything is fine, change the DEV option<br />
Stop the firewall from automatically clearing itself every 5 minutes from cron.<br />
We recommend changing this back to &#8220;0&#8243; after you&#8217;ve had a chance to ensure everything is working well and tested the server out.</p>
<p>pico /etc/apf/conf.apf</p>
<p>FIND: DEVM=&#8221;1&#8243;<br />
CHANGE TO: DEVM=&#8221;0&#8243;</p>
<p>10. Configure AntiDOS for APF<br />
Relatively new to APF is the new AntiDOS feature which can be found in: /etc/apf/ad<br />
The log file will be located at /var/log/apfados_log so you might want to make note of it and watch it!</p>
<p>pico /etc/apf/ad/conf.antidos</p>
<p>There are various things you might want to fiddle with but I&#8217;ll get the ones that will alert you by email.</p>
<p># [E-Mail Alerts]<br />
Under this heading we have the following:</p>
<p># Organization name to display on outgoing alert emails<br />
CONAME=&#8221;Your Company&#8221;<br />
Enter your company information name or server name..</p>
<p># Send out user defined attack alerts [0=off,1=on]<br />
USR_ALERT=&#8221;0&#8243;<br />
Change this to 1 to get email alerts</p>
<p> # User for alerts to be mailed to<br />
USR=&#8221;your@email.com&#8221;<br />
Enter your email address to receive the alerts</p>
<p>Save your changes! Ctrl+X then press Y<br />
Restart the firewall: /usr/local/sbin/apf -r</p>
<p>11. Checking the APF Log</p>
<p>Will show any changes to allow and deny hosts among other things.<br />
tail -f /var/log/apf_log</p>
<p>Example output:<br />
Aug 23 01:25:55 ocean apf(31448): (insert) deny all to/from 185.14.157.123<br />
Aug 23 01:39:43 ocean apf(32172): (insert) allow all to/from 185.14.157.123</p>
<p>12. New &#8211; Make APF Start automatically at boot time<br />
To autostart apf on reboot, run this:</p>
<p>chkconfig &#8211;level 2345 apf on</p>
<p>To remove it from autostart, run this:</p>
<p>chkconfig &#8211;del apf</p>
<p>13. Denying IPs with APF Firewall (Blocking)<br />
Now that you have your shiny new firewall you probably want to block a host right, of course you do! With this new version APF now supports comments as well. There are a few ways you can block an IP, I&#8217;ll show you 2 of the easier methods.</p>
<p>A) /etc/apf/apf -d IPHERE COMMENTHERENOSPACES<br />
> The -d flag means DENY the IP address<br />
> IPHERE is the IP address you wish to block<br />
> COMMENTSHERENOSPACES is obvious, add comments to why the IP is being blocked<br />
These rules are loaded right away into the firewall, so they&#8217;re instantly active.<br />
Example:</p>
<p>./apf -d 185.14.157.123 TESTING</p>
<p>pico /etc/apf/deny_hosts.rules</p>
<p>Shows the following:</p>
<p># added 185.14.157.123 on 08/23/05 01:25:55<br />
# TESTING<br />
185.14.157.123</p>
<p>B) pico /etc/apf/deny_hosts.rules</p>
<p>You can then just add a new line and enter the IP you wish to block. Before this becomes active though you&#8217;ll need to reload the APF ruleset.</p>
<p>/etc/apf/apf -r</p>
<p>14. Allowing IPs with APF Firewall (Unblocking)</p>
<p>I know I know, you added an IP now you need it removed right away! You need to manually remove IPs that are blocked from deny_hosts.rules.<br />
A)<br />
pico /etc/apf/deny_hosts.rules</p>
<p>Find where the IP is listed and remove the line that has the IP.<br />
After this is done save the file and reload apf to make the new changes active.</p>
<p>/etc/apf/apf -r</p>
<p>B) If the IP isn&#8217;t already listed in deny_hosts.rules and you wish to allow it, this method adds the entry to allow_hosts.rules</p>
<p> /etc/apf/apf -a IPHERE COMMENTHERENOSPACES<br />
> The -a flag means ALLOW the IP address<br />
> IPHERE is the IP address you wish to allow<br />
> COMMENTSHERENOSPACES is obvious, add comments to why the IP is being removed These rules are loaded right away into the firewall, so they&#8217;re instantly active.<br />
Example:</p>
<p>./apf -a 185.14.157.123 UNBLOCKING</p>
<p>pico /etc/apf/allow_hosts.rules</p>
<p># added 185.14.157.123 on 08/23/05 01:39:43<br />
# UNBLOCKING<br />
185.14.157.123</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ezpzhosting.co.uk/blog/2009/03/29/how-to-install-apf-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

