<?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; sysadmin</title>
	<atom:link href="http://rackerhacker.com/tag/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Tue, 07 Feb 2012 14:07:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>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>3</slash:comments>
		</item>
		<item>
		<title>Create a local PyPi repository using only mod_rewrite</title>
		<link>http://rackerhacker.com/2012/01/31/create-a-local-pypi-repository-using-only-mod_rewrite/</link>
		<comments>http://rackerhacker.com/2012/01/31/create-a-local-pypi-repository-using-only-mod_rewrite/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 04:02:49 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2861</guid>
		<description><![CDATA[Regular users of Python's package tools like pip or easy_install are probably familiar with the PyPi repository. It's a one-stop-shop to learn more about available Python packages and get them installed on your server. However, certain folks may find the need to host a local PyPi repository for their own packages. You may need it [...]<p><a href="http://rackerhacker.com/2012/01/31/create-a-local-pypi-repository-using-only-mod_rewrite/">Create a local PyPi repository using only mod_rewrite</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>Regular users of Python's package tools like <a href="http://pypi.python.org/pypi/pip">pip</a> or <a href="http://pypi.python.org/pypi/setuptools">easy_install</a> are probably familiar with the <a href="http://pypi.python.org/pypi">PyPi</a> repository.  It's a one-stop-shop to learn more about available Python packages and get them installed on your server.</p>
<p>However, certain folks may find the need to host a local PyPi repository for their own packages.  You may need it to store Python code which you don't plan to release publicly or you may need to add proprietary patches to upstream Python packages.  Regardless of the reason to have it, a local PyPi repository is relatively easy to configure.</p>
<p>You'll need to start with a base directory for your PyPi repository.  For this example, I chose <code>/var/pypi</code>.  The directory structure should look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/var/pypi/simple/[package_name]/[package_tarball]</pre></div></div>

<p>For a package like <code>pip</code>, you'd make a structure like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/var/pypi/simple/pip/pip-1.0.2.tar.gz</pre></div></div>

<p>Once you have at least one package stored locally, it's time to configure apache.  Here's a snippet from the virtual host I configured:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">DocumentRoot /var/pypi/
ServerName pypi.example.com
&nbsp;
Options +Indexes
&nbsp;
RewriteEngine On
RewriteRule ^/robots.txt - [L]
RewriteRule ^/icons/.* - [L]
RewriteRule ^/index\..* - [L]
&nbsp;
RewriteCond /var/pypi/$1 !-f
RewriteCond /var/pypi/$1 !-d
RewriteRule ^/(.*)/?$ http://pypi.python.org/$1 [R,L]</pre></div></div>

<p>The last set of rewrite directives check to see if the request refers to an existing file or directory under your document root.  If it does, your server will reply with a directory listing or with the actual file to download.  If the directory or file doesn't exist, apache will send the client a redirection to the main PyPi site.</p>
<p>Reload your apache configuration to bring in your new changes.  Let's try to download the <code>pip</code> tarball from our local server in the example I mentioned above:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ curl -I http://pypi.example.com/simple/pip/
HTTP/1.1 200 OK
&nbsp;
$ curl -I http://pypi.example.com/simple/pip/pip-1.0.2.tar.gz
HTTP/1.1 200 OK</pre></div></div>

<p>I've obviously snipped a bit of the response above, but you can see that apache is responding with 200's since it has the directories and files that I was trying to retrieve via curl.  Let's try to get something we don't have locally, like <code>kombu</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">$ curl -I http://pypi.example.com/simple/kombu/
HTTP/1.1 302 Found
Location: http://pypi.python.org/simple/kombu/</pre></div></div>

<p>Our local PyPi repository doesn't have <code>kombu</code> so it will refer our Python tools over to the official PyPi repository to get the listing of available package versions for <code>kombu</code>.</p>
<p>Now we need to tell <code>pip</code> to use our local repository.  Edit <code>~/.pip/pip.conf</code> and add:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[global]
index-url = http://pypi.example.com/simple/</pre></div></div>

<p>If you'd rather use <code>easy_install</code>, edit <code>~/.pydistutils.cfg</code> and add:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[easy_install]
index_url = http://pypi.example.com/simple/</pre></div></div>

<p>Once your tools are configured, try installing a package you have locally and try to install one that you know you won't have locally.  You can add <code>-v</code> to <code>pip install</code> to watch it retrieve different URL's to get the packages it needs.  If you spot any peculiar behavior or unexpected redirections, double-check your mod_rewrite rules in your apache configuration and check the spelling of your directories under your document root.</p>
<p><a href="http://rackerhacker.com/2012/01/31/create-a-local-pypi-repository-using-only-mod_rewrite/">Create a local PyPi repository using only mod_rewrite</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/01/31/create-a-local-pypi-repository-using-only-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with SELinux</title>
		<link>http://rackerhacker.com/2012/01/25/getting-started-with-selinux/</link>
		<comments>http://rackerhacker.com/2012/01/25/getting-started-with-selinux/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 04:28:41 +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[red hat]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[seliux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2838</guid>
		<description><![CDATA[I used to be one of those folks who would install Fedora, CentOS, Scientific Linux, or Red Hat and disable SELinux during the installation. It always seemed like SELinux would get in my way and keep me from getting work done. Later on, I found that one of my servers (which I'd previously secured quite [...]<p><a href="http://rackerhacker.com/2012/01/25/getting-started-with-selinux/">Getting started with SELinux</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 used to be one of those folks who would install Fedora, CentOS, Scientific Linux, or Red Hat and disable SELinux during the installation.  It always seemed like SELinux would get in my way and keep me from getting work done.  </p>
<p>Later on, I found that one of my servers (which I'd previously secured quite thoroughly) had some rogue processes running that were spawned through httpd.  Had I actually been using SELinux in enforcing mode, those processes would have probably never even started.</p>
<p>If you're trying to get started with SELinux but you're not sure how to do it without completely disrupting your server's workflow, these tips should help:</p>
<p><b>Get some good reporting and monitoring</b><br />
Two of the most handy SELinux tools are <a href="https://fedorahosted.org/setroubleshoot/">setroubleshoot and setroubleshoot-server</a>.  If you're running a server without X, you can use <a href="/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/">my guide for configuring setroubleshoot-server</a>.  You will receive email alerts within seconds of an AVC denial and the emails should contain tips on how to resolve the denial if the original action should be allowed.  If the AVC denial caught something you didn't expect, you'll know about the potential security breach almost immediately.</p>
<p><b>Start out with SELinux in permissive mode</b><br />
If you're overly concerned about SELinux getting in your way, or if you're enabling SELinux on a server that has been running without SELinux since it was installed, start out with SELinux in permissive mode.  To make the change effective immediately, just run:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># setenforce 0
# getenforce
Permissive</pre></div></div>

<p>Edit <code>/etc/sysconfig/selinux</code> to make it persistent across reboots:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive</pre></div></div>

<p><b>Adjust booleans before adding your own custom modules</b><br />
There are a lot of booleans you can toggle to get the functionality you need without adding your own custom SELinux modules with <code>audit2allow</code>.  If you wanted to see all of the applicable booleans for <code>httpd</code>, just use <code>getsebool</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># getsebool -a | grep httpd
httpd_builtin_scripting --&gt; on
httpd_can_check_spam --&gt; off
httpd_can_network_connect --&gt; on
httpd_can_network_connect_cobbler --&gt; off
httpd_can_network_connect_db --&gt; off
httpd_can_network_memcache --&gt; off
httpd_can_network_relay --&gt; on
httpd_can_sendmail --&gt; on
... and so on ...</pre></div></div>

<p>Toggling booleans is easy with <code>togglesebool</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># togglesebool httpd_can_network_memcache
httpd_can_network_memcache: active</pre></div></div>

<p>Now <code>httpd</code> can talk to <code>memcache</code>.  You can also use <code>setsebool</code> if you want to be specific about your setting (this is good for scripts):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># setsebool httpd_can_network_memcache on</pre></div></div>

<p><b>Tracking your history of AVC denials</b><br />
All of your AVC denals are logged by <code>auditd</code> in <code>/var/log/audit/audit.log</code> but it's not the easiest file to read and parse.  That's where <code>aureport</code> comes in:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># aureport --avc | tail -n 5
45. 01/24/2012 04:23:29 postdrop unconfined_u:system_r:httpd_t:s0 4 fifo_file getattr system_u:object_r:postfix_public_t:s0 denied 1061
46. 01/24/2012 04:23:29 postdrop unconfined_u:system_r:httpd_t:s0 2 fifo_file write system_u:object_r:postfix_public_t:s0 denied 1062
47. 01/24/2012 04:23:29 postdrop unconfined_u:system_r:httpd_t:s0 2 fifo_file open system_u:object_r:postfix_public_t:s0 denied 1062
48. 01/24/2012 14:01:58 sendmail unconfined_u:system_r:httpd_t:s0 160 process setrlimit unconfined_u:system_r:httpd_t:s0 denied 1123
49. 01/24/2012 14:01:58 postdrop unconfined_u:system_r:httpd_t:s0 4 dir search system_u:object_r:postfix_public_t:s0 denied 1124</pre></div></div>

<p><b>Summary</b><br />
There's no need to be scared of or be annoyed by SELinux in your server environment.  While it takes some getting used to (and what new software doesn't?), you'll have an extra layer of security and access restrictions which should let you sleep a little better at night.</p>
<p><a href="http://rackerhacker.com/2012/01/25/getting-started-with-selinux/">Getting started with SELinux</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/01/25/getting-started-with-selinux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fight SOPA &amp; PIPA</title>
		<link>http://rackerhacker.com/2012/01/12/fight-sopa-and-pipa/</link>
		<comments>http://rackerhacker.com/2012/01/12/fight-sopa-and-pipa/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 13:36:38 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[sopa]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2816</guid>
		<description><![CDATA[Get informed about what the US government is trying to accomplish with SOPA and PIPA. Get involved and do what you can to prevent it from moving any further. WordPress > Help Stop SOPA/PIPA Reddit - SOPA Stop American Censorship Wikipedia - Stop Online Piracy Act EFF - Take Action Why Rackspace opposes the Stop [...]<p><a href="http://rackerhacker.com/2012/01/12/fight-sopa-and-pipa/">Fight SOPA &#038; PIPA</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/01/sopacantspelldns.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2012/01/sopacantspelldns.jpg" alt="SOPA - M. Chairman, with all due respect, you can&#039;t even spell DNS." title="SOPA - M. Chairman, with all due respect, you can&#039;t even spell DNS." width="625" height="374" class="alignnone size-full wp-image-2817" /></a></p>
<p>Get informed about what the US government is trying to accomplish with SOPA and PIPA.  Get involved and do what you can to prevent it from moving any further.</p>
<ul>
<li><a href="http://wordpress.org/news/2012/01/help-stop-sopa-pipa/">WordPress > Help Stop SOPA/PIPA</a></li>
<li><a href="http://reddit.com/r/sopa">Reddit - SOPA</a></li>
<li><a href="http://americancensorship.org/">Stop American Censorship</a></li>
<li><a href="http://en.wikipedia.org/wiki/Stop_Online_Piracy_Act">Wikipedia - Stop Online Piracy Act</a></li>
<li><a href="https://action.eff.org/o/9042/p/dia/action/public/?action_KEY=8173">EFF - Take Action</a></li>
<li><a href="http://www.rackspace.com/cloud/blog/2011/12/24/why-rackspace-opposes-the-%E2%80%9Cstop-online-piracy-act%E2%80%9D/">Why Rackspace opposes the Stop Online Piracy Act</a></li>
<li><a href="http://www.mozilla.org/sopa/">Mozilla - Protect The Internet</a></li>
</ul>
<p>You may need a little humor after all of that reading.  Head on over to <a href="http://knowyourmeme.com/memes/events/protect-ip-act-stop-online-piracy-act">Know Your Meme</a> (warning: NSFW language in certain areas) for a laugh.</p>
<p><a href="http://rackerhacker.com/2012/01/12/fight-sopa-and-pipa/">Fight SOPA &#038; PIPA</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/01/12/fight-sopa-and-pipa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SELinux and .forward files</title>
		<link>http://rackerhacker.com/2012/01/02/selinux-and-forward-files/</link>
		<comments>http://rackerhacker.com/2012/01/02/selinux-and-forward-files/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 22:44:43 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2680</guid>
		<description><![CDATA[If you want to forward e-mail from root to another user, you can usually place a .forward file in root's home directory and your mail server will take care of the rest: echo &#34;user@example.com&#34; &#62; /root/.forward With SELinux, you'll end up getting an AVC denial each time your mail server tries to read the contents [...]<p><a href="http://rackerhacker.com/2012/01/02/selinux-and-forward-files/">SELinux and .forward files</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 to forward e-mail from root to another user, you can usually place a <code>.forward</code> file in root's home directory and your mail server will take care of the rest:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">echo &quot;user@example.com&quot; &gt; /root/.forward</pre></div></div>

<p>With SELinux, you'll end up getting an AVC denial each time your mail server tries to read the contents of the <code>.forward</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">type=AVC msg=audit(1325543823.787:7416): avc:  denied  { open } for  pid=9850 
  comm=&quot;local&quot; name=&quot;.forward&quot; dev=md0 ino=17694734 
  scontext=system_u:system_r:postfix_local_t:s0 
  tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file</pre></div></div>

<p>The reason is that your <code>.forward</code> file doesn't have the right SELinux contexts.  You can set the correct contest quickly with <code>restorecon</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># ls -Z /root/.forward 
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 /root/.forward
# restorecon -v /root/.forward
restorecon reset /root/.forward context unconfined_u:object_r:admin_home_t:s0-&gt;system_u:object_r:mail_forward_t:s0
# ls -Z /root/.forward 
-rw-r--r--. root root system_u:object_r:mail_home_t:s0 /root/.forward</pre></div></div>

<p>Try to send another e-mail to root and you should see the mail server forward the e-mail properly without any additional AVC denials.</p>
<p><a href="http://rackerhacker.com/2012/01/02/selinux-and-forward-files/">SELinux and .forward files</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/01/02/selinux-and-forward-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Live upgrade Fedora 15 to Fedora 16 using yum</title>
		<link>http://rackerhacker.com/2011/11/14/live-upgrading-fedora-15-to-fedora-16-using-yum/</link>
		<comments>http://rackerhacker.com/2011/11/14/live-upgrading-fedora-15-to-fedora-16-using-yum/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 04:37:39 +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[linux]]></category>
		<category><![CDATA[preupgrade]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[scientific linux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2623</guid>
		<description><![CDATA[Before we get started, I really ought to drop this here: Upgrading Fedora via yum is not the recommended method. Your first choice for upgrading Fedora should be to use preupgrade. Seriously. This begs the question: When should you use another method to upgrade Fedora? What other methods are there? You have a few other [...]<p><a href="http://rackerhacker.com/2011/11/14/live-upgrading-fedora-15-to-fedora-16-using-yum/">Live upgrade Fedora 15 to Fedora 16 using yum</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>Before we get started, I really ought to drop this here:</p>
<blockquote style="color: red; font-weight: bold;"><p>Upgrading Fedora via yum is <u>not</u> the recommended method.  Your first choice for upgrading Fedora should be to use <code>preupgrade</code>.  Seriously.</p></blockquote>
<p><a href="http://rackerhacker.com/wp-content/uploads/2011/11/Logo_fedoralogo.png"><img src="http://rackerhacker.com/wp-content/uploads/2011/11/Logo_fedoralogo-300x91.png" alt="" title="Logo_fedoralogo" width="300" height="91" class="alignright size-medium wp-image-2662" /></a>This begs the question: <em>When should you use another method to upgrade Fedora? What other methods are there?</em></p>
<p>You have a few other methods to get the upgrade done:</p>
<ul>
<li><strong>Toss in a CD or DVD:</strong> You can upgrade via the anaconda installer provided on the CD, DVD or netinstall media.  My experiences with this method for Fedora (as well as CentOS, Scientific Linux, and Red Hat) haven't been too positive, but your results may vary.</li>
<li><strong>Download the newer release's fedora-release RPM, install it with <code>rpm</code>, and <code>yum upgrade</code>:</strong> This is the really old way of doing things.  Don't try this (read the next bullet).</li>
<li><strong>Use <code>yum</code>'s distro-sync functionality:</strong> If you can't go the <code>preupgrade</code> route, I'd recommend giving this a try.  However, leave plenty of time to fix small glitches after it's done (and after your first reboot).</li>
</ul>
<p><strong>Personal anecdote time</strong> <em>(Keep scrolling for the meat and potatoes)</em><br />
I have a dedicated server at <a href="http://joesdatacenter.com/">Joe's Datacenter</a> (love those folks) with IPMI and KVM-over-LAN access.  The <code>preupgrade</code> method won't work for me because my <code>/boot</code> partition is on a software RAID volume.  There's a <a href="https://bugzilla.redhat.com/show_bug.cgi?id=504826">rat's nest of a Bugzilla ticket</a> over on Red Hat's site about this problem.  I'm really only left with a live upgrade using <code>yum</code>.</p>
<p><strong>Live <code>yum</code> upgrade process</strong><br />
Before even beginning the upgrade, I double-checked that I'd applied all of the available updates for my server.  Once that was done, I realized I was one kernel revision behind and I rebooted to ensure I was in the latest Fedora 15 kernel.</p>
<p>A good practice here is to run <code>package-cleanup --orphans</code> (it's in the <code>yum-utils</code> package) to find any packages which don't exist on any Fedora mirrors.  In my case, I had two old kernels and a JungleDisk package.  I removed the two old kernels (probably wasn't necessary) and left JungleDisk alone (it worked fine after the upgrade).  If you have any external repositories, such as Livna or RPMForge, you may want to disable those until the upgrade is done.  Should the initial upgrade checks bomb out, try adding as few repositories back in as possible to see if it clears up the problem.</p>
<p>Once you make it this far, just follow the instructions available in Fedora's documentation: <a href="http://fedoraproject.org/wiki/Upgrading_Fedora_using_yum#Fedora_15_-.3E_Fedora_16">Upgrading Fedora using yum</a>.  I set SELinux to permissive mode during the upgrade just in case it caused problems.</p>
<p>I'd recommend skipping the <code>grub2-install</code> portion since your original grub installation will still be present after the upgrade.  If your server has EFI (not BIOS), <b>don't use</b> <code>grub2</code> yet.  Keep an eye on the previously mentioned documentation page to see if the problems get ironed out between <code>grub2</code> and EFI.</p>
<p><b>Before you reboot,</b> be sure to get a list of your active processes and daemons.  After your reboot, some old SysVinit scripts will be converted into Systemd service scripts.  They might not start automatically and you might need to enable and/or start some services.</p>
<p>New to Systemd? This will be an extremely handy resource: <a href="http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet">SysVinit to Systemd Cheatsheet</a>.</p>
<p>I haven't seen too many issues after cleaning up some daemons that didn't start properly.  There is a problem between <code>asterisk</code> and SELinux that I haven't nailed down yet but it's not a showstopper.</p>
<p>Good luck during your upgrades.  Keep in mind that Fedora 15 could be EOL'd as early as May or June 20102 when Fedora 17 is released.</p>
<p><a href="http://rackerhacker.com/2011/11/14/live-upgrading-fedora-15-to-fedora-16-using-yum/">Live upgrade Fedora 15 to Fedora 16 using yum</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/11/14/live-upgrading-fedora-15-to-fedora-16-using-yum/feed/</wfw:commentRss>
		<slash:comments>1</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>4</slash:comments>
		</item>
		<item>
		<title>Receive e-mail reports for SELinux AVC denials</title>
		<link>http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/</link>
		<comments>http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 04:17:04 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[messagebus]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[systemd]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2537</guid>
		<description><![CDATA[SELinux isn't a technology that's easy to tackle for newcomers. However, there's been a lot of work to smooth out the rough edges while still keeping a tight grip on what applications and users are allowed to do on a Linux system. One of the biggest efforts has been around setroubleshoot. The purpose behind setroubleshoot [...]<p><a href="http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/">Receive e-mail reports for SELinux AVC denials</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>SELinux isn't a technology that's easy to tackle for newcomers.  However, there's been a lot of work to smooth out the rough edges while still keeping a tight grip on what applications and users are allowed to do on a Linux system.  One of the biggest efforts has been around <a href="https://fedorahosted.org/setroubleshoot/wiki/SETroubleShoot%20Overview">setroubleshoot</a>.</p>
<p>The purpose behind setroubleshoot is to let users know when access has been denied, help them resolve it if necessary, and to reduce overall frustration while working through tight security restrictions in the default SELinux policies.  The GUI frontend for setroubleshoot is great for users who run Linux desktops or those who run servers with a display attached.  Don't worry, you can configure setroubleshoot on remote servers to send alerts elsewhere when a GUI alert isn't an option.</p>
<p>Install a few packages to get started:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum install setroubleshoot{-server,-plugins,-doc}</pre></div></div>

<p>Open <code>/etc/setroubleshoot/setroubleshoot.conf</code> in your favorite text editor and adjust the <code>[email]</code> section to fit your server:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">recipients_filepath = /var/lib/setroubleshoot/email_alert_recipients
smtp_port = 25
smtp_host = localhost
from_address = selinux@myserver.com
subject = [MyServer] SELinux AVC Alert</pre></div></div>

<p>You could probably see it coming, but you need to put the e-mail addresses for your recipients into <code>/var/lib/setroubleshoot/email_alert_recipients</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">echo &quot;selinux@mycompany.com&quot; &gt;&gt; /var/lib/setroubleshoot/email_alert_recipients</pre></div></div>

<p>You'll notice that setroubleshoot doesn't have an init script and it doesn't exist in systemd in Fedora 15.  It runs through the <a href="http://en.wikipedia.org/wiki/D-Bus">dbus-daemon</a> and a quick bounce of the messagebus via its init script brings in the necessary components to run setroubleshoot:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">service messagebus restart</pre></div></div>

<p>A really easy (and safe) test is to ask sshd to bind to a non-standard port.  Simply define an additional port on in your <code>/etc/ssh/sshd_config</code> like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Port 22
Port 222</pre></div></div>

<p>When you restart sshd, it will bind to port 22 with success, but it won't be allowed to bind to port 222 (since that's blocked by SELinux as a non-standard port for the <code>ssh_port_t</code> port type).  <strong>DON'T WORRY!</strong> Your sshd server will still be listening on port 22.  If you wait a moment, you'll get an e-mail (perhaps two) that not only notify you of the denial, but they make suggestions for how to fix it:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">SELinux is preventing /usr/sbin/sshd from name_bind access on the tcp_socket port 222.
&nbsp;
*****  Plugin bind_ports (99.5 confidence) suggests  *************************
&nbsp;
If you want to allow /usr/sbin/sshd to bind to network port 222
Then you need to modify the port type.
Do
# semanage port -a -t PORT_TYPE -p tcp 222
   where PORT_TYPE is one of the following: ...</pre></div></div>

<p>For this particular example, the quick fix would be to run:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">semanage port -a -t ssh_port_t -p tcp 222</pre></div></div>

<hr />
<em><br />
Much of this post's information was gathered from the detailed documentation on <a href="http://fedoraproject.org/wiki/Docs/Drafts/SELinux/SETroubleShoot/UserFAQ">Fedora's setroubleshoot User's FAQ</a> as well as <a href="http://danwalsh.livejournal.com/20931.html">Dan Walsh's setroubleshoot blog post</a>.<br />
</em></p>
<p><a href="http://rackerhacker.com/2011/09/15/receive-e-mail-reports-for-selinux-avc-denials/">Receive e-mail reports for SELinux AVC denials</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/15/receive-e-mail-reports-for-selinux-avc-denials/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting apache, PHP, and memcached working with SELinux</title>
		<link>http://rackerhacker.com/2011/09/07/getting-apache-php-and-memcached-working-with-selinux/</link>
		<comments>http://rackerhacker.com/2011/09/07/getting-apache-php-and-memcached-working-with-selinux/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 03:55:00 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[selinux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2516</guid>
		<description><![CDATA[I'm using SELinux more often now on my Fedora 15 installations and I came up against a peculiar issue today on a new server. My PHP installation is configured to store its sessions in memcached and I brought over some working configurations from another server. However, each time I accessed a page which tried to [...]<p><a href="http://rackerhacker.com/2011/09/07/getting-apache-php-and-memcached-working-with-selinux/">Getting apache, PHP, and memcached working with SELinux</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/2011/09/selinux-penguin-125.png"><img src="http://rackerhacker.com/wp-content/uploads/2011/09/selinux-penguin-125.png" alt="SELinux Penguin" title="SELinux Penguin" width="125" height="113" class="alignright size-full wp-image-2532" /></a>I'm using SELinux more often now on my Fedora 15 installations and I came up against a peculiar issue today on a new server.  My PHP installation is configured to store its sessions in memcached and I brought over some working configurations from another server.  However, each time I accessed a page which tried to initiate a session, the page load would hang for about a minute and I'd find this in my apache error logs:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[Thu Sep 08 03:23:40 2011] [error] [client 11.22.33.44] PHP Warning:  
Unknown: Failed to write session data (memcached). Please verify that 
the current setting of session.save_path is correct (127.0.0.1:11211) 
in Unknown on line 0</pre></div></div>

<p>I ran through my usual list of checks:</p>
<ul>
<li>netstat showed memcached bound to the correct ports/interfaces</li>
<li>memcached was running and I could reach it via telnet</li>
<li>memcached-tool could connect and pull stats from memcached</li>
<li>double-checked my php.ini</li>
<li>tested memcached connectivity via a PHP and ruby script -- they worked</li>
</ul>
<p>Even after all that, I still couldn't figure out what was wrong.  I ran strace on memcached while I ran a curl against the page which creates a session and I found something significant -- memcached wasn't seeing any connections whatsoever at that time.  A quick check of the lo interface with tcpdump showed the same result.  Just before I threw a chair, I remembered one thing:</p>
<p><em>SELinux.</em></p>
<p>A quick check for AVC denials showed the problem:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># aureport --avc | tail -n 1
4021. 09/08/2011 03:23:38 httpd system_u:system_r:httpd_t:s0 42 tcp_socket name_connect system_u:object_r:memcache_port_t:s0 denied 31536</pre></div></div>

<p>I'm far from being a guru on SELinux, so I leaned on audit2allow for help:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># grep memcache /var/log/audit/audit.log | audit2allow
&nbsp;
#============= httpd_t ==============
#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_relay, httpd_can_network_memcache, httpd_can_network_connect
&nbsp;
allow httpd_t memcache_port_t:tcp_socket name_connect;</pre></div></div>

<p>The boolean we're looking for is <code>httpd_can_network_memcache</code>. Flipping the boolean can be done in a snap:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># setsebool -P httpd_can_network_memcache 1
# getsebool httpd_can_network_memcache
httpd_can_network_memcache --&gt; on</pre></div></div>

<p>After adjusting the boolean, apache was able to make connections to memcached without a hitch.  My page which created sessions loaded quickly and I could see data being stored in memcached.  If you want to check the status of all of the apache-related SELinux booleans, just use getsebool:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># getsebool -a | grep httpd | grep off$
allow_httpd_anon_write --&gt; off
allow_httpd_mod_auth_ntlm_winbind --&gt; off
allow_httpd_mod_auth_pam --&gt; off
allow_httpd_sys_script_anon_write --&gt; off
httpd_can_check_spam --&gt; off
httpd_can_network_connect_cobbler --&gt; off
httpd_can_network_connect_db --&gt; off
httpd_can_network_relay --&gt; off
httpd_can_sendmail --&gt; off
httpd_dbus_avahi --&gt; off
httpd_enable_ftp_server --&gt; off
httpd_enable_homedirs --&gt; off
httpd_execmem --&gt; off
httpd_read_user_content --&gt; off
httpd_setrlimit --&gt; off
httpd_ssi_exec --&gt; off
httpd_tmp_exec --&gt; off
httpd_unified --&gt; off
httpd_use_cifs --&gt; off
httpd_use_gpg --&gt; off
httpd_use_nfs --&gt; off</pre></div></div>

<p>If you're interested in SELinux, a good way to get your feet wet is to head over to the CentOS Wiki and review their <a href="http://wiki.centos.org/HowTos/SELinux">SELinux Howtos</a></p>
<p><a href="http://rackerhacker.com/2011/09/07/getting-apache-php-and-memcached-working-with-selinux/">Getting apache, PHP, and memcached working with SELinux</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/07/getting-apache-php-and-memcached-working-with-selinux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to write e-mails to nerds (that they will actually read)</title>
		<link>http://rackerhacker.com/2011/08/26/how-to-write-e-mails-to-nerds-that-they-will-actually-read/</link>
		<comments>http://rackerhacker.com/2011/08/26/how-to-write-e-mails-to-nerds-that-they-will-actually-read/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 13:00:06 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2469</guid>
		<description><![CDATA[Standard e-mail etiquette is pretty obvious to most of us and if you're good at it, you'll get your point across more often without stepping on toes or causing unneeded confusion. Simple things like identifying yourself well, avoiding sarcasm and adding context to statements are all extremely beneficial. However, writing e-mails to highly technical developers, [...]<p><a href="http://rackerhacker.com/2011/08/26/how-to-write-e-mails-to-nerds-that-they-will-actually-read/">How to write e-mails to nerds (that they will actually read)</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>Standard e-mail etiquette is pretty obvious to most of us and if you're good at it, you'll get your point across more often without stepping on toes or causing unneeded confusion.  Simple things like identifying yourself well, avoiding sarcasm and adding context to statements are all extremely beneficial.  However, writing e-mails to highly technical developers, system administrators, and engineers is a little trickier.  These types of e-mail recipients don't really enjoy handling e-mail (inbound or outbound) and most find that e-mail is just a speed bump which interrupts their productivity.</p>
<p>If you're not technical, you might be asking yourself: <em>"I need to e-mail technical people and they need to take what I say seriously?  How do I do it?"</em>  It's not impossible, but the rest of this blog post should help.</p>
<h3>Brevity is key</h3>
<p>There are some people who thrive on receiving e-mail, sending e-mail, and talking about e-mail that they've sent or received.  Most nerds don't feel this way.</p>
<p>You need to get your point across concisely and succinctly so that your e-mail is seen as less of a distraction.  Avoid adding a lot of context where it isn't needed and try to summarize business needs and processes unless details are absolutely critical.  If you need to send your e-mail to multiple recipients and some of those recipients need additional details, provide an abstract at the beginning of the e-mail.</p>
<h3>Learn the ways of TL;DR</h3>
<p>I've heard quite a few conversations like these around the office:</p>
<blockquote><p>
Nerd 1: "Did you get that e-mail from [name here]?"<br />
Nerd 2: "The six page one with four PDF files attached?"<br />
Nerd 1: "Yeah. That one."<br />
Nerd 2: "TL;DR dude, seriously. Did you read it?"<br />
Nerd 1: "Nah. I might read it later."
</p></blockquote>
<p>If someone's ever mentioned "TL;DR" (too long; didn't read) when your e-mail was mentioned, don't fret.  It's a quick fix.  Just add a quick summary to the top of your e-mail prefaced with "TL;DR".  Provide a really brief summary (bulleted lists are a plus) of your e-mail in the section and then start your e-mail right afterwards.  Here's an example:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">TL;DR
  * next software release deploys Monday
  * two bugs remaining to fix
  * we will get started at 8AM Saturday, yeaaaaah</pre></div></div>

<p><em>Missed the joke? <a href="http://en.wikipedia.org/wiki/Bill_Lumbergh">Head over to Wikipedia</a>.</em></p>
<p>If one of the summary points interests a recipient, they'll scan your e-mail for the pertinent sections.  Some recipients may only need to see what's in the summary and they won't bother reading the remainder.  Either way, the effectiveness of your e-mail increases by leaps and bounds.</p>
<h3>Plain text</h3>
<p><div id="attachment_2483" class="wp-caption alignright" style="width: 310px"><a href="http://rackerhacker.com/wp-content/uploads/2011/08/mutt-screenshots_001.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2011/08/mutt-screenshots_001-300x195.jpg" alt="" title="mutt-screenshots_001" width="300" height="195" class="size-medium wp-image-2483" /></a><p class="wp-caption-text">Users of mutt prefer plain text e-mails</p></div>If you only take away one thing from this entire post, let it be this section.  Writing e-mails in plain text is *highly recommended* if you want a technical person to take your e-mail seriously.  Many system administrators I know use <a href="http://www.mutt.org/">mutt</a>, a text-based console-only e-mail reader.  Click the thumbnail at the right and imagine what your e-mails would look like if they're full of images, stylesheets and background images.  Better yet, imagine if your entire e-mail was in an image and the e-mail itself had no text.</p>
<p>Here are a few more tips under this category:</p>
<ul>
<li>Don't use Outlook stationery.</li>
<li>Never send e-mails with an image as the e-mail itself.</li>
<li><strong>No Comic Sans at any time. Period.</strong></li>
<li>Avoid graphical e-mail signatures (more on that in a moment).</li>
</ul>
<h3>E-mail signatures</h3>
<p>Brevity can definitely be applied to e-mail signatures, too.  How many times have you seen e-mails that end like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Frank Frankelton MCSE, RHCSA, RHCE, CCNA, RHCA, LPIC-3, Ph.D., M.D., Esq., CMDBA
Systems Adminstrator Extraordinaire, Database Administrator, All-around great guy
Office: 210-555-1212
Mobile: 210-555-1213
Other Mobile: 210-555-1214
Fax: 210-555-1215
VOIP: 210-555-1216
AIM: frankeltonia
Twitter: @frankyfrank
Jabber: frankfurter@frankeltonisinthehouse.com
Big Company, Inc</pre></div></div>

<p>You might think that nobody would ever send out e-mails with a signature like the one above, but I've seen some that are actually worse.  Keep the signature short and only put in the information that people really need to know.  Generally, your name and title or department is sufficient for e-mail signatures (unless your local/federal laws require otherwise).  Always preface it with a double dash "--" on a line by itself to signify that the remainder of the e-mail is the signature.</p>
<h3>Summary</h3>
<p>Keep it simple, keep it brief, and keep it relevant.  While the suggestions above might not apply to every business or every person, following the suggestions will increase the effectiveness of your e-mails and ensure that your voice is heard on the other end.</p>
<p>I'm really interested to hear your comments.  Are there some suggestions you have that I missed in the post?  Did I make some suggestions which didn't make sense or don't apply to you?  Let me know!</p>
<p><a href="http://rackerhacker.com/2011/08/26/how-to-write-e-mails-to-nerds-that-they-will-actually-read/">How to write e-mails to nerds (that they will actually read)</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/08/26/how-to-write-e-mails-to-nerds-that-they-will-actually-read/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Contest winners from the &quot;Inspire a sysadmin&quot; contest</title>
		<link>http://rackerhacker.com/2011/08/22/contest-winners-from-the-inspire-a-sysadmin-contest/</link>
		<comments>http://rackerhacker.com/2011/08/22/contest-winners-from-the-inspire-a-sysadmin-contest/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 12:43:53 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2442</guid>
		<description><![CDATA[Before I get started, I'd like to give a big thanks to all of the visitors who dropped by and participated in the contest last week. Also, thanks to ThinkGeek for offering to pay for (and double) one of the prizes! Here are the list of winners: Grand Prize ($50 at ThinkGeek): Dan Udey Runners-Up [...]<p><a href="http://rackerhacker.com/2011/08/22/contest-winners-from-the-inspire-a-sysadmin-contest/">Contest winners from the "Inspire a sysadmin" contest</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>Before I get started, I'd like to give a big thanks to all of the visitors who dropped by and <a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/">participated in the contest</a> last week.  Also, thanks to <a href="http://thinkgeek.com/">ThinkGeek</a> for offering to pay for (and double) one of the prizes!</p>
<p>Here are the list of winners:</p>
<ul>
<li>Grand Prize ($50 at ThinkGeek): <strong>Dan Udey</strong></li>
<li>Runners-Up ($25 at ThinkGeek): <strong>Joe Wright, Susan Price, and Giovanni Tirloni</strong></li>
</ul>
<p><a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/#comment-23915">Dan's comment rang true</a> with me since much of a sysadmin's job involves responding to crises regardless of how much planning you put forth:</p>
<blockquote><p>Keep a cool head. Focus. Work methodically. Figure out what to do and get it done, and people will remember you as the person who performs under pressure. Once you can do that, you're a sysadmin.</p></blockquote>
<p><a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/#comment-23911">Joe touched on a critical point</a> about system administration:</p>
<blockquote><p>Tell the truth. If you break something, 'fess up and fix it. If you don't know how to do something, admit it and learn how to do the task. Create your own culture of honesty on the job; others will respect and follow your example.</p></blockquote>
<p><a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/#comment-23921">Susan offered some inspiration</a> for system administrators stuck in frustrating situations:</p>
<blockquote><p>I know, I know - dumb users, RTFM. Believe me, I've been there. In fact - one of your strategies should be to establish a trusted community where you can VENT about these issues, and get support for yourself. Ask for answers when you don't know them. Restock on the compassion and patience.</p></blockquote>
<p><a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/#comment-23907">Giovanni talked about the basics</a> and what every system administrator should know to get started in a career.  We probably take this for granted, but this is critical to keep in mind:</p>
<blockquote><p>If you are starting in the system administration area, don't praise yourself only because you (blindly?) fixed an issue or helped that friend with his/her server. Ask yourself: Why what I did fixed the issue? Why that was happening in the first place? And more importantly, how to avoid it for all eternity? You won't but it doesn't hurt to aim high.</p></blockquote>
<p><a href="http://rackerhacker.com/wp-content/uploads/2011/08/giftcert-preview.png"><img src="http://rackerhacker.com/wp-content/uploads/2011/08/giftcert-preview.png" alt="ThinkGeek Gift Certificate" title="ThinkGeek Gift Certificate" width="186" height="120" class="alignleft size-full wp-image-2430" /></a>Even though it isn't a runner-up, <a href="http://rackerhacker.com/2011/08/17/inspire-a-sysadmin-get-a-thinkgeek-gift-certificate/#comment-23919">Paul's comment</a> certainly deserves an honorable mention.  His comment is actually a true story (with a slight amount of embellishment, of course) and it serves as a reminder that system administrators and developers must stand up for their beliefs even if it goes against the beliefs of their superiors.  If your managers don't value the feedback, it might be a sign that a career change is in order.</p>
<p>Once again, <strong>a big thanks</strong> goes out to everyone who submitted a comment.  I'll reach out to the winners today and get the gift certificates sent out to them.</p>
<p><a href="http://rackerhacker.com/2011/08/22/contest-winners-from-the-inspire-a-sysadmin-contest/">Contest winners from the "Inspire a sysadmin" contest</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/08/22/contest-winners-from-the-inspire-a-sysadmin-contest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xen Summit 2011: My Takeways</title>
		<link>http://rackerhacker.com/2011/08/08/xen-summit-2011-my-takeways/</link>
		<comments>http://rackerhacker.com/2011/08/08/xen-summit-2011-my-takeways/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 12:58:54 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[glusterfs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2391</guid>
		<description><![CDATA[Quite a few people who couldn't make it to Xen Summit 2011 this year asked me to write a post summarizing my takeaways from the event. I'm not generally one to back down from peer pressure, so read on if you're interested about the discussions at this year's Summit. The feeling I had at last [...]<p><a href="http://rackerhacker.com/2011/08/08/xen-summit-2011-my-takeways/">Xen Summit 2011: My Takeways</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/2011/08/xensummit_na11_small.png"><img src="http://rackerhacker.com/wp-content/uploads/2011/08/xensummit_na11_small-300x81.png" alt="Xen Summit 2011 Logo" title="Xen Summit 2011 Logo" width="300" height="81" class="alignright size-medium wp-image-2396" /></a>Quite a few people who couldn't make it to <a href="http://xen.org/community/xensummit.html">Xen Summit 2011</a> this year asked me to write a post summarizing my takeaways from the event.  I'm not generally one to back down from peer pressure, so read on if you're interested about the discussions at this year's Summit.</p>
<p>The feeling I had at last year's summit is that Xen was on the verge of losing traction in the market.  Very few distributions still had Xen support going forward and much of the discussion was around the lack of dom0 support in upstream Linux kernels.  Distribution vendors were hesitant to drag patches forward into modern kernels and this made it much more difficult to get Xen working for many people.</p>
<p><a href="http://rackerhacker.com/wp-content/uploads/2011/08/Photo-Aug-01-5-54-05-PM.jpeg"><img src="http://rackerhacker.com/wp-content/uploads/2011/08/Photo-Aug-01-5-54-05-PM-224x300.jpg" alt="Major at the Golden Gate Bridge" title="Major at the Golden Gate Bridge" width="224" height="300" class="alignleft size-medium wp-image-2404" /></a>This year was quite different.  The number of attendees was up, the <a href="http://www.citrix.com/tv/#videos/4386">venue was much better</a>, and there was an obvious buzz of energy in the room.  As many of the presenters noted, this excitement stemmed from the <a href="http://blog.xen.org/index.php/2011/06/14/linux-3-0-how-did-we-get-initial-domain-dom0-support-there/">upstream dom0 support in Linux 3.0</a>.  This inclusion is a huge win and it helps to drive Xen forward since the developers don't have to worry about dragging patches forward.  They can focus on improving performance, adding features, and tightening security.</p>
<p>Many of the discussions this year focused on security and performance.  Ian Pratt discussed Xen's ability to view memory pages of virtual machines via an API to detect malware running inside the instance.  Memory pages could be identified and marked as not executable or applications could be triggered when a VM attempts to touch a particular memory page.  Also, the whole VM could be frozen if needed.</p>
<p>There's also a big push to bring code out of the dom0 and push it into utility VM's.  Driver domains could manage the network or I/O infrastructure and this would further reduce the amount of privileged code actively running in dom0.  There is already very little code required for the Xen hypervisor itself (much much less than the Linux kernel -- I'm looking at you, <a href="http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine">KVM</a>) and this reduces the attack surface for potential compromises of the hypervisor.  Some projects even aim to restart driver domains multiple times per minute to ensure that any malicious code injected into those virtual machines can't exist for long periods.</p>
<p>Pradeep Vincent from <a href="http://aws.amazon.com/">Amazon</a> talked about how Amazon uses Xen and the pain points they have with its current architecture.  Much of his discussion was around scaling problems (and we see many of the same issues at <a href="http://www.rackspace.com">Rackspace</a>).  Higher performance could easily be gained by multi-threaded operations in dom0 when attaching block devices and creating virtual network interfaces.  He also saw some areas for performance gains in the pvops I/O code.</p>
<p>Quite a few of the talks centered on the ARM architecture and what Xen is able to do on those systems after <a href="http://www.xen.org/products/xen_arm.html">Samsung published their port in 2008</a>.  HVM is on the way for ARM and it might even show up in Xen 4.2.  Some demos of Xen on mobile phones from Samsung were amazing.  They showed how an attacker could compromise the web browser on the phone with a keylogger, but that application was running in a VM.  Once the user switched back to the phone's main menu, the keylogger couldn't access the keystrokes any longer.  After that, a simple close of the browser killed the VM and destroyed the malicious code.</p>
<p>Xen 4.2 should be available in early 2012 and the feature list is staggering.  Improvements to libxenlight, pvops performance (even in HVM), and guest memory sharing should be available with the new release.  Nested virtualization (run a hypervisor inside a hypervisor) is also coming in Xen 4.2 and I'm sure Xzibit will be a huge fan.  This should streamline hypervisor testing, allow for embedded hypervisor options and extend the capabilities of client hypervisors.  Remus should be available in 4.2 as well, but it might be marked as experimental.  OVMF will be added as a BIOS option for UEFI (along with the standard SeaBIOS) and this should allow for Mac OS X guests.  UEFI allows Windows to boot faster since it switches to PV mode sooner and it allows for simpler platform certification for software vendors.</p>
<p><a href="http://rackerhacker.com/wp-content/uploads/2011/08/OpenStackLogo_270x279.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2011/08/OpenStackLogo_270x279.jpg" alt="" title="OpenStackLogo_270x279" width="180" height="195" class="alignright size-full wp-image-2399" /></a>Mike McClurg's presentation on <a href="http://www.xen.org/products/cloudxen.html">XCP</a> was pretty important to me since Rackspace is a big consumer of <a href="http://www.citrix.com/English/ps2/products/product.asp?contentID=683148">XenServer</a>.  If you're not familiar with XCP, it's basically open-source XenServer which runs on bleeding edge (and sometimes unstable) components.  XCP 1.5 and XenServer 6 should be available in November with Xen 4.1 and Linux 2.6.32.  GPU passthrough, up to 1TB RAM, and disaster recovery will be available.  Another goal for the XCP team is to work closely with OpenStack via Project Olympus.  Mike's vision is to have XCP become the configuration of choice for open source clouds.  <a href="http://blog.xen.org/index.php/2011/07/22/project-kronos/">Project Kronos</a> was also extremely interesting.  It's essentially XCP's XenAPI stack running on Debian and Ubuntu.  You'd be able to install either OS on a physical server and run XCP's services on it for a fully OSS hypervisor.</p>
<p>Konrad Wilk gave an update on Linux pvops and it appears there is a shift to get Xen working well on a desktop.  This includes 3D graphics support, S3/hibernate capabilities and various bug fixes.  There's also a push to get PV functionality into HVM and get HVM functionality into PV.  Driver/device domains were discussed again in Patrick Kolp's talk and he had plenty of graphs showing performance changes when regularly restarting device domains.  The performance dips were almost negligible with 10 second restarts and the security gains were significant.</p>
<p>There were several other great presentations on other topics like <a href="http://www.gluster.org/">GlusterFS</a>, <a href="http://nova.openstack.org/">OpenStack Nova</a>, and <a href="http://cgit.freedesktop.org/~ewalsh/linpicker/">Linpicker</a> (from the NSA!).  If these types of things interests you, keep your eyes peeled for Xen Summit 2012 next year.  The <a href="http://weatherspark.com/#!dashboard;q=santa+clara,+ca">weather in the bay area</a> is well worth the trip. <img src='http://rackerhacker.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://rackerhacker.com/2011/08/08/xen-summit-2011-my-takeways/">Xen Summit 2011: My Takeways</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/08/08/xen-summit-2011-my-takeways/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Xen 4.1 on Fedora 15 with Linux 3.0</title>
		<link>http://rackerhacker.com/2011/08/05/xen-4-1-on-fedora-15-with-linux-3-0/</link>
		<comments>http://rackerhacker.com/2011/08/05/xen-4-1-on-fedora-15-with-linux-3-0/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 04:34:06 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2367</guid>
		<description><![CDATA[If you haven't noticed already, full Xen dom0 support was added in the Linux 3.0 kernel. This means there's no longer a need to drag patches forward from old kernels and work from special branches and git repositories when building a kernel for dom0. Something else you might not have noticed is that the Fedora [...]<p><a href="http://rackerhacker.com/2011/08/05/xen-4-1-on-fedora-15-with-linux-3-0/">Xen 4.1 on Fedora 15 with Linux 3.0</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 haven't noticed already, <a href="http://blog.xen.org/index.php/2011/06/02/xen-celebrates-full-dom0-and-domu-support-in-linux-3-0/">full Xen dom0 support</a> was added in the <a href="http://kernelnewbies.org/Linux_3.0">Linux 3.0 kernel</a>.  This means there's no longer a need to drag patches forward from old kernels and work from special branches and git repositories when building a kernel for <a href="http://wiki.xensource.com/xenwiki/Dom0">dom0</a>.</p>
<p>Something else you might not have noticed is that the Fedora kernel team has <a href="https://admin.fedoraproject.org/updates/kernel-2.6.40-4.fc15">quietly slipped Linux 3.0</a> into Fedora 15's update channels in disguise.  Click that link, scroll down, and you'll see <em>"Rebase to 3.0. Version reports as 2.6.40 for compatibility with older userspace."</em>  Although I'm not a fan of calling something what it isn't (2.6.40 doesn't exist on kernel.org), I can understand some of the reasoning behind the choice.</p>
<p>This change makes the Xen installation on Fedora 15 pretty trivial.  To get started, update your kernel to the latest if you're not already on Fedora's 2.6.40 kernels:</p>

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

<p>We need three more packages (quite a few dependencies will roll in with them):</p>

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

<p>The xen package reels in the hypervisor itself along with libraries and command line tools (like xl and xm).  Libvirt gives us easy access to VM management with the <code>virsh</code> command and python-virtinst gives us the handy <code>virt-install</code> command to make OS installations easy.</p>
<p>Once those packages are installed, we need to make some adjustments in your grub configuration.  Open <code>/boot/grub/menu.lst</code> in your text editor of choice and add something like this at the bottom:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">title Fedora + Xen (2.6.40-4.fc15.x86_64)
        root (hd0,1)
	kernel /boot/xen.gz
        module /boot/vmlinuz-2.6.40-4.fc15.x86_64 ro root=/dev/sda1
        module /boot/initramfs-2.6.40-4.fc15.x86_64.img</pre></div></div>

<p>Ensure that the <code>root (hd0,1)</code> is applicable to your system (adjust it if it isn't).  Also, check the kernel version to ensure it matches your installed kernel and adjust the <code>root=</code> portion to match your root volume.  Flip the <code>default</code> line to a value which will boot your new grub entry and ensure the timeout is set to a reasonable number if you need to temporarily switch back to your original grub entry at boot time.  (Hey, we all make mistakes.)</p>
<p>I take one extra precaution and change the <code>UPDATEDEFAULT=yes</code> line to <code>no</code> in <code>/etc/sysconfig/kernel</code>.  This ensures that future kernel updates don't trample the entry you've just made.  Keep in mind that you'll need to manually update your grub configuration when you do kernel upgrades later.</p>
<p>Cross your fingers and reboot.  If your system doesn't reboot properly, reboot it again and choose your old kernel from the grub menu.  Double-check your configuration for fat-fingering and give it another try.  If your system boots and pings but you have no output via a monitor, don't fret.  There's a <a href="http://marc.info/?l=linux-kernel&#038;m=131169794026271&#038;w=2">patch</a> for the problem which <a href="http://marc.info/?l=linux-kernel&#038;m=131169794026271&#038;w=2">should appear soon</a> in Linux 3.0.  The impatient can snag a kernel source RPM, add the patch file, and <a href="http://fedoraproject.org/wiki/Building_a_custom_kernel">build a local kernel</a> (or you can <a href="http://majorhayden.com/RPMS/kernel-3.0.0-1.mhayden.fc16/">download my local build</a> from when I did it).</p>
<p>Log in and verify that you booted into the dom0:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[root@xenbox ~]# xm dmesg | head -n 5
 __  __            _  _    _   _   ____     __      _ ____  
 \ \/ /___ _ __   | || |  / | / | |___ \   / _| ___/ | ___| 
  \  // _ \ '_ \  | || |_ | | | |__ __) | | |_ / __| |___ \ 
  /  \  __/ | | | |__   _|| |_| |__/ __/ _|  _| (__| |___) |
 /_/\_\___|_| |_|    |_|(_)_(_)_| |_____(_)_|  \___|_|____/</pre></div></div>

<p>Once you're done with that, make sure libvirtd is running:</p>

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

<p>Try installing a VM:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">virt-install \
  --paravirt \
  --name=testvm \
  --ram=512 \
  --vcpus=4 \
  --file /dev/vmstorage/testvm \
  --graphics vnc,port=5905 --noautoconsole \
  --autostart --noreboot \
  --location=http://mirrors.kernel.org/debian/dists/squeeze/main/installer-amd64/</pre></div></div>

<p>You should have a VM installation underway pretty quickly and it will be visible via port 5905 on the local host.  Enjoy the power and freedom of your brand new <a href="http://en.wikipedia.org/wiki/Hypervisor#Classification">type 1 hypervisor</a>.</p>
<p><a href="http://rackerhacker.com/2011/08/05/xen-4-1-on-fedora-15-with-linux-3-0/">Xen 4.1 on Fedora 15 with Linux 3.0</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/08/05/xen-4-1-on-fedora-15-with-linux-3-0/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Success with stress</title>
		<link>http://rackerhacker.com/2011/07/21/success-with-stress/</link>
		<comments>http://rackerhacker.com/2011/07/21/success-with-stress/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 01:50:34 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2353</guid>
		<description><![CDATA[This is a copy of a post I wrote for the Rackspace Talent blog. Much of it probably applies to the job of a system administrator, so I figured it would be a good idea to post it here as well. Let me know what you think! Although Rackspace has one of the best work [...]<p><a href="http://rackerhacker.com/2011/07/21/success-with-stress/">Success with stress</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><em>This is a <a href="http://rackertalent.com/rackers/success-with-stress/">copy of a post</a> I wrote for the <a href="http://rackertalent.com/rackers/">Rackspace Talent</a> blog.  Much of it probably applies to the job of a system administrator, so I figured it would be a good idea to post it here as well.  Let me know what you think!</em></p>
<hr />
<a href="http://rackerhacker.com/wp-content/uploads/2011/07/BustTheKeyboard.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2011/07/BustTheKeyboard-199x300.jpg" alt="sledgehammer hitting a keyboard" title="success with stress" width="199" height="300" class="alignright size-medium wp-image-2356" /></a>Although Rackspace has one of the best work environments of any company I’ve worked for, there are plenty of opportunities to become stressed.</p>
<p>Stress can come from a variety of sources. Some of the obvious ones involve dealing with outages or tight deadlines, but there are some that aren’t so obvious, such as maintaining the customers’ trust and interpersonal issues.</p>
<p>There’s one thing you must remember: stress doesn’t have to rule your life. I’ve learned (and sometimes stumbled upon) some good techniques to prevent many of the negative effects of stressful situations at work and they’re definitely worth a try.</p>
<p><strong>Know what you’re up against</strong><br />
It’s hard to battle a source of stress if you don’t know why it’s bothering you. Take the problem you’re facing and break it down into pieces. There are going to be some things you can and can’t change. Put the things you can’t change aside and focus on the things you’re able to change. As you tackle the list of things you can change, you might find ways to work around the things you can’t.</p>
<p><strong>Interpersonal issues are easy</strong><br />
Stress that comes from dealing with coworkers may seem insurmountable at times. However, this type of stress is easily fixed and it normally stems from insufficient communication or conflicting goals. There’s an informal policy I’ve had on most of my teams called “Take it to the Racker” and it’s been quite successful. The basic idea is that if you have problems with another Racker, whether it’s something personal or work-related, take the grievance to them directly (in private, of course) and find common ground.</p>
<p>More often than not, this process leads to a good work relationship. It also improves communication drastically in the short term and it generally lasts if the people involved keep up the communication over time. I’ve seen Rackers who are so upset that they refuse to sit next to each other and after this process, they’re eating lunch together and working on the same projects.</p>
<p><strong>Don’t fight your battles alone</strong><br />
Your best resources for fighting stress are all around you. Lean on your manager or your coworkers for help. Remember what your mother always told you: a trouble shared is a trouble halved. Your coworker might have a solution to a particular problem which frees up an hour for you each day and allows you to work on other projects. Your manager might not know that a particular task doesn’t fit your strengths and they might be able to provide you with another project that plays to your strengths.</p>
<p>Is it possible to reduce your stress level to zero at work? I don’t think so. However, you should always have a goal to reduce it when it makes sense.</p>
<p>As always, I’m interested to hear your comments. Which stress-reduction strategies work best for you? What is the source of most of your stress?</p>
<p><a href="http://rackerhacker.com/2011/07/21/success-with-stress/">Success with stress</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/07/21/success-with-stress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Keep all old kernels when upgrading via yum</title>
		<link>http://rackerhacker.com/2011/06/16/keep-all-old-kernels-when-upgrading-via-yum/</link>
		<comments>http://rackerhacker.com/2011/06/16/keep-all-old-kernels-when-upgrading-via-yum/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 12:50:46 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2336</guid>
		<description><![CDATA[Some might call me paranoid, but I get nervous when my package manager automatically removes a kernel. I logged into my Fedora 15 VM this morning and found this: ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: kernel x86_64 2.6.35.13-92.fc14 updates 22 M Removing: kernel x86_64 2.6.35.11-83.fc14 @updates 104 M &#160; Transaction Summary ================================================================================ Install [...]<p><a href="http://rackerhacker.com/2011/06/16/keep-all-old-kernels-when-upgrading-via-yum/">Keep all old kernels when upgrading via yum</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>Some might call me paranoid, but I get nervous when my package manager automatically removes a kernel.  I logged into my Fedora 15 VM this morning and found this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">================================================================================
 Package        Arch           Version                   Repository        Size
================================================================================
Installing:
 kernel         x86_64         2.6.35.13-92.fc14         updates           22 M
Removing:
 kernel         x86_64         2.6.35.11-83.fc14         @updates         104 M
&nbsp;
Transaction Summary
================================================================================
Install       1 Package(s)
Remove        1 Package(s)</pre></div></div>

<p>Fedora 15's default behavior is to keep three kernels: the latest one and the two previous versions.  However, this behavior may be counter-productive if you compile your own modules, or if you have compatibility issues with subsequent kernel versions.</p>
<p>You can change how yum handles kernel packages with some simple changes to your <code>/etc/yum.conf</code>.  The <code>installonly_limit</code> option controls how many old packages are kept:</p>
<blockquote><p><strong>installonly_limit</strong> Number of packages listed  in  installonlypkgs to  keep  installed at the same time. Setting to 0 disables this feature. Default is '0'.</p></blockquote>
<p>I disabled the functionality altogether by setting <code>installonly_limit</code> to 0:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">#installonly_limit=3
installonly_limit=0</pre></div></div>

<p>It's important to keep in mind that you will need to purge these packages from your system yourself now.  Kernel packages can occupy a fair amount of disk space, so make a note to go back and clean them up when you no longer need them.</p>
<p><a href="http://rackerhacker.com/2011/06/16/keep-all-old-kernels-when-upgrading-via-yum/">Keep all old kernels when upgrading via yum</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/16/keep-all-old-kernels-when-upgrading-via-yum/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Do your homework before a technical interview</title>
		<link>http://rackerhacker.com/2011/05/02/do-your-homework-before-a-technical-interview/</link>
		<comments>http://rackerhacker.com/2011/05/02/do-your-homework-before-a-technical-interview/#comments</comments>
		<pubDate>Tue, 03 May 2011 02:05:05 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2284</guid>
		<description><![CDATA[If you work for a growing company like I do, it's inevitable that you'll have to do your fair share of interviewing. I love it when I leave an interview with a good feeling about the candidate. That "wow, they really nailed it" feeling is always great to have when you need to fill a [...]<p><a href="http://rackerhacker.com/2011/05/02/do-your-homework-before-a-technical-interview/">Do your homework before a technical interview</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 work for a growing company like I do, it's inevitable that you'll have to do your fair share of interviewing.  I love it when I leave an interview with a good feeling about the candidate.  That "wow, they really nailed it" feeling is always great to have when you need to fill a critical role.  Most often, the successful candidates are the ones who do their homework before they ever walk in our office doors.</p>
<p>What do I mean by "do your homework?"  Here are some bullet points to get you on your way:</p>
<p><strong>Know what the company does.</strong><br />
This one is critical and it should be easy.  However, make sure to do thorough research first.  For example, if you interviewed at a company like Apple, becoming familiar with their hardware lineup should be a no-brainer.  That's their bread and butter.  On the other hand, remember that Apple isn't solely a hardware company; they write lots of software, provide online productivity services, and they distribute music, movies, and other entertainment media.</p>
<p>While you're doing this research, try to discover what makes the company unique.  Sure, <a href="http://www.apple.com/">Apple</a> sells laptops and desktops (just like a lot of other companies), but what makes their particular products unique?  Is there something unique about the way they provide their services?  Have they cornered a certain market segment by providing a combination of products and services to that group of consumers?  Answering these simple questions may help you tip the scales in the interview process.</p>
<p><strong>Try one or more of the company's products.</strong><br />
The feasibility of trying a company's product before an interview could be debatable.  For example, if you wanted to interview at <a href="http://cray.com/">Cray</a>, you probably don't need to drop $2M USD on your own <a href="http://www.cray.com/Products/XE/Systems.aspx">XE6</a> before walking in the door.  For companies where the barrier to entry for purchasing a product is much lower, such as cloud computing companies, there's no excuse to not try things out first.  Amazon has a <a href="http://aws.amazon.com/free/">free tier</a> and a Rackspace Cloud Server could cost you <a href="http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/">as little as $2.50 per week</a>.</p>
<p>It's concerning when I talk to an applicant about a job working with Rackspace's Cloud Servers and they haven't tried out any cloud products from any provider.  How can I take a candidate's interest seriously when they haven't shown interest in any portion of my group's market segment?</p>
<p><strong>Know what the company's competitors do.</strong><br />
It's often more impressive to an interviewer to know what a company's competitors are doing and how it compares to what that company is doing in the market.  For example, if you can walk into an interview and say "I like the way your company makes these widgets, but Company X is able to make them more lightweight, and I value that more than the added customer service your company offers."  This shows the interviewer that you're familiar with various products in the segment and you've used them enough to understand what makes them different.</p>
<p>Some of you might be thinking: "Why would I say something like that to the interviewer? They'll think I'm being too negative about their product."  That's always possible, but you can guard against it by wording everything carefully.  Make sure you have a solid reason for the way you feel that is based on something substantial (usability, price, features, etc).  I've had candidates talk for five to ten minutes about why one of our product is inferior to one of our competitors' products and I was very impressed.</p>
<p>One quick gotcha: your interviewer might turn your comments back on you and ask you how you would improve one of the inferior products (I do this regularly).  Make sure that you're prepared for that question and consider offering up a suggestion before the question is presented to you.</p>
<p><strong>Can't get the information you need? Ask!</strong><br />
When you reach the end of the interview and the interviewer asks if you have questions, be sure to ask any questions about topics you had trouble researching.  Going back to the Cray example, compare what you know about an XE6 to servers you've used before.  You could mention a problem you had with the density of your previous configurations and ask how they overcame that hurdle at Cray.  If it's a proprietary trade secret, you might not get an answer, but they'll know that you did some serious research ahead of time.  If they can share the answer, they might still be impressed, and you might end up learning something you didn't know prior to the interview.</p>
<p><strong>Conclusion</strong><br />
In summary, doing your homework and learning about the company shows the interviewers that you not only have what it takes to do the work, but that the work interests you as well.  I've interviewed folks in the past who lacked on technical ability but had plenty of desire and drive.  More often than not, those people are now Rackers.</p>
<p><a href="http://rackerhacker.com/2011/05/02/do-your-homework-before-a-technical-interview/">Do your homework before a technical interview</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/02/do-your-homework-before-a-technical-interview/feed/</wfw:commentRss>
		<slash:comments>5</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>Dual-primary DRBD with OCFS2</title>
		<link>http://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/</link>
		<comments>http://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/#comments</comments>
		<pubDate>Mon, 14 Feb 2011 02:12:58 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ocfs2]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2197</guid>
		<description><![CDATA[As promised in one of my previous posts about dual-primary DRBD and OCFS2, I've compiled a step-by-step guide for Fedora. These instructions should be somewhat close to what you would use on CentOS or Red Hat Enterprise Linux. However, CentOS and Red Hat don't provide some of the packages needed, so you will need to [...]<p><a href="http://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/">Dual-primary DRBD with OCFS2</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>As promised in one of my <a href="/2010/12/02/keep-web-servers-in-sync-with-drbd-and-ocfs2/">previous posts</a> about dual-primary DRBD and OCFS2, I've compiled a step-by-step guide for Fedora.  These instructions should be somewhat close to what you would use on CentOS or Red Hat Enterprise Linux.  However, CentOS and Red Hat don't provide some of the packages needed, so you will need to use other software repositories like <a href="http://rpmfusion.org/">RPMFusion</a> or <a href="http://fedoraproject.org/wiki/EPEL">EPEL</a>.</p>
<p>In this guide, I'll be using two Fedora 14 instances in the <a href="http://rackspacecloud.com/">Rackspace Cloud</a> with separate public and private networks.  The instances are called server1 and server2 to make things easier to follow.  </p>
<p><strong>NOTE: All of the instructions below should be done on both servers unless otherwise specified.</strong></p>
<hr />
First, we need to set up DRBD with two primary nodes.  I'll be using loop files for this setup since I don't have access to raw partitions.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum -y install drbd-utils
dd if=/dev/zero of=/drbd-loop.img bs=1M count=1000</pre></div></div>

<p>Put this <a href="/wp-content/uploads/2011/02/loop-for-drbd.txt">loop file initialization init script</a> in /etc/init.d/loop-for-drbd and finish setting it up:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">chmod a+x /etc/init.d/loop-for-drbd
chkconfig loop-for-drbd on
/etc/init.d/loop-for-drbd start</pre></div></div>

<p>Place this DRBD resource file in <code>/etc/drbd.d/r0.res</code>.  Be sure to adjust the server names and IP addresses for your servers.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">resource r0 {
	meta-disk internal;
	device /dev/drbd0;
	disk /dev/loop7;
&nbsp;
	syncer { rate 1000M; }
        net { 
                allow-two-primaries; 
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
                after-sb-2pri disconnect;
        }
	startup { become-primary-on both; }
&nbsp;
	on server1 { address 10.181.76.0:7789; }
	on server2 { address 10.181.76.1:7789; }
}</pre></div></div>

<p>The <code>net</code> section is telling DRBD to do the following:</p>
<ul>
<li><em>allow-two-primaries</em> - Generally, DRBD has a primary and a secondary node.  In this case, we will allow both nodes to have the filesystem mounted at the same time.  <strong>Do this only with a clustered filesystem. If you do this with a non-clustered filesystem like ext2/ext3/ext4 or reiserfs, <em>you will have data corruption</em>. Seriously!</strong></li>
<li><em>after-sb-0pri discard-zero-changes</em> - DRBD detected a split-brain scenario, but none of the nodes think they're a primary.  DRBD will take the newest modifications and apply them to the node that didn't have any changes.</li>
<li><em>after-sb-1pri discard-secondary</em> - DRBD detected a split-brain scenario, but one node is the primary and the other is the secondary.  In this case, DRBD will decide that the secondary node is the victim and it will sync data from the primary to the secondary automatically.</li>
<li><em>after-sb-2pri disconnect</em> - DRBD detected a split-brain scenario, but it can't figure out which node has the right data.  It tries to protect the consistency of both nodes by disconnecting the DRBD volume entirely.  You'll have to tell DRBD which node has the valid data in order to reconnect the volume.  <strong>Use extreme caution if you find yourself in this scenario.</strong></li>
</ul>
<p>If you'd like to read about DRBD split-brain behavior in more detail, <a href="http://www.drbd.org/users-guide/s-configure-split-brain-behavior.html">review the documentation</a>.</p>
<p>I generally turn off the usage reporting functionality in DRBD within <code>/etc/drbd.d/global_common.conf</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">global {
	usage-count no;
}</pre></div></div>

<p>Now we can create the volume and start DRBD:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">drbdadm create-md r0
/etc/init.d/drbd start &amp;&amp; chkconfig drbd on</pre></div></div>

<p>You may see some errors thrown about having two primaries but neither are up to date.  That can be fixed by running the following command on the <strong>primary node only</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">drbdsetup /dev/drbd0 primary -o</pre></div></div>

<p>If you run <code>cat /proc/drbd</code> on the secondary node, you should see the DRBD sync running:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">version: 8.3.8 (api:88/proto:86-94)
srcversion: 299AFE04D7AFD98B3CA0AF9
 0: cs:SyncTarget ro:Secondary/Primary ds:Inconsistent/UpToDate C r----
    ns:0 nr:210272 dw:210272 dr:0 al:0 bm:12 lo:1 pe:2682 ua:0 ap:0 ep:1 wo:b oos:813660  
        [===&gt;................] sync'ed: 20.8% (813660/1023932)K queue_delay: 0.0 ms
        finish: 0:01:30 speed: 8,976 (6,368) want: 1024,000 K/sec</pre></div></div>

<p>Before you go any further, wait for the DRBD sync to fully finish. When it completes, it should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">version: 8.3.8 (api:88/proto:86-94)
srcversion: 299AFE04D7AFD98B3CA0AF9
 0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r----
    ns:0 nr:1023932 dw:1023932 dr:0 al:0 bm:63 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0</pre></div></div>

<p>Now, <strong>on the secondary node only</strong> make it a primary node as well:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">drbdadm primary r0</pre></div></div>

<p>You should see this on the secondary node if you've done everything properly:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">version: 8.3.8 (api:88/proto:86-94)
srcversion: 299AFE04D7AFD98B3CA0AF9 
 0: cs:Connected ro:Primary/Primary ds:UpToDate/UpToDate C r----
    ns:1122 nr:1119 dw:2241 dr:4550 al:2 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0</pre></div></div>

<p>We're now ready to move on to configuring OCFS2.  Only one package is needed:</p>

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

<p>Ensure that you have your servers and their private IP addresses in <code>/etc/hosts</code> before proceeding.  Create the <code>/etc/ocfs2</code> directory and place the following configuration in <code>/etc/ocfs2/cluster.conf</code> (adjust the server names and IP addresses):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">cluster:
	node_count = 2          
	name = web
&nbsp;
node:
	ip_port = 7777
	ip_address = 10.181.76.0
	number = 1
	name = server1
	cluster = web
&nbsp;
node:
	ip_port = 7777
	ip_address = 10.181.76.1
	number = 2
	name = server2
	cluster = web</pre></div></div>

<p>Now it's time to configure OCFS2.  Run <code>service ocfs2 configure</code> and follow the prompts.  Use the defaults for all of the responses except for two questions:</p>
<ul>
<li>Answer "y" to "Load O2CB driver on boot"</li>
<li>Answer "web" to "Cluster to start on boot"</li>
</ul>
<p>Start OCFS2 and enable it at boot up:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">chkconfig o2cb on &amp;&amp; chkconfig ocfs2 on
/etc/init.d/o2cb start &amp;&amp; /etc/init.d/ocfs2 start</pre></div></div>

<p>Create an OCFS2 partition <strong>on the primary node only</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">mkfs.ocfs2 -L &quot;web&quot; /dev/drbd0</pre></div></div>

<p>Mount the volumes and configure them to automatically mount at boot time.  You might be wondering why I do the mounting within <code>/etc/rc.local</code>.  I chose to go that route since mounting via fstab was often unreliable for me due to the incorrect ordering of events at boot time.  Using rc.local allows the mounts to work properly upon every reboot.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">mkdir /mnt/storage
echo &quot;/dev/drbd0  /mnt/storage  ocfs2  noauto,noatime  0 0&quot; &gt;&gt; /etc/fstab
mount /dev/drbd0
echo &quot;mount /dev/drbd0&quot; &gt;&gt; /etc/rc.local</pre></div></div>

<p>At this point, you should be all done.  If you want to test OCFS2, copy a file into your /mnt/storage mount on one node and check that it appears on the other node.  If you remove it, it should be gone instantly on both nodes.  This is a great opportunity to test reboots of both machines to ensure that everything comes up properly at boot time.</p>
<p><a href="http://rackerhacker.com/2011/02/13/dual-primary-drbd-with-ocfs2/">Dual-primary DRBD with OCFS2</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/02/13/dual-primary-drbd-with-ocfs2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Strategies for storing backups</title>
		<link>http://rackerhacker.com/2011/01/09/strategies-for-storing-backups/</link>
		<comments>http://rackerhacker.com/2011/01/09/strategies-for-storing-backups/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 01:20:44 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[emergency]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2123</guid>
		<description><![CDATA[Although it's not a glamorous subject for system administrators, backups are necessary for any production environment. Those who run their systems without backups generally learn from their errors in a very painful way. However, the way you store your backups may sometimes prove to be just as vital as the methods you use to backup [...]<p><a href="http://rackerhacker.com/2011/01/09/strategies-for-storing-backups/">Strategies for storing backups</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>Although it's not a glamorous subject for system administrators, backups are necessary for any production environment.  Those who run their systems without backups generally learn from their errors in a very painful way.  However, the way you store your backups may sometimes prove to be just as vital as the methods you use to backup your data.</p>
<p>For my environments, I follow a strategy like this: I have some backups immediately accessible, others that are accessible very quickly (but not instantly), and others that are offsite and may take a bit more time to access.</p>
<p><strong>Immediately accessible backups</strong><br />
One of the easiest way to have an immediately accessible backup is to have multiple machines online running the same versions of code or databases in a high availability group.  If you have a node which fails, the remaining nodes should be able to handle the requests immediately.  You may not consider this to be a backup under the traditional definition of what a backup should be, but it's functionally similar.</p>
<p><strong>Backups that are accessible quickly</strong><br />
This second level of backups should be stored very close to your environment or within the environment itself.  If you have multiple database and web server nodes, you could consider storing your web backups on the database servers and vice versa.  For those who run very sensitive applications, this may violate the provisions of different certifications and regulations.  A server dedicated to holding backups may be a viable alternative for additional security.</p>
<p><strong>Offsite backup storage</strong><br />
These are the backups that need to be geographically distant from your main environment.  Also, you should always consider storing these backups on more than one medium with more than one company.</p>
<p>For example, if your hosting providers offers a storage service, it's fine to store one set of your backups there, but consider storing them with a competitor as well.  If you store your backups with your hosting provider in multiple places, you could be caught be a provider issue and lose access to your backups entirely.  Hosting with multiple providers will allow you to access at least one copy of your backups even if there are billing or technical issues with a particular provider.</p>
<p>Another thing to keep in mind with offsite backup storage is how long it will take to transfer the backups to your hosting environment in case of an emergency.  If your hosting environment is in Texas, but your backups are stored in Australia, you're going to have a longer wait when you transfer your data back.</p>
<p><strong>A specific example</strong><br />
My environments are all in Dallas, Texas and I have a highly available environment with multiple instances.  My second layer of backups are stored within the environment as well as in Rackspace's Cloud Files in Dallas.  My third layer of backups are stored with Amazon S3 via Jungle Disk and at my home on a RAID array.</p>
<p>While I hope you never need to access your backups under duress, these tips should help to reduce your stress if you need to restore data in a hurry.</p>
<p><a href="http://rackerhacker.com/2011/01/09/strategies-for-storing-backups/">Strategies for storing backups</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/09/strategies-for-storing-backups/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>One RHCA exam down, five to go</title>
		<link>http://rackerhacker.com/2011/01/06/one-rhca-exam-down-five-to-go/</link>
		<comments>http://rackerhacker.com/2011/01/06/one-rhca-exam-down-five-to-go/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 02:24:49 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[certification]]></category>
		<category><![CDATA[general advice]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhca]]></category>
		<category><![CDATA[rhce]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2107</guid>
		<description><![CDATA[While I'm not the biggest proponent of certifications, I still think you can learn some valuable information while studying for some certification tests. A good example of that is Red Hat's System Monitoring and Performance Tuning Expertise Exam. It's one test out of five in the Red Hat Certified Architect (RHCA) track of exams. I [...]<p><a href="http://rackerhacker.com/2011/01/06/one-rhca-exam-down-five-to-go/">One RHCA exam down, five to go</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/2011/01/Major_Hayden_EX442.jpg"><img src="http://rackerhacker.com/wp-content/uploads/2011/01/Major_Hayden_EX442-300x231.jpg" alt="EX442" title="EX442" width="300" height="231" class="alignright size-medium wp-image-2115" /></a>While I'm not the biggest proponent of certifications, I still think you can learn some valuable information while studying for some certification tests.  A good example of that is Red Hat's <a href="https://www.redhat.com/courses/ex442_red_hat_enterprise_system_monitoring_and_performance_tuning_expertise_exam/">System Monitoring and Performance Tuning Expertise Exam</a>.  It's one test out of five in the <a href="http://www.redhat.com/certification/rhca/">Red Hat Certified Architect (RHCA)</a> track of exams.  I passed the exam this week and it's definitely one of the most difficult certification exams I've ever taken.</p>
<p>Many of the <a href="https://www.redhat.com/courses/rh442_red_hat_enterprise_system_monitoring_and_performance_tuning/details/">topics covered on the EX442 exam</a> are really handy for Linux system administrators.  The advanced filesystem configuration, software RAID optimization, and process scheduling knowledge can provide some tangible performance gains on just about any Linux server.</p>
<p>I especially enjoyed learning about <a href="http://sourceware.org/systemtap/">SystemTap</a>.  I'd heard about it before, but I never really understood what it did and how much power it can give a system administrator on a server.  You can <a href="http://sourceware.org/systemtap/examples/keyword-index.html">sample a wide variety of system events</a> quickly with relative ease and you're not bound to the hardware dependencies of <a href="http://oprofile.sourceforge.net/news/">OProfile</a>.</p>
<p>Bear in mind that you'll need a valid <a href="http://www.redhat.com/certification/rhce/">RHCE</a> to get started with the RHCA exams.  That's another certification that I'd definitely recommend as it helps you learn a wide variety of administration topics that can be applied to almost any Linux distribution available today.</p>
<p><a href="http://rackerhacker.com/2011/01/06/one-rhca-exam-down-five-to-go/">One RHCA exam down, five to go</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/06/one-rhca-exam-down-five-to-go/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Using GNU sort to sort a list by IP address</title>
		<link>http://rackerhacker.com/2011/01/06/using-gnu-sort-to-sort-a-list-by-ip-address/</link>
		<comments>http://rackerhacker.com/2011/01/06/using-gnu-sort-to-sort-a-list-by-ip-address/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 13:52:58 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2100</guid>
		<description><![CDATA[My daily work requires me to work with a lot of customer data and much of it involves IP address allocations. If you find that you need to sort a list by IP address with GNU sort on a Linux server, just use these handy arguments for sort: sort -n -t . -k 1,1 -k [...]<p><a href="http://rackerhacker.com/2011/01/06/using-gnu-sort-to-sort-a-list-by-ip-address/">Using GNU sort to sort a list by IP address</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>My <a href="http://rackspace.com/">daily work</a> requires me to work with a lot of customer data and much of it involves IP address allocations.  If you find that you need to sort a list by IP address with GNU sort on a Linux server, just use these handy arguments for sort:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 somefile.txt</pre></div></div>

<p><em>For this to work, the file you're sorting needs to have the IP address as the first item on each line.</em></p>
<p><a href="http://rackerhacker.com/2011/01/06/using-gnu-sort-to-sort-a-list-by-ip-address/">Using GNU sort to sort a list by IP address</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/06/using-gnu-sort-to-sort-a-list-by-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting a raw partition file made with dd or dd_rescue in Linux</title>
		<link>http://rackerhacker.com/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/</link>
		<comments>http://rackerhacker.com/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 01:07:24 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[emergency]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2069</guid>
		<description><![CDATA[This situation might not affect everyone, but it struck me today and left me scratching my head. Consider a situation where you need to clone one drive to another with dd or when a hard drive is failing badly and you use dd_rescue to salvage whatever data you can. Let's say you cloned data from [...]<p><a href="http://rackerhacker.com/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/">Mounting a raw partition file made with dd or dd_rescue in Linux</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>This situation might not affect everyone, but it struck me today and left me scratching my head.  Consider a situation where you need to clone one drive to another with <a href="http://en.wikipedia.org/wiki/Dd_(Unix)">dd</a> or when a hard drive is failing badly and you use <a href="http://www.garloff.de/kurt/linux/ddrescue/">dd_rescue</a> to salvage whatever data you can.</p>
<p>Let's say you cloned data from a drive using something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># dd if=/dev/sda of=/mnt/nfs/backup/harddrive.img</pre></div></div>

<p>Once that's finished, you should end up with your partition table as well as the grub data from the MBR in your image file.  If you run <code>file</code> against the image file you made, you should see something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># file harddrive.img
harddrive.img: x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 
address 0x2000, stage2 segment 0x200, GRUB version 0.97; partition 1: ID=0x83, 
active, starthead 1, startsector 63, 33640047 sectors, code offset 0x48</pre></div></div>

<p>What if you want to pull some files from this image without writing it out to another disk?  Mounting it like a loop file isn't going to work:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># mount harddrive /mnt/temp
mount: you must specify the filesystem type</pre></div></div>

<p>The key is to mount the file <a href="http://www.linuxquestions.org/questions/linux-general-1/trouble-mounting-dd-image-file-644362/#post3660310">with an offset specified</a>.  In the output from <code>file</code>, there is a particular portion of the output that will help you:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">... startsector 63 ...</pre></div></div>

<p>This means that the filesystem itself starts on sector 63.  You can also view this with <code>fdisk -l</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># fdisk -l harddrive.img
                    Device Boot      Start         End      Blocks   Id  System
harddrive.img                *          63    33640109    16820023+  83  Linux</pre></div></div>

<p>Since we need to scoot 63 sectors ahead, and each sector is 512 bytes long, we need to use an offset of 32,256 bytes.  Fire up the mount command and you'll be on your way:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># mount -o ro,loop,offset=32256 harddrive.img /mnt/loop
# mount | grep harddrive.img
/root/harddrive.img on /mnt/loop type ext3 (ro,loop=/dev/loop1,offset=32256)</pre></div></div>

<p>If you made this image under duress (due to a failing drive or other emergency), you might have to check and repair the filesystem first.  Doing that is easy if you make a loop device:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># losetup --offset 32256 /dev/loop2 harddrive.img
# fsck /dev/loop2</pre></div></div>

<p>Once that's complete, you can save some time and mount the loop device directly:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># mount /dev/loop2 /mnt/loop</pre></div></div>

<p><a href="http://rackerhacker.com/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/">Mounting a raw partition file made with dd or dd_rescue in Linux</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/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Locate RPM packages which contain a certain file</title>
		<link>http://rackerhacker.com/2010/12/08/locate-rpm-packages-which-contain-a-certain-file/</link>
		<comments>http://rackerhacker.com/2010/12/08/locate-rpm-packages-which-contain-a-certain-file/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 02:30:00 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2040</guid>
		<description><![CDATA[It's not easy remembering which RPM packages contain certain files. If I asked you which files you'd find in packages like postfix-2.7.1-1.fc14 and bash-4.1.7-3.fc14, you would be able to name some obvious executables. However, would you be able to do the same if I mentioned a package like util-linux-ng-2.18-4.6.fc14? If the RPM is already installed, [...]<p><a href="http://rackerhacker.com/2010/12/08/locate-rpm-packages-which-contain-a-certain-file/">Locate RPM packages which contain a certain file</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 not easy remembering which RPM packages contain certain files.  If I asked you which files you'd find in packages like <code>postfix-2.7.1-1.fc14</code> and <code>bash-4.1.7-3.fc14</code>, you would be able to name some obvious executables.  However, would you be able to do the same if I mentioned a package like <code>util-linux-ng-2.18-4.6.fc14</code>?  If the RPM is already installed, you can quickly use <code>rpm -ql</code> to list the files within it.</p>
<p>However, what if the RPM isn't installed already?  How do you figure out which one to install?</p>
<p>Fedora has well over 20,000 packages in the standard repositories without adding additional repositories like RPM Fusion.  Narrowing that list down to find the package you want can be daunting, but you can use yum to help.</p>
<p>Consider this: you're following a guide online and the author says you need to run <code>deallocvt</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># deallocvt
-bash: deallocvt: command not found</pre></div></div>

<p>Perhaps it's in a package with <code>deallocvt</code> in the name:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># yum search deallocvt
Warning: No matches found for: deallocvt
No Matches found</pre></div></div>

<p>This is where yum's <code>whatprovides</code> (<code>provides</code> works in recent yum versions) command works really well:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># yum whatprovides */deallocvt
kbd-1.15-11.fc14.x86_64 : Tools for configuring the console
Repo        : fedora
Matched from:
Filename    : /usr/bin/deallocvt</pre></div></div>

<p>From there, you can install the <code>kbd</code> RPM package via yum and you'll be on your way.</p>
<p><em>Author's note: Regular readers will probably think this is pretty basic, but I often find people who don't know this functionality exists in yum.</em></p>
<p><strong>UPDATE:</strong> I forgot to include another handy command in this article (thanks to Jason Gill for reminding me).  If you have file on your system already, but you need to know which RPM package it came from, you can do this very quickly:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># rpm -qf /usr/bin/free
procps-3.2.8-14.fc14.x86_64</pre></div></div>

<p><a href="http://rackerhacker.com/2010/12/08/locate-rpm-packages-which-contain-a-certain-file/">Locate RPM packages which contain a certain file</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/12/08/locate-rpm-packages-which-contain-a-certain-file/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tap into your Linux system with SystemTap</title>
		<link>http://rackerhacker.com/2010/12/07/tap-into-your-linux-system-with-systemtap/</link>
		<comments>http://rackerhacker.com/2010/12/07/tap-into-your-linux-system-with-systemtap/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 02:27:02 +0000</pubDate>
		<dc:creator>Major Hayden</dc:creator>
				<category><![CDATA[Blog Posts]]></category>
		<category><![CDATA[advanced]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[systemtap]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://rackerhacker.com/?p=2005</guid>
		<description><![CDATA[One of the most interesting topics I've seen so far during my RHCA training at Rackspace this week is SystemTap. In short, SystemTap allows you to dig out a bunch of details about your running system relatively easily. It takes scripts, converts them to C, builds a kernel module, and then runs the code within [...]<p><a href="http://rackerhacker.com/2010/12/07/tap-into-your-linux-system-with-systemtap/">Tap into your Linux system with SystemTap</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 most interesting topics I've seen so far during my <a href="https://www.redhat.com/courses/rh442_red_hat_enterprise_system_monitoring_and_performance_tuning/">RHCA</a> training at <a href="http://rackspace.com/">Rackspace</a> this week is <a href="http://sourceware.org/systemtap/">SystemTap</a>.  In short, SystemTap allows you to dig out a bunch of details about your running system relatively easily.  It takes scripts, converts them to C, builds a kernel module, and then runs the code within your script.</p>
<p><strong><span style="color: #D42020;">HOLD IT:</span> The steps below are <em>definitely</em> not meant for those who are new to Linux.  Utilizing SystemTap on a production system is a bad idea -- it can chew up significant resources while it runs and it can also cause a running system to kernel panic if you're not careful with the packages you install.</strong></p>
<p>These instructions will work well with Fedora, CentOS and Red Hat Enterprise Linux.  Luckily, the SystemTap folks put together some instructions for <a href="http://sourceware.org/systemtap/wiki/SystemtapOnDebian">Debian</a> and <a href="http://sourceware.org/systemtap/wiki/SystemtapOnUbuntu">Ubuntu</a> as well.</p>
<p>Before you can start working with SystemTap on your RPM-based distribution, you'll need to get some prerequisites together:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">yum install gcc systemtap systemtap-runtime systemtap-testsuite kernel-devel
yum --enablerepo=*-debuginfo install kernel-debuginfo kernel-debuginfo-common</pre></div></div>

<p><strong><span style="color: #D42020;">WHOA THERE:</span> Ensure that the kernel-devel and kernel-debuginfo* packages that you install via yum match up with your running kernel.  If there's a newer kernel available from your yum repo, yum will pull that one.  If it's been a while since you updated, you'll either need to upgrade your current kernel to the latest and reboot or you'll need to hunt down the corresponding kernel-devel and kernel-debuginfo* packages from a repository.  <em>Installing the wrong package version can lead to kernel panics.</em>  Also, bear in mind that the debuginfo packages are quite large: almost 200MB in Red Hat/CentOS and almost 300MB in Fedora.</strong></p>
<p>You can't write the script in just any language.  SystemTap uses an odd syntax to get things going:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">#! /usr/bin/env stap
probe begin { println(&quot;hello world&quot;) exit () }</pre></div></div>

<p>Just run the script with <code>stap</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># stap -v helloworld.stp 
Pass 1: parsed user script and 73 library script(s) using 94380virt/21988res/2628shr kb, in 140usr/30sys/167real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) using 94776virt/22516res/2692shr kb, in 10usr/0sys/5real ms.
Pass 3: using cached /root/.systemtap/cache/bc/stap_bc368822da380b943d4e845ee15ed047_773.c
Pass 4: using cached /root/.systemtap/cache/bc/stap_bc368822da380b943d4e845ee15ed047_773.ko
Pass 5: starting run.
hello world
Pass 5: run completed in 0usr/20sys/285real ms.</pre></div></div>

<p>The <code>systemtap-testsuite</code> package gives you a <strong>tubload</strong> of extremely handy SystemTap scripts.  For example:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># cd /usr/share/systemtap/testsuite/systemtap.examples/io/
# stap iotime.stp
15138470 6351 (httpd) access /usr/share/cacti/index.php read: 0 write: 0
15142243 6351 (httpd) access /usr/share/cacti/include/auth.php read: 0 write: 0
15143780 6351 (httpd) access /usr/share/cacti/include/global.php read: 0 write: 0
15144099 6351 (httpd) access /etc/cacti/db.php read: 0 write: 0
15187641 6351 (httpd) access /usr/share/cacti/lib/adodb/adodb.inc.php read: 106486 write: 0
15187664 6351 (httpd) iotime /usr/share/cacti/lib/adodb/adodb.inc.php time: 218
15194965 6351 (httpd) access /usr/share/cacti/lib/adodb/adodb-time.inc.php read: 0 write: 0
15195692 6351 (httpd) access /usr/share/cacti/lib/adodb/adodb-iterator.inc.php read: 0 write: 0
   ... output continues ...</pre></div></div>

<p>The <code>iotime.stp</code> script dumps out the reads and writes occurring on the system in real time.  After starting the script above, I accessed my cacti instance on the server and immediately started seeing some reads as apache began picking up PHP files to parse.</p>
<p>Consider a situation in which you need to decrease interrupts on a Linux machine.  This is vital for laptops and systems that need to remain in low power states.  Some might suggest powertop<a href="http://www.lesswatts.org/projects/powertop/"> for that, but why not give SystemTap a try?</a></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"># cd /usr/share/systemtap/testsuite/systemtap.examples/interrupt/
# stap interrupts-by-dev.stp 
        ohci_hcd:usb3 :      1
        ohci_hcd:usb4 :      1
            hda_intel :      1
                 eth0 :      2
                 eth0 :      2
                 eth0 :      2
                 eth0 :      2
                 eth0 :      2
                 eth0 :      2</pre></div></div>

<p>On this particular system, it's pretty obvious that the ethernet interface is causing a lot of interrupts.</p>
<p>If you want more examples, keep hunting around in the systemtap-testsuite package (remember <code>rpm -ql systemtap-testsuite</code>) or review the <a href="http://sourceware.org/systemtap/examples/">giant list of examples</a> on SystemTap's site.</p>
<p><em>Thanks again to Phil Hopkins at Rackspace for giving us a detailed explanation of system profiling during training.</em></p>
<p><a href="http://rackerhacker.com/2010/12/07/tap-into-your-linux-system-with-systemtap/">Tap into your Linux system with SystemTap</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/12/07/tap-into-your-linux-system-with-systemtap/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

