<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; Apache</title>
	<atom:link href="http://www.g-loaded.eu/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Speed up Apache by including htaccess files into httpd.conf</title>
		<link>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/</link>
		<comments>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 05:12:59 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=2522</guid>
		<description><![CDATA[It is widely known that, if virtual hosts in Apache (httpd) are configured to permit vhost administrators override specific configuration options at the directory level using htaccess files, the web server consumes valuable time in order to check whether an htaccess file exists in every directory included in the requested path and parse it. On [...]]]></description>
			<content:encoded><![CDATA[<p>It is widely known that, if virtual hosts in Apache (httpd) are configured to permit vhost administrators override specific configuration options at the directory level using htaccess files, the web server consumes valuable time in order to check whether an htaccess file exists in every directory included in the requested <em>path</em> and parse it. On the other hand, many popular web applications utilize htaccess files, especially those residing in the <em>DocumentRoot</em>, in order to implement pretty URLs or HTTP redirections, which is extremely convenient since the virtual host owner does not have to edit httpd&#8217;s configuration directly. So, I had the idea to include the htaccess file of the DocumentRoot directory on the filesystem into the virtual host&#8217;s configuration.<br />
<span id="more-2522"></span><br />
Suppose we have the <code>/home/example.org/public_html/</code> directory on the filesystem, which serves as the document root of our virtualhost. The relevant httpd configuration for that vhost would look like this:</p>
<pre class="codesnp">
&lt;VirtualHost 123.123.123.123:80&gt;
  ServerName example.org:80
  ...
  DocumentRoot /home/example.org/public_html
  &lt;Directory /home/example.org/public_html&gt;
    AllowOverride All
    ...
  &lt;/Directory&gt;
  ...
&lt;/VirtualHost&gt;
</pre>
<p>In order to prevent the htaccess lookups on the filesystem without losing the htaccess functionality &#8211; at least at the DocumentRoot level- I transformed the configuration to the following:</p>
<pre class="codesnp">
&lt;VirtualHost 123.123.123.123:80&gt;
  ServerName example.org:80
  ...
  DocumentRoot /home/example.org/public_html
  &lt;Directory /home/example.org/public_html&gt;
    AllowOverride None
    Include /home/example.org/public_html/.htaccess
    ...
  &lt;/Directory&gt;
  ...
&lt;/VirtualHost&gt;
</pre>
<p>Let&#8217;s see what we have accomplished with this:</p>
<ol>
<li>httpd does not waste any time looking for and parsing htaccess files resulting in faster request processing,</li>
<li>the virtual host administrator can still override the configuration options of the document root manually or through the web interface of the web application.</li>
</ol>
<p>Seems like a win-win situation performance and functionality wise.</p>
<p>But, as usual, there is no win-win situation without a downside. In this case, the above trick weakens the server&#8217;s security. Let&#8217;s see how.</p>
<p>Although the configuration of a directory can be set in both <code>httpd.conf</code> and the directory&#8217;s htaccess file, not all directives can be used in both contexts. htaccess files support a subset of the directives that can be used in the <code>Directory</code> context within <code>httpd.conf</code>. By including the htaccess file in httpd&#8217;s configuration the vhost admin is no longer restricted to that subset of directives.</p>
<p>This means that by implementing the above configuration the virtual host administrator is granted more privileges regarding the configuration of the virtual host. This also means that a potential attacker, that would exploit a vulnerability of the web application, would be granted the same privileges once he got write access to that htaccess file.</p>
<p>So, although this trick may seem like a good idea at first, it is in fact a rather <strong>bad idea</strong> and <em>should never be used in production, unless you trust the virtual host administrator and the web application</em>. I do not intend to use such a configuration and I do not recommend it. There are by far better ways to speed up Apache.</p>
<p>Your comments and suggestions are welcome.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/">Speed up Apache by including htaccess files into httpd.conf</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/" rel="bookmark">.htaccess Cheat Sheet</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/" rel="bookmark">Using the mod_dav_svn SVNParentPath directive with multiple authz files</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</title>
		<link>http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/</link>
		<comments>http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 20:40:45 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[ciphers]]></category>
		<category><![CDATA[mod_gnutls]]></category>
		<category><![CDATA[mod_ssl]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[vulnerability]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=2471</guid>
		<description><![CDATA[It&#8217;s been a while since the details of an SSL/TLS vulnerability have been released to the public. Since then, security experts have worked on the issue and have released a whitepaper describing how to mitigate the attack, known as BEAST (Browser Exploit Against SSL/TLS). From the security researchers&#8217; article: The problem lies in the way [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since the details of an <em>SSL/TLS vulnerability</em> have been released to the public. Since then, security experts have worked on the issue and have <a href="http://www.phonefactor.com/blog/slaying-beast-mitigating-the-latest-ssltls-vulnerability.php">released</a> a <a href="http://www.phonefactor.com/resources/CipherSuiteMitigationForBeast.pdf" title="Whitepaper on the mitigation of the BEAST attack">whitepaper</a> describing how to mitigate the attack, known as BEAST (Browser Exploit Against SSL/TLS).<br />
<span id="more-2471"></span><br />
From the security researchers&#8217; article:</p>
<blockquote><p>The problem lies in the way that block ciphers are used in SSL/TLS. Block ciphers are generally operated in one of several modes that define how encrypted blocks are manipulated to ensure complete confidentiality. Cipher Block Chaining, or CBC mode, is used in SSL for all block ciphers, including AES and Triple-DES. The BEAST attack relies on a weakness in the way CBC mode is used in SSL and TLS. Non-CBC cipher suites, such as those using the RC4 stream encryption algorithm, are not vulnerable.</p>
<p>There have been several suggested mitigations that can be put into play from the perspective of the client, such as reorganizing the way the data is sent in the encrypted stream. Servers can protect themselves by requiring a non-CBC cipher suite. One such cipher suite is rc4-sha, which is widely supported by clients and servers.</p></blockquote>
<p>Researchers have concluded that the <a href="http://en.wikipedia.org/wiki/RC4" title="Information about the Alleged RC4 cipher">RC4</a> (Alleged RC4) based cipher suites are not vulnerable to the BEAST attack, while <a href="http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29" title="Information about the Cipher-block chaining (CBC)">CBC</a> (Cipher Block Chaining mode) based cipher suites are. This involves both the <strong>TLS 1.0</strong> and the <strong>SSL 3.0</strong> protocols. On the contrary, TLS 1.1 and 1.2 have not been found to be vulnerable, but their use is very limited since they haven&#8217;t been adopted by the majority of HTTP clients and servers yet.</p>
<p>So, the use of <strong>RC4</strong> based ciphers is all that is left for the moment. The security experts have released a list of cipher suites that is suitable for use in the configuration of the <a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html" title="mod_ssl documentation page">mod_ssl</a> module for <a href="http://httpd.apache.org/" title="Apache's httpd homepage">httpd</a>:</p>
<pre class="console">
SSLHonorCipherOrder on
SSLCipherSuite !aNULL:!eNULL:!EXPORT:!DSS:!DES:RC4-SHA:RC4-MD5:ALL
</pre>
<p>They have also released a one-liner list of ciphers suitable for use in the relevant fields of the <em>Local Group Policy Editor</em> in Windows Server boxes.</p>
<p>However, there is no info about configuring the <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/" title="mod_gnutls homepage">mod_gnutls</a> module for <em>apache</em> to use <strong>RC4</strong> based ciphers, so, as a dedicated user of <em>mod_gnutls</em>, I decided to release this <em>tip</em>. All you have to do is set the preferred ciphers in the <strong>GnuTLSPriorities</strong> directive. In this example we use the TLS 1.0 protocol:</p>
<pre class="console">
GnuTLSPriorities NONE:+VERS-TLS1.0:+ARCFOUR-128:+RSA:+SHA1:+COMP-NULL
</pre>
<p>Visiting a secure web site that has been configured using any of the methods described above and by checking the information of the secure connection to that website, you should see the following message:</p>
<div id="attachment_2478" class="wp-caption aligncenter" style="width: 576px"><img src="http://www.g-loaded.eu/wp-content/uploads/firefox_ssl_tls_rc4_message.png" alt="Firefox message about using RC4 encryption cipher" title="firefox_ssl_tls_rc4_message" width="566" height="109" class="size-full wp-image-2478" /><p class="wp-caption-text">Firefox message about using RC4 encryption cipher</p></div>
<p>This means that everything is working correctly.</p>
<p>As always, comments and suggestions are welcome and appreciated.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/">How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/02/20/critical-vulnerability-in-adobe-reader/" rel="bookmark">Critical vulnerability in Adobe Reader</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/" rel="bookmark">mod_gnutls binary for Apache</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/" rel="bookmark">Using SSH for networking</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/10/how-to-configure-and-use-lirc/" rel="bookmark">How to configure and use LIRC</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>mod_wsgi incompatible with mod_python</title>
		<link>http://www.g-loaded.eu/2010/04/07/mod_wsgi-incompatible-with-mod_python/</link>
		<comments>http://www.g-loaded.eu/2010/04/07/mod_wsgi-incompatible-with-mod_python/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 09:00:58 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[WSGI]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1676</guid>
		<description><![CDATA[This is a quick note that mod_wsgi daemon processes are now incompatible with mod_python. Upgraded mod_wsgi earlier today in CentOS and saw the following note. I guess this limitation has been around for a while before affecting CentOS/RHEL: ################################################################################# # mod_python and mod_wsgi compatibility note ################################################################################# # mod_wsgi will deadlock if run in daemon mode [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick note that <a href="http://code.google.com/p/modwsgi/">mod_wsgi</a> daemon processes are now incompatible with <a href="http://www.modpython.org/">mod_python</a>. Upgraded <strong>mod_wsgi</strong> earlier today in CentOS and saw the following note. I guess this limitation has been around for a while before affecting CentOS/RHEL:<br />
<span id="more-1676"></span></p>
<pre class="codesnp">
#################################################################################
# mod_python and mod_wsgi compatibility note
#################################################################################
# mod_wsgi will deadlock if run in daemon mode while mod_python is enabled
# do not enable both mod_python and mod_wsgi if you are going to use the
# WSGIDaemonProcess directive
# In previous version of mod_wsgi, apache would segfault when both mod_wsgi
# and mod_python were enabled.  This update does not guarantee that will not
# happen.
#################################################################################
# Do not enable mod_python and mod_wsgi in the same apache process.
#################################################################################
</pre>
<p>Keep this in mind if you plan to mix both modules under the same Apache instance.</p>
<p><strong>Update</strong>: As <a href="http://blog.dscpl.com.au/">Graham</a> pointed out in <a href="http://www.g-loaded.eu/2010/04/07/mod_wsgi-incompatible-with-mod_python/#comment-12257">this comment</a>, there is no issue if <strong>mod_python 3.3.1</strong> is used. That&#8217;s great news because I would miss the flexibility of mod_python when it comes to request processing.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/04/07/mod_wsgi-incompatible-with-mod_python/">mod_wsgi incompatible with mod_python</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/11/20/my-running-dog/" rel="bookmark">My running dog</a></li>
<li><a href="http://www.g-loaded.eu/2010/01/02/spamassassin-fh_date_past_20xx-test-buggy-in-2010/" rel="bookmark">Spamassassin FH_DATE_PAST_20XX test buggy in 2010</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/09/making-a-directory-writable-by-the-webserver/" rel="bookmark">Making a directory writable by the webserver</a></li>
<li><a href="http://www.g-loaded.eu/2006/12/20/selinux-audit-reports-script/" rel="bookmark">SELinux audit reports script</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/24/beagle-part-ii/" rel="bookmark">Beagle Part II</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/04/07/mod_wsgi-incompatible-with-mod_python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Script for Apache Error Report</title>
		<link>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/</link>
		<comments>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 17:26:47 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Report]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Snippet]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1648</guid>
		<description><![CDATA[The last incident with the php-cgi errors as a result of a bad PHP script made me re-evaluate the daily reports I receive from the server. I realized that a report about the httpd errors that have occured during the previous day, including all virtualhosts, is more important than I had initially thought. Such a [...]]]></description>
			<content:encoded><![CDATA[<p>The last incident with the <a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/">php-cgi errors</a> as a result of a bad PHP script made me re-evaluate the daily reports I receive from the server. I realized that a report about the <em>httpd errors</em> that have occured during the previous day, including all virtualhosts, is more important than I had initially thought. Such a report would have brought the problem to my attention much earlier and could also point me to the right direction while I was trying to figure out what was the cause of it. Fortunately, I found a nice error report generator for this purpose.<br />
<span id="more-1648"></span><br />
The script is called <a href="http://www.librelogiciel.com/software/ScanErrLog/action_Presentation">scanerrlog</a> and has some quite nice features. I highly recommend you check it out. In order to run it you will also need an extra Python module, <a href="http://www.librelogiciel.com/software/jaxml/action_Presentation">jaxml</a>. Download both packages and extract <strong>scanerrlog.py</strong> and <strong>jaxml.py</strong> to the same directory. Then you can call <code>scanerrlog.py</code> using the following cronjob.</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /usr/bin/env bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Error Report for httpd</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Requires:</span>
<span style="color: #666666; font-style: italic;">#   - scanerrlog - http://www.librelogiciel.com/software/ScanErrLog/action_Presentation</span>
<span style="color: #666666; font-style: italic;">#   - jaxml - http://www.librelogiciel.com/software/jaxml/action_Presentation</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>error_log \
    <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/*/</span>log<span style="color: #000000; font-weight: bold;">/</span>error_log \
    <span style="color: #000000; font-weight: bold;">|</span> python <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>scanerrlog.py <span style="color: #660033;">-f</span> text \
    <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`hostname`</span> - Apache Error Report&quot;</span> root<span style="color: #000000; font-weight: bold;">@</span>localhost
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>
<p>Some notes:</p>
<ol>
<li>Make sure that this cronjob runs before <strong>log rotation</strong> takes place.</li>
<li>The above shell script concatenates the <strong>error_log</strong> files from the main web server and all <em>virtualhosts</em>. Edit the paths to reflect your server configuration and virtualhost layout.</li>
<li>Edit the path to <code>scanerrlog.py</code>.</li>
</ol>
<p>Scanerrlog has some quite nice features that let you further customize the report. Make sure you read the help message.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/">Script for Apache Error Report</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/20/selinux-audit-reports-script/" rel="bookmark">SELinux audit reports script</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/" rel="bookmark">Strange mod_dav_svn error</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/25/how-to-integrate-seaudit-report-in-logwatch/" rel="bookmark">How to integrate seaudit-report in logwatch</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/03/28/script-apache-error-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Redmine deployment delayed</title>
		<link>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/</link>
		<comments>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 04:21:50 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[CodeTRAX]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1269</guid>
		<description><![CDATA[I am afraid the deployment of Redmine on CodeTRAX.org will be delayed some more. This is because I am skeptical about using mod_fcgid to run two different kinds of web applications on the same web server. This software is pretty much incomplete when it comes to defining classes of applications and setting limits, like the [...]]]></description>
			<content:encoded><![CDATA[<p>I am afraid the deployment of <a href="http://www.redmine.org/">Redmine</a> on CodeTRAX.org will be delayed some more. This is because I am skeptical about using <a href="http://httpd.apache.org/mod_fcgid/">mod_fcgid</a> to run two different kinds of web applications on the same web server. This software is pretty much incomplete when it comes to defining <strong>classes of applications</strong> and setting <strong>limits</strong>, like the maximum number of <strong>fastcgi processes</strong> and the <strong>spawning rate</strong> of new processes, for each application class. What&#8217;s a process manager if you can&#8217;t define classes of processes? I also now realize the lack of a standalone, feature-rich and well-documented <strong>fastcgi process manager</strong>.</p>
<p>I use mod_fcgid to run <a href="http://php.net">PHP</a> in fastcgi mode, but I cannot let it run the same amount of Redmine instances as it will bring the server to its knees. Redmine is not a blog. It&#8217;s a whole project hosting platform. Each instance will require about 45MB of RAM. I have already experimented with another <a href="http://httpd.apache.org">Apache</a> module that can manage Rails applications, but this will require some extra testing and this is exactly what I am going to do in the following days.</p>
<p>The most unfortunate thing is that I have removed the old platform and, for a couple of weeks now, CodeTRAX serves a <em>503 Service Unavailable</em> error document, which I consider bad for the website. I hope I find the time to fix this soon.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/">Redmine deployment delayed</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/10/15/redmine-deployment-meets-social-media/" rel="bookmark">Redmine deployment meets social media</a></li>
<li><a href="http://www.g-loaded.eu/2009/09/21/redmine/" rel="bookmark">Redmine</a></li>
<li><a href="http://www.g-loaded.eu/2010/04/14/some-preliminary-redmine-customizations/" rel="bookmark">Some Preliminary Redmine Customizations</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/28/delayed-shutdown-initscript/" rel="bookmark">delayed-shutdown initscript</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/" rel="bookmark">Issues with the feeds are now resolved</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Strange mod_dav_svn error</title>
		<link>http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/</link>
		<comments>http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 20:54:10 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Subversion]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1213</guid>
		<description><![CDATA[mod_dav_svn lets you serve subversion repositories through the Apache HTTP Server. mod_dav.so is a requirement for mod_dav_svn.so. If while setting up mod_dav_svn you see the error &#8220;undefined symbol: dav_register_provider&#8220;, make sure you check the order that the aforementioned modules are loaded. mod_dav must precede mod_dav_svn: LoadModule dav_module modules/mod_dav.so LoadModule dav_svn_module modules/mod_dav_svn.so This will resolve the [...]]]></description>
			<content:encoded><![CDATA[<p>mod_dav_svn lets you serve <a href="http://subversion.tigris.org/">subversion</a> repositories through the <a href="http://httpd.apache.org/">Apache HTTP Server</a>. <em>mod_dav.so</em> is a requirement for <em>mod_dav_svn.so</em>. If while setting up mod_dav_svn you see the error &#8220;<em>undefined symbol: dav_register_provider</em>&#8220;, make sure you check the order that the aforementioned modules are loaded. mod_dav must precede mod_dav_svn:</p>
<pre class="codesnp">
LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
</pre>
<p>This will resolve the issue.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/">Strange mod_dav_svn error</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/02/24/creative-commons-v30-licenses-launched/" rel="bookmark">Creative Commons v3.0 Licenses Launched</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/" rel="bookmark">Using the mod_dav_svn SVNParentPath directive with multiple authz files</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/29/when-it-comes-to-error-messages/" rel="bookmark">When it comes to error messages&#8230;</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/25/error-when-using-old-runbin-installers-under-linux/" rel="bookmark">Error when using old run/bin installers under Linux</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/05/strange-mod_dav_svn-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Use mod_deflate to Compress Web Content delivered by Apache</title>
		<link>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/</link>
		<comments>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/#comments</comments>
		<pubDate>Sat, 10 May 2008 00:09:24 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=492</guid>
		<description><![CDATA[One of the most efficient methods to reduce the usage of bandwidth by the web server and, at the same time, increase the speed of the content delivery is to compress your web pages and, generally, all output that is returned to the clients. The compression of the web content can be done using several [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most efficient methods to reduce the usage of bandwidth by the web server and, at the same time, increase the speed of the content delivery is to <strong>compress</strong> your web pages and, generally, all output that is returned to the clients. The compression of the <strong>web content</strong> can be done using several methods. This article describes how to use the <em>mod_deflate</em> module to compress Apache&#8217;s output <em>on-the-fly</em>.<br />
<span id="more-492"></span></p>
<h4>Introducing mod_deflate</h4>
<p>Apache prepares the response that will be sent back to the client in several stages. One of those stages involves the modification or conversion of the data using <strong>output filters</strong>. <em>mod_deflate</em>, once loaded and activated, inserts such a filter, named <strong>DEFLATE</strong>, in Apache&#8217;s chain of <em>output filters</em>, which compresses all data that goes through it according to some rules the web server administator has defined. For instance, one can set the compression level, restrict the compression to particular MIME types or prevent some problematic web browsers or other HTTP clients from receiving compressed data from the server.</p>
<p><em>mod_deflate</em> also offers an input filter which can be used to decompress compressed HTTP requests, but this feature is outside of the scope of the current document.</p>
<p>Here follow some instructions on how to configure <em>mod_deflate</em>. Most of it can be found inside HTTPd&#8217;s official documentation, so you&#8217;d better read this resource as well.</p>
<p>Note that all of the following configuration directives can be inserted in Apache&#8217;s <em>main server context</em> or can be saved to a file that will be loaded from within the main server or any other <em>virtual host context</em>. If the configuration directives are inserted in the main server context, then <strong>they will be inherited by all virtual hosts</strong>.</p>
<h4>Load mod_deflate</h4>
<p><em>mod_deflate</em> can be loaded like any other Apache module:</p>
<pre class="codesnp">
LoadModule deflate_module modules/mod_deflate.so
</pre>
<p>Please note that <strong>this directive can only exist in the main server configuration</strong>.</p>
<h4>Enable Compression</h4>
<p>The compression of the data can be enabled <strong>for all data</strong> that goes through the <em>DEFLATE</em> filter or <em>selectively</em> depending on its <strong>MIME type</strong>.</p>
<p>To enable the compression <strong>for any type of content</strong>, insert the following directive:</p>
<pre class="codesnp">
 SetOutputFilter DEFLATE
</pre>
<p>Alternatively, to define which filetypes should pass through the <em>DEFLATE</em> output filter use the  <strong>AddOutputFilterByType</strong> directive. The following is an example:</p>
<pre class="codesnp">
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</pre>
<h4>Set the Compression Level</h4>
<p>Generally, the <a href="http://en.wikipedia.org/wiki/DEFLATE_(algorithm)">deflate compression algorithm</a> is fast enough, so setting the compression level to the maximum (9) will not cause any noticeable trouble, even to relatively old hardware.</p>
<pre class="codesnp">
DeflateCompressionLevel 9
</pre>
<h4>Custom Rules for problematic browsers</h4>
<p>The compression can be turned-off or be restricted to files of type <code>text/html</code> for known problematic web browsers. These are taken from the official documentation.</p>
<pre class="codesnp">
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</pre>
<h4>Keep track of the compression</h4>
<p>Finally you can keep track of the compression in order to evaluate the effectiveness of the use of <em>mod_deflate</em> in your server.</p>
<p>The following directives define some variables, such as:</p>
<ul>
<li><strong>instream</strong> : the size in bytes of the data as received by the <em>DEFLATE</em> filter.</li>
<li><strong>outstream</strong> : the size in bytes of the compressed data as returned from the <em>DEFLATE</em> filter.</li>
<li><strong>ratio</strong> : the compression ratio, <code>(Output/Input)x100</code></li>
</ul>
<pre class="codesnp">
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
</pre>
<p>Finally, you can define a custom <em>logformat</em> so to be able to record the aforementioned values to a logfile:</p>
<pre class="codesnp">
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
</pre>
<p>The deflate logformat can be used for the main server&#8217;s or for any vhost;s logfile.</p>
<h4>Effectiveness of Compression</h4>
<p>It is well known that not all document types can benefit the same from compression. Generally, the <em>deflate algorithm</em> can compress <strong>text</strong> surprisingly fast and with a very high efficiency ratio. On the other hand, it is almost useless when used to compress <strong>images</strong> which have been prepared for the web such as PNG, JPEG, GIF and generally all other image types in which the data has already been compressed. The same goes for compressed <strong>audio</strong> files, such as MP3, AAC, OGG, <strong>videos</strong>, <strong>PDF</strong> documents and all other already compressed files.</p>
<p>So, the benefits of using <em>mod_deflate</em> to reduce the bandwidth usage and speed up the content delivery are heavily dependent on the type of files your web server delivers.</p>
<h4>Browser Support</h4>
<p>A web server that sends compressed data to clients would be completely useless if the HTTP clients couldn&#8217;t decompress that data. All modern and popular web browsers support accepting content that has been compressed using the <em>gzip</em> or <em>deflate</em> algorithms, so there should be no problem at all.</p>
<h4>Appendix I</h4>
<p>Here is the complete <em>mod_deflate</em> configuration as described in this <span style="color:black;text-decoration:none;"><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/">article</a></span>. Save it in a file, named <strong>deflate.conf</strong> and import it in the main server&#8217;s configuration using the <strong>Include</strong> directive</p>
<p>(<code>Include /path/to/deflate.conf</code>):</p>
<pre class="codesnp">
#
# mod_deflate configuration
#
LoadModule deflate_module modules/mod_deflate.so
&lt;IfModule mod_deflate.c&gt;
        AddOutputFilterByType DEFLATE text/plain
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE text/xml
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE application/xml
        AddOutputFilterByType DEFLATE application/xhtml+xml
        AddOutputFilterByType DEFLATE application/rss+xml
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE application/x-javascript
        DeflateCompressionLevel 9
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        DeflateFilterNote Input instream
        DeflateFilterNote Output outstream
        DeflateFilterNote Ratio ratio
        LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
&lt;/IfModule&gt;
</pre>
<p>This configuration will be <strong>inherited by all virtual hosts</strong>.</p>
<p>To <strong>disable</strong> it just comment out the line that loads the mod_deflate module (<code>#LoadModule ...</code>).</p>
<p>To record <em>mod_deflate</em>&#8216;s specific variable (<em>instream</em>, <em>outstream</em>, <em>ratio</em>) values for a virtual host, just add a new log file of type <em>deflate</em>:</p>
<pre class="codesnp">
CustomLog /path/to/vhost/logs/deflate_log deflate
</pre>
<p>This will give you an idea of how efficient is the use of mod_deflate in that particular vhost.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/">Use mod_deflate to Compress Web Content delivered by Apache</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/" rel="bookmark">Optimize and Compress CSS Files</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/" rel="bookmark">Check Server HTTP Headers with CURL</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>mod_gnutls binary for Apache</title>
		<link>http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/</link>
		<comments>http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 12:00:31 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Software]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/</guid>
		<description><![CDATA[mod_gnutls is an experimental Apache module. As long as I had compiled it for the sake of the secure name-based vhosts with SNI test and since I was asked to release the compiled library in this forum post, here it goes. The following is an archived mod_gnutls installation. One word of warning: It also contains [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a> is an experimental Apache module. As long as I had compiled it for the sake of the <a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/">secure name-based vhosts with SNI test</a> and since I was asked to release the compiled library in this forum post, here it goes. The following is an <a href="http://www.g-loaded.eu/packages/mod_gnutls/mod_gnutls_bin.tar.gz">archived mod_gnutls installation</a>. <em>One word of warning</em>: It also contains a file named <strong>rsafile</strong>, which is obviously an <strong>private RSA key</strong> generated at the module compilation time. Since this private key has been publicly exposed, <strong>you should not use it in a production server</strong>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/">mod_gnutls binary for Apache</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/24/creative-commons-v30-licenses-launched/" rel="bookmark">Creative Commons v3.0 Licenses Launched</a></li>
<li><a href="http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/" rel="bookmark">How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</a></li>
<li><a href="http://www.g-loaded.eu/2011/03/01/forking-apache-licensed-software-on-github-and-bitbucket/" rel="bookmark">Forking Apache-licensed software on Github and Bitbucket</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</title>
		<link>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</link>
		<comments>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 05:35:49 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Compiling]]></category>
		<category><![CDATA[Encryption]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/</guid>
		<description><![CDATA[This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the SNI-capable mod_gnutls module for Apache&#8217;s httpd web server. Server Name Indication (SNI), as described in section 3.1 of the RFC3546, is a TLS extension which makes the configuration of [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes how to implement SSL-enabled name-based vhosts &#8211; that is secure virtual hosts which share the same IP address and port &#8211; with the <strong>SNI</strong>-capable <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a> module for Apache&#8217;s httpd web server.<br />
<span id="more-438"></span><br />
<em>Server Name Indication</em> (<strong>SNI</strong>), as described in section 3.1 of the <a href="http://www.ietf.org/rfc/rfc3546.txt">RFC3546</a>, is a TLS extension which makes the configuration of SSL-enabled name-based virtual hosts possible. This extention eliminates the need for the assignment of one IP address per secure virtual host, therefore the cost for secure web hosting is greatly reduced, as all secure virtual hosts can share the same IP address and port combination. SNI is a huge step forward as it promotes security by making secure web services easier and cheaper to implement. The current version of <a href="http://www.openssl.org/">OpenSSL</a> &#8211; 0.98 at the time of writing &#8211; does not support SNI yet, but this is planned for the upcoming 0.99 release. On the other hand, <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/">mod_gnutls</a>, an experimental module for Apache&#8217;s <a href="http://httpd.apache.org/">httpd</a> which has been around for 2+ years, includes support for <strong>SNI</strong>.</p>
<h4>Introduction</h4>
<p>Searching the web for mod_gnutls binary distribution packages or information on how to set it up returned very few relevant results. This was a surprise, as, at this moment, the only implementation that supports SNI is mod_gnutls. So, I decided to write a tutorial on how to set things up for a test. I hope you find it useful.</p>
<p>The test that is described in this guide includes:</p>
<ol>
<li>The compilation of the mod_gnutls module.</li>
<li>The generation of SSL certificates.</li>
<li>The configuration of the SSL-enabled name-based virtual hosts.</li>
</ol>
<p>This test was performed on a server that runs <a href="http://fedoraproject.org/">Fedora</a> 7.</p>
<h4>Installation</h4>
<p>In order to compile mod_gnutls, you will need the development tools for Fedora:</p>
<pre class="console"># yum groupinstall "Development Tools"</pre>
<p>Install the mod_gnutls dependencies:</p>
<pre class="console"># yum install httpd-devel gnutls-devel</pre>
<p>As an unprivileged user, download the mod_gnutls distribution and compile it.</p>
<pre class="console">
$ wget http://www.outoforder.cc/downloads/mod_gnutls/mod_gnutls-0.2.0.tar.bz2
$ tar -xjvf mod_gnutls-0.2.0.tar.bz2
$ cd mod_gnutls-0.2.0
$ ./configure --prefix=/usr
$ make
</pre>
<p>Do not use the &#8216;<code>make install</code>&#8216; script, but perform the installation manually &#8211; it is only one library.</p>
<p>As root, copy <strong>libmod_gnutls.so</strong> to the directory that holds the Apache modules (usually <code>/usr/lib/httpd/modules</code>) and rename it to <strong>mod_gnutls.so</strong> for consistency:</p>
<pre class="console"># cp mod_gnutls-0.2.0/src/.libs/libmod_gnutls.so /usr/lib/httpd/modules/mod_gnutls.so</pre>
<p>During the compilation, two keys, <code>dhfile</code> and <code>rsafile</code>, have been generated in the <code>mod_gnutls-0.2.0/data/</code> directory. It is absolutely important to copy these files in httpd&#8217;s configuration directory (usually <code>/etc/httpd/conf/</code>), otherwise mod_gnutls will never work. This is undocumented, and I found out about it after some trial&#038;error.</p>
<p>As root:</p>
<pre class="console"># cp mod_gnutls-0.2.0/data/{dh,rsa}file /etc/httpd/conf/</pre>
<p>Installation is complete.</p>
<h4>SSL certificates</h4>
<p>In this test installation, two virtual hosts will be used. Thus, two SSL certificates will be required. Please read my article on how to <a href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">generate SSL certificates</a> for your servers, as this information is beyond the scope of this document. Alternatively, you may use a ready-made <strong>script</strong> which will create those certificates for you quickly. Such scripts are shipped will almost all Linux distributions. Please consult your distribution&#8217;s documentation for more information.</p>
<h4>HTTPd Configuration</h4>
<p>The configuration of the Apache web server includes two phases:</p>
<ol>
<li>The configuration of the main server.</li>
<li>The configuration of the virtual hosts.</li>
</ol>
<p>In the following instructions, some brief notes about what each directive does is included. For more detailed information, please consult the <a href="http://www.outoforder.cc/projects/apache/mod_gnutls/docs/">mod_gnutls documentation</a>.</p>
<h5>Main Server Configuration</h5>
<p>This includes setting some general mod_gnutls options, which will be inherited by all virtual hosts.</p>
<p>But, first of all, httpd needs to be set to listen on port 443 (in addition to port 80). Instead of specifying the SSL port only (<code>Listen 443</code>) which will lead httpd to listen to all the available network interfaces, you may specify the exact network interface on which the server will listen. For example:</p>
<pre class="codesnp">Listen 192.168.0.1:443</pre>
<p>Next, load mod_gnutls:</p>
<pre class="codesnp">LoadModule gnutls_module modules/mod_gnutls.so</pre>
<p>Add some MIME-types for downloading Certificates and CRLs from your web sites (taken from the <code>mod_ssl</code> configuration):</p>
<pre class="codesnp">
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
</pre>
<p>It is suggested that you use a session cache for mod_gnutls. This will increase its performance. In this example, the <strong>dbm</strong> cache type is used. This cache type requires a directory where mod_gnutls will actually save SSL session data. So, creating a directory for this purpose and giving ownership to the user that runs Apache (usually <code>apache</code> or <code>www-data</code>) is needed. Assuming that the Apache user is <code>apache</code>, as root issue the commands:</p>
<pre class="console">
# mkdir -m 0700 /var/cache/mod_gnutls_cache
# chown apache:apache /var/cache/mod_gnutls_cache
</pre>
<p>Now, back to the Apache configuration. The following directive sets the <strong>dbm</strong> SSL Session Cache for mod_gnutls:</p>
<pre class="codesnp">
GnuTLSCache dbm "/var/cache/mod_gnutls_cache"
</pre>
<p>Set a timeout for the SSL Session Cache entries. Usually, this is set to 300 seconds:</p>
<pre class="codesnp">
GnuTLSCacheTimeout 300
</pre>
<p>Finally, specify that on the <code>192.168.0.1:443</code> interface and port there will be name-based virtual hosts; that is vhosts that <em>share</em> the specified interface and port:</p>
<pre class="codesnp">
NameVirtualHost 192.168.0.1:443
</pre>
<h5>Virtual Host Configuration</h5>
<p>The example virtual hosts are: <code>v1.example.org</code> and <code>v2.example.org</code>. It is assumed that two SSL certificates with the canonical name (CN) correctly set to each of the aforementioned vhost domains have been generated.</p>
<p>In the following vhost configs, only the absolutely required directives have been used. The rest of the options are inherited from the main server.</p>
<pre class="codesnp">
&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v1.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v1.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v1.example.org.key
    DocumentRoot "/var/www/v1/public_html"
&lt;/VirtualHost&gt;
&lt;VirtualHost 192.168.0.1:443&gt;
    ServerName v2.example.org:443
    GnuTLSEnable on
    GnuTLSCertificateFile /etc/pki_custom/certs/v2.example.org.crt
    GnuTLSKeyFile /etc/pki_custom/private/v2.example.org.key
    DocumentRoot "/var/www/v2/public_html"
&lt;/VirtualHost&gt;
</pre>
<h4>Testing the setup</h4>
<p>Having finished with the configuration, <strong>review</strong> the changes, <strong>restart</strong> the server and <strong>check</strong> the error logs for any errors.</p>
<p>Use a <em>web browser</em> to visit each of the virtual hosts by using the HTTPS protocol:</p>
<pre class="codesnp">
https://v1.example.org/
https://v2.example.org/
</pre>
<p>Until now, the web server did not support the SNI TLS extension. Therefore, when visiting the <code>v2.example.org</code> virtual host, you would see <strong>two</strong> warnings in your browser. The first one would be because the vhost&#8217;s certificate has not been issued by a trusted Certificate Authority &#8211; this is normal as it was you who issued that certificate &#8211; and the other one because on a server without SNI support it is actually the V1 vhost&#8217;s certificate that is used when visiting V2 vhost over https. Remember the <a href="http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html#vhosts2">limitation</a> with SSL and name-based virtual hosts?</p>
<p>With mod_gnutls, the server supports the SNI TLS extension. Although the virtual hosts are name-based, no matter which one you visit, the relevant certificate for each vhost is used and the only warning you see is the one about the certificates being self-signed. You can get rid of these by purchasing a certificate that is issued by a trusted Certificate Authority.</p>
<h4>Conclusion</h4>
<p><strong>mod_gnutls</strong> works. Actually, it was a real pleasure to see SNI work!</p>
<p>It is important to note though that mod_gnutls is still in <em>experimental</em> phase. Therefore, performance issues should be considered as normal when using it.</p>
<p>At the moment of writing, my server uses Fedora 7 as an operating system. As I haven&#8217;t upgraded my desktop to F7 yet and my server does not have any development tools installed, I compiled mod_gnutls on a Fedora 6 system and used it on Fedora 7. I do not know if that was the reason &#8211; and I did not have the necessary free time to investigate &#8211; or anything else, but, during the use of mod_gnutls, my server&#8217;s load average increased significantly.</p>
<p><a href="http://www.flickr.com/photos/maxshots/1067120133/" title="Load Average increase during mod_gnutls testing on a production web server"><img src="http://farm2.static.flickr.com/1198/1067120133_38398a4fe8_o.png" width="597" height="255" alt="Load average increase during mod_gnutls testing" /></a></p>
<p>I will test mod_gnutls again soon and post the new results, if they are different than the ones I present in this article. I highly recommend that you try it, as it is currently the only way to easily achieve SSL-enabled name-based virtual hosts using the SNI TLS extension. Note, that this extension will be supported by openssl 0.99, so the moment that SNI goes mainstream and such a setup becomes easy and cheap to implement with any Linux distribution is close.</p>
<p>One last thing that has not been mentioned at all is about SNI support in <strong>web browsers</strong>. Currently, with the exception of Safari (this is unconfirmed, please correct me if I am wrong), the latest versions of all major web browsers, Firefox and other Mozilla-based browsers, Internet Explorer, Opera, support SNI.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/14/mod_gnutls-binary-for-apache/" rel="bookmark">mod_gnutls binary for Apache</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/" rel="bookmark">How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>.htaccess Cheat Sheet</title>
		<link>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/</link>
		<comments>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 17:35:30 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/</guid>
		<description><![CDATA[Apache is a very flexible web server implementation. The .htaccess files give the webmasters the ability to override the default server configuration on a per-directory basis, provided that httpd's configuration pernits the overrides of the htaccess file. I am aware that there are thousands of cheat sheets (aka ready-made recipes) out there, mostly implementing mod_rewrite conditional redirections, but I decided to bookmark this article because it is very well and carefully written.]]></description>
			<content:encoded><![CDATA[<p><a href="http://httpd.apache.org/">Apache</a> is a very flexible web server implementation. The <strong>.htaccess</strong> files give the webmasters the ability to override the default server configuration on a <em>per-directory</em> basis, provided that <strong>httpd</strong>&#8216;s configuration pernits the overrides of the htaccess file. I am aware that there are thousands of cheat sheets (aka ready-made recipes) out there, mostly implementing <em>mod_rewrite</em> conditional redirections, but I decided to bookmark <a href="http://evolt.org/ultimate_htaccess_examples">this article</a> because it is very well and carefully written.</p>
<p>[<em>Update</em>]: Also, another resource of htaccess recipes exists <a href="http://www.htaccesselite.com/htaccess/">here</a>. I didn&#8217;t have the time though to go through all of their sections, but all .htacces rule examples seem very organized and well written too.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/">.htaccess Cheat Sheet</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2006/08/24/modsecurity-overview/" rel="bookmark">ModSecurity Overview</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/07/awesome-awk-tutorial/" rel="bookmark">Awesome AWK Tutorial</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/16/namespace-declarations-with-celementtree/" rel="bookmark">Namespace Declarations With cElementTree</a></li>
<li><a href="http://www.g-loaded.eu/2006/12/08/more-data-recovery-tools/" rel="bookmark">More Data Recovery Tools</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

