<?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>Extensible Development &#187; mod_ssl</title>
	<atom:link href="http://blog.itwarlocks.com/tag/mod_ssl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.itwarlocks.com</link>
	<description>Profession blog about Software Engineering, Web, *nix, Processes, Tools and more.</description>
	<lastBuildDate>Mon, 29 Mar 2010 12:20:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update: HTTPS Virtual Hosts on Ubuntu 8.04 LTS Server</title>
		<link>http://blog.itwarlocks.com/2009/07/16/update-https-virtual-hosts-on-ubuntu-8-04-lts-server/</link>
		<comments>http://blog.itwarlocks.com/2009/07/16/update-https-virtual-hosts-on-ubuntu-8-04-lts-server/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 13:59:28 +0000</pubDate>
		<dc:creator><span property="dc:creator" resource="http://blog.itwarlocks.com/2009/07/16/update-https-virtual-hosts-on-ubuntu-8-04-lts-server/">Jeffrey Ridout</span></dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[gnutls]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[mod_gnutls]]></category>
		<category><![CDATA[mod_ssl]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual Hosting]]></category>

		<guid isPermaLink="false">http://blog.itwarlocks.com/?p=219</guid>
		<description><![CDATA[Original article: 
The gnutls and gcrypt packages were updated for Ubuntu 8.04, but they are still not right for mod_gnutls.

libgnutls-dev (2.0.4-1ubuntu2.5)
libgnutls13 (2.0.4-1ubuntu2.5)
gnutls-bin (2.0.4-1ubuntu2.5)
libgcrypt11-dev (1.2.4-2ubuntu7)
libgcrypt11 (1.2.4-2ubuntu7)

]]></description>
			<content:encoded><![CDATA[<div class="messagebox"><strong>Original article:</strong> <a href="http://blog.itwarlocks.com/2009/06/18/https-virtual-hosts-on-ubuntu-8-04-lts-server/" target="_self">HTTPS Virtual Hosts on Ubuntu 8.04 LTS Server</a></div>
<p>The gnutls and gcrypt packages were updated for Ubuntu 8.04, but they are still not right for mod_gnutls.</p>
<ul>
<li>libgnutls-dev (2.0.4-1ubuntu2.5)</li>
<li>libgnutls13 (2.0.4-1ubuntu2.5)</li>
<li>gnutls-bin (2.0.4-1ubuntu2.5)</li>
<li>libgcrypt11-dev (1.2.4-2ubuntu7)</li>
<li>libgcrypt11 (1.2.4-2ubuntu7)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.itwarlocks.com/2009/07/16/update-https-virtual-hosts-on-ubuntu-8-04-lts-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTPS Virtual Hosts on Ubuntu 8.04 LTS Server</title>
		<link>http://blog.itwarlocks.com/2009/06/18/https-virtual-hosts-on-ubuntu-8-04-lts-server/</link>
		<comments>http://blog.itwarlocks.com/2009/06/18/https-virtual-hosts-on-ubuntu-8-04-lts-server/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 14:54:10 +0000</pubDate>
		<dc:creator><span property="dc:creator" resource="http://blog.itwarlocks.com/2009/06/18/https-virtual-hosts-on-ubuntu-8-04-lts-server/">Jeffrey Ridout</span></dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[gnutls]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[mod_gnutls]]></category>
		<category><![CDATA[mod_ssl]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[TLS]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual Hosting]]></category>

		<guid isPermaLink="false">http://blog.itwarlocks.com/?p=167</guid>
		<description><![CDATA[

Updated

2009-07-16: 

Introduction
Normally having multiple virtual hosts on Apache with HTTPS is not possible. HTTPS is short for HTTP/SSL which means HTTP encapsulated by SSL (Secure Socket Layer). This means the HTTP traffic sent to the Apache webserver is encrypted using SSL.
The VirtualHost definitions in the Apache configuration are used to specify the SSL options. To [...]]]></description>
			<content:encoded><![CDATA[<div class="warning">
<div class="boxcaption">
<h3>Updated</h3>
</div>
<div class="box">2009-07-16: <a href="http://blog.itwarlocks.com/2009/07/16/update-https-virtual-hosts-on-ubuntu-8-04-lts-server/" target="_self">Update: HTTPS Virtual Hosts on Ubuntu 8.04 LTS Server</a></div>
</div>
<h3>Introduction</h3>
<p>Normally having multiple <a title="VHosts documentation on apache.org" href="http://httpd.apache.org/docs/2.2/vhosts/">virtual hosts</a> on Apache with HTTPS is not possible. HTTPS is short for HTTP/SSL which means HTTP encapsulated by SSL (Secure Socket Layer). This means the HTTP traffic sent to the Apache webserver is encrypted using SSL.</p>
<p>The VirtualHost definitions in the Apache configuration are used to specify the SSL options. To know what VirtualHost Apache should use, Apache sneak previews the HTTP header to look for the &#8220;HOST&#8221; field. With HTTPS the HTTP header can only be previewed after the SSL connection has been established, so technically Apache cannot know what VirtualHost definition to use to set up the SSL connection.</p>
<p>Apache could use the correct SSL options if it knew what VirtualHost definition it should use and luckily that is possible. SSL supports several encryption protocols, the newest being <a title="TLS on Wikipedia" href="http://en.wikipedia.org/wiki/Transport_Layer_Security" target="_blank">TLS (Transport Layer Security)</a>. Technically this is a replacement for SSL and would result in HTTP/TLS instead of HTTP/SSL. TLS has a feature called <a title="SNI on Wikipedia" href="http://en.wikipedia.org/wiki/Server_Name_Indication">SNI (Server Name Indication)</a> which is the equivalent of HTTP&#8217;s &#8220;HOST&#8221; field.</p>
<p>There are a few problems with SNI though.The standard SSL/TLS module that comes with Apache is mod_ssl, which is based on <a title="OpenSSL homepage." href="http://www.openssl.org/" target="_blank">OpenSSL</a>. Unfortunately OpenSSL does not support SNI in it&#8217;s TLS implementation yet. It has been added to <a title="Virtual Hosting, SSL and SNI" href="http://weblogs.mozillazine.org/gerv/archives/2007/08/virtual_hosting_ssl_and_sni.html" target="_blank">OpenSSL 0.99 and backported to 0.98</a>, but <a title="mod_ssl documentation on apache.org" href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html" target="_blank">mod_ssl</a> doesn&#8217;t support it. <a title="GnuTLS homepage." href="http://www.gnu.org/software/gnutls/" target="_blank">GnuTLS</a> is an alternative to OpenSSL and it does support the SNI feature in TLS. A GnuTLS based module for Apache is <a title="mod_gnutls homepage." href="http://www.outoforder.cc/projects/apache/mod_gnutls/" target="_blank">mod_gnutls</a>, but this is not available as a Ubuntu binary. Internet Explorer 7 only supports SNI on Windows Vista, thus causing the same problem as SSL on Windows XP.<br />
<span id="more-167"></span></p>
<h3>Adding mod_gnutls to Apache</h3>
<p>There is no package for mod_gnutls available for Ubuntu so it has to be built from source. mod_gnutls has a few prerequisites that make it tricky to build on Ubuntu:</p>
<ul>
<li>GnuTLS (&gt;= 2.4.0)
<ul>
<li>libgcrypt (&gt;= 1.4.0)</li>
<li>libtasn1 (included in GnuTLS source package)</li>
<li>libgpgerror (&gt;= 1.4.0)</li>
</ul>
</li>
</ul>
<p>The libgcrypt version available for Ubuntu 8.04 is 1.4.1, but unfortunately that doesn&#8217;t seem to work. that means we&#8217;ll need to build libgcrypt from source too. The standard libgcrypt11 and libgcrypt11-dev packages are hard to remove and the lib-gpgerror that comes with it is fine, so you might want to leave the old libgcrypt in place and just overwrite them. (The standard libgcrypt is installed in /lib)</p>
<div>
<div class="wp-caption">Listing 1; Get, compile and install libgcrypt</div>
<pre class="brush: shell">
~% mkdir gnutls
~% cd gnutls
~/gnutls% sudo apt-get install libgcrypt11 libgcrypt-dev
~/gnutls% sudo rm /lib/libgcrypt*
~/gnutls% wget &quot;ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.4.tar.gz&quot;
~/gnutls% tar -xvzf libgcrypt-1.4.4.tar.gz
~/gnutls% cd libgcrypt-1.4.4
~/gnutls/libgcrypt-1.4.4% ./configure --prefix=/usr
~/gnutls/libgcrypt-1.4.4% make
~/gnutls/libgcrypt-1.4.4% sudo make install
~/gnutls/libgcrypt-1.4.4% sudo ldconfig
~/gnutls/libgcrypt-1.4.4% cd ..
~/gnutls% rm -Rf libgcrypt-1.4.4
</pre>
</div>
<p>It should be no problem to build GnuTLS now.</p>
<pre class="brush: shell">
~/gnutls% wget &quot;ftp://ftp.gnupg.org/gcrypt/gnutls/gnutls-2.8.1.tar.bz2&quot;
~/gnutls% tar -xvjf gnutls-2.8.1
~/gnutls% cd gnutls-2.8.1
~/gnutls/gnutls-2.8.1% ./configure --prefix=/usr
~/gnutls/gnutls-2.8.1% make
~/gnutls/gnutls-2.8.1% sudo make install
~/gnutls/gnutls-2.8.1% sudo ldconfig
~/gnutls/gnutls-2.8.1% cd ..
~/gnutls% rm -Rf gnutls-2.8.1
</pre>
<p>With all the prerequisites in place it&#8217;s time to build mod_gnutls. The configure probably will not be able to find Apache&#8217;s apxs2, so find that first.</p>
<pre class="brush: shell">
~/gnutls% which apxs2
/usr/bin/apxs2
~/gnutls% wget &quot;http://www.outoforder.cc/downloads/mod_gnutls/mod_gnutls-0.5.5.tar.bz2&quot;
~/gnutls% tar -xvjf mod_gnutls-0.5.5.tar.bz2
~/gnutls% cd mod_gnutls-0.5.5
~/gnutls/mod_gnutls-0.5.5% ./configure --prefix=/usr --with-apxs=/usr/bin/apxs2
~/gnutls/mod_gnutls-0.5.5% make
~/gnutls/mod_gnutls-0.5.5% sudo make install
~/gnutls/mod_gnutls-0.5.5% cd ..
~/gnutls% rm -Rf mod_gnutls-0.5.5
</pre>
<p>Depending on your Apache configuration practice, the module might be loaded differently. Here&#8217;s my way.</p>
<div>
<div class="wp-caption">/usr/etc/apache2/mods-available/gnutls.load</div>
<pre class="brush: text">
LoadModule gnutls_module /usr/lib/apache2/modules/mod_gnutls.so
</pre>
</div>
<div>
<div class="wp-caption">/usr/etc/apache2/mods-available/gnutls.conf</div>
<pre class="brush: text">
GnuTLSCache dbm /var/cache/apache2/gnutls_cache
</pre>
</div>
<div>
<pre class="brush: shell">
~/gnutls% cd /etc/apache2/mods-enabled
/etc/apache2/mods-enabled% sudo ln -s ../mods-available/gnutls.load
/etc/apache2/mods-enabled% sudo ln -s ../mods-available/gnutls.conf
/etc/apache2/mods-enabled% sudo touch /var/cache/apache2/gnutls_cache
/etc/apache2/mods-enabled% sudo chown www-data:www-data /var/cache/apache2/gnutls_cache
</pre>
</div>
<p>That should be it, your mod_gnutls should be functional after restarting Apache.</p>
<p>Creating certificates for GnuTLS</p>
<p>Creating certificates is quite easy, as explained in the articles below. For GnuTLS to accept the certificates however, no MD5 may be used since it&#8217;s considered unsecure. Using SHA256 or SHA512 instead is much more secure. The examples below use OpenSSL, but</p>
<div>
<div class="wp-caption">openssl.cnf</div>
<pre class="brush: text">
...
[ CA_default ]
...
default_md				= sha256
...
</pre>
</div>
<p><a title="Setting up OpenSSL to Create Certificates" href="http://www.flatmtn.com/article/setting-openssl-create-certificates" target="_blank">Setting up OpenSSL to Create Certificates</a><br />
<a title="Setting up SSL Certificates on Apache" href="http://www.flatmtn.com/article/setting-ssl-certificates-apache" target="_blank">Setting up SSL Certificates on Apache</a><br />
<a title="Creating PKCS12 Certificates" href="http://www.flatmtn.com/article/creating-pkcs12-certificates" target="_blank">Creating PKCS12 Certificates</a></p>
<h3>Creating name based Virtual Hosts with HTTPS</h3>
<p>With mod_gnutls in place and the certificates ready name based Virtual Hosts can be added to Apache.</p>
<div>
<div class="wp-caption">/etc/apache2/sites-available/https-vhost1.conf</div>
<pre class="brush: text">
&lt;VirtualHost *:443&gt;
    ServerAdmin admin@example.org
    ServerName vhost1.example.org:443
    DocumentRoot /var/vhosts/vhost1.example.org/public_html

    # Configure TLS
    GnuTLSEnable On
    GnuTLSPriorities NORMAL
    GnuTLSCertificateFile /var/vhosts/vhost1.example.org/ssl.crt/vhost1.example.org-cert.pem
    GnuTLSKeyFile /var/vhosts/vhost1.example.org/ssl.key/vhost1.example.org-key.pem
&lt;/VirtualHost&gt;
</pre>
</div>
<div>
<div class="wp-caption">/etc/apache2/sites-available/https-vhost2.conf</div>
<pre class="brush: text">
&lt;VirtualHost *:443&gt;
    ServerAdmin admin@example.org
    ServerName vhost2.example.org:443
    DocumentRoot /var/vhosts/vhost2.example.org/public_html

    # Configure TLS
    GnuTLSEnable On
    GnuTLSPriorities NORMAL
    GnuTLSCertificateFile /var/vhosts/vhost2.example.org/ssl.crt/vhost2.example.org-cert.pem
    GnuTLSKeyFile /var/vhosts/vhost2.example.org/ssl.key/vhost2.example.org-key.pem
&lt;/VirtualHost&gt;
</pre>
</div>
<p>Access vhost1.example.ogr and vhost2.example.org and examine the certificates, unless you used the same certificate files, they should be different.</p>
<h3>Conclusion</h3>
<p>Until OpenSSL and mod_ssl start supporting TLS&#8217; SNI and everyone stops using IE7 (please do!), or until mod_gnutls becomes available for Ubuntu through apt, this procedure should keep your Virtual Hosts secure.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.itwarlocks.com/2009/06/18/https-virtual-hosts-on-ubuntu-8-04-lts-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)

Served from: blog.itwarlocks.com @ 2010-09-05 05:25:24 -->