<?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 Geekery &#187; Linux</title>
	<atom:link href="http://jon.netdork.net/category/technology/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://jon.netdork.net</link>
	<description>The Usual Stuff...</description>
	<lastBuildDate>Sun, 18 Jul 2010 16:53:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Configuration Management (Part I): Introduction</title>
		<link>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=configuration-management-part-i-introduction</link>
		<comments>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction#comments</comments>
		<pubDate>Mon, 21 Jun 2010 01:22:19 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=876</guid>
		<description><![CDATA[I&#8217;ve been asked to write a post on configuration management, and version control by a friend, Steven Klassen. Instead of a single post, I&#8217;m going to break this into several posts as some parts might be unimportant to some, and they can easily skip a whole post. I&#8217;ll be posting this over a few days, [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F20%2Fconfiguration-management-part-i-introduction">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F06%2F20%2Fconfiguration-management-part-i-introduction&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>I&#8217;ve been asked to write a post on configuration management, and version control by a friend, <a href="http://www.stevenklassen.com/" title="Steven Klassen">Steven Klassen</a>.  Instead of a single post, I&#8217;m going to break this into several posts as some parts might be unimportant to some, and they can easily skip a whole post.  I&#8217;ll be posting this over a few days, so stay tuned.  If you&#8217;re not subscribed to my <a href="http://feeds.feedburner.com/TheGeekery" title="The Geekery; RSS Feed"><acronym title="Really Simple Syndication">RSS</acronym> feed</a>, now would be a great time.</p>

<p><span id="more-876"></span></p>

<h2>The Request</h2>

<p>Earlier today, Steven asked if I used any form of version control.  It was a leading question, straight into &#8220;dev only or system files&#8221;?  His questions were targeted, he was searching for guidance.  Another question or two later, and it boils down to this:</p>

<ul>
<li>Do you use version control for system files?</li>
<li>Files like domain zone files?</li>
<li>What about multi-user environments?</li>
<li>Can you write it up?</li>
</ul>

<p>My take away on the questions boils down to two things; configuration management, and backups.  Anybody that has managed any type of system has, at some point, messed up the configuration file, and forgotten what they did to get there in the first place.  Those who have been at it a while will usually do a quick copy before they do any modifications.  But, as Steven found out in the past, best laid plans can be foiled by a <a href="http://www.stevenklassen.com/2010/06/16/murphy/" title="Steven Klassen; Murphy">simple typo</a>. </p>

<h2>Version Control</h2>

<p>This is what version control is all about.  It acts as a backup, whilst keeping a running history of what you did between changes.  Version control, or revision control as it&#8217;s also known, is big business.  Anywhere you find a big name development company, you&#8217;ll find they&#8217;ve probably developed a revision control system to go with whatever they&#8217;re offering.  Take a look at <a href="http://en.wikipedia.org/wiki/Comparison_of_revision_control_software" title="Wikipedia; Comparison of revision control software">this</a> Wikipedia entry comparing just a handful of them.</p>

<h2>Configuration Management and Version Control</h2>

<p>You don&#8217;t have to be a genius to figure out how useful version control can be for configuration management, but in case your brain often goes off to lala land like <a href="http://twitter.com/j_angliss/status/16407172868" title="Twitter; j_angliss">mine</a>, here is a run down on a few reasons you should really consider using it&#8230;</p>

<ul>
<li>What did I just change again? And why is that service not starting any more? Oh hell&#8230;</li>
<li>6 months down the road, can you figure out <em>why</em> you changed that line to Apache to start 10 daemons instead of 5? No? Most version control systems allow you to add comments to your commits.</li>
<li>As above, but why did Fred in your team change that entry back down to 7 a week later?</li>
<li>In the words of Homer&#8230; <strong>Doh!!</strong> I wasn&#8217;t supposed to delete/overwrite that file!</li>
</ul>

<p>So, there are 4 obvious cases as to why you&#8217;d want to use version control.</p>

<h2>The Breakdown</h2>

<p>As I said at the beginning, I&#8217;ll be breaking this down into several parts.  I expect them to be something along these lines:</p>

<ul>
<li>Introduction</li>
<li>Setting up <acronym title="Subversion">SVN</acronym> and the base repository</li>
<li>Using your repository</li>
<li>Educating your team members</li>
<li>Maintenance and monitoring</li>
<li>Conclusion, and follow-up ideas.</li>
</ul>

<p>If you&#8217;re interested, keep an eye open for the rest of the series.  If not, send me something you&#8217;d like to see me write about.  I&#8217;m open to suggestions, and will probably butcher anything you can throw at me.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/06/20/configuration-management-part-i-introduction/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	<!-- google ad injected by adsense-optimizer http://www.adsenseoptimizer.de -->
			<div  style="padding:7px; display: block; margin-left: auto; margin-right: auto; text-align: center;"><!-- Linkblock number: 1 --><script type="text/javascript"><!--
	 
google_ad_client = "pub-5380792458095798";
google_ad_width = 468;
google_ad_height = 15;
google_ad_format = "468x15_0ads_al"; google_ad_channel ="";
google_color_border = "CCCCCC";
google_color_bg = "F7F7F7";
google_color_link = "2970A6";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>	<item>
		<title>Hiding web server information</title>
		<link>http://jon.netdork.net/2010/04/17/hiding-web-server-information?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=hiding-web-server-information</link>
		<comments>http://jon.netdork.net/2010/04/17/hiding-web-server-information#comments</comments>
		<pubDate>Sat, 17 Apr 2010 16:48:00 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=765</guid>
		<description><![CDATA[In a case of what I&#8217;d call security through obscurity, the Linux Poison blog has a posting up on how to hide the PHP information in your web server. The idea is that the less a potential hacker knows about a system, the better. Here, I&#8217;m going to take it one step further, and show [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F04%2F17%2Fhiding-web-server-information">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F04%2F17%2Fhiding-web-server-information&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=Security" height="61" width="50" />
			</a>
		</div><p>In a case of what I&#8217;d call <em>security through obscurity</em>, the <a href="http://linuxpoison.blogspot.com/2010/04/how-to-hide-php-version-information.html" title="Linux Poison; How To Hide PHP Version Information">Linux Poison blog</a> has a posting up on how to <a href="http://linuxpoison.blogspot.com/2010/04/how-to-hide-php-version-information.html" title="Linux Poison; How To Hide PHP Version Information">hide the <acronym title="Pre-Hypertext Processing">PHP</acronym> information</a> in your web server.  The idea is that the less a potential hacker knows about a system, the better.  Here, I&#8217;m going to take it one step further, and show you the impact of some other options, and what data gets hidden.</p>

<p><span id="more-765"></span>
The first step is to see what information is displayed without making changes.  From my development server, I pull up Firebug, and load a page, and see what the response headers look like&#8230;</p>

<p><a href="http://jon.netdork.net/wp-content/uploads/2010/04/nd_nowebchanges.png"><img src="http://jon.netdork.net/wp-content/uploads/2010/04/nd_nowebchanges-300x59.png" alt="" title="Server info with no changes" width="300" height="59" class="alignnone size-medium wp-image-766" /></a></p>

<p>As you can see from the image of Firebug there is a wealth of information being presented to any would-be hacker.  To start, they now know my development server is running Debian Lenny.  It also has mod_php, mod_perl, mod_ssl, and mod_python (plus specific version information) installed, and that the instance of apache running is using OpenSSL 0.9.8g.  A quick search of any security tracking sites could pull up all kinds of useful information based around that alone.  This just made the hackers life easier, because now s/he doesn&#8217;t have to brute force attack the server.</p>

<p>Lets see what happens when we modify the recommendations by the <a href="http://linuxpoison.blogspot.com/" title="Linux Poison">Linux Poison</a> blog.  In Debian the file needed to be modified is in /etc/php5/apache/php.ini, other platforms may store the file elsewhere. Don&#8217;t forget to tell your web server to reload after making the changes.</p>

<p><a href="http://jon.netdork.net/wp-content/uploads/2010/04/nd_hidephp.png"><img src="http://jon.netdork.net/wp-content/uploads/2010/04/nd_hidephp-300x56.png" alt="" title="Hide PHP information" width="300" height="56" class="alignnone size-medium wp-image-768" /></a></p>

<p>This looks a little better.  It no longer displays any <acronym title="Pre-Hypertext Processing">PHP</acronym> related information, but the rest of the data is still there.  We need to do something more about that.  In my case, that means moving onto the apache configuration.  The two important directives in this case are <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servertokens" title="Apache Documentation; ServerTokens">ServerTokens</a> and <a href="http://httpd.apache.org/docs/2.2/mod/core.html#serversignature" title="Apache Documentation; ServerSignature">ServerSignature</a>.  These directives are both in /etc/apache2/apache2.conf in Debian, so may be located in a different file depending on platform.  <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servertokens" title="Apache Documentation; ServerTokens">ServerTokens</a> is the most important one.  A quick look at the apache documentation shows what the output looks like depending on the options selected&#8230;</p>

<blockquote>
ServerTokens <b>Prod[uctOnly]</b><br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache<br />
ServerTokens <b>Major</b><br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache/2<br />
ServerTokens <b>Minor</b><br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache/2.0<br />
ServerTokens <b>Min[imal]</b><br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache/2.0.41<br />
ServerTokens <b><acronym title="Operating System">OS</acronym></b><br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache/2.0.41 (Unix)<br />
ServerTokens <b>Full</b> (or not specified)<br />
&nbsp;&nbsp;&nbsp;Server sends (e.g.): Server: Apache/2.0.41 (Unix) <acronym title="Pre-Hypertext Processing">PHP</acronym>/4.2.2 MyMod/1.2
</blockquote>

<p>From this list, it&#8217;s clear to see that <strong>prod</strong> is the winner on showing the least amount of information.  So a quick change of that setting, and a restart of apache again, lets see what happens to the output now&#8230;</p>

<p><a href="http://jon.netdork.net/wp-content/uploads/2010/04/nd_servertokens.png"><img src="http://jon.netdork.net/wp-content/uploads/2010/04/nd_servertokens.png" alt="" title="Server Tokens" width="388" height="141" class="alignnone size-full wp-image-773" /></a></p>

<p>As we can see from the Firebug output, it now lists only that I&#8217;m running apache, a substantial improvement.</p>

<p>What about the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#serversignature" title="Apache Documentation; ServerSignature">ServerSignature</a> option I mentioned?  The apache documentation has this to say about this configuration entry&#8230;</p>

<blockquote>
The ServerSignature directive allows the configuration of a trailing footer line under server-generated documents (error messages, mod_proxy ftp directory listings, mod_info output, &#8230;). The reason why you would want to enable such a footer line is that in a chain of proxies, the user often has no possibility to tell which of the chained servers actually produced a returned error message.
</blockquote>

<p>It mentions <em>server-generated documents</em>, so this includes any error pages, but it also includes the pages Apache generates when you don&#8217;t have a directory index, and it just lists the file contents.  The option, and the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servertokens" title="Apache Documentation; ServerTokens">ServerTokens</a> option actually play together, so for a test, I&#8217;ve reverted the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servertokens" title="Apache Documentation; ServerTokens">ServerTokens</a> option back to <strong>Full</strong> so you can see what happens when <a href="http://httpd.apache.org/docs/2.2/mod/core.html#serversignature" title="Apache Documentation; ServerSignature">ServerSignature</a> is set to <strong>On</strong>.</p>

<p><a href="http://jon.netdork.net/wp-content/uploads/2010/04/nd_serversig.png"><img src="http://jon.netdork.net/wp-content/uploads/2010/04/nd_serversig-300x73.png" alt="" title="Server Signature" width="300" height="73" class="alignnone size-medium wp-image-775" /></a></p>

<p>As you can see from the screenshot, it contains the same information that is contained in the headers, a little easier for somebody to see.  So flipping the option <a href="http://httpd.apache.org/docs/2.2/mod/core.html#servertokens" title="Apache Documentation; ServerTokens">ServerTokens</a> back to <strong>Prod</strong> and all you display is that the server is running apache.  Flipping the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#serversignature" title="Apache Documentation; ServerSignature">ServerSignature</a> option to <strong>Off</strong> does exactly that, there is no longer a signature at the bottom of the pages generated.  The other option is <strong>Email</strong>.  This is the same as <strong>On</strong> but adds a mailto: link where the server name is too.  This may be handy if you want to allow people to track down the administrator of the server.</p>

<p>As I mentioned at the start of the post, this to me, falls into the &#8216;security through obscurity&#8217; category, and should be one step towards making your server a little more secure, but definitely not the last.  The less the person knows about a system, the more they&#8217;ll have to work to find out ways in.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/04/17/hiding-web-server-information/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL: Error 127 when reading table</title>
		<link>http://jon.netdork.net/2010/01/12/mysql-error-127-when-reading-table?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mysql-error-127-when-reading-table</link>
		<comments>http://jon.netdork.net/2010/01/12/mysql-error-127-when-reading-table#comments</comments>
		<pubDate>Wed, 13 Jan 2010 04:55:22 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[Repair]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=576</guid>
		<description><![CDATA[After today&#8217;s little hiccup, I noticed the random image in the top right of my page throwing an error message, something about ERROR_STORAGE_FAILURE. A little digging about, I stumbled across an error in the daemon.log file&#8230; mysqld&#91;4478&#93;: 100112 20:31:04 &#91;ERROR&#93; Got error 127 when reading table g2_ItemAttributesMap Fortunately, most of the times, this is relatively [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F01%2F12%2Fmysql-error-127-when-reading-table">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F01%2F12%2Fmysql-error-127-when-reading-table&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=MySql,Repair" height="61" width="50" />
			</a>
		</div><p>After today&#8217;s little hiccup, I noticed the random image in the top right of my page throwing an error message, something about ERROR_STORAGE_FAILURE.  A little digging about, I stumbled across an error in the daemon.log file&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysqld<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">4478</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: <span style="color: #000000;">100112</span> <span style="color: #000000;">20</span>:<span style="color: #000000;">31</span>:04 <span style="color: #7a0874; font-weight: bold;">&#91;</span>ERROR<span style="color: #7a0874; font-weight: bold;">&#93;</span> Got error <span style="color: #000000;">127</span> when reading table g2_ItemAttributesMap</div></div>

<p>Fortunately, most of the times, this is relatively easy to resolve.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql<span style="color: #000000; font-weight: bold;">&gt;</span> USE mydbname;<br />
mysql<span style="color: #000000; font-weight: bold;">&gt;</span> REPAIR TABLE g2_ItemAttributesMap;<br />
+----------------------+--------+----------+----------+<br />
<span style="color: #000000; font-weight: bold;">|</span> Table &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">|</span> Op &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">|</span> Msg_type <span style="color: #000000; font-weight: bold;">|</span> Msg_text <span style="color: #000000; font-weight: bold;">|</span><br />
+----------------------+--------+----------+----------+<br />
<span style="color: #000000; font-weight: bold;">|</span> g2_ItemAttributesMap <span style="color: #000000; font-weight: bold;">|</span> repair <span style="color: #000000; font-weight: bold;">|</span> status &nbsp; <span style="color: #000000; font-weight: bold;">|</span> OK &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">|</span> <br />
+----------------------+--------+----------+----------+<br />
<span style="color: #000000;">1</span> row <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0.01</span> sec<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>

<p>As you can see from the Msg_text column, the command completed OK.  A quick refresh of the blog page, and the error is now gone, and the random picture is back&#8230;</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/01/12/mysql-error-127-when-reading-table/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Corral those processes&#8230;</title>
		<link>http://jon.netdork.net/2010/01/12/corral-those-processes?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=corral-those-processes</link>
		<comments>http://jon.netdork.net/2010/01/12/corral-those-processes#comments</comments>
		<pubDate>Wed, 13 Jan 2010 02:10:32 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=573</guid>
		<description><![CDATA[Running on from today&#8217;s outage, I&#8217;ve put a few more safety measures in place. I&#8217;ve always had old faithful Nagios watching over my servers, however sometimes a little more is needed. Introducing Monit into the picture&#8230; Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F01%2F12%2Fcorral-those-processes">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2010%2F01%2F12%2Fcorral-those-processes&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>Running on from today&#8217;s outage, I&#8217;ve put a few more safety measures in place.  I&#8217;ve always had <em>old faithful</em> <a href="http://www.nagios.org" title="Nagios">Nagios</a> watching over my servers, however sometimes a little more is needed.  Introducing <a href="http://mmonit.com/monit/" title="Monit">Monit</a> into the picture&#8230;</p>

<p><span id="more-573"></span></p>

<blockquote>
Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.
</blockquote>

<p>Monit basically watches your processes, and takes actions based on criteria specified.  The configurations are practically English, so bashing something together quickly to monitor the major culprits isn&#8217;t hard.  Debian is even easier for general installs.</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> monit</div></div>

<p>Then you just need to edit the config.  The base config has an awful log of commenting, so it&#8217;s easy to understand, but here is an example of monitoring apache&#8230;</p>

<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">check process apache2 with pidfile <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>apache2.pid<br />
&nbsp; start program = <span style="color: #ff0000;">&quot;/etc/init.d/apache2 start&quot;</span><br />
&nbsp; stop program &nbsp;= <span style="color: #ff0000;">&quot;/etc/init.d/apache2 stop&quot;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> cpu is greater than <span style="color: #000000;">60</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000;">2</span> cycles <span style="color: #000000; font-weight: bold;">then</span> alert<br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> cpu <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000;">5</span> cycles <span style="color: #000000; font-weight: bold;">then</span> restart<br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> totalmem <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">200.0</span> MB <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000;">5</span> cycles <span style="color: #000000; font-weight: bold;">then</span> restart<br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> children <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">250</span> <span style="color: #000000; font-weight: bold;">then</span> restart<br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> loadavg<span style="color: #7a0874; font-weight: bold;">&#40;</span>5min<span style="color: #7a0874; font-weight: bold;">&#41;</span> greater than <span style="color: #000000;">10</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000;">8</span> cycles <span style="color: #000000; font-weight: bold;">then</span> stop<br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000;">3</span> restarts within <span style="color: #000000;">5</span> cycles <span style="color: #000000; font-weight: bold;">then</span> timeout<br />
&nbsp; group server</div></div>

<p>Without any knowledge of the Monit configuration system, I bet 90% of all admins can figure out what all of this means.</p>

<p>Once started, Monit will come to life every X minutes (based on configuration variable), check the process, make sure it&#8217;s running, and not exceeding the defined limits, and take actions if it is.</p>

<p>Stay tuned for more server modifications for better handling my <em>customers</em>.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2010/01/12/corral-those-processes/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tinkering with Temperature (Part Deux)</title>
		<link>http://jon.netdork.net/2009/08/01/tinkering-with-temperature-part-deux?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=tinkering-with-temperature-part-deux</link>
		<comments>http://jon.netdork.net/2009/08/01/tinkering-with-temperature-part-deux#comments</comments>
		<pubDate>Sun, 02 Aug 2009 02:54:25 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[1-wire]]></category>
		<category><![CDATA[instructable]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[temperature]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2009/08/01/tinkering-with-temperature-part-deux</guid>
		<description><![CDATA[As a follow up to the previous Tinkering with Temperature post, here is more on what I did, and how. I made some alterations to my original schematic, as I was originally going with a serial to RJ45 conversion.&#160; I figured I’d save myself some headaches, and use one of the Cisco console cables I [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F08%2F01%2Ftinkering-with-temperature-part-deux">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F08%2F01%2Ftinkering-with-temperature-part-deux&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=1-wire,Electronics,instructable,make,temperature" height="61" width="50" />
			</a>
		</div><p></p><p>As a follow up to the previous <a href="http://jon.netdork.net/2009/07/07/tinkering-with-temperature" target="_blank">Tinkering with Temperature</a> post, here is more on what I did, and how.</p> <span id="more-531"></span>  <p>I made some alterations to my original schematic, as I was originally going with a serial to RJ45 conversion.&#160; I figured I’d save myself some headaches, and use one of the Cisco console cables I had laying around.&#160; This had a slightly different pinout on the RJ45 end, compared to the serial cable I was going to make.&#160; Pinouts for the cable can be found all over the internet, including Cisco’s own site, but I used <a href="http://www.allpinouts.org/index.php/Cisco_Console_RJ45_to_DB9_Pin_Cable" target="_blank">this</a> as a reference.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/temp_sensor_board.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="temp_sensor_board" border="0" alt="temp_sensor_board" align="right" src="http://jon.netdork.net/wp-content/uploads/2009/08/temp_sensor_board_thumb.png" width="92" height="116" /></a> Now I had my new schematic, I put it onto a board.&#160; As with my schematic, KiCad helped out here too.&#160; It mocked out the basic components, I just had to rearrange them, and then draw tracks.&#160; I did read somewhere that there is an auto-route feature, but I couldn’t find/figure it out, not that mine was complicated, and I couldn’t figure out a few lines.&#160; So I ultimately ended up with the image to the right.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6006.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6006" border="0" alt="DSC_6006" align="left" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6006_thumb.jpg" width="116" height="77" /></a> Once drawn out, a simple case of printing on <a href="http://www.dipmicro.com/store/PNPB" target="_blank">special paper</a>, or you can do it the cheaper way of using <a href="http://www.riccibitti.com/pcb/pcb.htm" target="_blank">magazine pages</a>.&#160; I went with the later.&#160; When printed,&#160; it’s just a case of taping the paper to the board, and applying heat.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6008.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6008" border="0" alt="DSC_6008" align="right" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6008_thumb.jpg" width="130" height="86" /></a> When applying heat, you must remember to turn off the steam options, otherwise it won’t work properly.&#160; This can take some time, depending on the toner, paper thickness, and the iron involved.&#160; Once you’re satisfied with enough transfer, time to get the paper wet.&#160; This will dissolve the paper, but leave the toner on the board. </p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6009.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6009" border="0" alt="DSC_6009" align="left" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6009_thumb.jpg" width="101" height="67" /></a> Now is a good time to inspect the board, and make sure that any missing traces are covered.&#160; Usually you can get away with a sharpie, but you can get special etch-resistant pens.&#160; I went over all the lines again just to make extra sure.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6012.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6012" border="0" alt="DSC_6012" align="right" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6012_thumb.jpg" width="98" height="65" /></a> At this point, we could etch the board, but it’s still a little large, so I trimmed off the larger side, and left the shortest excess attached.&#160; This gave me a good point to hold, as well as a good indication of how well it was going.</p>  <p>Now it’s etching time.&#160; Following the instructions carefully, I did this outside in a well ventilated area, with poor light.&#160; Okay maybe I cannot follow all instructions well, but I did wear gloves, and did this away from anything metal.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6014.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6014" border="0" alt="DSC_6014" align="left" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6014_thumb.jpg" width="121" height="80" /></a> After about 15 minutes of agitation, and careful inspection, the board was etched.&#160; Note that part of the board wasn’t etched in the picture, but that was part that was in the excess area.&#160; Another quick trim to remove that excess piece, so it’d fit nicely into the housing.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6016.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6016" border="0" alt="DSC_6016" align="right" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6016_thumb.jpg" width="98" height="65" /></a> I borrowed <a href="http://jstudios.us/" target="_blank">Jeremy’s</a> drill, and a bit from Rick. I quickly drilled the parts, and got to work soldering.&#160; One thing to note is that when soldering, and constructing, follow your diagrams closely.&#160; I originally soldered one of the diodes in backwards, so it wasn’t working until I desoldered it, and put it back in correctly.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6019.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6019" border="0" alt="DSC_6019" align="left" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6019_thumb.jpg" width="123" height="81" /></a> I’d carefully designed the size of the PCB to be oversized, I could have clearly chopped an extra inch or so off, because it was to fit inside an old Linksys workgroup switch box.&#160; This ended up being about 4&#215;6.&#160; The RJ45 connectors were a little low profile for the case, but it doesn’t matter too much, as it’s going to be hiding in the server room away from careful inspection of most people.</p>  <p><a href="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6022.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="DSC_6022" border="0" alt="DSC_6022" align="right" src="http://jon.netdork.net/wp-content/uploads/2009/08/DSC_6022_thumb.jpg" width="113" height="75" /></a> The final product looks like this.&#160; Sits nicely inside the chassis, and looks pretty good.&#160; It was a 5 port workgroup switch, with port 5 being disabled if you had an “uplink” cable in place.&#160; In my case, port 6 is going to be the serial port.</p>  <p>Now for Monday, build some cables, once I’ve figured out all the lengths I need.&#160; I did do a quick breadboard test with a RJ45 connector, and 2 wires crimped down to a breadboard to ensure it was working, and got good readings (compared with my fluke tester).&#160; </p>  <p>I’ll power additional pictures once I have all the cables in place, and tucked into the racks.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2009/08/01/tinkering-with-temperature-part-deux/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Mail Stats</title>
		<link>http://jon.netdork.net/2009/07/20/random-mail-stats?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=random-mail-stats</link>
		<comments>http://jon.netdork.net/2009/07/20/random-mail-stats#comments</comments>
		<pubDate>Mon, 20 Jul 2009 23:44:38 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[General Ramblings]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/?p=505</guid>
		<description><![CDATA[I&#8217;ve been meaning to get some proper stats setup for my mail server, but until then, I&#8217;ve been mostly content with reading the LogWatch reports from my server. It has been dutifully analyzing my log files, and giving me all kinds of useful data, such as the mail stats from Saturday, 18th July&#8230; The first [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F07%2F20%2Frandom-mail-stats">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F07%2F20%2Frandom-mail-stats&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>I&#8217;ve been meaning to get some proper stats setup for my mail server, but until then, I&#8217;ve been mostly content with reading the <a href="http://www.logwatch.org/" title="LogWatch">LogWatch</a> reports from my server. It has been dutifully analyzing my log files, and giving me all kinds of useful data, such as the mail stats from Saturday, 18th July&#8230;</p>

<p><span id="more-505"></span>
The first interesting stat is for my tiny little mail server, I received 27,668 emails.  Of that 27,242 of them were dropped at the door.  20k of which were <a href="http://en.wikipedia.org/wiki/DNSBL" title="Wikipedia; DNS BL">RBLs</a>.  Of the handful that were left behind, half of them were marked as spam by <a href="http://www.ijs.si/software/amavisd/" title="Amavisd-New">Amavis</a> and <a href="http://spamassassin.apache.org/" title="The Apache SpamASsassin Project">SpamAssassin</a>.</p>

<p>Here are the full details&#8230;</p>

<blockquote><pre>
 --------------------- Postfix Begin ------------------------ 

        4   SASL authentication failed 
 
   48.003M  Bytes accepted                        50,334,433
   77.976M  Bytes sent via <acronym title="Simple Mail Transfer Protocol">SMTP</acronym>                   81,763,280
    8.110M  Bytes delivered                        8,503,744
 ========   ================================================
 
      426   Accepted                                   1.54%
    27242   Rejected                                  98.46%
 --------   ------------------------------------------------
    27668   Total                                    100.00%
 ========   ================================================
 
      504   5xx Reject relay denied                    1.85%
       42   5xx Reject HELO/EHLO                       0.15%
     4239   5xx Reject unknown user                   15.56%
     1914   5xx Reject recipient address               7.03%
    20543   5xx Reject RBL                            75.41%
 --------   ------------------------------------------------
    27242   Total 5xx Rejects                        100.00%
 ========   ================================================
 
     1097   4xx Reject recipient address             100.00%
 --------   ------------------------------------------------
     1097   Total 4xx Rejects                        100.00%
 ========   ================================================
 
    22593   Connections made      
    12936   Connections lost (inbound) 
    22592   Disconnections        
      422   Removed from queue    
      115   Delivered             
      333   Sent via <acronym title="Simple Mail Transfer Protocol">SMTP</acronym>         
        4   Resent                
     7536   Policyd-weight        
 
        2   Connection failure (outbound) 
      184   Timeout (inbound)     
       28   Illegal address syntax in <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> command 
        4   Numeric hostname      
       14   <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> dialog error     
       28   Excessive errors in <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> dialog 
     3484   Hostname verification errors 
        4   Hostname validation errors 
        7   SASL authenticated messages 
 
 
 
 ---------------------- Postfix End ------------------------- 
</pre></blockquote>

<p>This reminds me of a need to setup more monitoring and statistics.  For example, per domain logs for the domain owners to review (and me to find out who uses my system the most).</p>

<p>I have some interesting ideas for my servers, just got to get around to doing them&#8230;</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2009/07/20/random-mail-stats/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	<!-- google ad injected by adsense-optimizer http://www.adsenseoptimizer.de -->
			<div  style="padding:7px; display: block; margin-left: auto; margin-right: auto; text-align: center;"><!-- Ad number: 1 --><script type="text/javascript"><!--
    	 
    	google_ad_client = "pub-5380792458095798"; google_alternate_color = "FFFFFF";
		google_ad_width = 468; google_ad_height = 60;
		google_ad_format = "468x60_as"; google_ad_type = "text";
		google_ad_channel =""; google_color_border = "CCCCCC";
		google_color_link = "2970A6"; google_color_bg = "F7F7F7";
		google_color_text = "555555"; google_color_url = "2970A6";
		google_ui_features = "rc:10"; //--></script>
		<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>	<item>
		<title>Debian Lenny, and tab auto-complete</title>
		<link>http://jon.netdork.net/2009/06/28/debian-lenny-and-tab-auto-complete?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=debian-lenny-and-tab-auto-complete</link>
		<comments>http://jon.netdork.net/2009/06/28/debian-lenny-and-tab-auto-complete#comments</comments>
		<pubDate>Sun, 28 Jun 2009 16:31:15 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Debain]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2009/06/28/debian-lenny-and-tab-auto-complete</guid>
		<description><![CDATA[I’m currently working on rebuilding a server on a project, and went to hit the tab key to auto-complete, when I was presented a delightful error… $ vim RE-sh: &#60;( compgen -d &#8212; &#8216;RE&#8217; ): No such file or directory -sh: &#60;( eval compgen -f -X &#8216;*.@(o&#124;so&#124;so.!(conf)&#124;a&#124;rpm&#124;gif&#124;GIF&#124;jp?(e)g&#124;JP?(E)G&#124;mp3&#124;MP3&#124;mp?(e)g&#124;MPG&#124;avi&#124;AVI&#124;asf&#124;ASF&#124;ogg&#124;OGG&#124;class&#124;CLASS)&#8217; &#8212; $(quote_readline $cur) ): No such file or [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F06%2F28%2Fdebian-lenny-and-tab-auto-complete">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F06%2F28%2Fdebian-lenny-and-tab-auto-complete&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=Bash,Debain" height="61" width="50" />
			</a>
		</div><p></p><p>I’m currently working on rebuilding a server on a project, and went to hit the tab key to auto-complete, when I was presented a delightful error…</p>  <blockquote>   <p>$ vim RE-sh: &lt;( compgen -d &#8212; &#8216;RE&#8217; ): No such file or directory     <br />-sh: &lt;( eval compgen -f -X &#8216;*.@(o|so|so.!(conf)|a|rpm|gif|<acronym title="Graphics Interchange Format">GIF</acronym>|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)&#8217; &#8212; $(quote_readline $cur) ): No such file or directory</p> </blockquote>  <p>This is actually a reported bug in Debian [<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502804" target="_blank">#502804</a>] and is caused by using /bin/sh as a shell, rather than /bin/bash due to some POSIX compliant code.&#160; A simple change to the shell until they release the fix..</p>  <blockquote>   <p>usermod –s /bin/bash jangliss</p> </blockquote>  <p>And we’re all set again.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2009/06/28/debian-lenny-and-tab-auto-complete/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sad Day&#8230;</title>
		<link>http://jon.netdork.net/2009/04/07/sad-day-2?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=sad-day-2</link>
		<comments>http://jon.netdork.net/2009/04/07/sad-day-2#comments</comments>
		<pubDate>Tue, 07 Apr 2009 14:20:35 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2009/04/07/sad-day-2</guid>
		<description><![CDATA[Today I’ve decided to finally shut down a trusty server.&#160; It’s been the office firewall for 4+ years, happily chugging away on an old HP desktop, running Gentoo linux. $ uptime 08:44:48 up 267 days, 17:51,&#160; 1 user,&#160; load average: 0.00, 0.00, 0.00 It’s currently been running for nearly a year.&#160; It’d be double that [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F04%2F07%2Fsad-day-2">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F04%2F07%2Fsad-day-2&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p></p><p>Today I’ve decided to finally shut down a trusty server.&#160; It’s been the office firewall for 4+ years, happily chugging away on an old HP desktop, running Gentoo linux.</p>  <blockquote>   <p>$ uptime     <br /> 08:44:48 up 267 days, 17:51,&#160; 1 user,&#160; load average: 0.00, 0.00, 0.00</p> </blockquote>  <p>It’s currently been running for nearly a year.&#160; It’d be double that if we’d not had an issue with a snake, and the office transformed.&#160; Before that, it’d been running without issues for nearly 2 years, where the failure before that was caused by a PSU fan failure.</p>  <p>It was recently phased out with some network reconfigurations, and is no longer needed…</p>  <p>Good night lestats.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2009/04/07/sad-day-2/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Bash One-Liners</title>
		<link>http://jon.netdork.net/2009/02/04/bash-one-liners?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=bash-one-liners</link>
		<comments>http://jon.netdork.net/2009/02/04/bash-one-liners#comments</comments>
		<pubDate>Wed, 04 Feb 2009 15:05:06 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2009/02/04/bash-one-liners</guid>
		<description><![CDATA[I love one-liners to make my life easier.&#160; Today I decided to clean up a directory full of CSV files, and compress them down.&#160; After all, a 2MB CSV file can be reduced quite substantially, and I had 300 of them. Here it is, quite simply loops through the directory of CSVs, and zips the [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F02%2F04%2Fbash-one-liners">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2009%2F02%2F04%2Fbash-one-liners&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly&amp;hashtags=Bash,Scripting" height="61" width="50" />
			</a>
		</div><p></p><p>I love one-liners to make my life easier.&#160; Today I decided to clean up a directory full of CSV files, and compress them down.&#160; After all, a 2MB CSV file can be reduced quite substantially, and I had 300 of them.</p> <span id="more-446"></span>  <p>Here it is, quite simply loops through the directory of CSVs, and zips the file up, keeping the name the same.</p>  <pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">for i in `ls -1 *.csv`; do zip -m ${i%csv}zip ${i}; done</div></div>

<p></p></pre>

<p>This all goes on a single line, but can easily be written out over multiple lines, like this:</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">for i in `ls -1 *.csv`;<br />
do<br />
&nbsp; zip -m ${i%csv}zip ${i}<br />
done</div></div>

</pre>

<p>Doing this reduced the folder size down from 600MB, to about 70MB, about an eighth the size.</p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2009/02/04/bash-one-liners/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mail Relaying in Sendmail</title>
		<link>http://jon.netdork.net/2007/08/15/mail-relaying-in-sendmail?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mail-relaying-in-sendmail</link>
		<comments>http://jon.netdork.net/2007/08/15/mail-relaying-in-sendmail#comments</comments>
		<pubDate>Wed, 15 Aug 2007 15:53:00 +0000</pubDate>
		<dc:creator>Jonathan Angliss</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://jon.netdork.net/2007/08/15/mail-relaying-in-sendmail/</guid>
		<description><![CDATA[I&#8217;ve always been in favor of removing the standard Sendmail install on most Linux boxes, in favor of Postfix. I&#8217;ve found it easier to use, and easier to configure. Having a simple configuration file that doesn&#8217;t need compiling is always helpful too. However, in some cases, you really don&#8217;t like to touch the delicate balance [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjon.netdork.net%2F2007%2F08%2F15%2Fmail-relaying-in-sendmail">
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjon.netdork.net%2F2007%2F08%2F15%2Fmail-relaying-in-sendmail&amp;source=j_angliss&amp;style=normal&amp;service=bit.ly" height="61" width="50" />
			</a>
		</div><p>I&#8217;ve always been in favor of removing the standard <a href="http://www.sendmail.org" title="Sendmail.org">Sendmail</a> install on most Linux boxes, in favor of <a href="http://www.postfix.org" title="Postfix.org">Postfix</a>.  I&#8217;ve found it easier to use, and easier to configure.  Having a simple configuration file that doesn&#8217;t need <em>compiling</em> is always helpful too.  However, in some cases, you really don&#8217;t like to touch the delicate balance of an ancient server, in fear of it falling over in a spectacular death.</p>

<p>Due to the nature of a lot of viruses, our firewall blocks outbound <acronym title="Simple Mail Transfer Protocol">SMTP</acronym>, with the exception of a few hosts.  This allows for services to use the server as a mail relay, whilst not allowing infected clients to send bad emails.  Due to this, I had to figure out how to reconfigure sendmail on one of our servers to use our postfix based server as a mail relay.  This actually turns out to be relatively easy, a single line in the /etc/mail/sendmail.mc file.  The bit that caught me was getting it to work.</p>

<p>RedHat is nice, in that they supply a <code>make</code> command in the /etc/mail directory to build new configurations.  However, for some reason, the default install of sendmail is missing some critical files that allow the rebuild of the configs to work.  The first step to setting up the relaying was to add the line:</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DEFINE(`SMART_HOST',`my.relay.host')</div></div>

</pre>

<p>This was added into the /etc/mail/sendmail.mc file.  Then the idea is you&#8217;re supposed to be able to execute:</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">make -C /etc/mail</div></div>

</pre>

<p>This spewed out some data about it processing the directories.  I then recycled sendmail.  I gave the new setup a quick test, and found it was still trying to direct send.  I verified the files, and it was configured right.  However, I noticed something odd.  Using <code>ls -lt</code> I found the sendmail.cf file (the compiled configuration file) had not been updated.  This was odd, as it should have built it.</p>

<p>Having had experience with modifying the sendmail configurations before, I knew the make command was simply issuing an <code>m4</code> command to compile the configurations.  On a hunch, I tried running the command myself:</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">m4 sendmail.mc &gt; sendmail.cf</div></div>

</pre>

<p>This is where the hint of the issue came in&#8230;</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Cannot open /usr/share/sendmail-cf/m4/cf.m4</div></div>

</pre>

<p>So I was missing files required to build the new configuration files.  A quick google search showed I needed to have the <em>sendmail-cf</em> package installed.  As RedHat 9 is pretty old, I didn&#8217;t expect the RedHat <acronym title="File Transfer Protocol">FTP</acronym> servers to still hold the files, so I hit <a href="http://www.rpmfind.net" title="RPMFind">RPMFind</a>, and searched for sendmail-cf.  A handful of results returned, but I found the one specifically for RedHat9.</p>

<p>After downloading the RPM file, and installing it using <code>rpm -Uvh file</code> I was then able to execute the make command as I had done before, but this time with a little more success (the files updated).  Now it was time to restart sendmail again&#8230;  This wasn&#8217;t as successful&#8230;.</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sendmail[24223]: NOQUEUE: SYSERR(root): No local mailer defined<br />
sendmail[24223]: NOQUEUE: SYSERR(root): QueueDirectory (Q) option must be set</div></div>

</pre>

<p>That&#8217;s not right.  So a quick look in the sendmail.mc file again, I found that the local delivery option was not set, so I added the following line:</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">MAILER(local)</div></div>

</pre>

<p>Then rebuilt the configurations using the make command again, and restarted Sendmail.  This time with some success.  I then tested the connection, ensuring that it relayed through the remote server&#8230;</p>

<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sendmail[24468]: l7FFWqWF024468: from=jon@netdork, size=45, class=0, nrcpts=1, msgid=&lt;20070815<br />
1533.l7FFWqWF024468@origsmtp_server&gt;, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]<br />
sendmail[24472]: l7FFWqWF024468: to=jon@netdork.net, delay=00:00:13, xdelay=00:00:01, mailer=relay, pri=300<br />
15, relay=my.relay.host [172.16.10.5], dsn=2.0.0, stat=Sent (Ok: queued as A979D6BCB4)</div></div>

</pre>

<p>Now the server is behaving as I need it to.</p>

<p>Technorati Tags: <a href="http://technorati.com/tag/Work" rel="tag">Work</a>, <a href="http://technorati.com/tag/Tech" rel="tag">Tech</a>, <a href="http://technorati.com/tag/Linux" rel="tag">Linux</a>, <a href="http://technorati.com/tag/Sendmail" rel="tag">Sendmail</a>, <a href="http://technorati.com/tag/Postfix" rel="tag">Postfix</a></p><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://jon.netdork.net/2007/08/15/mail-relaying-in-sendmail/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
