<?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>SavvyAdmin.com &#187; Firewalls</title>
	<atom:link href="http://savvyadmin.com/tag/firewalls/feed/" rel="self" type="application/rss+xml" />
	<link>http://savvyadmin.com</link>
	<description>For savvy admins everywhere...</description>
	<lastBuildDate>Thu, 05 Aug 2010 03:30:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>fwknop: Single Packet Authorization in Ubuntu</title>
		<link>http://savvyadmin.com/fwknop-single-packet-authorization-in-ubuntu/</link>
		<comments>http://savvyadmin.com/fwknop-single-packet-authorization-in-ubuntu/#comments</comments>
		<pubDate>Sun, 24 Jun 2007 08:21:04 +0000</pubDate>
		<dc:creator>gmendoza</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Firewalls]]></category>
		<category><![CDATA[Fwknop]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.savvyadmin.com/2007/06/24/fwknop-single-packet-authorization-in-ubuntu/</guid>
		<description><![CDATA[Updated (11/21/2007): I&#8217;ve added an updated version of this How-to on the community supported Ubuntu documentation site. The new document can be found at: https://help.ubuntu.com/community/SinglePacketAuthorization. Single Packet Authorization (SPA) using &#8220;fwknop&#8221; is probably one of the coolest recent innovations in server and network access control technology. Just what is SPA, you ask? SPA is a [...]


Related posts:<ol><li><a href='http://savvyadmin.com/ubuntus-ufw/' rel='bookmark' title='Permanent Link: Ubuntu&#8217;s Uncomplicated Firewall (UFW)'>Ubuntu&#8217;s Uncomplicated Firewall (UFW)</a></li>
<li><a href='http://savvyadmin.com/denyhosts-automated-ssh-brute-force-response-system/' rel='bookmark' title='Permanent Link: DenyHosts: Automated SSH Brute Force Response System'>DenyHosts: Automated SSH Brute Force Response System</a></li>
<li><a href='http://savvyadmin.com/vlan-hopping-on-cisco-voice-enabled-switch-ports/' rel='bookmark' title='Permanent Link: VLAN Hopping on Cisco Voice-enabled Switch Ports'>VLAN Hopping on Cisco Voice-enabled Switch Ports</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>Updated (11/21/2007): </strong>I&#8217;ve added an updated version of this How-to on the community supported Ubuntu documentation site.  The new document can be found at: <a href="https://help.ubuntu.com/community/SinglePacketAuthorization" target="_blank">https://help.ubuntu.com/community/SinglePacketAuthorization</a>.</p>
<p>Single Packet Authorization (SPA) using &#8220;<a title="fwknop by CipherDyne" href="http://www.cipherdyne.org/fwknop/" target="_blank">fwknop</a>&#8221; is probably one of the coolest recent innovations in server and network access control technology.  Just what is SPA, you ask?   SPA is a method of  limiting access to server and network resources by cryptographically authenticating users before any type TCP/IP stack access is allowed.</p>
<p>In it&#8217;s simplest form, your Linux server can have an inbound firewall rule that by default drops all access to any of it&#8217;s listening services.  Nmap scans will completely fail to detect any open ports, and zero-day attacks will not have any effect on vulnerable services since the firewall is blocking access to the applications.</p>
<p>The server however has a nifty trick up it&#8217;s sleeve.  An authorized user sends a single encrypted UDP packet that is passively sniffed and analyzed by the <a title="fwknopd MAN page" href="http://www.cipherdyne.org/fwknop/docs/manpages/fwknopd.html" target="_blank">fwknopd</a> service running on the server using pcap.  If successfully authenticated, fwknopd dynamically creates an iptables firewall rule, granting the source IP address of the authorized client access to the service for a defined period of time (default is 30 seconds).  Pretty frickin&#8217; cool, eh?</p>
<p>Okay, so here&#8217;s how to get it working in Ubuntu 7.04.  <span id="more-25"></span></p>
<p>In this example, the service we will be protecting is SSH.  I will be using a simple firewall rule that blocks all inbound connections, but has an unrestricted outbound policy.  The client will authenticate using a GNUPG key pair.</p>
<p>1. We start by setting up the firewall. I&#8217;ve provided a firewall script below that should work for most configurations.  Tailor this to your needs.  Do NOT use this script unless you know for sure you want all traffic blocked.</p>
<blockquote><p><code>$ wget <a title="An example firewall" href="http://www.savvyadmin.com/downloads/firewall" target="_blank">http://www.savvyadmin.com/downloads/firewall</a><br />
$ sudo cp firewall /etc/init.d/firewall<br />
$ sudo chmod 755 /etc/init.d/firewall<br />
</code><code> $ sudo update-rc.d firewall defaults 10</code><br />
<code>$ sudo /etc/init.d/firewall start</code></p></blockquote>
<p>2. Install fwknop prerequisites.</p>
<blockquote><p><code>$ sudo apt-get install build-essential libpcap-dev mailx -y</code></p></blockquote>
<p>3. Download latest version of fwknop from the official website, and install.</p>
<p>Site: <a href="http://www.cipherdyne.org/fwknop/download/" target="_blank">http://www.cipherdyne.org/fwknop/download/</a></p>
<blockquote><p><code>$ wget http://www.cipherdyne.org/fwknop/download/fwknop-1.8.1.tar.gz<br />
$ tar zxvf fwknop-1.8.1.tar.gz<br />
$ cd fwknop-1.8.1<br />
$ sudo ./install.pl</code></p>
<p>(The installer will ask you a couple of questions.  You will need to provide the interface you wish the service to monitor, and specify that the installation should run as a server).</p>
<p><code>$ sudo update-rc.d fwknop defaults 20 </code></p></blockquote>
<p>4. You (the client) and the server should use individualized PGP key pairs for this to work as securely as possible.  The client will use it&#8217;s own private key to digitally sign the SPA packet payload, and  then use the servers public key to encrypt it as well.  The server will use the clients public key and digital signature to verify that the SPA packet originated from a trusted source.  This means that both the server and the client will need a <em>signed</em> copy of each others public keys in their keyring.</p>
<p>The instructions on how to generate these key pairs are located at:</p>
<p><a title="fwknop with Gnupg guide" href="http://www.cipherdyne.org/fwknop/docs/gpghowto.html" target="_blank">http://www.cipherdyne.org/fwknop/docs/gpghowto.html </a></p>
<p>Once you have followed the sites instructions, you&#8217;re almost ready to have SPA working.  I know it&#8217;s a lot to take in if you are not familiar with the concepts behind the PGP cryptosystem, so make sure to <a title="PGP on Wikipedia" href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy" target="_blank">read up on it</a> if you&#8217;re feeling a bit lost.  Gnupg&#8217;s manual is located <a title="Gnupg User Manual" href="http://www.gnupg.org/(en)/documentation/guides.html" target="_blank">here</a>.</p>
<p>5.  As also mentioned in the above referenced article, you will need to edit the fwknop configuration file &#8220;/etc/fwknop/access.conf&#8221;.   An example of this configuration is shown below.</p>
<blockquote><p><code>SOURCE: ANY;<br />
OPEN_PORTS: tcp/22;<br />
DATA_COLLECT_MODE: PCAP;<br />
GPG_HOME_DIR: /root/.gnupg;<br />
GPG_DECRYPT_ID: SERVER_KEY_ID;<br />
GPG_DECRYPT_PW: PASSWORD_HERE;<br />
GPG_REMOTE_ID: CLIENT_KEY_ID;<br />
FW_ACCESS_TIMEOUT: 30;</code></p></blockquote>
<p>6. Start the fwknopd service:</p>
<blockquote><p><code>$ sudo /etc/init.d/fwknop start</code></p></blockquote>
<p>7. You should now be ready to test things out using another computer with the fwknop client.  You install everything exactly the same as the server, with the exception of specifying that the installer should run fwknop as a client.</p>
<p>The typical authorization process from client to server can be completed as follows.</p>
<blockquote><p><code>$ fwknop -A tcp/22 --gpg-recip SERVER_KEY --gpg-sign CLIENT_KEY -w -k SERVER_IP</code></p></blockquote>
<p>The &#8220;-w&#8221; flag queries www.whatismyip.com for the clients real ip address and uses that as the source address.  This is useful when you are behind a NAT firewall, since the source address specified on the SPA packet would otherwise be a local address.</p>
<p>If you are on the same network as the server, or simply do not have to worry about NAT, the syntax would be as follows:</p>
<blockquote><p><code>$ fwknop -A tcp/22 --gpg-recip SERVER_KEY --gpg-sign CLIENT_KEY -a CLIENT_IP -k SERVER_IP</code></p></blockquote>
<p>If successful, your server adds the appropriate access list entry for you to connect using your ssh client.  You will have 30 seconds to make the connection, after which the access list is dynamically removed.</p>
<blockquote><p><code>$ ssh username@SERVER_IP</code></p></blockquote>
<p>It is important to note that the SPA packet is sent to the servers IP address using the destination port of UDP/62201.  You must ensure that this port number is allowed outbound from the network you are connecting from, and that no router or firewall is blocking it from reaching your server.</p>
<p>It should also be noted that the time stamp embedded in the SPA packet must fall within 120 seconds of the servers clock.  You should make sure that both the server and client are using NTP to keep their clocks as close as possible.</p>
<p>Check out your syslogs and iptables output for useful information while testing.</p>
<blockquote><p><code>$ watch -n1 sudo iptables -L -n<br />
$ tail -f /var/log/syslog</code></p></blockquote>
<p>Hope this provides you with some very useful information to get you started with SPA.</p>

<div class="sociable">
<div class="sociable_tagline">
<strong>Share and Enjoy:</strong>
</div>
<ul>
	<li class="sociablefirst"><a rel="nofollow"  href="http://www.printfriendly.com/print?url=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;partner=sociable" title="Print"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;t=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu" title="Facebook"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://twitter.com/home?status=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu%20-%20http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F" title="Twitter"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;title=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu&amp;notes=Updated%20%2811%2F21%2F2007%29%3A%20I%27ve%20added%20an%20updated%20version%20of%20this%20How-to%20on%20the%20community%20supported%20Ubuntu%20documentation%20site.%20%20The%20new%20document%20can%20be%20found%20at%3A%20https%3A%2F%2Fhelp.ubuntu.com%2Fcommunity%2FSinglePacketAuthorization.%0D%0A%0D%0ASingle%20Packet%20Authorization%20%28S" title="del.icio.us"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://savvyadmin.com/feed/" title="RSS"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/rss.png" title="RSS" alt="RSS" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;title=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu&amp;bodytext=Updated%20%2811%2F21%2F2007%29%3A%20I%27ve%20added%20an%20updated%20version%20of%20this%20How-to%20on%20the%20community%20supported%20Ubuntu%20documentation%20site.%20%20The%20new%20document%20can%20be%20found%20at%3A%20https%3A%2F%2Fhelp.ubuntu.com%2Fcommunity%2FSinglePacketAuthorization.%0D%0A%0D%0ASingle%20Packet%20Authorization%20%28S" title="Digg"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="mailto:?subject=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu&amp;body=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F" title="email"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;title=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu&amp;source=SavvyAdmin.com+For+savvy+admins+everywhere...&amp;summary=Updated%20%2811%2F21%2F2007%29%3A%20I%27ve%20added%20an%20updated%20version%20of%20this%20How-to%20on%20the%20community%20supported%20Ubuntu%20documentation%20site.%20%20The%20new%20document%20can%20be%20found%20at%3A%20https%3A%2F%2Fhelp.ubuntu.com%2Fcommunity%2FSinglePacketAuthorization.%0D%0A%0D%0ASingle%20Packet%20Authorization%20%28S" title="LinkedIn"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://identi.ca/notice/new?status_textarea=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F" title="Identi.ca"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/identica.png" title="Identi.ca" alt="Identi.ca" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;title=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu&amp;annotation=Updated%20%2811%2F21%2F2007%29%3A%20I%27ve%20added%20an%20updated%20version%20of%20this%20How-to%20on%20the%20community%20supported%20Ubuntu%20documentation%20site.%20%20The%20new%20document%20can%20be%20found%20at%3A%20https%3A%2F%2Fhelp.ubuntu.com%2Fcommunity%2FSinglePacketAuthorization.%0D%0A%0D%0ASingle%20Packet%20Authorization%20%28S" title="Google Bookmarks"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a></li>
	<li class="sociablelast"><a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fsavvyadmin.com%2Ffwknop-single-packet-authorization-in-ubuntu%2F&amp;title=fwknop%3A%20Single%20Packet%20Authorization%20in%20Ubuntu" title="StumbleUpon"><img src="http://savvyadmin.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
</ul>
</div>


<p>Related posts:<ol><li><a href='http://savvyadmin.com/ubuntus-ufw/' rel='bookmark' title='Permanent Link: Ubuntu&#8217;s Uncomplicated Firewall (UFW)'>Ubuntu&#8217;s Uncomplicated Firewall (UFW)</a></li>
<li><a href='http://savvyadmin.com/denyhosts-automated-ssh-brute-force-response-system/' rel='bookmark' title='Permanent Link: DenyHosts: Automated SSH Brute Force Response System'>DenyHosts: Automated SSH Brute Force Response System</a></li>
<li><a href='http://savvyadmin.com/vlan-hopping-on-cisco-voice-enabled-switch-ports/' rel='bookmark' title='Permanent Link: VLAN Hopping on Cisco Voice-enabled Switch Ports'>VLAN Hopping on Cisco Voice-enabled Switch Ports</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://savvyadmin.com/fwknop-single-packet-authorization-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
