<?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>Vitriol and Routing Tables &#187; Apache</title>
	<atom:link href="http://www.raptorized.com/tags/english/work/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.raptorized.com</link>
	<description>Tales from the OSI layer 3</description>
	<lastBuildDate>Wed, 08 Sep 2010 02:34:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update on the Apache-Hangs-On-Digest-Generation topic</title>
		<link>http://www.raptorized.com/2007/02/14/update-on-the-apache-hangs-on-digest-generation-topic/</link>
		<comments>http://www.raptorized.com/2007/02/14/update-on-the-apache-hangs-on-digest-generation-topic/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 04:39:54 +0000</pubDate>
		<dc:creator>mr_daemon</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://www.raptorized.com/?p=109</guid>
		<description><![CDATA[Just to let everyone know I&#8217;ve poked my head in the Apache2 hanging on digest generation problem again, and figured out a better solution than relying on rng-utils. Check it out.]]></description>
			<content:encoded><![CDATA[<p>Just to let everyone know I&#8217;ve poked my head in the Apache2 hanging on digest generation problem again, and figured out a better solution than relying on rng-utils.</p>

<p><a href="http://www.raptorized.com/?p=70">Check it out.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.raptorized.com/2007/02/14/update-on-the-apache-hangs-on-digest-generation-topic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion: .htaccess gives 403 forbidden?</title>
		<link>http://www.raptorized.com/2006/11/14/subversion-htaccess-gives-403-forbidden/</link>
		<comments>http://www.raptorized.com/2006/11/14/subversion-htaccess-gives-403-forbidden/#comments</comments>
		<pubDate>Tue, 14 Nov 2006 21:44:31 +0000</pubDate>
		<dc:creator>mr_daemon</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://www.raptorized.com/?p=92</guid>
		<description><![CDATA[I&#8217;m trying to import a brand new top secret project into my Subversion Repository. Okay, I&#8217;ve had my share of troubles with that set-up &#8212; it is behind an Apache Reverse Proxy, with a bit of perl hacking to support move operations accross SSL tunnels. (I&#8217;ll post about this soon, I&#8217;m sure it will interest [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to import a brand new top secret project into <a href="http://nailhead.underwares.org">my Subversion Repository</a>.</p>

<p>Okay, I&#8217;ve had my share of troubles with that set-up &#8212; it is behind an Apache Reverse Proxy, with a bit of perl hacking to support move operations accross SSL tunnels. (I&#8217;ll post about this soon, I&#8217;m sure it will interest someone).</p>

<p>So, I was trying to import my new project and BANG, it dies.</p>

<pre><code>Ajout          public/javascripts/application.js
Ajout          public/javascripts/controls.js
Ajout          public/404.html
Ajout          public/index.html
Ajout          public/.htaccess
svn: PUT of '/svn/repos/!svn/xx/.htaccess': 
302 Found (https://www.underwares.org)
svn: Le message de propagation a été laissé dans un fichier temporaire :
svn:    'svn-commit.4.tmp'
</code></pre>

<p>I first wonder the meaning of such foolery (foolery that has nothing to do with Tom, whatsoever) and then slap my forehead loudly. </p>

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

<p>I use shitty redirects for HTTP errors to display lovely custom error messages. SVN probably dislikes the redirect and displays it as the problem, hence, 302 found.</p>

<p>I comment that stuff out of httpd.conf, restart apache, and bam. There is the real error.</p>

<pre><code>svn: PUT of '/svn/repos/!svn/wrk/xx/.htaccess': 
403 Forbidden (https://www.underwares.org)
</code></pre>

<p>Well, shit. It seems to be explicitely rejecting files named &#8220;.htaccess&#8221;.
I thought it might have been mod_security being too anal once again, but that would have returned a 406 (content unacceptable). I still disable mod_security, to no avail.</p>

<p>I run a simple test to confirm. I create a folder with four files:</p>

<ul>
    <li>.htaccess</li>
    <li>.htpasswd</li>
    <li>.htpouet</li>
    <li>.pouet</li>
</ul>

<p>So, we&#8217;ll see what happen. I try to import them into svn. I first start with &#8220;.pouet&#8221;, for kicks.</p>

<pre><code>$ svn import . https://www.underwares.org/svn/repos/private/test
Ajout          .pouet

Révision 275 propagée.</code></pre>

<p>Well, that worked. So it&#8217;s not the dot. Next, &#8220;.htaccess&#8221;.</p>

<pre><code> phobos$ svn import . https://www.underwares.org/svn/repos/private/test
svn: PROPFIND request failed on '/svn/repos/private/test/.htaccess'
svn: PROPFIND of '/svn/repos/private/test/.htaccess': 
403 Forbidden (https://www.underwares.org)
svn: Le message de propagation a été laissé dans un fichier temporaire :
svn:    'svn-commit.2.tmp'
phobos$</code></pre>

<p>Well, that failed. &#8220;.htpasswd&#8221; fails as well, and to much of my surprise, <b>&#8220;.htpouet&#8221; fails as well</b>.</p>

<p>Then it hit me. The following regular expression flashed through my mind:
<code>^.ht</code>
Damn it! The default httpd.conf has a directive that denies access to such files on a global level. A quick look at the file confirms:</p>

<pre><code>&lt;Files ~ "^\.ht"&gt;
    Order allow,deny
    Deny from all
    Satisfy All
&lt;/Files&gt;</code></pre>

<p>So here we go. I comment out that obnoxious directive, and move it inside the &#8220;Directory&#8221; directive of my vhost. I also add it to every single vhost on my server.</p>

<p>Some clever people are probably thinking, why didn&#8217;t you do something like this?</p>

<pre><code>&lt;Location /svn&gt;
  &lt;Files ~ "^\.ht"&gt;
        Order allow,deny
        Allow from all
        Satisfy All
  &lt;/Files&gt;
&lt;/Location&gt;</code></pre>

<p>Well, you can&#8217;t have a Files directive nested inside a Location directive. You can, however, have one inside a Directory directive. So, now users can&#8217;t access .ht files through the web, which is good, and SVN can, which is good as well. </p>

<p>All of this was probably related to my sinister Reverse Proxy buisness. Don&#8217;t attempt such a set-up unless you like pain, kids.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raptorized.com/2006/11/14/subversion-htaccess-gives-403-forbidden/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sharing, Syncing and editing iCal over WebDAV</title>
		<link>http://www.raptorized.com/2006/08/16/sharing-syncing-and-editing-ical-over-webdav/</link>
		<comments>http://www.raptorized.com/2006/08/16/sharing-syncing-and-editing-ical-over-webdav/#comments</comments>
		<pubDate>Wed, 16 Aug 2006 13:54:11 +0000</pubDate>
		<dc:creator>mr_daemon</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tutorials/How-To]]></category>

		<guid isPermaLink="false">http://www.raptorized.com/?p=72</guid>
		<description><![CDATA[iCal. Such a nice calendering application that is, and a pioneer in the vastly used ics calendar format. Is it the ultimate calendar ever? Well, almost. What drove me insane was that, while you can publish your calendars to a WebDAV server for others to see and subscribe to, you cannot edit the calendars that [...]]]></description>
			<content:encoded><![CDATA[<p>iCal. Such a nice calendering application that is, and a pioneer in the vastly used ics calendar format. Is it the ultimate calendar ever? Well, almost.</p>

<p>What drove me insane was that, while you can <em>publish</em> your calendars to a WebDAV server for others to see and subscribe to, you <strong>cannot</strong> edit the calendars that are published &#8212; unless you have a .mac account. While I sincerly hope this will be in Leopard, I&#8217;m not holding my breath.</p>

<p>You see, I run Linux on my desktop at home, and Mac OS X on my laptop, for work. I just wanted to find a simple way to share my calendar between the two machines, and to <strong>be able to edit them</strong> on any machine.</p>

<p>And it just so happens I just have the solution.
<span id="more-72"></span></p>

<h2>Configuring the WebDAV server</h2>

<p>Now, vast amounts of documentation can be found on the subject of setting up the WebDAV server. I&#8217;m not going to insult those who already worked on the problem by needlessly rewriting the instructions here. However, I will give you pointers.</p>

<ul>
<li><a href="http://www.serverwatch.com/tutorials/article.php/2176771">Enabling WebDAV on Apache [serverwatch.com]</a>
</li><li><a href="http://www.gregwestin.com/webdav_for_ical.php">WebDAV on OS X With iCal [gregwestin.com]</a>
</li><li><a href="http://www.icalx.com/">iCal Exchange (Free ics hosting)</a>
</li><li><a href="http://www.box.net/">Free WebDAV Hosting [box.net]</a>
</li></ul>

<p>So you could go ahead and setup your WebDAV server on *nix or OS X using the two first links, or you could just get free WebDAV hosting using the two others. Any will do.</p>

<p>For the sake of completeness, I will add my own WebDAV configuration below, on Gentoo Linux with Apache 2.
I just installed mod_dav on apache2, and added the following configuration to <em>/etc/apache/modules.d/10_mod_dav.conf</em>:</p>

<pre><code>
&lt;IfModule mod_dav.c>
  DAVLockDB /var/lock/mod_dav/Dav_Lock
  Alias /ical /var/dav/davroot
  DavMinTimeout 600
        &lt;Directory /var/dav/davroot>
                Dav On
                Options +Indexes
                AllowOverride None
                AuthType Digest
                AuthName "ical-webdav"
                AuthDigestFile /var/dav/htpasswd.digest
                Require valid-user
                Order allow,deny
                Allow from All
        &lt;/Directory>
&lt;/IfModule>
</code></pre>

<p>Of course, I just then added a user using <strong>htdigest</strong>. You could use &#8220;AuthType Basic&#8221; if you don&#8217;t use mod_digest.</p>

<p>I tested the WebDAV functionality using the OS X &#8220;Connect to server&#8221; Function. Just enter the path to your webdav location.</p>

<p><img id="image73" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-11.png" alt="connect_to_webdav" /></p>

<p>I was prompted for authentication. Upon submitting my credentials, the drive was mounted on the desktop.</p>

<p><img id="image74" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-12.png" alt="connected_webdav" /></p>

<p>You should test to see if you can write files to the WebDAV folder. Once that&#8217;s done, we can move on the beef of this article.</p>

<h2>Setting up iCal</h2>

<p>You should take care of iCal first. First thing first, go ahead and share your calendar via iCal, as usual. Enter your WebDAV server information.</p>

<p><img id="image75" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-13.png" alt="ical_sharing" /></p>

<p>Once all is published and well, according to the little icon next to your calendar (<img id="image76" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-15.png" alt="ical_sharing_widget" />), you have successfully published your calendar in a perfect <strong>read only fashion</strong>.</p>

<h2>Making iCal Sync from the server</h2>

<p>This is the sweet part, the core of this article. Now, we want iCal to also <em>download</em> the changes from the server. For this purpose, you must find out the Path of your <em>corestorage.ics</em> file for that calendar. Go have a look in ~/Libary/Application Support/iCal/Sources/, right now. (That being the &#8220;Library&#8221; folder from your <strong>Home Directory</strong>).</p>

<p><img id="image78" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-17.png" alt="ical_files" /></p>

<p>You should see some folder(s) with ugly names, one per Calendar you have. There&#8217;s no easy step to this, but you have to find out which is which. You can judge either by creation dates, or by opening the .ics file in your favorite text editor to see if you recognize some of the contents. Of course, if you only have <em>one</em> calendar, things are simplified, you will just have one folder, and one file.</p>

<p>In any case, write down the <strong>absolute path</strong> to the folder containing the ics file, it&#8217;s important. For instance, in my case, it turns out to be:</p>

<p>/Users/supernaut/Library/Application Support/iCal/Sources/2FBCA21F-80E0-44FD-B47A-ED34AE652010.calendar</p>

<h2>ical_sync.sh</h2>

<p>I have then written two scripts that take care of downloading, comparing and synchronizing your calendars from the WebDAV server.
You will need the following utilities installed, most are available from <a href="http://fink.sourceforge.net">Fink</a>.</p>

<ul>
    <li>wget
    </li><li>md5sum
</li></ul>

<p>Download and place the <a href="http://alex.underwares.org/projects/scripts/ical_sync.sh">following script</a> somewhere on your system. I created a folder named &#8220;bin&#8221; in my home directory and placed it there.</p>

<p>Next, edit the script and change the variables to match your situation, eg:</p>

<pre><code>
ICALPATH="/you/core/ics/folder"
WEBDAV="http://www.yourserver.com/path/to/dav/folder/calendar.ics"
LOGIN="yourlogin"
PASSWORD="yourpassword"

WGET="/sw/bin/wget"
MD5SUM="/sw/bin/md5sum"
</code></pre>

<p><em>Remember! The value for $ICALPATH is actually the one you wrote down earlier. Don&#8217;t worry if you mess it up, the script will warn you.</em></p>

<p>Once that&#8217;s done, run it in terminal. It should tell you if ANYTHING goes wrong and back off. I made it extra careful, it would suck to wreck your calendar because the server is down or answers strange things.</p>

<p>This will indeed download and update your calendar on your Mac from the WebDAV server. But how will you make this happen automagically? Well, I have taken care of that too.</p>

<h2>Working the Applescript magic</h2>

<p>Turns out I have written a second script, this time, an applescript one. You can download the source <a href="http://alex.underwares.org/projects/scripts/ical_wrapper.applescript">over there</a>.</p>

<p>Open it or paste it in Script Editor. You should then change the line</p>

<p><code>    do shell script "bash /Users/supernaut/bin/ical_sync.sh"</code></p>

<p>to match the location of the ical_sync.sh script and then hit &#8220;compile&#8221;.</p>

<p>Once that&#8217;s done, just save it somewhere, but make sure you save it:</p>

<ul>
<li>As an <strong>Application</strong>
</li><li>Make sure the startup screen is <strong>unchecked</strong>
</li></ul>

<p><img id="image79" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-18.png" alt="script_save" /></p>

<p>Once that&#8217;s done, simply replace the iCal icon in your dock by this script. You can add a pretty icon to it to make it more bearable.</p>

<p><img id="image80" src="http://www.raptorized.com/wp-content/uploads/2006/08/dock.png" alt="dock screenshot" /></p>

<p>Everytime you click on iCal then, it will sync up the calendar from the server, and tell if you if anything goes wrong. It will then proceed to launch the real iCal for you.</p>

<p>The AppleScript will show a dialog box if, say, the network is down, or something went wrong. For example:</p>

<p><img id="image81" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-20.png" alt="ical crapped out screenshot" /></p>

<p>You can then take action. As a precaution, in the event that it wasn&#8217;t what you wanted to do, the script will ask you if you still want to launch iCal.</p>

<p><img id="image82" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-21.png" alt="ical notice" /></p>

<p>I made it that way because, sometimes, you might want to look at your calendar without being connected to the internet. Makes sense, right?</p>

<p>Now, onwards to other Calendaring software.</p>

<h2> Configuring Other Calendars</h2>

<p>Nearly any other Calendaring software will not only fetch the lastest ics file from a webdav server, but will also <em>write it back</em> on change, or upon instruction to do so. This means, no problems whatsoever.</p>

<p>I use Korganizer in conjunction with Kontact on my KDE based desktop. Evolution and Sunbird could most likely do this as well.</p>

<p>I just added a calendar for a web source, and configured it with my WebDAV information:</p>

<p><img id="image77" src="http://www.raptorized.com/wp-content/uploads/2006/08/image-16.png" alt="kontact_korganizer_webdav" /></p>

<p><tt>Please excuse the craptacular quality of the screenshot. It was taken while forwarding X11 to my Mac over an SSH tunnel, and as such, fonts are screwy.</tt></p>

<p>Then, it just worked out of the box. No problem whatsoever.</p>

<h2>In conclusion</h2>

<p>This is somewhat of a cheap and dirty hack, but it works fairly well. I&#8217;ve been using it for three weeks and it&#8217;s a dream.
I sincerely hope that this has been somewhat useful to at least someone <img src='http://www.raptorized.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>Drop me a comment if you liked it, or if you have problems. Feel free to ask, really.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raptorized.com/2006/08/16/sharing-syncing-and-editing-ical-over-webdav/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Apache hangs on Digest Secret generation</title>
		<link>http://www.raptorized.com/2006/08/11/apache-hangs-on-digest-secret-generation/</link>
		<comments>http://www.raptorized.com/2006/08/11/apache-hangs-on-digest-secret-generation/#comments</comments>
		<pubDate>Fri, 11 Aug 2006 15:24:47 +0000</pubDate>
		<dc:creator>mr_daemon</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Tutorials/How-To]]></category>
		<category><![CDATA[Unix/Linux]]></category>

		<guid isPermaLink="false">http://www.raptorized.com/?p=70</guid>
		<description><![CDATA[I have a machine on my network that is very special. It&#8217;s a rather old Quad Xeon, an HP LH4 that I scavenged out of the proverbial dumpster of a buisness that didn&#8217;t want it anymore. In fact, they were about to trash six of them. I decided it was a crime to shitcan such [...]]]></description>
			<content:encoded><![CDATA[<p>I have a machine on my network that is very special. It&#8217;s a rather old Quad Xeon, an HP LH4 that I scavenged out of the proverbial dumpster of a buisness that didn&#8217;t want it anymore. In fact, they were about to trash <strong>six of them.</strong></p>

<p>I decided it was a crime to shitcan such beautiful machines, so with the help of my friend Mike <em>&#8220;I mangle french words&#8221;</em> Le Blanc, we drove there, armed with a large truck and patience. Carrying them down the three stories with no elevator was an interesting experience. I scavenged lots and lots of interesting hardware there.</p>

<p>But i&#8217;m getting ahead of myself here. The point is, lots of screwy things start occuring when you have a Quad SMP machine, such a timers and clock drift. I started having a lot of problems with Apache recently&#8230; once in a blue moon, on restart, it would spawn a single process with no PID file, and hang there. Checking out error_log pointed out that apache would apparently hang while generating the Secret seed for Digest authentication (mod_digest). Disabling mod_digest would have worked, but sadly, I use it. This could be found in error_log:</p>

<pre>
<code>
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[notice] Apache configured -- resuming normal operations
[notice] caught SIGTERM, shutting down
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)
[notice] Digest: generating secret for digest authentication ...
</code>
</pre>

<p>Fortunately, I cobbled up a fix. <strong>Updated! Read on for a more elegant fix.</strong>
<span id="more-70"></span></p>

<p>So it hangs while generating the secret for digest authentication. My gut feeling was that it had to do with the system running out of entropy (random data, that is). Probably waits for <em>apr_generate_random_bytes()</em> to complete but that never happens. I immediatly checked out the kernel for available entropy from /dev/random and friends.</p>

<pre>
<code>
# cat /proc/sys/kernel/random/entropy_avail
16
</code>
</pre>

<p>Now, I have no clue why, but entropy ran out (not quite, but close). Probably another whacky quad SMP issue. I&#8217;m starting to drive the Gentoo devs and maintainers crazy with my strange hardware.</p>

<p><strong>Note: Before proceeding, please read the updated section below.</strong></p>

<p>So, to remedy it, I fetched and installed <strong>rngd</strong> from the <strong>rng-tools</strong> package in Gentoo Portage. Check out your distro&#8217;s package repository for it or something similar. This tool allegedy gathers random data from I/O transactions and hardware stuff around. I compiled it, installed it and launched it. The Gentoo way:</p>

<pre><code>
# emerge -va rng-tools
# rc-update add rngd default &#038;&#038; /etc/init.d/rngd start
</code></pre>

<p>Once that was taken care of, I checked the available entropy by querying the kernel once again.</p>

<pre><code>
# cat /proc/sys/kernel/random/entropy_avail
6854
</code></pre>

<p>That&#8217;s much better. To my surpise, Apache finished loading instantly the split second rngd started up. Schweet.
Sounds like that fixes the problem. <strike>I have no idea why it occurs right now, but this works around it elegantly.</strike></p>

<p><strong>UPDATE!</strong>
I figured out what the greasy poop was going on. Installing rngd will gather entropy using /dev/urandom if no hardware RNG is found by default. I didn&#8217;t pay much attention to that detail at the time. However, you will notice that when installing the Apache Portable Runtime on Gentoo (dev-libs/apr) the use flag <em>urandom</em> is available. Using <em>euse</em> (from gentoolkit) to get info about it returns the following:</p>

<pre><code>
valkyrie ~ # euse -i urandom
global use flags (searching: urandom)
************************************************************
no matching entries found

local use flags (searching: urandom)
************************************************************
[-    ] urandom (dev-libs/apr):
Use /dev/urandom instead of /dev/random
</code></pre>

<p>This will make apache fetch randomness from /dev/urandom directly, therefore giving the same result as rng-tools. The proper solution would be to <strong>just re-emerge <em>dev-libs/apr</em> with the <em>urandom</em> use flag enabled.</strong></p>

<p>I tried it and it works beautifully, and looks a lot more elegant to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raptorized.com/2006/08/11/apache-hangs-on-digest-secret-generation/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss>
