<?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"
	>

<channel>
	<title>Network Blog &#187; Firewall</title>
	<atom:link href="http://www.webnet-ts.com/category/firewall/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webnet-ts.com</link>
	<description>Network Blog - Tech Blog</description>
	<pubDate>Sun, 04 Jul 2010 12:18:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>APF Deny ALL for SSH - Limit IP Connections</title>
		<link>http://www.webnet-ts.com/2008/09/05/apf-deny-all-for-ssh-limit-ip-connections/</link>
		<comments>http://www.webnet-ts.com/2008/09/05/apf-deny-all-for-ssh-limit-ip-connections/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:15:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Firewall]]></category>

		<category><![CDATA[APF_Firewall]]></category>

		<guid isPermaLink="false">http://webnet-ts.com/?p=37</guid>
		<description><![CDATA[APF firewall can deny ALL connections for ssh and allow only a single or select few of IPs to connect to your server. We&#8217;ll guide you through DENY ALL with APF firewall.
PROBLEM:
You want to deny all IPs to connect to shell/ssh on you server but only allow a select one or few to connect with [...]]]></description>
			<content:encoded><![CDATA[<p>APF firewall can deny ALL connections for ssh and allow only a single or select few of IPs to connect to your server. We&#8217;ll guide you through DENY ALL with APF firewall.</p>
<p>PROBLEM:<br />
You want to deny all IPs to connect to shell/ssh on you server but only allow a select one or few to connect with APF firewall.</p>
<p><img src="http://www.webnet-ts.com/images/APF.gif" alt="APF_Firewall" /></p>
<p>APF SOLUTION:<br />
1) Login to your server as the root user.</p>
<p>2) cd /etc/apf</p>
<p>3) Use vi or nano to edit the /etc/apf/allow_hosts.rules file<br />
EG: vi /etc/apf/allow_hosts.rules</p>
<p>4) Scroll down until after their last comment with the ##</p>
<p>Add the following in:</p>
<p>tcp:in:d=22:s=YOURHOMEIPHERE<br />
out:d=22:d=YOURHOMEIPHERE</p>
<p>The d=22 part is the port, so you can repeat for other services as well to limit connections if you like.</p>
<p>Save the changes.</p>
<p>5) Edit the /etc/apf/deny_hosts.rules  file<br />
EG: vi /etc/apf/deny_hosts.rules</p>
<p>Scroll down until the last default comment ## then below it add the following:</p>
<p>tcp:in:d=22:s=0/0</p>
<p>out:d=22:d=0/0<br />
6) Restart APF firewall<br />
apf -r</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.webnet-ts.com/2008/09/05/apf-deny-all-for-ssh-limit-ip-connections/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to install KISS Firewall ( Linux )</title>
		<link>http://www.webnet-ts.com/2008/08/29/how-to-install-kiss-firewall/</link>
		<comments>http://www.webnet-ts.com/2008/08/29/how-to-install-kiss-firewall/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 14:58:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Firewall]]></category>

		<category><![CDATA[Kiss+Firewall]]></category>

		<guid isPermaLink="false">http://webnet-ts.com/?p=34</guid>
		<description><![CDATA[How to install KISS Firewall
Brief Summary
KISS My Firewall is a FREE iptables script designed for a typical web server. It takes advantage of the latest firewall technologies including stateful packet inspection and connection tracking. It also contains some preventative measures for port scanning, DoS attacks, and IP spoofing, among other things.
KISS My Firewall 2 is [...]]]></description>
			<content:encoded><![CDATA[<p>How to install KISS Firewall</p>
<p>Brief Summary</p>
<p>KISS My Firewall is a FREE iptables script designed for a typical web server. It takes advantage of the latest firewall technologies including stateful packet inspection and connection tracking. It also contains some preventative measures for port scanning, DoS attacks, and IP spoofing, among other things.</p>
<p>KISS My Firewall 2 is very easy to install and does not require any initial configuration. It will work with any stock installation of Ensim WEBppliance Basic &amp; Pro, Plesk, and Webmin. Cpanel installations require some modifications.</p>
<p>What&#8217;s New in Version 2?</p>
<p>The biggest change is that it does not require any initial configuration. With version 2, you won&#8217;t automatically lock yourself out of your server unless you set some of the variables incorrectly. It also does extensive error checking and is distributed as a tar file. This solves a lot of the issues that were present with the older version. In addition, version 2 is highly configurable and was tested to work with the latest version of iptables - version 1.2.8.</p>
<p> <img src="http://www.webnet-ts.com/images/kiss-firewall.jpg" alt="kiss-firewall" /></p>
<p>HOW TO: Install KISS My Firewall</p>
<p>1) When logged in as root ( &#8220;su -&#8221; ), type:</p>
<p>2) cd /usr/bin</p>
<p>3) Download KISS firewall<br />
wget <a href="http://www.geocities.com/steve93138/kiss-2.0.1.tar.gz">http://www.geocities.com/steve93138/kiss-2.0.1.tar.gz</a></p>
<p>4) Extract it<br />
tar zxvf kiss-2.0.1.tar.gz</p>
<p>If you want to block an offenders IP address/subnet, simply edit the BLOCK_LIST variable in the /usr/bin/kiss file. You can separate IP addresses and subnet&#8217;s with a space. Once you are finished, restart the firewall.</p>
<p>5) Editing the config<br />
pico -w /usr/bin/kiss</p>
<p>You must change config from: NOTE see our Printer friendly version to avoid text wrapping!</p>
<p># Uncomment to allow DNS zone transfers<br />
#<br />
#$IPTABLES -A INPUT -i eth0 -p udp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
#$IPTABLES -A INPUT -i eth0 -p tcp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
#$IPTABLES -A OUTPUT -o eth0 -p udp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
#$IPTABLES -A OUTPUT -o eth0 -p tcp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT</p>
<p>To:</p>
<p># Uncomment to allow DNS zone transfers<br />
#<br />
$IPTABLES -A INPUT -i eth0 -p udp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
$IPTABLES -A INPUT -i eth0 -p tcp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
$IPTABLES -A OUTPUT -o eth0 -p udp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT<br />
$IPTABLES -A OUTPUT -o eth0 -p tcp &#8211;sport 53 &#8211;dport 53 -m state &#8211;state NEW -j ACCEPT</p>
<p>6) Cpanel Users Config - other users ignore this step<br />
In the /usr/bin/kiss file scroll down until you see the line: TCP_IN and replace it with this.</p>
<p>TCP_IN=&#8221;20 21 25 53 80 110 143 443 995 2082:2083 2086:2087 2095:2096 3306&#8243;</p>
<p>Now find the line that says TCP_OUT and replace it with this.</p>
<p>TCP_OUT=&#8221;21 22 25 37 43 53 80 443 873 2089&#8243;</p>
<p>7) Save the changes and restart the firewall<br />
Ctrl + X then Y</p>
<p>Restart KISS by typing:<br />
kiss restart</p>
<p>That&#8217;s it! You now have a nice IPtables firewall running that&#8217;s easy to configure and use.</p>
<p>Firewall Commands<br />
That&#8217;s it! To get it running anywhere on the command line, you simply type:<br />
kiss start</p>
<p>To stop the firewall, type:<br />
kiss stop</p>
<p>To get status information, type:<br />
kiss status</p>
<p>Restart KISS by typing:<br />
kiss restart</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webnet-ts.com/2008/08/29/how-to-install-kiss-firewall/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Firewall</title>
		<link>http://www.webnet-ts.com/2008/08/27/firewall/</link>
		<comments>http://www.webnet-ts.com/2008/08/27/firewall/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 01:13:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Firewall]]></category>

		<guid isPermaLink="false">http://webnet-ts.com/?p=15</guid>
		<description><![CDATA[Firewall
]]></description>
			<content:encoded><![CDATA[<p>Firewall</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webnet-ts.com/2008/08/27/firewall/feed/</wfw:commentRss>
		</item>
		<item>
		<title>APF (Advanced Policy Firewall) For Linux</title>
		<link>http://www.webnet-ts.com/2008/06/04/apf/</link>
		<comments>http://www.webnet-ts.com/2008/06/04/apf/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 03:01:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Firewall]]></category>

		<category><![CDATA[APF+Firewall]]></category>

		<guid isPermaLink="false">http://webnet-ts.com/?p=1</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 based [...]]]></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: <a href="http://www.rfxnetworks.com/apf.php"><span style="color: #003366;">http://www.rfxnetworks.com/apf.php</span></a></p>
<p>This guide will show you how to install and configure APF firewall, one of the better known Linux firewalls available.10</p>
<p>Limit SSH connections to one IP with APF in this advanced tutorial</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 <a href="http://www.rfxnetworks.com/downloads/apf-current.tar.gz"><span style="color: #003366;">http://www.rfxnetworks.com/downloads/apf-current.tar.gz</span></a></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’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’s “block” list of top networks that have exhibited<br />
suspicious activity.<br />
FIND: USE_DS=”0″<br />
CHANGE TO: USE_DS=”1″</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=”21,22,25,53,80,110,143,443,2082,2083, 2086,2087, 2095, 2096,3000_3500″<br />
#<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS=”53″</p>
<p>Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF=”1″</p>
<p># Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS=”21,25,80,443,43,2089″<br />
#<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS=”20,21,53″<br />
Ensim Servers<br />
We have found the following can be used on Ensim Servers - although we have not tried these ourselves as I don’t run Ensim boxes.</p>
<p>Common ingress (inbound) ports<br />
# Common ingress (inbound) TCP ports<br />
IG_TCP_CPORTS=”21,22,25,53,80,110,143,443,19638″<br />
#<br />
# Common ingress (inbound) UDP ports<br />
IG_UDP_CPORTS=”53″</p>
<p>Common egress (outbound) ports<br />
# Egress filtering [0 = Disabled / 1 = Enabled]<br />
EGF=”1″</p>
<p># Common egress (outbound) TCP ports<br />
EG_TCP_CPORTS=”21,25,80,443,43″<br />
#<br />
# Common egress (outbound) UDP ports<br />
EG_UDP_CPORTS=”20,21,53″</p>
<p>Save the changes: Ctrl+X then Y<br />
8. Starting the firewall<br />
/usr/local/sbin/apf -s</p>
<p>Other commands:<br />
usage ./apf [OPTION]<br />
-s|–start ……………………. load firewall policies<br />
-r|–restart ………………….. flush &amp; load firewall<br />
-f|–flush|–stop ……………… flush firewall<br />
-l|–list …………………….. list chain rules<br />
-st|–status ………………….. firewall status<br />
-a HOST CMT|–allow HOST COMMENT … add host (IP/FQDN) to allow_hosts.rules and<br />
                                     immediately load new rule into firewall<br />
-d HOST CMT|–deny HOST COMMENT …. add host (IP/FQDN) to deny_hosts.rules and<br />
                                     immediately load new rule into firewall<br />
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 “0″ after you’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=”1″<br />
CHANGE TO: DEVM=”0″<br />
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’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=”Your Company”<br />
Enter your company information name or server name..</p>
<p># Send out user defined attack alerts [0=off,1=on]<br />
USR_ALERT=”0″<br />
Change this to 1 to get email alerts</p>
<p> # User for alerts to be mailed to<br />
USR=”<a href="mailto:your@email.com"><span style="color: #003366;">your@email.com</span></a>”<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<br />
12. New - Make APF Start automatically at boot time<br />
To autostart apf on reboot, run this:</p>
<p>chkconfig –level 2345 apf on</p>
<p>To remove it from autostart, run this:</p>
<p>chkconfig –del apf<br />
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’ll show you 2 of the easier methods.</p>
<p>A) /etc/apf/apf -d IPHERE COMMENTHERENOSPACES<br />
&gt; The -d flag means DENY the IP address<br />
&gt; IPHERE is the IP address you wish to block<br />
&gt; COMMENTSHERENOSPACES is obvious, add comments to why the IP is being blocked<br />
These rules are loaded right away into the firewall, so they’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’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’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 />
&gt; The -a flag means ALLOW the IP address<br />
&gt; IPHERE is the IP address you wish to allow<br />
&gt; COMMENTSHERENOSPACES is obvious, add comments to why the IP is being removed These rules are loaded right away into the firewall, so they’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>
<p>Article provided : WebHostGear.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webnet-ts.com/2008/06/04/apf/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
