<?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>Joe's Linux Blog &#187; Subversion</title>
	<atom:link href="http://joseph.freivald.com/linux/tag/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://joseph.freivald.com/linux</link>
	<description>Linux Admin tips and tricks</description>
	<lastBuildDate>Mon, 26 Jul 2010 16:37:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Subversion, SSL and Apache for Secure, Passwordless, User-based repository access controls</title>
		<link>http://joseph.freivald.com/linux/2009/05/14/subversion-ssl-and-apache-for-secure-passwordless-user-based-repository-access-controls/</link>
		<comments>http://joseph.freivald.com/linux/2009/05/14/subversion-ssl-and-apache-for-secure-passwordless-user-based-repository-access-controls/#comments</comments>
		<pubDate>Thu, 14 May 2009 16:54:57 +0000</pubDate>
		<dc:creator>jfreivald</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://joseph.freivald.com/linux/?p=3</guid>
		<description><![CDATA[I get tired of passwords.  Password here, password there, everywhere a password. I am a systems designer who does a lot of admin out of necessity.  When I get tired enough of a task, I eliminate it. I use subversion on several projects to track documentation, source, configurations and more.  All of my servers are [...]]]></description>
			<content:encoded><![CDATA[<p>I get tired of passwords.  Password here, password there, everywhere a password.</p>
<p>I am a systems designer who does a lot of admin out of necessity.  When I get tired enough of a task, I eliminate it.</p>
<p>I use subversion on several projects to track documentation, source, configurations and more.  All of my servers are SSL only, and use user certificates for identity verification.  Here&#8217;s what I did to make passwordless, user-based restrictions on Subversion:</p>
<p>First, make sure that SSL is working on your apache server (if you get a server error when you do an https request, but http://yourserver.com:443 works then SSL is not set up right).</p>
<p>Put the following in /etc/httpd/conf.d/subversion.conf:</p>
<pre>&lt;Location /<em>yourSubversionWebLocation</em>&gt;
   DAV svn
   SVNParentPath <em>pathToYourSubversionFolder</em>

   AuthzSVNAccessFile /etc/httpd/<em>yourSubversionAccessFile</em>

   SSLRequireSSL
   SSLVerifyClient require
   SSLUserName SSL_CLIENT_S_DN_Email
   SetOutputFilter DEFLATE
&lt;/Location&gt;</pre>
<p>Some people might want to use SSL_CLIENT_S_DN_CN as the user name instead of the email, but in my case I use the CN to put the person&#8217;s real full name in the certificate, so the email worked out better.  Also, this way I can have jsmith@company1.com and jsmith@company2.com without a collision.  Use whichever works for your situation.</p>
<p>Put your repository access information into your SVN access file like this:</p>
<pre>[shared:/]
user1@yourplace.com = rw
user2@yourplace.com = rw
user3@yourplace.com = rw
readonlyuser@yourplace.com = r

[user1:/]
user1@yourplace.com = rw

[user2:/]
user2@yourplace.com = rw

[user3:/]
user3@yourplace.com = rw</pre>
<p>Generate your User SSL keys.  I do it with a script (lots of stuff on the web on how to set up your own CA, so I&#8217;m not re-hashing it here):</p>
<pre>#!/bin/bash

[ "$1" == "" ] &amp;&amp; exit -1;

openssl req -config openssl.myconf.cnf -new -sha1 -newkey rsa:1024 -nodes -keyout private/$1.key -out csr/$1.pem
openssl ca -config openssl.myconf.cnf -policy policy_anything -extensions usr_cert -out certs/$1.pem -infiles csr/$1.pem
openssl pkcs12 -export -clcerts -in certs/$1.pem -inkey private/$1.key -out userp12/$1.p12</pre>
<p>Be sure to use the same email addresses that you use in the SVN authorization file.</p>
<p>To access subversion from the command line, put the following into your .subverions/servers file.  Be certain that the file has strict permissions (chmod -R 0600 ~user1/.subversion; chmod -R 0600 ~user1/certs):</p>
<pre>[groups]
myrepositories = &lt;your server address&gt;</pre>
<pre>[myrepositories]</pre>
<pre>ssl-authority-files = /home/user1/certs/&lt;your CA file&gt;.crt</pre>
<pre>ssl-client-cert-file = /home/user1/certs/user1.p12</pre>
<pre>ssl-client-cert-password = &lt;user's certificate password&gt;</pre>
<p>To access it with a browser, import the CA and user certificates into the browser of your choice.  Users should then be able to select your web page and auto-magically get the right repositories with the right permissions.  No passwords needed.</p>
<p>If you want a pretty web interface for your repository, try out websvn.  Use the same SSL configuration information for your websvn.conf as you did for your subversion.conf, follow the install information for websvn, put your repositories into your config.php and you&#8217;re done.</p>
]]></content:encoded>
			<wfw:commentRss>http://joseph.freivald.com/linux/2009/05/14/subversion-ssl-and-apache-for-secure-passwordless-user-based-repository-access-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
