<?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>Omnia sunt communia &#187; webdav</title>
	<atom:link href="http://www.blog.amrlima.info/archives/tag/webdav/feed" rel="self" type="application/rss+xml" />
	<link>http://www.blog.amrlima.info</link>
	<description>gnu/linux, cultura livre e outras divagações</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:18:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to configure a webdav server secured with openssl</title>
		<link>http://www.blog.amrlima.info/archives/795</link>
		<comments>http://www.blog.amrlima.info/archives/795#comments</comments>
		<pubDate>Thu, 23 Jul 2009 16:15:43 +0000</pubDate>
		<dc:creator>amrlima</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Software Livre]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[webdav]]></category>

		<guid isPermaLink="false">http://www.blog.amrlima.info/?p=795</guid>
		<description><![CDATA[I needed a fast way to have people sharing documents and other data remotely. I wanted to avoid the cloud, I really rather having things locally at work.
This was made in a Debian 5 (lenny) sever and pretty much works the same way for a recent Ubuntu server. I&#8217;ve done most of this in a [...]]]></description>
			<content:encoded><![CDATA[<p>I needed a fast way to have people sharing documents and other data remotely. I wanted to avoid the cloud, I really rather having things locally at work.</p>
<p>This was made in a Debian 5 (lenny) sever and pretty much works the same way for a recent Ubuntu server. I&#8217;ve done most of this in a 9.04 Ubuntu box.</p>
<p>First I configured apache with the webdav module:</p>
<blockquote><p>#aptitude install apache2</p></blockquote>
<p>Activate de webdav module:</p>
<blockquote><p># a2enmod dav_fs</p></blockquote>
<p>The webdav acess should be limited to authorized users. So we create a protected /webdav location by editing  /etc/apache2/sites-available/webdav:</p>
<blockquote><p># vim /etc/apache2/sites-available/webdav</p></blockquote>
<blockquote><p>Alias /webdav   /var/www/webdav</p>
<p>DAV On<br />
AuthType Digest<br />
AuthName &#8220;webdav&#8221;<br />
AuthUserFile /etc/apache2/webdav.passwd<br />
Require valid-user</p></blockquote>
<p>we also need, for more secure authentication, to activate the auth_digest module:</p>
<blockquote><p># a2enmod auth_digest</p></blockquote>
<p>The we need to create our users and passwords:</p>
<blockquote><p># htdigest -c /etc/apache2/webdav.passwd webdav username</p></blockquote>
<p>When adding a new user don&#8217;t use the -c flag because it will override the previous settings.</p>
<p>Then we need to add our directory and make it writable by the www-data group:</p>
<blockquote><p># mkdir /var/www/webdav<br />
# chgrp www-data /var/www/webdav<br />
# chmod g+w /var/www/webdav</p></blockquote>
<p>Lest&#8217;s activate our site:</p>
<blockquote><p>#a2ensite webdav</p></blockquote>
<p>And reload apache:</p>
<blockquote><p># /etc/init.d/apache2 reload</p></blockquote>
<p>Test it with a webdav client like cadaver</p>
<blockquote><p>$ cadaver  http://yourdomain/webdav</p></blockquote>
<p>Now to secure the connection with openssl:</p>
<blockquote><p># aptitude install openssl</p></blockquote>
<blockquote><p># a2enmod ssl</p></blockquote>
<p>We need to generate a personal certificate for our server:</p>
<blockquote><p># openssl genrsa -des3 -out server.key 1024</p></blockquote>
<blockquote><p># openssl req -new -key server.key -out server.csr</p></blockquote>
<blockquote><p># openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt</p></blockquote>
<p>Now we have 3 files: server.key, server.csr and server.crt. Let&#8217;s copy erver.key and server.crt to the certs and private directories:</p>
<blockquote><p># cp server.crt /etc/ssl/certs</p>
<p># cp server.key /etc/ssl/private</p></blockquote>
<p>Now we need to edit  /etc/apache2/ports.conf:</p>
<blockquote><p># vim /etc/apache2/ports.conf</p></blockquote>
<p>You have change the port from 80 to 443. It should look like this:</p>
<blockquote><p>NameVirtualHost *:443</p>
<p>#Listen 80</p>
<p># SSL name based virtual hosts are not yet supported, therefore no</p>
<p># NameVirtualHost statement here</p>
<p>Listen 443</p></blockquote>
<p>Now edit /etc/apache2/sites-enabled/000-default and change the port 80 to 443 in the firts line:<br />
Note that http requests will be bloqued, and only https requests will be accepted.</p>
<p>Now lets edit /etc/apache2/sites-available/default to tell apache where to find the certificate:</p>
<blockquote><p>#vim /etc/apache2/sites-available/default</p></blockquote>
<blockquote><p>DocumentRoot /var/www/</p>
<p>SSLEngine on</p>
<p>SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire</p>
<p>SSLCertificateFile /etc/ssl/certs/server.crt</p>
<p>SSLCertificateKeyFile /etc/ssl/private/server.key</p></blockquote>
<blockquote><p>(&#8230;)</p></blockquote>
<p>Time to reload apache and try it out!</p>
<blockquote><p># /etc/init.d/apache2 force-reload</p></blockquote>
<p>This how to was made with the help of two other how two&#8217;s I found. <a href="http://andres.jaimes.net/setting-up-a-webdav-server/" target="_blank">One of tem is this one</a>, for openssl and the other one I really can&#8217;t find it now <img src='http://www.blog.amrlima.info/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . It was a Debian how to written in Portuguese, so thank you to the author! If I find it I&#8217;ll link it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.amrlima.info/archives/795/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

