<?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>Static in the Ether &#187; Unix</title>
	<atom:link href="http://lair.moria.org/blog/archives/category/unix/feed" rel="self" type="application/rss+xml" />
	<link>http://lair.moria.org/blog</link>
	<description>Unix, Information Security &#38; Systems Administration</description>
	<lastBuildDate>Wed, 11 Nov 2009 09:14:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Verifying Smime content with openSSL</title>
		<link>http://lair.moria.org/blog/archives/123</link>
		<comments>http://lair.moria.org/blog/archives/123#comments</comments>
		<pubDate>Mon, 25 Aug 2008 16:51:03 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[mail security]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[smime]]></category>
		<category><![CDATA[x509]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=123</guid>
		<description><![CDATA[I had an interesting question posed ot me today by Dominic who asked me to verify whether his all new Digital certificate was correctly being used for signing mail. Thunderbird sadly complained that the signature was invalid, which was unexpected, and that the issuer was unknown ( expected since it comes form a private hierarchy.)  [...]]]></description>
			<content:encoded><![CDATA[<p>I had an interesting question posed ot me today by <a title="Dominic White " href="http://singe.za.net/">Domini</a>c who asked me to verify whether his all new Digital certificate was correctly being used for signing mail. Thunderbird sadly complained that the signature was invalid, which was unexpected, and that the issuer was unknown ( expected since it comes form a private hierarchy.)  The question then lead to where did the problem lie?</p>
<p>My gut feel was that it was the disclaimer being inserted by an intermediary gateway ( one has to love corpmail).  Setting about proving this was the hard part.  The first issue at hand wa to actually extract the certificates so I could play with the verification.  <a href="https://addons.mozilla.org/en-US/firefox/addon/1964/">Cert Viewer Plus</a> for Thunderbird made this part a dream. Creating a modified version of the signed message was a little bit more problematic.</p>
<p>Trusting the command line, I started hunting around for details on OpenSSL support for <a href="http://www.ietf.org/rfc/rfc2633.txt">SMIME</a>, which it has.  OpenSSL needs a full CA path for being able to verify SMIME signed messages. One can obtain this from various places ( such as exporting form your browser) but in a case like this where a private hierarchy was being used, its enough to just make used of a somewhat smaller subset contianing only the certificates used in this chain.  These can be extracted using  <a href="https://addons.mozilla.org/en-US/firefox/addon/1964/">Cert Viewer Plus</a>. Alternately some command line magic can be used to extract the PKCS7 formatted embedded certificates out in standard PEM format., using the following command:</p>
<p><code>openssl smime -pk7out -in mail.txt | \<br />
openssl pkcs7 -print_certs &gt; extract.crt</code></p>
<p>Now that we have a certificate chain we can attempt the verify. The extract.crt below can be either from the openssl method above or the Cert Viewer plus PEM dump.<br />
<code>openssl smime -CAfile extract.crt -verify -in mail.txt</code><br />
Now we actually have a more usable error message. Although I really don&#8217;t know why I have such a deep distrust in GUI apps for actually telling me what is wrong.<br />
<code>Verification failure<br />
88175:error:21071065:PKCS7 routines:PKCS7_signatureVerify:digest failure:/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/pkcs7/pk7_doit.c:808:<br />
88175:error:21075069:PKCS7 routines:PKCS7_verify:signature failure:/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/pkcs7/pk7_smime.c:265:<br />
</code><br />
As suspected the digest filed, which lead to a overall signature failure.  The next step was to see if removing the disclaimer worked.  Repeating on a slightly edited version of the the mail gave the following:</p>
<p><code>openssl smime -CAfile extract.crt -verify -in mail2.txt<br />
...<br />
<em>mail contents deleted</em><br />
...<br />
Verification successful</code></p>
<p>So the original question posed was if the signature system was working correctly which it now was. The differences between the two mail files was checked using diff</p>
<p><code>diff -u mail.txt  mail2.txt<br />
--- mail.txt         Mon Aug 25 18:06:33 2008<br />
+++ mail2.txt      Mon Aug 25 18:08:10 2008<br />
@@ -61,10 +61,6 @@<br />
South Africa<br />
</code><code><br />
-Important Notice: This email is subject to important restrictions, qualifications<br />
and disclaimers ("the Disclaimer") ..that all was one very long line that made<br />
up the corporate disclaimer.....<br />
...<br />
------=_NextPart_000_0048_01C906C7.DB6FB700<br />
Content-Type: application/x-pkcs7-signature;<br />
name="smime.p7s"<br />
</code><br />
From the above the only difference shown is that a mail gateway had added in a extra four lines of disclaimer and white space padding.  The question now evolves as to how to provide the now pretty much ubiquitous organizational disclaimer in outgoing mail in such a way that it doesn&#8217;t trash any cryptographic operations in which the mail is involved.  Ive gone back over mails from a  couple of other people in corporate South Africa that I know , and the problem seems to be widespread.</p>
<p>The solution may be that the disclaimer as such is encapsulated as a separate MIME component, which is what interestingly one university here does ( although it insists on prepending its mime encapsulated HTML disclaimer, which makes for really ugly mail reading!)</p>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/123/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrating URLs with apache and mod_rewrite</title>
		<link>http://lair.moria.org/blog/archives/47</link>
		<comments>http://lair.moria.org/blog/archives/47#comments</comments>
		<pubDate>Fri, 06 Jun 2008 17:35:30 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Annoyances]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=47</guid>
		<description><![CDATA[Having now migrated to WordPress from my own very customised version of phpBloxsom, which ran the previous incarnation of this blog, Ive been left with the issue of dealing with all the sites pulling my RSS feeds. With the change of software has come a change of url for the location of the feeds. Apache&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Having now migrated to WordPress from my own very customised version of phpBloxsom, which ran the previous incarnation of this blog, Ive been left with the issue of dealing with all the sites pulling my RSS feeds.  With the change of software has come a change of url for the location of the feeds.</p>
<p>Apache&#8217;s mod_rewrite seems to be the obvious candidate for making this as transparent as possible. In essence what needed to happen was incoming requests for:</p>
<p><code> "GET /blog/?flav=rss&amp;category=Security HTTP/1.0" and<br />
<code>"GET /blog/?flav=rss HTTP/1.0" </code> respectively need to be converted into:</code></p>
<p><code><br />
<a title="Security RSS feed" href="http://lair.moria.org/blog/archives/category/security/feed">http://lair.moria.org/blog/archives/category/security/feed</a> </code></p>
<p><code>and</code></p>
<p><code> <a title="Static in the Ether - RSS feed" href="http://lair.moria.org/blog/feed">http://lair.moria.org/blog/feed</a></code> respectively</p>
<p>This was achieved matching on the QUERY_STRING variable within apache.  The real trick came trying to get the new URLS to appear clean.  This proved to be more difficult than I expected. My initial rewrite rules resulted int he following:<br />
<code><br />
"GET /blog/?flav=rss HTTP/1.0" 301 249 "<br />
"GET /blog/feed/?flav=rss HTTP/1.0" 200 54274 ""<br />
</code><br />
The agent was directed to the right url but it still looks ugly.  Note the use of a HTTP/301 status code indicating permanently moved rather than a 302 which mod_redirect usually provides.  The solution to the appending of the query string turned out to be to force my own null string onto the redirect. The <a href="http://wiki.apache.org/httpd/RewriteQueryString">Apache Wiki</a> was where I finally found the right answer. so the way to remove a QUERY_STRING is to append a blank string &#8220;?&#8221; to the redirect .</p>
<p>The final setup in my .htaccess for WordPress looks as follows:</p>
<pre><code>
RewriteCond %{QUERY_STRING} ^flav=rss$ [NC]
RewriteRule ^$ http://lair.moria.org/blog/feed? [R=301,L]
RewriteCond %{QUERY_STRING} ^flav=rss&amp;(category)=Security$ [NC]
RewriteRule ^$ http://lair.moria.org/blog/archives/category/security/feed? [R=301,L]
RewriteCond %{QUERY_STRING} ^flav=atom$ [NC]
RewriteRule ^$ http://lair.moria.org/blog/feed/atom? [R=301,L]</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/47/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Systems Administration Cheet Sheets</title>
		<link>http://lair.moria.org/blog/archives/15</link>
		<comments>http://lair.moria.org/blog/archives/15#comments</comments>
		<pubDate>Sun, 18 May 2008 08:25:09 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=15</guid>
		<description><![CDATA[Colin Barschel has published a rather complete listing of how to perform common unix related tasks in Linux and FreeBSD, and even some Solaris examples. Even better hes got a booklet version as well for easy printing. Something to keep on the back burner/bookmarks for when you get stuck trying to remember just how broken [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cb.vu/" target="_blank">Colin Barschel</a> has published a rather complete listing of <a href="http://cb.vu/unixtoolbox.xhtml">how to perform common unix related tasks </a>in Linux and FreeBSD, and even some Solaris examples. Even better hes got a<a title="Booklet PDF version" href="http://cb.vu/unixtoolbox.book.pdf" target="_blank"> booklet version</a> as well for easy printing.  Something to keep on the back burner/bookmarks for when you get stuck trying to remember just how broken ‹insert os of choice›&#8217;s fooblat command is.</p>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu LTS migration for the GUI challenged</title>
		<link>http://lair.moria.org/blog/archives/13</link>
		<comments>http://lair.moria.org/blog/archives/13#comments</comments>
		<pubDate>Mon, 28 Apr 2008 16:40:01 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PhD]]></category>
		<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Dapper]]></category>
		<category><![CDATA[Hardy]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=13</guid>
		<description><![CDATA[With the release of Ubuntu 8.10 (Hardy Heron) and its designation as the new LTS version, I decided to upgrade my one local server from Dapper to Hardy, with the small challenge of I didnt want to do it via a gui. This is partly because I did not have a X client on my [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of <a href="http://www.ubuntu.com/">Ubuntu</a> 8.10 (Hardy Heron)  and its designation as the new LTS version, I decided to upgrade my one local server from Dapper to Hardy, with the small challenge of I didnt want to do it  via a gui.  This is partly because I did not have a X client on my laptop this morning, and partly because it will allow me to trial the upgrade of one of my Remote hosted systems.</p>
<p>Some issues specific to the Rhodes environment are noted at the end.</p>
<p>Get up to date:</p>
<blockquote><p><code>aptitude  update<br />
aptitude upgrade<br />
aptitude dist-upgrade</code></p></blockquote>
<p>All fairly painless and out of the ordinary,  bar the need to add the <code>dapper-proposed</code> repo to my <code>/etc/apt/sources.list</code></p>
<p>Installing the requires base packages:</p>
<blockquote><p><code>aptitude install update-manager-core</code></p></blockquote>
<p>Before doing the upgrade I decided to set up the CDROM ISO as a local repository in order to save bandwidth whales etc.. (Having a system with real internet access, or a working apt-proxy may be a better solution).  Once the <a title="Get your JIGDO sources here!" href="http://cdimage.ubuntu.com/dvd/current/hardy-dvd-i386.jigdo">Hardy DVD</a> is available in a few weeks this may go a lot faster, as libraries such as QT and other components of main will be included in the larger image.</p>
<blockquote><p><code>$ mount -t iso9660 -o loop  ~bvi/ubuntu-8.04-server-i386.iso  /cdrom<br />
$ apt-cdrom add</code></p></blockquote>
<p>This should show output similar tot he following as the CDROM is added tot he Repo list.</p>
<blockquote><p><code>Using CD-ROM mount point /cdrom/<br />
Unmounting CD-ROM<br />
Waiting for disc...<br />
Please insert a Disc in the drive and press enter<br />
Mounting CD-ROM...<br />
Identifying.. [b36baea778d37bbf48a3c8bd75b5cffb-2]<br />
Scanning disc for index files..<br />
Found 2 package indexes, 0 source indexes and 1 signatures<br />
Found label 'Ubuntu-Server 8.04 _Hardy Heron_ - Release i386 (20080423.2)'<br />
...<br />
</code></p></blockquote>
<p>And should add a  to the top of your <code>/etc/apt/sources.list</code> similar to the following:</p>
<blockquote><p><code>deb cdrom:[Ubuntu-Server 8.04 _Hardy Heron_ - Release i386 (20080423.2)]/ hardy main restricted</code></p></blockquote>
<p>Finally the update can be performed</p>
<blockquote><p><code>do-release-update -p</code></p></blockquote>
<p>The -p parameter is due to the fact that the LTS as defined at  <a href="http://changelogs.ubuntu.com/meta-release-lts" target="_blank">http://changelogs.ubuntu.com/meta-release-lts</a> is still showing dapper as the LTS, and should be able to be omitted in the future. with the -p, the meta-release-lts.proposed file is used instead.</p>
<p>the bulk of the base operating system was happily upgraded form CDROM repo in a matter of minutes, and the remaining pile of mostly <code>universe</code> and <code>multiverse</code> packages took around an hour to download</p>
<p>3 hours and a reboot later and the server is happily running Hardy.</p>
<p>All in all its about the same time for doing a &#8216;buildworld dance&#8217; with FreeBSD, along with a massive level of portupgrade.</p>
<h2>Post Reboot</h2>
<p>In order to validate the upgrade, we can make use of the  <a href="http://www.linuxbase.org/">Linux Standard Base</a> support for Debian<br />
utilities ( aka lsb_release)</p>
<blockquote>
<h3>We have gone from:</h3>
<p><code>$ uname -a<br />
Linux spy.ict.ru.ac.za 2.6.15-51-686 #1 SMP PREEMPT Tue Feb 12 16:59:15 UTC 2008 i686 GNU/Linux<br />
$ lsb_release -a <em><span style="color: #3366ff;">(output trimmed)</span></em><br />
Distributor ID: Ubuntu<br />
Description:    Ubuntu 6.06.2 LTS<br />
Release:        6.06<br />
Codename:       dapper</code></p>
<h3>To:</h3>
<p><code>$ uname -a<br />
Linux spy.ict.ru.ac.za 2.6.24-16-server #1 SMP Thu Apr 10 13:58:00 UTC 2008 i686 GNU/Linux<br />
$ lsb_release -a<br />
Distributor ID: Ubuntu<br />
Description:    Ubuntu 8.04<br />
Release:        8.04<br />
Codename:       hardy</code></p></blockquote>
<p>In reflection, far less pain than I expected certainly not enough to make me want to employ  a <a title="Free your linux server" href="http://lair.moria.org/blog/archives/10">depenguinator </a>on this server yet.</p>
<h2>Rhodes Specific notes:</h2>
<ul>
<li>Preferably use ubuntu.rucus.ru.ac.za as your repo unless you would like your quota flattened. Hopefully it will be up.</li>
<li><a title="RUCUS FTP SITE" href="ftp://ftp.rucus.ru.ac.za/pub/linux/ubuntu/hardy " target="_blank">ftp://ftp.rucus.ru.ac.za/pub/linux/ubuntu/hardy </a>has the ISO files</li>
<li>You will need appropriate proxy settings in order for the do-release-upgrade to be able to access the changelogs.ubuntu.com site.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/13/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hilbert Curve TNG &#8211; Unix port</title>
		<link>http://lair.moria.org/blog/archives/11</link>
		<comments>http://lair.moria.org/blog/archives/11#comments</comments>
		<pubDate>Sun, 20 Apr 2008 10:41:13 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Vizualization]]></category>
		<category><![CDATA[Hilbert Curve]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=11</guid>
		<description><![CDATA[The Hilbert Curve Rework project is progressing well with version 2.05 having been released, by Nick earlier this week. Ive now taken the opportunity to port the current Windows code across to unix and particularly FreeBSD. Around 10 lines worth of changes later the app built and ran on my FreeBSD 7.0 system. For once [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://nick.rucus.net/hilbert/">Hilbert Curve Rework project</a> is progressing well with <a href="http://nick.rucus.net/hilbert/hilbert205.zip">version 2.05</a> having been released, by Nick earlier this week.  Ive now taken the opportunity to port the current Windows code across to unix and particularly FreeBSD. Around 10 lines worth of changes later the app built and ran on my FreeBSD 7.0 system. For once the mantra of the C/C++ work actually proved try &#8211; write once, run anywhere.  I really wish Java was that simple.</p>
<p>A couple of issues still need to be addressed:</p>
<ul>
<li>Rework the source to we can maintain a single source three for Windows and Unix targets- this is mostly slog rather than thinking work.</li>
<li>There is a bug in that some images are coming out a little wrong, but I think this may have to do with line termination issues the good old <tt>\r\n</tt> <em>vs.</em> <tt>\n</tt> issue again.</li>
<li>Write some decent docs!</li>
</ul>
<p>With a bit of luck <a title="Nicholas Pilkington" href="http://nick.rucus.net/">Nick</a> should be returning to Grahamstown for a month or so thanks to some funding from the<a href="http://www.coe.ru.ac.za/"> Center of Excellence</a> in the department. Working on the Hilbert project will be one of his main priorities.</p>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/11/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Remote FreeBSD install &#8211; Depenguinator TNG</title>
		<link>http://lair.moria.org/blog/archives/10</link>
		<comments>http://lair.moria.org/blog/archives/10#comments</comments>
		<pubDate>Sat, 19 Apr 2008 10:39:11 +0000</pubDate>
		<dc:creator>Barry Irwin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://lair.moria.org/blog/?p=10</guid>
		<description><![CDATA[Daniel Gerzo, has recently published an article as part of the FreeBSD documentation project on how to install FreeBSD on a remote system, when one doesn&#8217;t have the luxury of a IP KVM or other remote console. Unfortunately most hosting providers seem to think Linux in its gazillions of flavors (really who would want to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://danger.rulez.sk/">Daniel Gerzo</a>, has recently published an <a title="Remote Installation of the FreeBSD Operating System without a Remote Console" href="http://www.freebsd.org/doc/en_US.ISO8859-1/articles/remote-install/index.html" target="_blank">article</a> as part of the <a href="http://www.freebsd.org/">FreeBSD</a> documentation project on how to install FreeBSD on a remote system, when one doesn&#8217;t have the luxury of a IP KVM or other remote console.  Unfortunately most hosting providers seem to think Linux in its gazillions of flavors (really who would want to run <a title="Gentoo - because you like recompileing every 5 minutes " href="http://lair.moria.org/blog/wp-admin/www.gentoo.org" target="_blank">Gentoo</a>?) is the preferable option to windows.</p>
<p>The basic process is about creating a magic memory File System 9MFS) based mini FreeBSD install one can then <tt>dd</tt>over the base MBR on the system  This gets you jsut enough of a Real  OS to carry on with the rest of your install.</p>
<p>What this means for me is the possibility of doing some nice rmeote upgrade, or more acuratlye nuke and paves on some remorely hosted equipment.  The big cath of course is your remote systems should have sufficient bandwidth (, or at least a local copy of the ISO or CD handy and mounted.  Exploring other hosting providers may also now be feasible, now that I can run my favorite server OS without having to try persuade remotes upport to just put a BSD CD in and let me pay for a KVM access window :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://lair.moria.org/blog/archives/10/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
