<?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>Racker Hacker &#187; networking</title>
	<atom:link href="http://rackerhacker.com/tag/networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Wed, 16 May 2012 12:55:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Performance and redundancy boost for icanhazip.com</title>
		<link>http://rackerhacker.com/2012/04/18/performance-and-redundancy-boost-for-icanhazip-com/</link>
		<comments>http://rackerhacker.com/2012/04/18/performance-and-redundancy-boost-for-icanhazip-com/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 23:30:06 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=3310</guid>
		<description><![CDATA[It's been a few years since I started a little project to operate a service to return your IPv4 and IPv6 address. Although there are a bunch of other sites that offer this service as well, I've been amazed by the gradually increasing traffic to icanhazip.com. Here's a sample of the latest statistics: Hits per [...]<p><a href="http://rackerhacker.com/2012/04/18/performance-and-redundancy-boost-for-icanhazip-com/">Performance and redundancy boost for icanhazip.com</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>It's been a few years since I started <a href="/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/">a little project</a> to operate a service to return your IPv4 and IPv6 address.  Although there are a bunch of other sites that offer this service as well, I've been amazed by the gradually increasing traffic to <a href="http://icanhazip.com/">icanhazip.com</a>.</p>
<p>Here's a sample of the latest statistics:</p>
<ul>
<li>Hits per day: <strong>1.8 million</strong> (about 21 hits/second)</li>
<li>Unique IP addresses per day: <strong>25,555</strong></li>
<li>Hits per day from IPv6 addresses: <strong>1,069</strong> (a little sad)</li>
<li>Bandwidth used per day: <strong>~ 400MB</strong></li>
</ul>
<p>The site is now running on multiple <a href="http://www.rackspace.com/cloud/cloud_hosting_products/servers/">Cloud Servers</a> at <a href="http://www.rackspace.com/cloud/">Rackspace</a> behind a <a href="http://www.rackspace.com/cloud/cloud_hosting_products/loadbalancers/">load balancer cluster</a>.  In addition, the DNS records are hosted with Rackspace's <a href="http://www.rackspace.com/cloud/cloud_hosting_products/dns/">Cloud DNS</a> service.</p>
<p>This should allow the site to reply more quickly and reliably.  If you have suggestions for other improvements, let me know!</p>
<p><a href="http://rackerhacker.com/2012/04/18/performance-and-redundancy-boost-for-icanhazip-com/">Performance and redundancy boost for icanhazip.com</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2012/04/18/performance-and-redundancy-boost-for-icanhazip-com/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Using OpenSSL&#039;s s_client command with web servers using Server Name Indication (SNI)</title>
		<link>http://rackerhacker.com/2012/02/07/using-openssls-s_client-command-with-web-servers-using-server-name-indication-sni/</link>
		<comments>http://rackerhacker.com/2012/02/07/using-openssls-s_client-command-with-web-servers-using-server-name-indication-sni/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 14:07:41 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2998</guid>
		<description><![CDATA[One of the handiest tools in the OpenSSL toolbox is s_client. You can quickly view lots of details about the SSL certificates installed on a particular server and diagnose problems. For example, use this command to look at Google's SSL certificates: openssl s_client -connect encrypted.google.com:443 You'll see the chain of certificates back to the original [...]<p><a href="http://rackerhacker.com/2012/02/07/using-openssls-s_client-command-with-web-servers-using-server-name-indication-sni/">Using OpenSSL's s_client command with web servers using Server Name Indication (SNI)</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>One of the handiest tools in the OpenSSL toolbox is <code>s_client</code>.  You can quickly view lots of details about the SSL certificates installed on a particular server and diagnose problems.  For example, use this command to look at Google's SSL certificates:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">openssl s_client -connect encrypted.google.com:443</pre></div></div>

<p>You'll see the chain of certificates back to the original certificate authority where Google bought its certificate at the top, a copy of their SSL certificate in plain text in the middle, and a bunch of session-related information at the bottom.</p>
<p>This works really well when a site has one SSL certificate installed per IP address (this used to be a hard requirement).  With <a href="http://en.wikipedia.org/wiki/Server_Name_Indication">Server Name Indication</a> (SNI), a web server can have multiple SSL certificates installed on the same IP address.  SNI-capable browsers will specify the hostname of the server they're trying to reach during the initial handshake process.  This allows the web server to determine the correct SSL certificate to use for the connection.</p>
<p>If you try to connect to rackerhacker.com with <code>s_client</code>, you'll find that you receive the default SSL certificate installed on my server and not the one for this site:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ openssl s_client -connect rackerhacker.com:443
Certificate chain
 0 s:/C=US/ST=Texas/L=San Antonio/O=MHTX Enterprises/CN=*.mhtx.net
   i:/C=US/O=SecureTrust Corporation/CN=SecureTrust CA
 1 s:/C=US/O=SecureTrust Corporation/CN=SecureTrust CA
   i:/C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority</pre></div></div>

<p>Add on the <code>-servername</code> argument and <code>s_client</code> will do the additional SNI negotiation step for you:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ openssl s_client -connect rackerhacker.com:443 -servername rackerhacker.com
Certificate chain
 0 s:/OU=Domain Control Validated/OU=PositiveSSL/CN=rackerhacker.com
   i:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA
 1 s:/C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA
   i:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
 2 s:/C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
 3 s:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
   i:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root</pre></div></div>

<p>You may be asking yourself this question:</p>
<blockquote><p>Why doesn't the web server just use the <code>Host:</code> header that my browser sends already to figure out which SSL certificate to use?</p></blockquote>
<p>Keep in mind that the SSL negotiation must occur <b>prior</b> to sending the HTTP request through to the remote server.  That means that the browser and the server have to do the certificate exchange earlier in the process and the browser wouldn't get the opportunity to specify which site it's trying to reach.  SNI fixes that by allowing a <code>Host:</code> header type of exchange during the SSL negotiation process.</p>
<p><a href="http://rackerhacker.com/2012/02/07/using-openssls-s_client-command-with-web-servers-using-server-name-indication-sni/">Using OpenSSL's s_client command with web servers using Server Name Indication (SNI)</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2012/02/07/using-openssls-s_client-command-with-web-servers-using-server-name-indication-sni/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Kerberos-hater&#039;s guide to installing Kerberos</title>
		<link>http://rackerhacker.com/2012/02/05/the-kerberos-haters-guide-to-installing-kerberos/</link>
		<comments>http://rackerhacker.com/2012/02/05/the-kerberos-haters-guide-to-installing-kerberos/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 21:03:52 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[nis]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhca]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2949</guid>
		<description><![CDATA[As promised in my earlier post entitled Kerberos for haters, I've assembled the simplest possible guide to get Kerberos up an running on two CentOS 5 servers. Also, I don't really hate Kerberos. It's a bit of an inside joke with my coworkers who are studying for some of the RHCA exams at Rackspace. The [...]<p><a href="http://rackerhacker.com/2012/02/05/the-kerberos-haters-guide-to-installing-kerberos/">The Kerberos-hater's guide to installing Kerberos</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://rackerhacker.com/wp-content/uploads/2012/02/haters_gonna_hate_elephhant.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2012/02/haters_gonna_hate_elephhant-238x300.jpg" alt="Haters gonna hate - elephant" title="Haters gonna hate - elephant" width="171" height="216" class="alignright size-medium wp-image-2953" /></a>As promised in my earlier post entitled <a href="/2012/02/02/kerberos-for-haters/">Kerberos for haters</a>, I've assembled the simplest possible guide to get Kerberos up an running on two CentOS 5 servers.</p>
<p>Also, I don't really <em>hate</em> Kerberos.  It's a bit of an inside joke with my coworkers who are studying for some of the <a href="http://www.redhat.com/training/certifications/rhca/">RHCA</a> exams at Rackspace.  The additional security provided by Kerberos is quite good but the setup involves a lot of small steps.  If you miss one of the steps or if you get something done out of order, you may have to scrap the whole setup and start over unless you can make sense of the errors in the log files.  A lot of my dislikes for Kerberos comes from the number of steps required in the setup process and the difficulty in tracking down issues when they crop up.</p>
<p>To complete this guide, you'll need the following:</p>
<ul>
<li>two CentOS, Red Hat Enterprise Linux or Scientific Linux 5 servers or VM's</li>
<li>some patience</li>
</ul>
<p>Here's how I plan to name my servers:</p>
<ul>
<li><strong>kdc.example.com</strong> - the Kerberos KDC server at 192.168.250.2</li>
<li><strong>client.example.com</strong> - the Kerberos client at 192.168.250.3</li>
</ul>
<p><strong>CRITICAL STEP:</strong> Before getting started, ensure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in <code>/etc/hosts</code>.  Your server and client must be able to know the IP and hostname of the other system as well as themselves.</p>
<p>First off, we will need <a href="http://en.wikipedia.org/wiki/Network_Information_Service">NIS</a> working to serve up the user information for our client.  Install the NIS server components on the KDC server:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# yum install ypserv</pre></div></div>

<p>Set the NIS domain and set a static port for <code>ypserv</code> to make it easier to firewall off.  Edit <code>/etc/sysconfig/network</code> on the KDC server:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">NISDOMAINNAME=EXAMPLE.COM
YPSERV_ARGS=&quot;-p 808&quot;</pre></div></div>

<p>Manually set the NIS domain on the KDC server and add it to <code>/etc/yp.conf</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# nisdomain EXAMPLE.COM
[root@kdc ~]# echo &quot;domain EXAMPLE.COM server kdc.example.com&quot; &gt;&gt; /etc/yp.conf</pre></div></div>

<p>Adjust <code>/var/yp/securenets</code> on the KDC server for additional security:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# echo &quot;255.0.0.0 127.0.0.0&quot; &gt;&gt; /var/yp/securenets
[root@kdc ~]# echo &quot;255.255.255.0 192.168.250.0&quot; &gt;&gt; /var/yp/securenets</pre></div></div>

<p>Start the NIS server and generate the NIS maps:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# /etc/init.d/ypserv start; chkconfig ypserv on
[root@kdc ~]# make -C /var/yp</pre></div></div>

<p>I usually like to prepare my iptables rules ahead of time so I ensure that it doesn't derail me later on.  Paste this into the KDC's terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">iptables -N SERVICES
iptables -I INPUT -j SERVICES
iptables -A SERVICES -p tcp --dport 111 -j ACCEPT -m comment --comment &quot;rpc&quot;
iptables -A SERVICES -p udp --dport 111 -j ACCEPT -m comment --comment &quot;rpc&quot;
iptables -A SERVICES -p tcp --dport 808 -j ACCEPT -m comment --comment &quot;nis&quot;
iptables -A SERVICES -p udp --dport 808 -j ACCEPT -m comment --comment &quot;nis&quot;
iptables -A SERVICES -p tcp --dport 88 -j ACCEPT -m comment --comment &quot;kerberos&quot;
iptables -A SERVICES -p udp --dport 88 -j ACCEPT -m comment --comment &quot;kerberos&quot;
iptables -A SERVICES -p udp --dport 464 -j ACCEPT -m comment --comment &quot;kerberos&quot;
iptables -A SERVICES -p tcp --dport 749 -j ACCEPT -m comment --comment &quot;kerberos&quot;
/etc/init.d/iptables save</pre></div></div>

<p>We need our time in sync for Kerberos to work properly.  Install NTP on both nodes, start it, and ensure it comes up at boot time:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# yum -y install ntp &amp;&amp; chkconfig ntpd on &amp;&amp; /etc/init.d/ntpd start
[root@client ~]# yum -y install ntp &amp;&amp; chkconfig ntpd on &amp;&amp; /etc/init.d/ntpd start</pre></div></div>

<p>Now we're ready to set up Kerberos.  Start by installing some packages on the KDC:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# yum install krb5-server krb5-workstation</pre></div></div>

<p>We will need to make some edits to <code>/etc/krb5.conf</code> on the KDC to set up our KDC realm.  Ensure that the <code>default_realm</code> is set:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">default_realm = EXAMPLE.COM</pre></div></div>

<p>The <code>[realms]</code> section should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[realms]
EXAMPLE.COM = {
	kdc = 192.168.250.2:88
	admin_server = 192.168.250.2:749
}</pre></div></div>

<p>The <code>[domain_realm]</code> section should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[domain_realm]
kdc.example.com = EXAMPLE.COM
client.example.com = EXAMPLE.COM</pre></div></div>

<p>Add <code>validate = true</code> within the <code>pam { }</code> block of the <code>[appdefaults]</code> section:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[appdefaults]
 pam = {
   validate = true</pre></div></div>

<p>Adjust <code>/var/kerberos/krb5kdc/kdc.conf</code> on the KDC:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[realms]
EXAMPLE.COM = {
	master_key_type = des-hmac-sha1
	default_principal_flags = +preauth
}</pre></div></div>

<p>There's one last configuration file to edit on the KDC!  Ensure that <code>/var/kerberos/krb5kdc/kadm5.acl</code> looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">*/admin@EXAMPLE.COM	    *</pre></div></div>

<p>We're now ready to make a KDC database to hold our sensitive Kerberos data.  Create the database and set a good password which you can remember.  This command also stashes your password on the KDC so you don't have to enter it each time you start the KDC:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">kdb5_util create -r EXAMPLE.COM -s</pre></div></div>

<p>On the KDC, create a principal for the admin user as well as user1 (which we'll create shortly).  Also, export the admin details to the kadmind key tab.  You'll get some extra output after each one of these commands but I've snipped it to reduce the length of the post.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# kadmin.local
kadmin.local:  addprinc root/admin
kadmin.local:  addprinc user1
kadmin.local:  ktadd -k /var/kerberos/krb5kdc/kadm5.keytab kadmin/admin
kadmin.local:  ktadd -k /var/kerberos/krb5kdc/kadm5.keytab kadmin/changepw
kadmin.local:  exit</pre></div></div>

<p>Let's start the Kerberos KDC and kadmin daemons:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# /etc/init.d/krb5kdc start; /etc/init.d/kadmin start
[root@kdc ~]# chkconfig krb5kdc on; chkconfig kadmin on</pre></div></div>

<p>Now that the administration work is done, let's create a principal for our KDC server and stick it in it's keytab:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# kadmin.local
kadmin.local:  addprinc -randkey host/kdc.example.com
kadmin.local:  ktadd host/kdc.example.com</pre></div></div>

<p>Transfer your <code>/etc/krb5.conf</code> from the KDC server to the client.  Hop onto the client server, install the Kerberos client package and add some host principals:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@client ~]# yum install krb5-workstation
[root@client ~]# kadmin.local
kadmin.local:  addpinc --randkey host/client.example.com
kadmin.local:  ktadd host/kdc.example.com</pre></div></div>

<p>There aren't any daemons on the client side, so the configuration is pretty much wrapped up there for Kerberos.  However, we now need to tell both servers to use Kerberos for auth and your client servers needs to use NIS to get user data.</p>
<ul>
<li>On the KDC:
<ul>
<li>run <code>authconfig-tui</code></li>
<li>choose <b>Use Kerberos</b> from the second column</li>
<li>press <b>Next</b></li>
<li>don't edit the configuration (authconfig got the data from <code>/etc/krb.conf</code>)</li>
<li>press <b>OK</b></li>
</ul>
</li>
<li>On the client:
<ul>
<li>run <code>authconfig-tui</code></li>
<li>choose <b>Use NIS</b> and <b>Use Kerberos</b></li>
<li>press <b>Next</b></li>
<li>enter your NIS domain (EXAMPLE.COM) and NIS server (kdc.example.com or 192.168.250.2)</li>
<li>press <b>Next</b></li>
<li>don't edit the Kerberos configuration (authconfig got the data from <code>/etc/krb.conf</code>)</li>
<li>press <b>OK</b></li>
</ul>
</li>
</ul>
<p><b>Got NIS problems?</b>  If the NIS connection stalls on the client, ensure that you have the iptables rules present on the KDC that we added near the beginning of this guide.  Also, if you forgot to add <b>both</b> hosts to <b>both</b> servers' <code>/etc/hosts</code>, go do that now.</p>
<p>Let's make our test user on the KDC.  <b>Don't add this user to the client</b> -- we'll get the user information via NIS and authenticate via Kerberos shortly.  We'll also rebuild our NIS maps after adding the user:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@kdc ~]# useradd user1
[root@kdc ~]# passwd user1
[root@kdc ~]# make -C /var/yp/</pre></div></div>

<p>On the client, see if you can get the password hash for the user1 account via NIS:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@client ~]# ypcat -d EXAMPLE.COM -h kdc.example.com passwd | grep user1
user1:$1$sUlSTlCv$riK5El3z8N4y.mi5Fe3Q60:500:500::/home/user1:/bin/bash</pre></div></div>

<p>You can see why NIS isn't a good way to authenticate users.  Someone could easily pull the hash for any account and brute force the hash on their own server.  Go back to the KDC and lock out the user account:</p>
<pre>
[root@kdc ~]# usermod -p '!!' user1
</pre>
<p>Go back to the client and try to pull the password hash now:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@client ~]# ypcat -d EXAMPLE.COM -h kdc.example.com passwd | grep user1
user1:!!:500:500::/home/user1:/bin/bash</pre></div></div>

<p>On the plus side, the user's password hash is now gone.  On the negative side, you've just prevented this user from logging in locally or via NIS. Don't worry, the user can log in via Kerberos now.  Let's prepare a home directory on the client for the user:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@client ~]# mkdir /home/user1
[root@client ~]# cp -av /etc/skel/.bash* /home/user1/
[root@client ~]# chown -R user1:user1 /home/user1/</pre></div></div>

<p>Note: In a real-world scenario, you'd probably want to export this user's home directory via NFS so they didn't get a different home directory on every server.</p>
<p>While you're still on the client, try to log into the client via the user.  Use the password that you used when you created the user1 principal on the KDC.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@client ~]# ssh user1@localhost
user1@localhost's password:
[user1@client ~]$ whoami
user1</pre></div></div>

<p>List your Kerberos tickets and you should see one for your user principal:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[user1@client ~]$ klist
Ticket cache: FILE:/tmp/krb5cc_500_fCKPnZ
Default principal: user1@EXAMPLE.COM
&nbsp;
Valid starting     Expires            Service principal
02/05/12 14:18:53  02/06/12 00:18:53  krbtgt/EXAMPLE.COM@EXAMPLE.COM
	renew until 02/05/12 14:18:53</pre></div></div>

<p>Your KDC should have a couple of lines in its <code>/var/log/krb5kdc.log</code> showing the authentication:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Feb 05 14:18:53 kdc.example.com krb5kdc[4694](info): AS_REQ (12 etypes {18 17 16 23 1 3 2 11 10 15 12 13}) 192.168.250.3: ISSUE: authtime 1328473133, etypes {rep=16 tkt=16 ses=16}, user1@EXAMPLE.COM for krbtgt/EXAMPLE.COM@EXAMPLE.COM
Feb 05 14:18:53 kdc.example.com krb5kdc[4694](info): TGS_REQ (7 etypes {18 17 16 23 1 3 2}) 192.168.250.3: ISSUE: authtime 1328473133, etypes {rep=16 tkt=18 ses=18}, user1@EXAMPLE.COM for host/client.example.com@EXAMPLE.COM</pre></div></div>

<p>The first line shows that the client asked for a Authentication Server Request (AS_REQ) and the second line shows that the client then asked for a Ticket Granting Server Request (TGS_REQ).  In layman's terms, the client first asked for a ticket-granting ticket (TGT) so it could authenticate to other services.  When it actually tried to log in via <code>ssh</code> it asked for a ticket (and received it).</p>
<p><b>YOU JUST CONFIGURED KERBEROS!</b></p>
<p>From here, the sky's the limit.  Another popular implementation of Kerberos is encrypted NFSv4.  You can even go crazy and use <a href="http://wiki.centos.org/HowTos/HttpKerberosAuth">Kerberos with apache</a>.</p>
<p>Let me know if you have any questions about this post or if you spot any errors.  With this many steps, there's bound to be a typo or two in this guide.  Keep in mind that there are some obvious spots for network-level and service-level security improvements.  This guide was intended to give you the basics and it doesn't cover all of the security implications involved with a Kerberos implementation.</p>
<p><a href="http://rackerhacker.com/2012/02/05/the-kerberos-haters-guide-to-installing-kerberos/">The Kerberos-hater's guide to installing Kerberos</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2012/02/05/the-kerberos-haters-guide-to-installing-kerberos/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Kerberos for haters</title>
		<link>http://rackerhacker.com/2012/02/02/kerberos-for-haters/</link>
		<comments>http://rackerhacker.com/2012/02/02/kerberos-for-haters/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 04:29:32 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhca]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2906</guid>
		<description><![CDATA[I'll be the first one to admit that Kerberos drives me a little insane. It's a requirement for two of the exams in Red Hat's RHCA certification track and I've been forced to learn it. It provides some pretty nice security features for large server environments. You get central single sign ons, encrypted authentication, and [...]<p><a href="http://rackerhacker.com/2012/02/02/kerberos-for-haters/">Kerberos for haters</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>I'll be the first one to admit that Kerberos drives me a little insane.  It's a requirement for two of the exams in <a href="http://www.redhat.com/training/certifications/rhca/">Red Hat's RHCA certification track</a> and I've been forced to learn it.  It provides some pretty nice security features for large server environments.  You get central single sign ons, encrypted authentication, and bidirectional validation.  However, getting it configured can be a real pain due to some rather archaic commands and shells.</p>
<p>Here's Kerberos in a nutshell within a two-server environment:  One server is a Kerberos key distribution center (KDC) and the other is a Kerberos client.  The KDC has the list of users and their passwords.  Consider a situation where a user tries to ssh into the Kerberos client:</p>
<ul>
<li>sshd calls to pam to authenticate the user</li>
<li>pam calls to the KDC for a ticket granting ticket (TGT) to see if the user can authenticate</li>
<li>the KDC replies to the client with a TGT encrypted with the user's password</li>
<li>pam (on the client) tries to decrypt the TGT with the password that the user provided via ssh</li>
<li>if pam can decrypt the TGT, it knows the user is providing the right password</li>
</ul>
<p>Now that the client has a a TGT for that user, it can ask for tickets to access other network services.  What if the user who just logged in wants to access another Kerberized service in the environment?</p>
<ul>
<li>client calls the KDC and asks for a ticket to grant access to the other service</li>
<li>KDC replies with two copies of the ticket:
<ul>
<li>one copy is encrypted with the user's current TGT</li>
<li>a second copy is encrypted with the password of the network service the user wants to access</li>
</ul>
</li>
<li>the client can decrypt the ticket which was encrypted with the current TGT since it has the TGT already</li>
<li>client makes an authenticator by taking the decrypted ticket and encrypting it with a timestamp</li>
<li>client passes the authenticator and the second copy of the ticket it received from the KDC</li>
<li>the other network service decrypts the second copy of the ticket and verifies the password</li>
<li>the other network service uses the decrypted ticket to decrypt the authenticator it received from the client</li>
<li>if the timestamp looks good, the other network service allows the user access</li>
</ul>
<p>Okay, that's confusing.  Let's take it one step further.  Enabling pre-authentication requires that clients send a request containing a timestamp encrypted with the user's password prior to asking for a TGT.  Without this requirement, an attacker can ask for a TGT one time and then brute force the TGT offline.  Pre-authentication forces the client to send a timestamped request encrypted with the user's password back to the KDC before they can ask for a TGT.  This means the attacker is forced to try different passwords when encrypting the timestamp in the hopes that they'll get a TGT to work with eventually.  One would hope that you have something configured on the KDC to set off an alarm for multiple failed pre-authentication attempts.</p>
<p>Oh, but we can totally kick it up another notch.  What if an attacker is able to give a bad password to a client but they're also able to impersonate the KDC?  They could reply to the TGT request (as the KDC) with a TGT encrypted with whichever password they choose and get access to the client system.  Enabling mutual authentication stops this attack since it forces the client to ask the KDC for the client's own host principal password (this password is set when the client is configured to talk to the KDC).  The attacker shouldn't have any clue what that password is and the attack will be thwarted.</p>
<p>By this point, you're either saying "Oh man, I don't ever want to do this." or "How do I set up Kerberos?".  Stay tuned if you're in the second group.  I'll have a dead simple (or as close to dead simple as one can get with Kerberos) how-to on the blog shortly.</p>
<p>In the meantime, here are a few links for extra Kerberos bedtime reading:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Kerberos_(protocol)">Kerberos on Wikipedia</a></li>
<li><a href="http://www.kerberos.org/software/whykerberos.pdf">MIT's "Why Kerberos"</a> [PDF]</li>
<li><a href="http://learn-networking.com/network-security/how-kerberos-authentication-works">How Kerberos Authentication Works</a></li>
</ul>
<p><a href="http://rackerhacker.com/2012/02/02/kerberos-for-haters/">Kerberos for haters</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2012/02/02/kerberos-for-haters/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Getting back to using eth0 in Fedora 15</title>
		<link>http://rackerhacker.com/2011/09/25/getting-back-to-using-eth0-in-fedora-15/</link>
		<comments>http://rackerhacker.com/2011/09/25/getting-back-to-using-eth0-in-fedora-15/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 22:08:20 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2568</guid>
		<description><![CDATA[Fedora 15 was released with some updates to allow for consistent network device names. Once it's installed, you'll end up with network devices that are named something other than eth0, eth1, and so on. For example, all onboard ethernet adapters are labeled as emX (em1, em2...) and all PCI ethernet adapters are labeled as pXpX [...]<p><a href="http://rackerhacker.com/2011/09/25/getting-back-to-using-eth0-in-fedora-15/">Getting back to using eth0 in Fedora 15</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Fedora 15 was released with some updates to allow for <a href="http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming">consistent network device names</a>.  Once it's installed, you'll end up with network devices that are named something other than eth0, eth1, and so on.</p>
<p>For example, all onboard ethernet adapters are labeled as emX (em1, em2...) and all PCI ethernet adapters are labeled as pXpX (p[slot]p[port], like p7p1 for port 1 on slot 7).  Ethernet devices within Xen virtual machines aren't adjusted.</p>
<p>This may make sense to people who swap out the chassis on servers regularly and they don't want to mess with hard-coding MAC addresses in network configuration files.  Also, it should give users predictable names even if a running system's drives are inserted into a newer hardware revision of the same server.</p>
<p>However, I don't like this on my personal dedicated servers and I prefer to revert back to the old way of doing things.  Getting back to eth0 is pretty simple and it only requires a few configuration files to be edited followed by a reboot.</p>
<p>First, add <code>biosdevname=0</code> to your <code>grub.conf</code> on the kernel line:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">title Fedora (2.6.40.4-5.fc15.x86_64)
	root (hd0,0)
	kernel /boot/vmlinuz-2.6.40.4-5.fc15.x86_64 ro root=/dev/md0 SYSFONT=latarcyrheb-sun16 KEYTABLE=us biosdevname=0 quiet LANG=en_US.UTF-8
	initrd /boot/initramfs-2.6.40.4-5.fc15.x86_64.img</pre></div></div>

<p>Open <code>/etc/udev/rules.d/70-persistent-net.rules</code> in your favorite text editor (create it if it doesn't exist) and add in the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># Be sure to put your MAC addresses in the fields below
SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;00:11:22:33:44:10&quot;, ATTR{dev_id}==&quot;0x0&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth0&quot;
SUBSYSTEM==&quot;net&quot;, ACTION==&quot;add&quot;, DRIVERS==&quot;?*&quot;, ATTR{address}==&quot;00:11:22:33:44:11&quot;, ATTR{dev_id}==&quot;0x0&quot;, ATTR{type}==&quot;1&quot;, KERNEL==&quot;eth*&quot;, NAME=&quot;eth1&quot;</pre></div></div>

<p>Be sure to rename your <code>ifcfg-*</code> files in <code>/etc/sysconfig/network-scripts/</code> to match the device names you've assigned.  Just for good measure, I add in the MAC address in <code>/etc/sysconfig/network-scripts/ifcfg-ethX</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">...
HWADDR=00:11:22:33:44:10
...</pre></div></div>

<p>Reboot the server and you should be back to eth0 and eth1 after a reboot.</p>
<p><a href="http://rackerhacker.com/2011/09/25/getting-back-to-using-eth0-in-fedora-15/">Getting back to using eth0 in Fedora 15</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/09/25/getting-back-to-using-eth0-in-fedora-15/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Measure traffic flows with Mikrotik&#039;s RouterOS and ntop on Fedora 15</title>
		<link>http://rackerhacker.com/2011/06/05/measure-traffic-flows-with-mikrotiks-routeros-and-ntop-on-fedora-15/</link>
		<comments>http://rackerhacker.com/2011/06/05/measure-traffic-flows-with-mikrotiks-routeros-and-ntop-on-fedora-15/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 14:58:26 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mikrotik]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[ntop]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2311</guid>
		<description><![CDATA[It's no secret that I'm a big fan of the RouterBoard network devices paired with Mikrotik's RouterOS. I discovered today that these devices offer Cisco NetFlow-compatible statistics gathering which can be directed to a Linux box running ntop. Mikrotik calls it "traffic flow" and it's much more efficient than setting up a mirrored or spanned [...]<p><a href="http://rackerhacker.com/2011/06/05/measure-traffic-flows-with-mikrotiks-routeros-and-ntop-on-fedora-15/">Measure traffic flows with Mikrotik's RouterOS and ntop on Fedora 15</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>It's no secret that I'm a big fan of the <a href="http://www.routerboard.com/">RouterBoard</a> network devices paired with <a href="http://www.mikrotik.com/software.html">Mikrotik's RouterOS</a>.  I discovered today that these devices offer Cisco NetFlow-compatible statistics gathering which can be directed to a Linux box running <a href="http://www.ntop.org/">ntop</a>.  Mikrotik calls it "traffic flow" and it's much more efficient than setting up a mirrored or spanned port and then using ntop to dump traffic on that interface.</p>
<p>These instructions are for Fedora 15, but they should be pretty similar on most other Linux distributions.  Install ntop first:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum -y install ntop</pre></div></div>

<p>Adjust <code>/etc/ntop.conf</code> so that ntop listens on something other than localhost:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># limit ntop to listening on a specific interface and port
--http-server 0.0.0.0:3000 --https-server 0.0.0.0:3001</pre></div></div>

<p>I had to comment out the <code>sched_yield()</code> option to get ntop to start:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># Under certain circumstances, the sched_yield() function causes the ntop web 
# server to lock up.  It shouldn't happen, but it does.  This option causes 
# ntop to skip those calls, at a tiny performance penalty.
# --disable-schedyield</pre></div></div>

<p>Set an admin password for ntop:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ntop --set-admin-password</pre></div></div>

<p>Once you set the password, you may need to press CTRL-C to get back to a prompt in some ntop versions.</p>
<p>Start ntop:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/etc/init.d/ntop start</pre></div></div>

<p>Open a web browser and open http://example.com:3000 to access the ntop interface.  Roll your mouse over the <strong>Plugins</strong> menu, then <strong>NetFlow</strong>, and then click <strong>Activate</strong>.  Roll your mouse over the <strong>Plugins</strong> menu again, then <strong>NetFlow</strong>, and then click <strong>Configure</strong>.  Click <strong>Add NetFlow Device</strong> and fill in the following:</p>
<ul>
<li>Type "Mikrotik" in the <strong>NetFlow Device</strong> section and click <b>Set Interface Name</b>.</li>
<li>Type 2055 in the <strong>Local Collector UDP Port</strong> section and click <b>Set Port</b>.</li>
<li>Type in your router's IP/netmask in the <strong>Virtual NetFlow Interface Network Address</strong> section and click <b>Set Interface Address</b>.</li>
</ul>
<p>Enabling traffic flow on the Mikrotik can be done with just two configuration lines:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/ip traffic-flow
set enabled=yes interfaces=all
/ip traffic-flow target
add address=192.168.10.65:2055 disabled=no version=5</pre></div></div>

<p>Wait about a minute and then try reviewing some of the data in the ntop interface.  Depending on the amount of traffic on your network, you might see data in as little as 10-15 seconds.</p>
<p><a href="http://rackerhacker.com/2011/06/05/measure-traffic-flows-with-mikrotiks-routeros-and-ntop-on-fedora-15/">Measure traffic flows with Mikrotik's RouterOS and ntop on Fedora 15</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/06/05/measure-traffic-flows-with-mikrotiks-routeros-and-ntop-on-fedora-15/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Handy networking cheat sheets from Packet Life</title>
		<link>http://rackerhacker.com/2011/05/25/handy-networking-cheat-sheets-from-packet-life/</link>
		<comments>http://rackerhacker.com/2011/05/25/handy-networking-cheat-sheets-from-packet-life/#comments</comments>
		<pubDate>Wed, 25 May 2011 13:38:45 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2307</guid>
		<description><![CDATA[If you find yourself forgetting bits and pieces about network topics, Packet Life's cheat sheets should be a handy resource for you. Lots of topics are included, such as VOIP, NAT, MPLS, BGP, and IOS basics. They're all in PDF form and free to download. Cheat Sheets - Packet Life Thanks to @speude for mentioning [...]<p><a href="http://rackerhacker.com/2011/05/25/handy-networking-cheat-sheets-from-packet-life/">Handy networking cheat sheets from Packet Life</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>If you find yourself forgetting bits and pieces about network topics, Packet Life's cheat sheets should be a handy resource for you.  Lots of topics are included, such as VOIP, NAT, MPLS, BGP, and IOS basics.  They're all in PDF form and free to download.</p>
<p><a href="http://packetlife.net/library/cheat-sheets/">Cheat Sheets - Packet Life</a></p>
<p><em>Thanks to <a href="http://twitter.com/speude/status/73333508344524800">@speude</a> for mentioning the site on Twitter.</em></p>
<p><a href="http://rackerhacker.com/2011/05/25/handy-networking-cheat-sheets-from-packet-life/">Handy networking cheat sheets from Packet Life</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/05/25/handy-networking-cheat-sheets-from-packet-life/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Strategies for detecting a compromised Linux server</title>
		<link>http://rackerhacker.com/2011/03/09/strategies-for-detecting-a-compromised-linux-server/</link>
		<comments>http://rackerhacker.com/2011/03/09/strategies-for-detecting-a-compromised-linux-server/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 02:52:16 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1273</guid>
		<description><![CDATA[There are few things which will rattle systems administrators more than a compromised server. It gives you the same feeling that you would have if someone broke into your house or car, except that it's much more difficult (with a server) to determine how to clean up the compromise and found out how the attacker [...]<p><a href="http://rackerhacker.com/2011/03/09/strategies-for-detecting-a-compromised-linux-server/">Strategies for detecting a compromised Linux server</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>There are few things which will rattle systems administrators more than a compromised server.  It gives you the same feeling that you would have if someone broke into your house or car, except that it's much more difficult (with a server) to determine how to clean up the compromise and found out how the attacker gained access.  In addition, leaving a compromise in place for an extended period can lead to other problems:</p>
<ul>
<li>your server could be used to gain access other servers</li>
<li>data could be stolen from your server's databases or storage devices</li>
<li>an attacker could capture data from your server's local network</li>
<li>denial of service attacks could be launched using your server as an active participant</li>
</ul>
<p>The best ways to limit your server's attack surface are pretty obvious: limit network access, keep your OS packages up to date, and regularly audit any code which is accessible externally or internally.  As we all know, your server can still become compromised even with all of these preventative measures in place.</p>
<p>Here are some tips which will allow you to rapidly detect a compromise on your servers:</p>
<p><strong>Abnormal network usage patterns and atypical bandwidth consumption</strong><br />
Most sites will have a fairly normal traffic pattern which repeats itself daily.  If your traffic graph suddenly has a plateau or spikes drastically during different parts of the day, that could signify that there is something worth reviewing.  Also, if your site normally consumes about 2TB of traffic per month and you're at the 1.5TB mark on the fifth day of the month, you might want to examine the server more closely.</p>
<p>On the flip side, look for dips in network traffic as well.  This may mean that a compromise is interfering with the operation of a particular daemon, or there may be a rogue daemon listening on a trusted port during certain periods.</p>
<p>Many compromises consist of simple scripts which scan for other servers to infect or participate in large denial of service attacks.  The scans may show up as a large amount of packets, but the denial of service attacks will usually consume a large amount of bandwidth.  Keeping tabs on network traffic is easily done with open source software like <a href="http://munin-monitoring.org/">munin</a>, <a href="http://www.cacti.net/">cacti</a>, or <a href="http://oss.oetiker.ch/mrtg/">MRTG</a>.</p>
<p><strong>Unusual open ports</strong><br />
If you run a web server on port 80, but <code>netstat -ntlp</code> shows something listening on various ports over 1024, those processes are worth reviewing.  Use commands like <code>lsof</code> to probe the system for the files and network ports held open by the processes.  You can also check within <code>/proc/[pid]</code> to find the directory where the processes were originally launched.</p>
<p>Watch out for processes started within directories like <code>/dev/shm</code>, <code>/tmp</code> or any directories in which your daemons have write access.  You might see that some processes were started in a user's home directory.  If that's the case, it might be a good time to reset that user's password or clear out their ssh key.  Review the output from <code>last</code> authentication logs to see if there are account logins from peculiar locations.  If you know the user lives in the US, but there are logins from various other countries over a short period, you've got a serious problem.</p>
<p>I've used applications like <a href="http://www.chkrootkit.org/">chkrootkit</a> and <a href="http://www.rootkit.nl/projects/rootkit_hunter.html">rkhunter</a> in the past, but I still prefer a keen eye and <code>netstat</code> on most occasions. </p>
<p><strong>Command output is unusual</strong><br />
I've seen compromises in the past where the attacker actually took the time to replace integral applications like <code>ps</code>, <code>top</code> and <code>lsof</code> to hide the evidence of the ongoing compromise.  However, a quick peek in <code>/proc</code> revealed that there was a lot more going on.</p>
<p>If you suspect a compromise like this one, you may want to use the functionality provided by <code>rpm</code> to verify the integrity of the packages currently installed.  You can quickly hunt for changed files by running <code>rpm -Va | grep ^..5</code>.</p>
<p>Keeping tabs on changing files can be a challenge, but applications like <a href="http://www.tripwire.org/">tripwire</a> and good ol' <a href="http://www.logwatch.org/">logwatch</a> can save you in a pinch.</p>
<p><strong>Summary</strong><br />
We can all agree that the best way to prevent a compromise is to take precautions before putting anything into production.  In real life, something will always be forgotten, so detection is a must.  It's critical to keep in mind that <em>monitoring a server means more than keeping track on uptime</em>.  Keeping tabs on performance anomalies will allow you to find the compromise sooner and that keeps the damage done to a minimum.</p>
<p><a href="http://rackerhacker.com/2011/03/09/strategies-for-detecting-a-compromised-linux-server/">Strategies for detecting a compromised Linux server</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/03/09/strategies-for-detecting-a-compromised-linux-server/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>icanhazip.com now supports both IPv4 and IPv6 addresses</title>
		<link>http://rackerhacker.com/2011/01/15/icanhazip-com-now-supports-both-ipv4-and-ipv6-addresses/</link>
		<comments>http://rackerhacker.com/2011/01/15/icanhazip-com-now-supports-both-ipv4-and-ipv6-addresses/#comments</comments>
		<pubDate>Sat, 15 Jan 2011 14:08:12 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[icanhazip]]></category>
		<category><![CDATA[ipv6]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2162</guid>
		<description><![CDATA[If you're a fan of icanhazip.com, you'll be excited to know that it now supports IPv4 and IPv6 addresses. The icanhazip.com domain now has A and AAAA records, so you should now be able to reach it on connections that are IPv6 only. Should you find yourself in a situation in which you need to [...]<p><a href="http://rackerhacker.com/2011/01/15/icanhazip-com-now-supports-both-ipv4-and-ipv6-addresses/">icanhazip.com now supports both IPv4 and IPv6 addresses</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>If you're a fan of <a href="http://icanhazip.com/">icanhazip.com</a>, you'll be excited to know that it now supports IPv4 and IPv6 addresses.  The icanhazip.com domain now has A and AAAA records, so you should now be able to reach it on connections that are IPv6 only.</p>
<p>Should you find yourself in a situation in which you need to force it to display your IPv4 or IPv6 address (which is handy if you are running a dual stack), simply access ipv4.icanhazip.com or ipv6.icanhazip.com.  Those sites will always return your IPv4 and IPv6 addresses, respectively.</p>
<p>As always, if you find any bugs or other problems, be sure to let me know!</p>
<p><a href="http://rackerhacker.com/2011/01/15/icanhazip-com-now-supports-both-ipv4-and-ipv6-addresses/">icanhazip.com now supports both IPv4 and IPv6 addresses</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2011/01/15/icanhazip-com-now-supports-both-ipv4-and-ipv6-addresses/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Accessing Rackspace Cloud Servers and Slicehost slices privately via OpenVPN</title>
		<link>http://rackerhacker.com/2010/11/16/accessing-rackspace-cloud-servers-and-slicehost-slices-privately-via-openvpn/</link>
		<comments>http://rackerhacker.com/2010/11/16/accessing-rackspace-cloud-servers-and-slicehost-slices-privately-via-openvpn/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 13:52:53 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[networkmanager]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1889</guid>
		<description><![CDATA[A recent blog post from Mixpanel inspired me to write a quick how-to for Fedora users on using OpenVPN to talk to instances privately in the Rackspace Cloud. The diagram at the right gives an idea of what this guide will allow you to accomplish. Consider a situation where you want to talk to the [...]<p><a href="http://rackerhacker.com/2010/11/16/accessing-rackspace-cloud-servers-and-slicehost-slices-privately-via-openvpn/">Accessing Rackspace Cloud Servers and Slicehost slices privately via OpenVPN</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1897" class="wp-caption alignright" style="width: 298px"><a href="http://rackerhacker.com/wp-content/uploads/2010/11/openvpn-to-rackspace-cloud-diagram.png"><img src="http://rackerhacker.com/wp-content/uploads/2010/11/openvpn-to-rackspace-cloud-diagram.png" alt="Diagram: OpenVPN to Rackspace Cloud Servers and Slicehost" title="Diagram: OpenVPN to Rackspace Cloud Servers and Slicehost" width="288" height="248" class="size-full wp-image-1897" /></a><p class="wp-caption-text">Diagram: OpenVPN to Rackspace Cloud Servers and Slicehost</p></div><br />
A recent <a href="http://code.mixpanel.com/openvpn-in-the-rackspace-cloud/">blog post from Mixpanel</a> inspired me to write a quick how-to for Fedora users on using OpenVPN to talk to instances privately in the Rackspace Cloud.</p>
<p>The diagram at the right gives an idea of what this guide will allow you to accomplish.  Consider a situation where you want to talk to the MySQL installation on db1 directly without requiring extra ssh tunnels or MySQL over SSL via the public network.  If you tunnel into one of your instances, you can utilize the private network to talk between your instances very easily.</p>
<p>There's one important thing to keep in mind here: even though you'll be utilizing the private network between your tunnel endpoint and your other instances, your traffic will still traverse the public network.  That means that the instance with your tunnel endpoint will still get billed for the traffic flowing through your tunnel.</p>
<p>You'll only need the openvpn package on the server side:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum -y install openvpn</pre></div></div>

<p>Throw down this simple configuration file into /etc/openvpn/server.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">port 1194
proto tcp
dev tun
persist-key
persist-tun
&nbsp;
server 10.66.66.0 255.255.255.0
ifconfig-pool-persist ipp.txt
&nbsp;
#push &quot;route 10.0.0.0 255.0.0.0&quot;
push &quot;route 10.176.0.0 255.248.0.0&quot;
keepalive 10 120
&nbsp;
ca      /etc/openvpn/my_certificate_authority.pem
cert    /home/major/vpn_server_cert.pem
key     /home/major/vpn_server_key.pem
dh      /etc/openvpn/easy-rsa/2.0/keys/dh1024.pem
&nbsp;
status log/openvpn-status.log
verb 3</pre></div></div>

<p>Here's a bit of explanation for some things you may want to configure:</p>
<ul>
<li><code>push</code> - These are the routes that will be sent over the VPN that are pushed to the clients.  If you don't use any IP addresses in the 10.0.0.0/8 network block in your office, you can probably use the commented out line above.  However, you may want to be more specific with the routes if you happen to use any 10.0.0.0/8 space in your office.</li>
<li><code>server</code> - These are the IP addresses that the VPN server will assign and NAT out through the private interface.  I've used a /24 above, but you may want to adjust the netmask if you have a lot of users making tunnels to your VPN endpoint.</li>
<li><code>ca, cert, key</code> - You will need to create a certificate authority as well as a certificate/key pair for your VPN endpoint.  I already use <a href="http://simpleauthority.com/">SimpleAuthority</a> on my Mac to manage some other CA's and certificates, but you can use <a href="http://openvpn.net/index.php/open-source/documentation/miscellaneous/77-rsa-key-management.html">openvpn's easy-rsa</a> scripts if you wish.  They are already included with the openvpn installation.</li>
</ul>
<p>Build your Diffie-Hellman parameters file:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">cd /etc/openvpn/easy-rsa/2.0/ &amp;&amp; ./build-dh</pre></div></div>

<p>Tell iptables that you want to NAT your VPN endpoint traffic out to all 10.x.x.x IP addresses on the private network:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth1 -j MASQUERADE</pre></div></div>

<p>The last step on the server side is to ensure that the kernel will forward packets from the VPN endpoint out through the private interface.  Ensure that your /etc/sysctl.conf looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># Controls IP packet forwarding
net.ipv4.ip_forward = 1</pre></div></div>

<p>Adjusting your sysctl.conf ensures that forwarding is enabled at boot time, but you'll need to enable it on your VPN endpoint right now:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">echo 1 &gt; /proc/sys/net/ipv4/ip_forward</pre></div></div>

<p>Start the openvpn server:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/etc/init.d/openvpn start</pre></div></div>

<p>If all is well, you should see openvpn listening on port 1194:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@lb2 ~]# netstat -ntlp | grep openvpn
tcp        0      0 0.0.0.0:1194      0.0.0.0:*         LISTEN      2020/openvpn</pre></div></div>

<p>You'll need to configure a client to talk to your VPN now.  This involves three steps: creating a new certificate/key pair for the client (same procedure as making your server certificates), signing the client's certificate with your CA certificate (same one that you used above to sign your server certificates), and then configuring your client application to access the VPN.</p>
<p>There are <strong>many</strong> openvpn clients out there to choose from.</p>
<p>If you're using a Linux desktop, you may want to consider using the <a href="http://geraner.typepad.com/blog/2009/10/how-to-create-an-openvpn-connect-in-linux-version-2.html">built-in VPN functionality in NetworkManager</a>.  For Mac users, I'd highly recommend using <a href="http://www.thesparklabs.com/viscosity/">Viscosity</a> ($9), but there's also <a href="http://code.google.com/p/tunnelblick/">tunnelblick</a> (free).</p>
<p><a href="http://rackerhacker.com/2010/11/16/accessing-rackspace-cloud-servers-and-slicehost-slices-privately-via-openvpn/">Accessing Rackspace Cloud Servers and Slicehost slices privately via OpenVPN</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2010/11/16/accessing-rackspace-cloud-servers-and-slicehost-slices-privately-via-openvpn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A simple guide to redundant cloud hosting</title>
		<link>http://rackerhacker.com/2010/08/17/a-simple-guide-to-redundant-cloud-hosting/</link>
		<comments>http://rackerhacker.com/2010/08/17/a-simple-guide-to-redundant-cloud-hosting/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 00:41:16 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[load balancing]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1771</guid>
		<description><![CDATA[Today, on my 28th birthday, I'm finally delivering on a promise to my readers which I made about two months ago. I've written a guide on how to host a web application redundantly in a cloud environment. While it's still a bit of a rough draft, it should be a good starting point for those [...]<p><a href="http://rackerhacker.com/2010/08/17/a-simple-guide-to-redundant-cloud-hosting/">A simple guide to redundant cloud hosting</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Today, on my 28th birthday, I'm finally delivering on a promise to my readers which I made about two months ago.  I've <a href="/redundant-cloud-hosting-configuration-guide/">written a guide</a> on how to host a web application redundantly in a cloud environment.  While it's still a bit of a rough draft, it should be a good starting point for those who haven't worked in virtualized environments before.  Also, it may show some of the more experienced systems administrators a new way to do things.</p>
<p>The guide: <a href="/redundant-cloud-hosting-configuration-guide/">Redundant Cloud Hosting Guide</a></p>
<p>As always, if you find anything in the guide that needs improvement, I'm all ears. <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://rackerhacker.com/2010/08/17/a-simple-guide-to-redundant-cloud-hosting/">A simple guide to redundant cloud hosting</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2010/08/17/a-simple-guide-to-redundant-cloud-hosting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A modern implementation and explanation of Linux Virtual Server (LVS)</title>
		<link>http://rackerhacker.com/2010/06/27/modern-implementation-and-explanation-of-linux-virtual-server-lvs/</link>
		<comments>http://rackerhacker.com/2010/06/27/modern-implementation-and-explanation-of-linux-virtual-server-lvs/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 16:03:27 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1529</guid>
		<description><![CDATA[A typical load balancing configuration using hardware devices or software implementations will be organized such that they resemble the diagram at the right. I usually call this a proxy-type load balancing solution since the load balancer proxies your request to some other nodes. The standard order of operations looks like this: client makes a request [...]<p><a href="http://rackerhacker.com/2010/06/27/modern-implementation-and-explanation-of-linux-virtual-server-lvs/">A modern implementation and explanation of Linux Virtual Server (LVS)</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1533" class="wp-caption alignright" style="width: 207px"><a href="http://rackerhacker.com/wp-content/uploads/2010/06/loadbalancer-viaproxy.png"><img src="http://rackerhacker.com/wp-content/uploads/2010/06/loadbalancer-viaproxy.png" alt="Load balancing via proxy" title="Load balancing via proxy" width="197" height="206" class="size-full wp-image-1533" /></a><p class="wp-caption-text">Typical configuration for a <br />proxy-type load balancer</p></div>A typical load balancing configuration using hardware devices or software implementations will be organized such that they resemble the diagram at the right.  I usually call this a proxy-type load balancing solution since the load balancer proxies your request to some other nodes.  The standard order of operations looks like this:</p>
<ul>
<li>client makes a request</li>
<li>load balancer receives the request</li>
<li>load balancer sends request to a web node</li>
<li>the web server sends content back to the load balancer</li>
<li>the load balancer responds to the client</li>
</ul>
<p>If you're not familiar with load balancing, here's an analogy.  Consider a fast food restaurant.  When you walk up to the counter and place an order, you're asking the person at the counter (the load balancer) for a hamburger.  The person at the counter is going to submit your order, and then a group of people (web nodes) are going to work on it.  Once your hamburger (web request) is ready, your order will be given to the person at the counter and then back to you.</p>
<p>This style of organization can become a problem as your web nodes begin to scale.  It requires you to ensure that your load balancers can keep up with the requests and sustain higher transfer rates that come from having more web nodes serving a greater number of requests.  Imagine the fast food restaurant where you have one person taking the orders but you have 30 people working on the food.  The person at the counter may be able to take orders very quickly, but they may not be able to keep up with the orders coming out of the kitchen.</p>
<p><div id="attachment_1532" class="wp-caption alignright" style="width: 226px"><a href="http://rackerhacker.com/wp-content/uploads/2010/06/loadbalancer-ipvs.png"><img src="http://rackerhacker.com/wp-content/uploads/2010/06/loadbalancer-ipvs.png" alt="Load balancing via Linux Virtual Server" title="Load balancing via Linux Virtual Server" width="216" height="206" class="size-full wp-image-1532" /></a><p class="wp-caption-text">LVS allows for application servers<br /> to respond to clients directly</p></div><br />
This is where <a href="http://en.wikipedia.org/wiki/Linux_Virtual_Server">Linux Virtual Server (LVS)</a> really shines.  LVS operates a bit differently:</p>
<ul>
<li>client makes a request</li>
<li>load balancer receives the request</li>
<li>load balancer sends request to a web node</li>
<li>the web server sends the response <strong>directly to the client</strong></li>
</ul>
<p>The key difference is that the load balancer sends the unaltered request to the web server and the web server responds <em>directly to the client</em>.  Here's the fast food analogy again.  If you ask the person at the counter (the load balancer) for a hamburger, that person is going to take your order and give it to the kitchen staff (the web nodes) to work on it.  This time around, the person at the counter is going to advise the kitchen staff that the order needs to go directly to you once it's complete.  When your hamburger is ready, a member of the kitchen staff will walk to the counter and give it directly to you.</p>
<p>In the fast food analogy, what are the benefits?  As the number of orders and kitchen staff increases, the job of the person at the counter doesn't drastically increase in difficulty.  While that person will have to handle more orders and keep tabs on which of the kitchen staff is working on the least amount of orders, they don't have to worry about returning food to customers.  Also, the kitchen staff doesn't need to waste time handing orders to the person at the counter.  Instead, they can pass these orders directly to the customer that ordered them.</p>
<p>In the world of servers, this is a large benefit.  Since the web servers' responses no longer pass through the load balancer, they can spend more time on what they do best -- balancing traffic.  This allows for smaller, lower-powered load balancing servers from the beginning.  It also allows for increases in web nodes without big changes for the load balancers.</p>
<p>There are three main implementations of LVS to consider:</p>
<p><a href="http://rackerhacker.com/wp-content/uploads/2010/06/Lvslogo.png"><img src="http://rackerhacker.com/wp-content/uploads/2010/06/Lvslogo.png" alt="Linux Virtual Server Logo" title="Linux Virtual Server Logo" width="206" height="206" class="alignright size-full wp-image-1559" /></a><strong>LVS-DR: Direct Routing</strong><br />
The load balancer receives the request and sends the packet directly to a waiting real server to process.  LVS-DR has the best performance, but all of your servers must be on the same network subnet and they have to be able to share the same router (with no other routing devices in between them).</p>
<p><strong>LVS-TUN: Tunneling</strong><br />
This is very similar to the direct routing approach, but the packets are <a href="http://en.wikipedia.org/wiki/IP_tunnel">encapsulated</a> and sent directly to the real servers once the load balancer receives them.  This removes the restriction that all of the devices must be on the same network.  Thanks to encapsulation, you can use this method to load balance between multiple datacenters.</p>
<p><strong>LVS-NAT: Network Address Translation</strong><br />
Using NAT for LVS yields the least performance and scaling of all of the implementation options.  In this configuration, the incoming requests are rewritten so that they will be transported correctly in a NAT environment.  This puts a bigger burden on the load balancer as it must rewrite the requests quickly while still keeping up with how much work is being done by each web server.</p>
<hr />
<strong>Looking for a Linux Virtual Server HOWTO?</strong> Stay tuned.  I'm preparing one for my next post.</p>
<p><a href="http://rackerhacker.com/2010/06/27/modern-implementation-and-explanation-of-linux-virtual-server-lvs/">A modern implementation and explanation of Linux Virtual Server (LVS)</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2010/06/27/modern-implementation-and-explanation-of-linux-virtual-server-lvs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A New Year System Administrator Inspiration</title>
		<link>http://rackerhacker.com/2010/01/03/a-new-year-system-administrator-inspiration/</link>
		<comments>http://rackerhacker.com/2010/01/03/a-new-year-system-administrator-inspiration/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 02:53:53 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1104</guid>
		<description><![CDATA[Happy New Year! I certainly hope it's a great one for you, your family, and your business. As the new year begins, I figured it would be a good time to sit down and answer a question that I hear very often: How do I become a better systems administrator? The best way to become [...]<p><a href="http://rackerhacker.com/2010/01/03/a-new-year-system-administrator-inspiration/">A New Year System Administrator Inspiration</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Happy New Year!  I certainly hope it's a great one for you, your family, and your business.  As the new year begins, I figured it would be a good time to sit down and answer a question that I hear very often:</p>
<p><em>How do I become a better systems administrator?</em></p>
<p>The best way to become a better systems administrator is to <strong>fully understand the theory</strong> of what's happening in your server's environment.</p>
<p>What do I mean by that?  Learn why things aren't happening as you expected and think about all of the factors that could possibly be involved.  Instead of thinking purely about cause and effect, you'll find it much easier and rewarding to consider everything inside and outside your environment before you make any changes.</p>
<p>This still may be a little difficult to fully understand, so he's an example.  Let's say you're handling an issue where a customer can't reach a website hosted on their server.  When you ask them for more details, they might give you the dreaded reply: "It's not coming up."  Start by making a mental list of the problems that are easiest to check:</p>
<ul>
<li>Is the web server daemon running?</li>
<li>If a database server is being used, is it running and accessible?</li>
<li>Is there a software/hardware firewall blocking port 80?</li>
<li>Is a script stuck on the server tying up resources?</li>
<li>Could there be a DNS resolution problem?</li>
<li>Is the server up?</li>
<li>Did a switch fail?</li>
<li>Is the server's hard disk out of space?</li>
<li>Can the customer reach other websites like Google or Yahoo?</li>
<li>If SELinux is involved, have the appropriate contexts been set?</li>
<li>Could the site be a target of a denial of service attack?</li>
<li>Has the server reached its connection tracking limit?</li>
</ul>
<p>Of course, this is a relatively short list, but these are all easy to check.  If you're thinking about cause and effect, you might only consider the web server daemon and some basic network issues.  By considering all of the other factors that may be related, you've ensured that all of the basics are covered before you consider more complex problems.</p>
<p>Most systems administrators have taken an error message and tossed it in en masse into Google before.  Occasionally, no results will appear for the search.  If you find yourself in this situation, try to understand the individual parts of the error message.  Work outward from what you know already.  You should know which daemon said it, and you may have an idea of what the application was doing when the error occurred.  Take time to consider what the daemon is trying to tell you within the context of what it was doing at the time.</p>
<p>One of the easiest ways to force yourself to be immersed into this way of thinking is to host applications for non-technical people.  You'll find that many customers want things done differently, and they're all at different levels of technical aptitude.  Some may find it a frustrating experience at first, but you'll think yourself later.  It will force you to consider all aspects of how a server operates since you might not always know what's happening within a customer's application.</p>
<p>As always, if you find yourself stumbling, remember to ask your peers and colleagues.  Even if they haven't seen the particular issue, they will probably be able to guide you closer to the solution you seek.</p>
<p><a href="http://rackerhacker.com/2010/01/03/a-new-year-system-administrator-inspiration/">A New Year System Administrator Inspiration</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2010/01/03/a-new-year-system-administrator-inspiration/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Automatically loading iptables rules on Debian/Ubuntu</title>
		<link>http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/</link>
		<comments>http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 04:39:52 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=1039</guid>
		<description><![CDATA[If you want your iptables rules automatically loaded every time your networking comes up on your Debian or Ubuntu server, you can follow these easy steps. First, get your iptables rules set up the way you like them. Once you've verified that everything works, save the rules: iptables-save &#62; /etc/firewall.conf Next, open up /etc/network/if-up.d/iptables in [...]<p><a href="http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/">Automatically loading iptables rules on Debian/Ubuntu</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>If you want your iptables rules automatically loaded every time your networking comes up on your Debian or Ubuntu server, you can follow these easy steps.</p>
<p>First, get your iptables rules set up the way you like them.  Once you've verified that everything works, save the rules:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">iptables-save &gt; /etc/firewall.conf</pre></div></div>

<p>Next, open up <code>/etc/network/if-up.d/iptables</code> in your favorite text editor and add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
iptables-restore <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>firewall.conf</pre></div></div>

</pre>
<p>Once you save it, make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">chmod +x /etc/network/if-up.d/iptables</pre></div></div>

<p>Now, the rules will be restored each time your networking scripts start (or restart).  If you need to save changes to your rules in the future, you can manually edit <code>/etc/firewall.conf</code> or you can adjust your rules live and run:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">iptables-save &gt; /etc/firewall.conf</pre></div></div>

<p><em>Thanks to <a href="http://twitter.com/ajmesserli">Ant</a> for this handy tip.</em></p>
<p><a href="http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/">Automatically loading iptables rules on Debian/Ubuntu</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2009/11/16/automatically-loading-iptables-on-debianubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Get the public-facing IP for any server with icanhazip.com</title>
		<link>http://rackerhacker.com/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/</link>
		<comments>http://rackerhacker.com/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 13:41:38 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=963</guid>
		<description><![CDATA[There are a ton of places on the internet where you can check the public-facing IP for the device you are using. I've used plenty of them, but I've always wanted one that just returned text. You can get pretty close with checkip.dyndns.org, but there is still HTML in the output: $ curl checkip.dyndns.org &#60;html&#62;&#60;head&#62;&#60;title&#62;Current [...]<p><a href="http://rackerhacker.com/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/">Get the public-facing IP for any server with icanhazip.com</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>There are a ton of places on the internet where you can check the public-facing IP for the device you are using.  I've used plenty of them, but I've always wanted one that just returned text.  You can get pretty close with <a href="http://checkip.dyndns.org/">checkip.dyndns.org</a>, but there is still HTML in the output:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ curl checkip.dyndns.org
&lt;html&gt;&lt;head&gt;&lt;title&gt;Current IP Check&lt;/title&gt;&lt;/head&gt;&lt;body&gt;Current IP Address: 174.143.240.31&lt;/body&gt;&lt;/html&gt;</pre></div></div>

<p>I wanted something simpler, so I set up <a href="http://icanhazip.com/">icanhazip.com</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ curl icanhazip.com
174.143.240.31</pre></div></div>

<p><a href="http://rackerhacker.com/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/">Get the public-facing IP for any server with icanhazip.com</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2009/07/31/get-the-public-facing-ip-for-any-server-with-icanhazip-com/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Plesk Professional Website Editor hangs at login</title>
		<link>http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/</link>
		<comments>http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 18:11:57 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[networking]]></category>
		<category><![CDATA[plesk]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/</guid>
		<description><![CDATA[One of my biggest Plesk gripes is dealing with the Plesk Professional Website Editor. One of the most common occurrences with PPWSE is that it hangs when you attempt to log into the server. Normally, this happens when a server is behind a firewall, and it is using private IP's. Plesk will actually query the [...]<p><a href="http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/">Plesk Professional Website Editor hangs at login</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></description>
			<content:encoded><![CDATA[<p>One of my biggest Plesk gripes is dealing with the Plesk Professional Website Editor.  One of the most common occurrences with PPWSE is that it hangs when you attempt to log into the server.  Normally, this happens when a server is behind a firewall, and it is using private IP's.</p>
<p>Plesk will actually query the DNS for the domain (rather than simply connecting to the localhost), try to reach the public IP, and the traffic will be blocked by the firewall.  This creates a login session that appears to hang, and then it shows "FTP: not connected" in the interface.</p>
<p>The fix is actually quite easy:</p>
<p>1) Be sure that the ftp.domain.com CNAME/A record exists<br />
2) Add a line to /etc/hosts that forces ftp.domain.com to resolve to the proper private IP address.</p>
<p>The third item should be to stop using PPWSE, but that's the hardest one to work out.  I'd recommend using something like <a href="http://macromates.com/">TextMate</a> on a <a href="http://www.apple.com/macbookpro/">Mac</a> along with <a href="http://www.panic.com/transmit/">Transmit</a>, but you can get some good results out of Dreamweaver as well.  Whatever you do, don't use Contribute.</p>
<p><a href="http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/">Plesk Professional Website Editor hangs at login</a> is a post from: Major Hayden's <a href="http://rackerhacker.com">Racker Hacker</a> blog. 
<p>Thanks for following the blog via the RSS feed. Please don't copy my posts or quote portions of them without attribution.</p></p>
]]></content:encoded>
			<wfw:commentRss>http://rackerhacker.com/2008/03/13/plesk-professional-website-editor-hangs-at-login/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

