<?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"
	>

<channel>
	<title>usefulfor.com/nothing</title>
	<atom:link href="http://usefulfor.com/nothing/feed/" rel="self" type="application/rss+xml" />
	<link>http://usefulfor.com/nothing</link>
	<description>If it doesn't fit anywhere else, it's in /nothing</description>
	<pubDate>Fri, 05 Sep 2008 09:14:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>miniconomics.com - your expenses under control</title>
		<link>http://usefulfor.com/nothing/2008/06/09/miniconomicscom-your-expenses-under-control/</link>
		<comments>http://usefulfor.com/nothing/2008/06/09/miniconomicscom-your-expenses-under-control/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 21:31:16 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/uncategorized/miniconomicscom-your-expenses-under-control</guid>
		<description><![CDATA[&#160;

miniconomics.com is an easy-to-use tool designed to manage your personal expenses that we have been developing over the last few months. The key benefits of the tool at this point in time:

It is alive, changing every day, release early, release often. miniconomics.com is under a never ending churning process.
It is simple, a no brainer, you [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p style="text-align: center"><a href="https://secure.miniconomics.com/"><img src="http://usefulfor.com/nothing/files/2008/06/miniconomics_in_text300.png" alt="miniconomics.com logo" width="400" height="63" class="aligncenter size-full wp-image-63" /></p>
<p><a href="https://secure.miniconomics.com/">miniconomics.com</a> is an easy-to-use tool designed to manage your personal expenses that we have been developing over the last few months. The key benefits of the tool at this point in time:</p>
<ul>
<li>It is alive, changing every day, <em>release early, release often</em>. <a href="https://secure.miniconomics.com/">miniconomics.com</a> is under a never ending churning process.</li>
<li>It is <strong>simple</strong>, a no brainer, you have categories and you have expenses, you put expenses in your categories and <a href="https://secure.miniconomics.com/">miniconomics.com</a> gives you all sorts of useful information, stats and nice shinny graphs.</li>
<li>Is <strong>accessible</strong>, forget about maintaing a spreadsheet with your data in your home computer or laptop. Use an online service, use it no matter where you are, no matter when, just log in and add your expenses.</li>
<li>It is as <strong>geek</strong> as a tool can be. We are still developing it and we are keen on trying all sorts of approaches. We have some cool toughts on plugins and addons that we will be developing in the future. Give us your feedback and let us know what you do you want out of the tool, chances are we will develop it!</li>
<li><a href="https://secure.miniconomics.com/">miniconomics.com</a> is free, free to use, free to register, free to enjoy, free to everything <img src='http://usefulfor.com/nothing/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>I hope you decide to give it a try (you don&#8217;t have to register for a test drive) and let us know what you think. And of course if you like it, just <strong>spread the word</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2008/06/09/miniconomicscom-your-expenses-under-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>winning without fighting</title>
		<link>http://usefulfor.com/nothing/2008/06/01/winning-without-fighting/</link>
		<comments>http://usefulfor.com/nothing/2008/06/01/winning-without-fighting/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 11:08:19 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/uncategorized/winning-without-fighting</guid>
		<description><![CDATA[Directly inspired by The Art of War of Sun Tzu, yesterday I found the following piece of wisdom:
After years of thinking about, writing about, and filtering messages, I&#8217;ve decided that the best strategy for me is to not filter spam, but instead to filter non-spam
The full article at Reverse Spam Filtering: &#8220;Winning Without Fighting&#8221; by [...]]]></description>
			<content:encoded><![CDATA[<p>Directly inspired by <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.co.uk%2FArt-War-Sun-Tzu%2Fdp%2F1599869772%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1211017468%26sr%3D8-1&amp;tag=etsdoandos-21&amp;linkCode=ur2&amp;camp=1634&amp;creative=6738">The Art of War</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=etsdoandos-21&amp;l=ur2&amp;o=2" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" /> of Sun Tzu, yesterday I found the following piece of wisdom:</p>
<blockquote><p>After years of thinking about, writing about, and filtering messages, I&#8217;ve decided that the best strategy for me is to <em>not</em> filter spam, but instead to filter non-spam</p></blockquote>
<p>The full article at <a href="http://www.ii.com/internet/messaging/spam/">Reverse Spam Filtering: &#8220;Winning Without Fighting&#8221;</a> by Nancy McGough.</p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2008/06/01/winning-without-fighting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>the Buddhist monk puzzle</title>
		<link>http://usefulfor.com/nothing/2008/05/15/the-buddhist-monk-puzzle/</link>
		<comments>http://usefulfor.com/nothing/2008/05/15/the-buddhist-monk-puzzle/#comments</comments>
		<pubDate>Thu, 15 May 2008 10:37:16 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/uncategorized/the-buddhist-monk-puzzle</guid>
		<description><![CDATA[A new puzzle, this time from Conceptual Blockbusting: A Guide to Better Ideas by Jams L. Adams:

One morning, exactly at sunrise, a Buddhist monk began to climb a tall mountain. A narrow path, no more than a foot or two wide, spiraled around the mountain to a glittering temple at the summit. The monk ascended [...]]]></description>
			<content:encoded><![CDATA[<p>A new puzzle, this time from <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.co.uk%2FConceptual-Blockbusting-Guide-Better-Ideas%2Fdp%2F0738205370%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1210842884%26sr%3D8-1&amp;tag=etsdoandos-21&amp;linkCode=ur2&amp;camp=1634&amp;creative=6738">Conceptual Blockbusting: A Guide to Better Ideas</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=etsdoandos-21&amp;l=ur2&amp;o=2" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" /> by <em>Jams L. Adams</em>:</p>
<blockquote><p>
One morning, exactly at sunrise, a Buddhist monk began to climb a tall mountain. A narrow path, no more than a foot or two wide, spiraled around the mountain to a glittering temple at the summit. The monk ascended at varying rates of speed, stopping many times along the way to rest and eat dried fruit he carried with him. He reached the temple shortly before sunset. After several days of fasting and meditation he began his journey back along the same path, starting at sunrise and again walking at variable speeds with many pauses along the way. His average speed descending was, of course, greater than his average climbing speed. Prove that there is <em>a spot</em> along the path that the monk will occupy on both trips at precisely the same time of day.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2008/05/15/the-buddhist-monk-puzzle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>howto create an intermediate Certificate Authority (CA) using openssl</title>
		<link>http://usefulfor.com/nothing/2008/03/20/howto-create-an-intermediate-certifica-authority-ca-using-openssl/</link>
		<comments>http://usefulfor.com/nothing/2008/03/20/howto-create-an-intermediate-certifica-authority-ca-using-openssl/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 03:05:27 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Networking]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=44</guid>
		<description><![CDATA[What is an Intermediate Certificate Authority (CA) and why do I need one? An Intermediate CA is an authority that you use to create your own SSL certificates in a PKI environment. An Intermediate CA depends on a Root CA that is the origin of the chain of trust. The idea is that if your [...]]]></description>
			<content:encoded><![CDATA[<p>What is an Intermediate Certificate Authority (CA) and why do I need one? An Intermediate CA is an authority that you use to create your own <acronym title="Secure Sockets Layer">SSL</acronym> certificates in a <acronym title="Public Key Infrastructure">PKI</acronym> environment. An Intermediate CA depends on a Root CA that is the origin of the chain of trust. The idea is that if your Intermediate CA gets compromised or you decide to revocate all the certificates issued by it, you can still use your Root CA without further inconvenience for your users (the users only need to have installed the certificate of the Root CA in their browsers).</p>
<p>As for the second question, the sort answer is that chances are that you really do not need one <img src='http://usefulfor.com/nothing/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> but for the shake of the experiment lets get our hands dirty!<br />
<span id="more-48"></span><br />
First of all, I need to clarify that my interest in this topic was also risen by the fact that <a href="http://www.verisign.com/support/verisign-intermediate-ca/index.html">Verisign</a> has switched to a two-tier hierarchy of Certificate Authorities, and this has some implications specially in the configuration of web server software:</p>
<blockquote><p>
&#8220;As of April 2006, all SSL certificates issued by VeriSign require the installation of an Intermediate CA Certificate.  The SSL certificates are signed by an Intermediate CA using a two-tier hierarchy (also known as trust chain) which enhances the security of your SSL Certificate. If the proper Intermediate CA is not installed <strong>on the server</strong>, your customers will see browser errors and may choose not to proceed further and close their browser.&#8221; (<em>boldface is mine</em>)
</p>
</blockquote>
<p>This means that while the users do not need to modify anything (if their browser already has Verisigns Root CA certificate) the server owners need to ensure that the server is able to provide the so called <em>trust chain</em> to the users&#8217; browser when the SSL handshake is performed.</p>
<p>Never mind, lets get back to it. In order to get your Intermediate CA working, first you need a Root CA (if you already have a CA, feel free to skip the next section). Remember that in order to get this working you need to have a copy of the <a href="http://www.openssl.org/">openssl</a> toolkit installed in your system.</p>
<h3>Configure the Root CA</h3>
<p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
mkdir /var/ca&lt;br /&gt;
cd /var/ca/&lt;br /&gt;
mkdir certs crl newcerts private&lt;br /&gt;
echo &quot;01&quot; &gt; serial&lt;br /&gt;
cp /dev/null index.txt&lt;br /&gt;
# beware that the location of the sample file is dependent on your environment&lt;br /&gt;
cp /usr/lib/ssl/openssl.cnf .&lt;br /&gt;</pre></div></div>
</p>
<p>You may want to modify some of the settings in the configuration file to save you some time in the future when creating the certificates: <em>default_bits</em>, <em>countryName</em>, <em>stateOrProvinceName</em>, <em>0.organizationName_default</em>, <em>organizationalUnitName</em> and <em>emailAddress</em>.</p>
<p>Now you are ready to create the CA:</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
# generate a private key&lt;br /&gt;
openssl genrsa -des3 -out private/cakey.key 4096&lt;br /&gt;
# create a self-signed certificate valid for 5 years&lt;br /&gt;
openssl req -new -x509 -nodes -sha1 -days 1825 -key private/cakey.pem -out cacert.pem&lt;br /&gt;
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire&lt;br /&gt;</pre></div></div>
</p>
<p>Now you have everything you need to run a successful CA.</p>
<h3>Configure an Intermediate CA</h3>
<p>The idea is simple, we will create a new CA following the same template that we used  in the previous section, but this time instead of generating a self-signed certificate we will generate a certificate sign request that we will sign using the Root CA.</p>
<p>First we create the folder structure:</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
cd /var/ca/&lt;br /&gt;
mkdir ca2008&lt;br /&gt;
cd ca2008&lt;br /&gt;
cp ../openssl.cnf .&lt;br /&gt;
mkdir certs crl newcerts private&lt;br /&gt;
echo &quot;01&quot; &gt; serial&lt;br /&gt;
cp /dev/null index.txt&lt;br /&gt;</pre></div></div>
</p>
<p>Then the Intermediate CA private key:</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
#generate the key&lt;br /&gt;
openssl genrsa -des3 -out private/cakey.pem 4096&lt;br /&gt;
#generate a signing request (valid for 1year)&lt;br /&gt;
openssl req -new -sha1 -key private/cakey.pem -out ca2008.csr&lt;br /&gt;
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire&lt;br /&gt;</pre></div></div>
</p>
<p>Move the sign request to the Root CA directory and sign it:</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
mv ca2008.csr ..&lt;br /&gt;
cd ..&lt;br /&gt;
openssl ca -extensions v3_ca -days 365 -out ca2008.crt -in ca2008.csr -config openssl.cnf&lt;br /&gt;
mv ca2008.* ca2008/&lt;br /&gt;
cd ca2008/&lt;br /&gt;
mv ca2008.crt cacert.pem&lt;br /&gt;</pre></div></div>
</p>
<p>And that was it. The next thing to do is start using your Intermediate CA to sign your new certificates. But just before that, remember that<br />
to verify a certificate signed by an Intermediate CA the web browser has to verify both the certificate against the Intermediate CA and the certificate of the Intermediate CA against a Root CA.</p>
<p>In order to allow the browser to do this, a certificate chain file needs to be installed in the server. A certificate chain is a plaintext file that contains all the certificates from the Authority issuing a given certificate up to the Root of the certificate tree. In this case our chain has only two levels and the chain file is created like this:-</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
# first the intermediate CA certificate&lt;br /&gt;
cat cacert.pem &gt; chain.crt&lt;br /&gt;
# then the Root CA cert&lt;br /&gt;
cat ../cacert.pem &gt;&gt; chain.crt&lt;br /&gt;</pre></div></div>
</p>
<p>This file is the one you need to specify in the <strong>SSLCertificateChainFile</strong> of your server.</p>
<h3>Create a new server certificate</h3>
<p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
# make sure you are in the Intermediate CA folder and not in the Root CA one&lt;br /&gt;
cd /var/ca/ca2008/&lt;br /&gt;
# create the private key&lt;br /&gt;
openssl genrsa -des3 -out {server_name}.key 4096&lt;br /&gt;
# generate a certificate sign request&lt;br /&gt;
openssl req -new -key {server_name}.key -out {server_name}.csr&lt;br /&gt;
# sign the request with the Intermediate CA&lt;br /&gt;
openssl ca -config openssl.cnf -policy policy_anything -out {server_name}.crt -infiles {server_name}.csr&lt;br /&gt;
# and store the server files in the certs/ directory&lt;br /&gt;
mkdir certs/{server_name}&lt;br /&gt;
mv {server_name}.key {server_name}.csr {server_name}.crt certs/&lt;br /&gt;</pre></div></div>
</p>
<p>Then you should securely copy the .key and .crt files to the server and configure it to use them.</p>
<h3>Apache server configuration</h3>
<p>Just in case you are using Apache server and for the shake of completeness, these are the settings that you need to modify (possibly in your <tt>extra/http-ssl.conf</tt>):-</p>
<div class="hl-surround" ><div class="hl-main"><pre>&lt;br /&gt;
SSLCertificateFile /var/ca/ca2008/certs/{server_name}.crt&lt;br /&gt;
SSLCertificateKeyFile /var/ca/ca2008/certs/{server_name}.key&lt;br /&gt;
SSLCertificateChainFile /var/ca/ca2008/chain.crt&lt;br /&gt;</pre></div></div>
</p>
<h3>References</h3>
<ul>
<li><a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html">SSL/TLS Strong Encryption: FAQ</a></li>
<li><a href="http://www.onlamp.com/pub/a/onlamp/2003/02/06/linuxhacks.html">Creating Your Own CA</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority</a></li>
<li><a href="http://www.sendmail.org/~ca/email/other/cagreg.html">Very brief introduction to create a CA and a CERT</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2008/03/20/howto-create-an-intermediate-certifica-authority-ca-using-openssl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>howto resize an ext3 partition without losing data</title>
		<link>http://usefulfor.com/nothing/2007/12/14/howto-resize-an-ext3-partition-without-losing-data/</link>
		<comments>http://usefulfor.com/nothing/2007/12/14/howto-resize-an-ext3-partition-without-losing-data/#comments</comments>
		<pubDate>Thu, 13 Dec 2007 22:47:05 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=39</guid>
		<description><![CDATA[This has not been the first time I have tried, but it has been the first time it has worked. And the best of it, no Partition Magic or (qt)parted is needed, just pure old tune2fs, resize2fs and fdisk (read the man pages and backup everything as usual  ).

In order to resize it, the [...]]]></description>
			<content:encoded><![CDATA[<p>This has not been the first time I have tried, but it has been the first time it has worked. And the best of it, no Partition Magic or (qt)parted is needed, just pure old <code>tune2fs</code>, <code>resize2fs</code> and <code>fdisk</code> (read the man pages and backup everything as usual <img src='http://usefulfor.com/nothing/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' /> ).<br />
<span id="more-39"></span><br />
In order to resize it, the partition should not be mounted. You should read the full post before start issuing any commands.</p>
<p>As an example we are going to resize <code>/dev/sda1</code> from 200G to 50G. Since the partition is the primary /root we need to use a rescue disk to boot the system, I used <a href="http://www.remote-exploit.org/backtrack.html">BackTrack</a> from a USB stick (<a href="http://backtrack.offensive-security.com/index.php/Howto:USB_Stick">Howto:USB Stick</a>).</p>
<ol>
<li>use <code>tune2fs</code> to remove the journal from your ext3 partition:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>tune2fs -O ^has_journal /dev/sda1</pre></div></div>
<p> Now the partition is effectively an ext2 file system.</li>
<li>use &#8220;<code>resize2fs /dev/sda1 50G</code>&#8221; to resize the file system.</li>
<li>use fdisk to resize the partition: delete the old partition (no data will be lost! :twisted:). Create a new one of the desired size (exercise caution <img src='http://usefulfor.com/nothing/wp-includes/images/smilies/icon_exclaim.gif' alt=':!:' class='wp-smiley' />  see below). Save changes.</li>
<li>use &#8220;<code>resize2fs /dev/sda1</code>&#8221; (no size this time) to resize the file system to the maximum available.</li>
<li>use <code>tune2fs</code> to add the journal agai:
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>tune2fs -j /dev/sda1</pre></div></div>
<p>  This turns the partition back to ext3.</li>
</ol>
<p>Regarding the new size for the partition, it is important to allocate enough physical space to support the file system. I used the formula recommended by <a href="#2">[2]</a>:</p>
<blockquote><p>
We multiply the amount of blocks from the resize2fs output (1536000) by the size of a block (4k), and to go sure the partition is big enough, we add 3 to 5% to it (3% was enough for me, but if you want to go sure take 5%):</p>
<p>1536000 * 4k * 1.03 = 6328320k
</p></blockquote>
<p>The interesting number is the first one, and you can get it by looking at the output of <code>resize2fs</code> on step 2. You just need to specify that number when asked by <code>fdisk</code> (step 3) for the last cylinder of the new partition. Again from the same reference:</p>
<blockquote><p>
Last cylinder or +size or +sizeM or +sizeK (1-1247, default 1247): +6328320K
</p></blockquote>
<p>Note that this is not the vaule I used (I forgot to write it down), but I guess that this number depends on the hardware and the important bit is to learn how to apply <a href="http://www.imdb.com/title/tt0137523/quotes#qt0190452">The Formula</a>.</p>
<h3>References</h3>
<p>This post consists of 100% recycled  information, credit goes to:</p>
<ul>
<li>[1] <a href="http://www.linuxquestions.org/questions/linux-newbie-8/another-resize-ext3-problem-123378/">Another resize ext3 problem</a></li>
<li><a name="2"></a>[2] <a href="http://www.howtoforge.com/linux_resizing_ext3_partitions">How To Resize ext3 Partitions Without Losing Data</a></li>
</ul>
<h3>Last minute note</h3>
<blockquote><p>Support for ext3 was added to resize2fs in version 1.19, more than 7 years ago.  There is no reason to convert to ext2 first unless you are running a REALLY old system.</p></blockquote>
<p>So you may avoid steps 1 and 5 if your <code>resize2fs</code> supports ext3. <img src='http://usefulfor.com/nothing/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2007/12/14/howto-resize-an-ext3-partition-without-losing-data/feed/</wfw:commentRss>
		</item>
		<item>
		<title>jack bauer and the coffee</title>
		<link>http://usefulfor.com/nothing/2007/10/13/jack-bauer-and-the-cofee/</link>
		<comments>http://usefulfor.com/nothing/2007/10/13/jack-bauer-and-the-cofee/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 12:50:15 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=27</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p class="aligncenter"><a href='http://usefulfor.com/nothing/files/2008/06/cafejack_01.jpg'><img src="http://usefulfor.com/nothing/files/2008/06/cafejack_01-150x150.jpg" alt="" width="150" height="150" class="aligncenter size-thumbnail wp-image-61" /></a><a href='http://usefulfor.com/nothing/files/2008/06/cafejack_02.jpg'><img src="http://usefulfor.com/nothing/files/2008/06/cafejack_02-150x150.jpg" alt="" width="150" height="150" class="alignnone size-thumbnail wp-image-62" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2007/10/13/jack-bauer-and-the-cofee/feed/</wfw:commentRss>
		</item>
		<item>
		<title>harden your apache+php installation</title>
		<link>http://usefulfor.com/nothing/2007/09/14/harden-your-apachephp-installation/</link>
		<comments>http://usefulfor.com/nothing/2007/09/14/harden-your-apachephp-installation/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 10:05:31 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Networking]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=22</guid>
		<description><![CDATA[Instructions follow  on how to build and harden one of the most common configurations out there.

We are going for a DIY installation were everything is compiled from source, so some development tools are required. Let&#8217;s get our hands dirty!
Download an uncompress
cd /usr/local/src/
wget http://mirror.public-internet.co.uk/apache/httpd/httpd-2.2.4.tar.gz
tar -xvvzf httpd-2.2.4.tar.gz
wget http://uk2.php.net/get/php-5.2.3.tar.gz/from/this/mirror
tar -xvvzf php-5.2.3.tar.gz
Install software
Required by Apache:
apt-get install gcc make [...]]]></description>
			<content:encoded><![CDATA[<p>Instructions follow  on how to build and harden one of the most common configurations out there.<br />
<span id="more-27"></span><br />
We are going for a <acronym title="Do It Yourself">DIY</acronym> installation were everything is compiled from source, so some development tools are required. Let&#8217;s get our hands dirty!</p>
<p><strong>Download an uncompress</strong></p>
<div class="hl-surround" ><div class="hl-main"><pre>cd /usr/local/src/
wget http://mirror.public-internet.co.uk/apache/httpd/httpd-2.2.4.tar.gz
tar -xvvzf httpd-2.2.4.tar.gz
wget http://uk2.php.net/get/php-5.2.3.tar.gz/from/this/mirror
tar -xvvzf php-5.2.3.tar.gz</pre></div></div>
<p><strong>Install software</strong><br />
Required by Apache:</p>
<div class="hl-surround" ><div class="hl-main"><pre>apt-get install gcc make libc6-dev libc-dev \
linux-kernel-headers libssl-dev zlib1g-dev</pre></div></div>
<p>Required by PHP:</p>
<div class="hl-surround" ><div class="hl-main"><pre>apt-get install g++ g++-4.1 libfreetype6 \
libfreetype6-dev libgd2-noxpm libgd2-noxpm-dev \
libjpeg62 libjpeg62-dev libmysqlclient15-dev \
libpng12-0 libpng12-dev libstdc++6-4.1-dev \
libxml2 libxml2-dev</pre></div></div>
<p><strong>Tweak Apache</strong><br />
Get rid of the server banner, edit <code>/usr/local/src/httpd-2.2.4/include/ap_release.h</code>:</p>
<div class="hl-surround" ><div class="hl-main"><pre>define AP_SERVER_BASEVENDOR &quot;nomejortu&quot;
define AP_SERVER_BASEPROJECT &quot;nmt server&quot;
define AP_SERVER_BASEPRODUCT &quot;server&quot;</pre></div></div>
<p><strong>Configure, compile and install</strong></p>
<div class="hl-surround" ><div class="hl-main"><pre>cd /usr/local/src/httpd-2.2.4/
./configure --disable-info --disable-autoindex \
--disable-include  --disable-userdir --disable-status \
--disable-imagemap --disable-cgid --disable-cgi \
--disable-proxy --enable-ssl=static \
--enable-rewrite=static --enable-dir=static \
--enable-unique_id=static --enable-so
make
make install</pre></div></div>
<p>With the previous configure line we are removing modules that either disclose too much information or we do not need (wach out! you may need some of them). All inluded modules are statically linked to the binary. The only dynamic <code>modules</code> that we will be using are the <strong>mod_php</strong> and <strong>mod_security</strong>.</p>
<ul>
<li>&#8211;<strong>disable-info</strong>,  &#8211;<strong>disable-status</strong>: we don&#8217;t need server info or status at all.</li>
<li> &#8211;<strong>disable-autoindex</strong>, &#8211;<strong>disable-userdir</strong>:  no automatic directory listings, no username enumeration through the /~ technique.</li>
<li> &#8211;<strong>enable-dir</strong>: redirect malformed urls (requests to directories without trailing slash) and the <code>DirectoryIndex</code> directive.</li>
<li> &#8211;<strong>disable-include</strong>, &#8211;<strong>disable-imagemap</strong> : no server side includes or image maps handled by the server.</li>
<li> &#8211;<strong>disable-cgid</strong>, &#8211;<strong>disable-cgi</strong> : no cgi interfaces.</li>
<li> &#8211;<strong>disable-proxy</strong>, &#8211;<strong>enable-ssl</strong>, &#8211;<strong>enable-rewrite</strong>: disable the proxy capanility, enable <acronym title="Secure Sockets Layer">SSL</acronym> and the rewrite engine.</li>
<li> &#8211;<strong>enable-unique_id</strong>: needed for <strong>mod_security</strong> (see below).</li>
<li> &#8211;<strong>enable-so</strong>: </li>
</ul>
<p><strong>Configure apache</strong><br />
In apache2&#8217;s configuration file (<code>/usr/local/apache2/conf/httpd.conf</code>) append:</p>
<div class="hl-surround" ><div class="hl-main"><pre># server banner
ServerSignature  Off
ServerTokens  Prod
# disable TRACE requests
TraceEnable off</pre></div></div>
<p>If needed, add the <code>index.php</code><code> as a default file to </code><code>DirectoryIndex</code> directive on Line 165:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>DirectoryIndex index.php index.html</pre></div></div>
<p>In the same way, if you need virtual hosts enabled, uncomment the line 386 (or equivalent):</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>Include conf/extra/httpd-vhosts.conf</pre></div></div>
<p>Add your options to that file. And if you need SSL support, uncomment the line 398 (or equivalent) of the same file:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>Include conf/extra/httpd-ssl.conf</pre></div></div>
<p>Change ownership of the htdocs and remove unnecessary files and folders:-</p>
<div class="hl-surround" ><div class="hl-main"><pre>chown daemon.daemon /usr/local/apache2/htdocs/ -R
rm -rf /usr/local/apache2/htdocs/*
rm -rf /usr/local/apache2/cgi-bin/*
rm -rf /usr/local/apache2/icons</pre></div></div>
<p>If you want your server to start at boot time, issue the following commands:-</p>
<div class="hl-surround" ><div class="hl-main"><pre>rm /etc/init.d/apache2
ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache2
update-rc.d apache2 defaults</pre></div></div>
<p>Be careful because if you have configured SSL with a certificate whose private key requires a pass phrase, the system will request the pass phrase and wait upon restart.</p>
<p><strong>PHP</strong><br />
Not much on the PHP side. Download and compile:</p>
<div class="hl-surround" ><div class="hl-main"><pre>cd /usr/local/src/php-5.2.3
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/include/mysql --with-config-file-path=/etc --with-gd --with-zlib-dir=/usr/lib/

make
make install</pre></div></div>
<ul>
<li>&#8211;<strong>with-apxs2</strong>: compile a module for apache2 in the specified location.</li>
<li>&#8211;<strong>with-mysql</strong>: .enable mysql support.</li>
<li>&#8211;<strong>with-config-file-path</strong>: .specify where you want the php.ini config file.</li>
<li>&#8211;<strong>with-gd</strong>: .the graphical library if you need it.</li>
<li>&#8211;<strong>with-zlib-dir</strong>: .use system&#8217;s zlib (downloaded from packages).</li>
</ul>
<p>Although the php installation adds the <code>LoadModule</code> line, but you still need to edit apache configuration file (<code>httpd.conf</code>) and add the following:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>AddType application/x-httpd-php .php .phtml</pre></div></div>
<p>Modify the <code>DirectoryIndex</code> directive if you want the server to default to <code>index.php</code> when a directory is requested.</p>
<p><strong>mod_security</strong><br />
Download:</p>
<div class="hl-surround" ><div class="hl-main"><pre>cd /usr/local/src/
wget http://www.modsecurity.org/download/modsecurity-apache_2.1.2.tar.gz
tar -xvvzf modsecurity-apache_2.1.2.tar.gz
cd modsecurity-apache_2.1.2/apache2/</pre></div></div>
<p>Edit the Makefile to adjust the following lines (compile <strong>mod_security</strong> with Apache&#8217;s version of the <code>pcre</code> library):</p>
<div class="hl-surround" ><div class="hl-main"><pre>top_dir      = /usr/local/apache2
INCLUDES = -I /usr/include/libxml2 -I /usr/local/src/httpd-2.2.4/srclib/pcre/</pre></div></div>
<p>Compile and install:</p>
<div class="hl-surround" ><div class="hl-main"><pre>make
make install</pre></div></div>
<p>Copy the default rule set to apache directory and include them in the main apache configuration file:</p>
<div class="hl-surround" ><div class="hl-main"><pre>cp -r /usr/local/src/modsecurity-apache_2.1.2/rules/ \
/usr/local/apache2/conf/modsecurity</pre></div></div>
<p>In /usr/local/apache2/conf/httpd.conf add the following lines:</p>
<div class="hl-surround" ><div class="hl-main"><pre>LoadModule security2_module modules/mod_security2.so
Include conf/modsecurity/*.conf</pre></div></div>
<p>In order to enforce the rules (by default <strong>mod_security</strong> would simply log requests that matched the rules), go to each and single file and change the SecDefaultAction to:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>SecDefaultAction &quot;phase:2,log,deny,status:400&quot;</pre></div></div>
<p><strong>The End: up and running</strong><br />
Last but not least do not forget to remove software that you no longer need! No compilers or development libraries should remain in the sever.</p>
<p>First software needed to compile Apache:</p>
<div class="hl-surround" ><div class="hl-main"><pre>apt-get remove --purge binutils cpp cpp-4.1 gcc-4.1 \
libssp0 make gcc libc6-dev libc-dev \
linux-kernel-headers libssl-dev zlib1g-dev</pre></div></div>
<p>And also the one needed for PHP:</p>
<div class="hl-surround" ><div class="hl-main"><pre>apt-get remove --purge libxml2-dev libfreetype6-dev \
libgd2-noxpm-dev libjpeg62-dev libpng12-dev libgd2-dev \
libmysqlclient15-dev g++ g++-4.1 libstdc++6-4.1-dev</pre></div></div>
<p>Remove all the sources that we have used:</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>rm -rf /usr/local/src/*</pre></div></div>
<p>And of course:-</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>/usr/local/apache2/bin/apachectl start</pre></div></div>
<p><strong>References</strong></p>
<ul>
<li><a href="http://xianshield.org/guides/apache2.0guide.html">Apache 2.0 Hardening Guide</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2007/09/14/harden-your-apachephp-installation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>send files through email from the command line</title>
		<link>http://usefulfor.com/nothing/2006/12/20/send-files-through-email-from-the-command-line/</link>
		<comments>http://usefulfor.com/nothing/2006/12/20/send-files-through-email-from-the-command-line/#comments</comments>
		<pubDate>Wed, 20 Dec 2006 13:09:15 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Networking]]></category>

		<category><![CDATA[Shell Script]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=16</guid>
		<description><![CDATA[Every now and then I need to send by email some file to a friend or coworker or even myself. I have found that the easiest way to do this is just having a shell script that do the hard work for you.
After some research I found a set of scripts that actually do what [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I need to send by email some file to a friend or coworker or even myself. I have found that the easiest way to do this is just having a shell script that do the hard work for you.</p>
<p>After some research I found a set of scripts that actually do what I want (credit goes to Heiner Steven). The bad news is that this is not a full-bash solution. The scripts use the <code>metasend</code> command to send files as MIME atachments.</p>
<p><span id="more-20"></span></p>
<p>This is a easy two-step process. First, you need to install the <strong>metamail</strong> (this is the name of the Debian GNU/Linux package) in your box. Then grab this two scripts (sendfile,  getmimetype). The first one does the call to <code>metasend</code>. From it&#8217;s usage information:</p>
<div class="hl-surround" ><div class="hl-main"><pre>usage: sendfile [-f] [-s subject] [-m mimetype] recipient file ...
    -f:  force sending of mail even for invalid recipients
    -s:  subject of the mail message
    -m:  mime-type (i.e. &quot;application/octet-stream&quot;)

Multiple files may be specified. If no mimetype was given,
it is determined via a call to &quot;getmimetype&quot;.</pre></div></div>
<p>And you are ready to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2006/12/20/send-files-through-email-from-the-command-line/feed/</wfw:commentRss>
		</item>
		<item>
		<title>matar: bloodlust</title>
		<link>http://usefulfor.com/nothing/2006/12/15/matar-bloodlust/</link>
		<comments>http://usefulfor.com/nothing/2006/12/15/matar-bloodlust/#comments</comments>
		<pubDate>Fri, 15 Dec 2006 13:43:18 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Shell Script]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=15</guid>
		<description><![CDATA[Here is a tiny script that can be usefull to terminate (kill -9) all the programs which contain a certain string (i.e.: kill all the running copies of ping).
#!/bin/bash

for foo in `ps aux &#124; grep $1 &#124; awk '{print $2}'`;  do kill -9 $foo; done
Just run: matar &#60;program name&#62; and that&#8217;s it. They are [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a tiny script that can be usefull to terminate (<code>kill -9</code>) all the programs which contain a certain string (i.e.: kill all the running copies of <code>ping</code>).</p>
<div class="hl-surround" ><div class="hl-main"><pre>#!/bin/bash

for foo in `ps aux | grep $1 | awk '{print $2}'`;  do kill -9 $foo; done</pre></div></div>
<p>Just run: <code>matar &lt;program name&gt;</code> and that&#8217;s it. They are all gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2006/12/15/matar-bloodlust/feed/</wfw:commentRss>
		</item>
		<item>
		<title>replace spaces in filename</title>
		<link>http://usefulfor.com/nothing/2006/12/14/replace-spaces-in-filename/</link>
		<comments>http://usefulfor.com/nothing/2006/12/14/replace-spaces-in-filename/#comments</comments>
		<pubDate>Thu, 14 Dec 2006 11:25:33 +0000</pubDate>
		<dc:creator>etd</dc:creator>
		
		<category><![CDATA[Shell Script]]></category>

		<guid isPermaLink="false">http://weblog.nomejortu.com/?p=4</guid>
		<description><![CDATA[Just a quick tip!
You have to use the bash function ${foo//string1/string2}.  Check the Advanced Bash-Scripting Guide for a complete list of string manipulating functions.
for foo in *; do mv &#34;$foo&#34; ${foo// /_}; done
]]></description>
			<content:encoded><![CDATA[<p>Just a quick tip!</p>
<p>You have to use the bash function <code>${foo//string1/string2}</code>.  Check the <a href="http://www.tldp.org/LDP/abs/html/refcards.html">Advanced Bash-Scripting Guide</a> for a complete list of string manipulating functions.</p>
<div class="hl-surround" style="height:28px;"><div class="hl-main"><pre>for foo in *; do mv &quot;$foo&quot; ${foo// /_}; done</pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://usefulfor.com/nothing/2006/12/14/replace-spaces-in-filename/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
