<?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>The Otter Book &#187; sysadmin</title>
	<atom:link href="http://www.otterbook.com/blog/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.otterbook.com</link>
	<description>Automating System Administration with Perl</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:46:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>The Lawyer and the SysAdmin</title>
		<link>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/</link>
		<comments>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 22:27:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[joke]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=383</guid>
		<description><![CDATA[Warning: dumb joke modified from a dumb joke that used to contain a character of a certain ethnicity. Also note: this is not representative of lawyers in general so please do not sue me. A lawyer and an SysAdmin are sitting next to each other on a long flight. The lawyer is thinking that SysAdmins [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><strong>Warning</strong>: dumb joke modified from a dumb joke that used to contain a character of a certain ethnicity.  <em>Also note:</em> this is not representative of lawyers in general so please do not sue me.</p>
<p>A lawyer and an SysAdmin are sitting next to each other on a long flight.  The lawyer is thinking that SysAdmins are so dumb that he could get an advantage over on them easy&#8230;</p>
<p>So the lawyer asks if the SysAdmin would like to play a fun game. The SysAdmin is tired and just wants to take a nap, so he politely declines and tries to catch a few winks. The lawyer persists, and says that the game is a lot of fun. &#8220;I ask you a question, and if you don&#8217;t know the answer, you pay me only $5; you ask me one, and if I don&#8217;t know the answer, I will pay you $500,&#8221; he says. </p>
<p>This catches the SysAdmin&#8217;s attention and to keep the lawyer quiet, he agrees to play the game.</p>
<p>The lawyer asks the first question. &#8220;What&#8217;s the distance from the Earth to the Moon?&#8221;</p>
<p>The SysAdmin doesn&#8217;t say a word, reaches in his pocket, pulls out a five-dollar bill, and hands it to the lawyer.</p>
<p>Now, it&#8217;s the SysAdmin&#8217;s turn. He asks the lawyer, &#8220;What goes up a  hill with three legs, and comes down with four?&#8221; The lawyer uses his  laptop and searches all references he could find on the Net. He sends e-mails to all the smart friends he knows, all to no avail.  After one hour of searching he finally gives up. He wakes up the SysAdmin and hands him $500. The SysAdmin pockets the $500 and goes right back to sleep.</p>
<p>The lawyer is going nuts not knowing the answer. He wakes the SysAdmin up and asks, &#8220;Well, so what goes up a hill with three legs and comes down with four?&#8221;</p>
<p>The SysAdmin reaches in his pocket, hands the lawyer $5 and goes back to sleep.</p>
<p>Don&#8217;t mess with SysAdmins!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/04/the-lawyer-and-the-sysadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simon says&#8230;Restart Your Daemons</title>
		<link>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/</link>
		<comments>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 03:35:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[iTerm]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[tmux]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=376</guid>
		<description><![CDATA[I&#8217;m all for performing service management using mechanisms built-in to a configuration management system (i.e. you change a config file and the config management system automatically restarts the daemon), but occasionally you get into a situation where you want to interactively do the same exact thing on several machines. For example, I recently wanted to [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;m all for performing service management using mechanisms built-in to a configuration management system (i.e. you change a config file and the config management system automatically restarts the daemon), but occasionally you get into a situation where you want to interactively do the same exact thing on several machines. </p>
<p>For example, I recently wanted to bounce the <a href="http://www.clamav.net">ClamAV</a> daemon running on four of my incoming mail servers simultaneously. This process would require the exact same commands on all four machines, ideally run at the same time. </p>
<p>Rather than type the same thing four times, let me tell you about a few programs that can help in this sort of situation where you need interactive input to multiplex to different sessions. The one I used for the last example was OSX specific (since most of my time is spent typing at a Mac laptop):</p>
<ul>
<li><a href="http://iterm.sourceforge.net/">iTerm</a> &#8211; iTerm is a spiffy rewrite of the native OSX Terminal application that has a bunch of cool features. The one I used is called &#8220;Send Input to all Tabs&#8221; (under the Shell menu). iTerm lets you run multiple sessions in different tabs of the same window. When you turn &#8220;Send Input to all Tabs&#8221; anything you type in one tab is automatically echoed to every other tab. I ssh&#8217;d to each of the mail servers, turned on this feature, and typed the commands I needed a single time, yet all four machines obeyed these commands. If you run OSX and you haven&#8217;t played with iTerm, you really should.</li>
</ul>
<p>Before I discovered this feature in iTerm, I used to use <em>cssh</em>, from <a href="http://sourceforge.net/projects/clusterssh/">ClusterSSH</a>. It opens up a smaller input window and as many other xterms as you need. Anything typed in the input window is echoed to those windows. This program isn&#8217;t OSX specific, it can be used any place you can build the right Perl modules. I stopped using it a while back because I had issues with it building under <a href="http://www.macports.org/">MacPorts</a> (if I built the modules it needed using the Apple-provided Perl libraries, everything was peachy, but building it into MacPorts in an attempt to avoid polluting the OSX install of Perl lead to a script that would segfault upon running).</p>
<p>I recently noticed a new rewrite of the same idea for OSX called <a href="http://code.google.com/p/csshx/">csshx</a>. It uses the native OSX terminal vs. X11. I haven&#8217;t tried it, but it looks promising. I suspect there are other utilities like this available. I wouldn&#8217;t be surprised if there was a way to do this with <a href="http://www.gnu.org/software/screen/">GNU Screen</a> or <a href="http://tmux.sourceforge.net/">tmux</a>. Are there any you use for this sort if interactive multiplexing that I&#8217;m missing?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/04/simon-says-restart-your-daemons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speeding Up fsck/fsck_hsfs on OSX</title>
		<link>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/</link>
		<comments>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 01:15:39 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[fsck]]></category>
		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=357</guid>
		<description><![CDATA[Here&#8217;s a quick tip on how to make an fsck (or specifically an fsck_hsfs) run much faster. I learned this as part of debugging some corruption with the backup image on my Time Capsule. /bin/fsck_hfs -f -d -c {%mem} /dev/rdisk{N} where {%mem} is &#189; to 1&#8260;3rd the amount of memory you have in your computer. [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Here&#8217;s a quick tip on how to make an <span class="command">fsck</span> (or specifically an <span class="command">fsck_hsfs</span>) run <em>much</em> faster. I learned this as part of debugging some corruption with the backup image on my Time Capsule.</p>
<pre class="brush: bash;">/bin/fsck_hfs -f -d -c {%mem} /dev/rdisk{N}</pre>
<p>where <span class="variable">{%mem}</span> is  &#189; to 1&#8260;3rd the amount of memory you have in your computer. If you need to determine the amount of memory in a machine from the command line, a great blog post on <a href="http://juretta.com/log/2007/02/04/mac_os_x_command_line_goodies/">Mac OS X Command Line Goodies</a> suggests you can  use:</p>
<pre class="brush: bash;">
/usr/sbin/system_profiler SPHardwareDataType | grep Memory
</pre>
<p>For example, you can use <span class="command">-c 512m</span> if you have a 1GB machine. </p>
<p>and  </p>
<p><span class="variable">{N}</span> is the correct device node. This command will show you the list of disk nodes:</p>
<pre class="brush: bash;">diskutil list</pre>
<p>For example, you might use <span class="command">/dev/rdisk0s2</span>.</p>
<p>The <span class="command">-d</span> turns on debugging and <span class="command">-f</span> instructs <span class="command">fsck_hsfs</span> to force a repair if it finds any problems.</p>
<p>In case you were curious, the <span class="command">-c</span> setting is the part of the incantation that gives it its real magic. It lets the command cache a considerable amount of information in memory and that speeds up any scan a tremendous amount. If you ever run a disk repair from Disk Utility, you&#8217;ll notice the <span class="command">fsck_hsfs</span> command it spawns lacks this option and hence is much slower.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2010/01/speeding-up-an-fsckfsck_hsfs-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some lovely SSL resources</title>
		<link>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/</link>
		<comments>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 20:25:47 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=351</guid>
		<description><![CDATA[Just had to deal with a total swap out of all of my SSL certificates at work thanks to the ipsCA screwup that also nailed Bob Plankers and Chris Siebenmann and I&#8217;m sure lots of other sites (especially .edu). I&#8217;m really peeved too, but rather than hissing and spitting like I really feel like doing, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Just had to deal with a total swap out of all of my SSL certificates at work thanks to the ipsCA screwup that also nailed <a href="http://lonesysadmin.net/2009/12/22/ipsca-getting-what-you-pay-for/">Bob Plankers</a> and <a href="http://utcc.utoronto.ca/~cks/space/blog/web/SSLCAFailure">Chris Siebenmann</a> and I&#8217;m sure lots of other sites (especially .edu). I&#8217;m really peeved too, but rather than hissing and spitting like I really feel like doing, let me pass on a few SSL resources that I found useful while debugging the new chained certs we started using:</p>
<ul>
<li><a href="http://wiki.debian.org/SSLkeys">Debian&#8217;s SSL keys page</a> is a lovely resource for where and how each common open source package keeps its particular SSL-related configs. Your file system locations may vary but this at least gives you a start for the 30+ packages they list</li>
<li>UnixCraft&#8217;s <a href="http://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/">How To Verify SSL Certificate From a Shell Prompt</a> is a swell tutorial on the various <a href="http://www.openssl.org/">openssl</a> command line options you can use to debug certs. </li>
<li>Paul Heinlein&#8217;s <a href="http://www.madboa.com/geek/openssl/">OpenSSL Command-Line HOWTO</a> is a great HOWTO for all sorts of openssl operations.</li>
<li>The <a href="http://www.openssl.org/docs/apps/verify.html">OpenSSL verify manual page</a> lists the error messages you might get when attempting to verify, for example, a chained cert.</li>
<li><a href="http://www.sslshopper.com">SSLShopper.com</a>, in addition to being a good place to compare certificate authorities, has a surprising amount of really good technical information about all things SSL. For example, <a href="http://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html">The Most Common Java Keytool Keystore Commands</a> and 	<a href="http://www.sslshopper.com/article-most-common-openssl-commands.html">The Most Common OpenSSL Commands</a> are genuinely useful.</li>
</ul>
<p>Hope this are helpful to you should you get put in the same bind.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/12/some-lovely-ssl-resources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Have You Been All My Life? Rlwrap</title>
		<link>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/</link>
		<comments>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:42:21 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[rlwrap]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=342</guid>
		<description><![CDATA[Back in the days of yore (when sysadmins still had to bang two rocks together to do their job), we didn&#8217;t have command line history. No, we typed every command by hand. If we had to type the same 110-character command-line several times, we typed those 550 characters ourselves, mistakes and all, and by gum, [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Back in the days of yore (when sysadmins still had to bang two rocks together to do their job), we didn&#8217;t have command line history. No, we typed every command by hand. If we had to type the same 110-character command-line several times, we typed those 550 characters ourselves, mistakes and all, and by gum, we LIKED it! </p>
<p>And then shells became available with history functionality and, well, we kind of liked that too. And, um, then came along libraries like <a href="http://en.wikipedia.org/wiki/GNU_readline">GNU readline</a> that were written to provide even more pleasant, vizz-eee-ul history recall and editing to anything that presents a command line prompt, and well, ok, we REALLY that too. Because, quite frankly, typing long command line strings over and over again, sometimes because our typing skills aren&#8217;t always sharp, is a real drag.</p>
<p>But alas, not every program that provides a command-line prompt or handles interactive input provides this new-fangled user experience (I&#8217;m looking at you <a href="http://en.wikipedia.org/wiki/SQL*Plus">sqlplus</a>, maybe if scott had a real tiger&#8230;). In the past, a sysadmin had to look admonishingly at one of these programs, perhaps working around the lack of interface using something like <a href="http://expect.nist.gov/">Expect</a>.</p>
<p>Maybe I&#8217;m the last admin on the planet to hear about this idea, but it came as a pleasant surprise to find out that there are a number of programs out there whose whole purpose in life is to add the readline-yumminess to programs that don&#8217;t have it already. The first one I encountered was <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap">rlwrap</a> by Hans Lub. Now you can type:</p>
<pre class="brush: bash;">
$ rlwrap sqlplus scott/tiger@oracle_instance
</pre>
<p>And you get a reasonable command-line environment even from within sqlplus.</p>
<p>I know I would have offered at least a vestigial body part several times in the past to have the &#8220;add readline to command X&#8221; super power several times during my career. (apparently this tip has been <a href="http://sysdba.wordpress.com/2006/10/08/how-to-use-rlwrap-to-get-a-command-history-in-sqlplus/">making people in the Oracle community happy</a> for a while now).  </p>
<p>The <a href="http://utopia.knoware.nl/~hlub/uck/rlwrap/README.txt">rlwrap README</a> mentions two other similar packages: rlfe which even ships with the GNU readline distribution and <a href="http://kaolin.unice.fr/Cle/">cle</a>. I note that cle hasn&#8217;t been touched for over ten years (the last release&#8217;s 10th birthday was just over a week ago). I can&#8217;t speak to how well rlfe works, but kudos to Lub for continuing to update the rlwrap package.</p>
<p>Hope this tip brings you a similar amount of joy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/12/where-have-you-been-all-my-life-rlwrap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>But It&#8217;s Only A Slash: svn.access</title>
		<link>http://www.otterbook.com/blog/2009/09/but-its-only-a-slash-svn-access/</link>
		<comments>http://www.otterbook.com/blog/2009/09/but-its-only-a-slash-svn-access/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 03:44:27 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=336</guid>
		<description><![CDATA[I spent the good part of my morning today debugging an issue with a user&#8217;s access to a Subversion repository/trac service we provide. That person could not get even a basic svn checkout to work as expected. It would keep throwing errors like this: Server sent unexpected return value (403 Forbidden) in response to OPTIONS [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>I spent the good part of my morning today debugging an issue with a user&#8217;s access to a Subversion repository/trac service we provide. That person could not get even a basic svn checkout to work as expected. It would keep throwing errors like this:</p>
<p><code>Server sent unexpected return value (403 Forbidden) in response to OPTIONS request for {url}</code></p>
<p>I went up and down the stack, I poked and prodded the two web servers in question (Apache 2 and Lighttpd) and their authentication sources with multiple clients. I watched packet traces. I checked and rechecked every config I could lay my hands on to no avail. It was driving me crazy.</p>
<p>Finally, I realized that the mod_dav_svn file semantics for paths in an svn.access file distinguished between:</p>
<pre class="brush: plain;">
[repos:/dir/]
user1 = rw
user2 = rw</pre>
<p>and </p>
<pre class="brush: plain;">
[repos:/dir]
user1 = rw
user2 = rw</pre>
<p>The first only works if you&#8217;ve explicitly granted the same permissions to the parent directory as well, i.e.:</p>
<pre class="brush: plain;">
[repos:/]
user1 = rw
user2 = rw</pre>
<p>while the second &#8220;does the right thing&#8221; to allow the users to have access to that path component without having to permit the parent directory as well.</p>
<p>Hopes this saves you some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/09/but-its-only-a-slash-svn-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the SQLite DB for a Trac Instance</title>
		<link>http://www.otterbook.com/blog/2009/08/fixing-the-sqlite-db-for-a-trac-instance/</link>
		<comments>http://www.otterbook.com/blog/2009/08/fixing-the-sqlite-db-for-a-trac-instance/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 12:57:15 +0000</pubDate>
		<dc:creator>dnb</dc:creator>
				<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.otterbook.com/?p=305</guid>
		<description><![CDATA[&#8217;bout time I add some sysadmin content here. If you ever have a trac instance go boom with an error like &#8220;DatabaseError: database disk image is malformed&#8221; you can often fix the problem by doing an sqlite dump/reload: $ cd /path/to/trac-sqlite-db-directory # find the trac.db file $ su www-data # switch to the owner of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>&#8217;bout time I add some sysadmin content here.<br />
If you ever have a trac instance go boom with an error like &#8220;DatabaseError: database disk image is malformed&#8221; you can often fix the problem by doing an sqlite dump/reload:</p>
<pre class="brush: bash;">
$ cd /path/to/trac-sqlite-db-directory # find the trac.db file
$ su www-data   # switch to the owner of the db file
$ mv trac.db trac.db.damaged
$ sqlite3 trac.db.damaged .dump|sqlite3 trac.db
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.otterbook.com/blog/2009/08/fixing-the-sqlite-db-for-a-trac-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 20/30 queries in 0.032 seconds using disk

Served from: www.otterbook.com @ 2010-07-31 00:02:55 -->