<?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>Conecuh Software &#187; Subversion</title>
	<atom:link href="http://conecuh.com/category/development-tools/subversion/feed/" rel="self" type="application/rss+xml" />
	<link>http://conecuh.com</link>
	<description>Musings on Software and Development by David H. Wilkins</description>
	<lastBuildDate>Tue, 31 Aug 2010 22:50:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Subversion Configuration on a Virtual Host</title>
		<link>http://conecuh.com/2007/02/subversion-configuration-on-a-virtual-host/</link>
		<comments>http://conecuh.com/2007/02/subversion-configuration-on-a-virtual-host/#comments</comments>
		<pubDate>Sun, 11 Feb 2007 23:30:36 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://conecuh.com/blog/?p=3</guid>
		<description><![CDATA[Subversion rocks! I&#8217;ve been a fan of Subversion for the past 4 years or so. Recently, I needed to give Subversion access to a small team, and my constraints were: Available to the users over the Internet *Not* hosted over my DSL/Cable Using Apache 1.3 Secure SSL not available Given these constraints, I couldn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>Subversion rocks!  I&#8217;ve been a fan of Subversion for the past 4 years or so.  Recently, I needed to give Subversion access to a small team, and my constraints were:</p>
<ul>
<li>Available to the users over the Internet</li>
<li>*Not* hosted over my DSL/Cable</li>
<li>Using Apache 1.3</li>
<li>Secure</li>
<li>SSL not available</li>
</ul>
<p>Given these constraints, I couldn&#8217;t have a traditional Apache 2.0+https installation of Subversion, rather I needed <code>svnserve</code>.  Since I didn&#8217;t want to host it at home (my home machines frequently donate vital organs to science), I decided to host it on a virtual server.  I&#8217;d previously discounted <code>svnserve</code> as a minor footnote, not something that was useful or interesting.   Without Apache 2.0 and a dedicated server this imposed a couple more constraints:</p>
<ul>
<li>Only one user account</li>
<li>No access to arbitrary ports for <code>svnserve</code> to listen on</li>
</ul>
<p>From the <a href="http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.overview.svnserve">Subversion Book</a>, <code>svnserve</code> is:</p>
<blockquote><p>
A lightweight serve(sic) process which can run either as a persistent daemon, or as something automatically launched by inetd when necessary. Clients authenticate via CRAM-MD5 algorithm and speak a custom network protocol.
</p></blockquote>
<p>That&#8217;s all fine, but a little further down in the Subversion Book, we find <a href="http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.overview.svn-ssh"><code>svnserve</code> over SSH</a>, which fits the bill nicely.  </p>
<p>The basic premise of <code>svnserve</code> over SSH, is that the client connects via SSH to a host, which spawns an <code>svnserve</code> process to serve the repository data.  The Subversion designers built in a bit of *nix synergy here, so that svnserve could handle the repository, and ignore the authentication and encryption, via the <code>-t</code> option (tunnel mode).  Tunnel mode assumes that the <code>svnserve</code> process communicates over STDIN/STDOUT with the client.</p>
<h3>General Requirements</h3>
<dl>
<dt>Subversion command line client</dt>
<dd>Although this will work with <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a>, I use the command line client.</dd>
<dt>*nix server</dt>
<dd>My virtual host is Linux, but this should work on just about any *nix host.  On Windows, your mileage may vary</dd>
<dt>SSH Access to your virtual host</dt>
<dd>If your virtual host doesn&#8217;t allow SSH, then this will not work</dd>
</dl>
<h3>Server SSH Configuration</h3>
<p>First of all, your server needs to have Subversion installed.  Whether it&#8217;s installed by your hosting service, or you install it right to your user account, it really doesn&#8217;t matter.  Installation to a user account is a little tricky, since you may need to compile Subversion (lots of binaries exist, though).</p>
<p>All that&#8217;s really required is editing your <code>.ssh/authorized_keys2</code> (on Linux)  Here&#8217;s the line I added to mine:<br />
(Line breaks added for readability) From &#8220;<a href="http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.svnserve.sshtricks.fixedcmd">Controlling the invoked command</a>&#8221; in the Subversion Book</p>
<blockquote><p>
<code><br />
command="svnserve -r /home/jkeyfrom/repo -t --tunnel-user=dwilkins",<br />
no-port-forwarding,<br />
no-agent-forwarding,<br />
no-X11-forwarding,no-pty<br />
 ssh-rsa AAAAB3NzaC1yc2EA&lt;snip....snip&gt;DGLSKTFLPzUA9J8xJr1p/w== dwilkins@z60t<br />
</code>
</p></blockquote>
<p>This command instructs ssh to run the <code>svnserve</code> command when the specified key is encountered.   The Subversion Book suggests the additional ssh options to limit the rights of your Subversion users.  If you&#8217;ve got users that will be using both shell access and Subversion access, they&#8217;ll need two public/private key pairs, one for shell, and one for Subversion.</p>
<p>The options to the <code>svnserve</code> command are:</p>
<ul>
<li><code>-r &lt;repository path&gt;</code></li>
<li><code>-t</code> (instructs <code>svnserve</code> to tunnel)</li>
<li><code>--tunnel-user &lt;subversion user&gt;</code></li>
</ul>
<p>The &lt;Subversion User&gt; doesn&#8217;t have to bear any resemblance to your virtual host user.</p>
<h3>Subversion Client Configuration</h3>
<p>Your Subversion configuration is in <code>~/.subversion/config</code>.  This file is a pretty standard INI-style file, and in there, you&#8217;ll find a <code>[tunnels]</code> section.  In the <code>[tunnels]</code> section, add / edit the <code>ssh = </code> line to read something like:</p>
<blockquote><p>
ssh = $SVN_SSH ssh -l jkeyfrom -i /home/dwilkins/.ssh/identity.svn
</p></blockquote>
<p>The options to the <code>ssh</code> command are:</p>
<ul>
<li><code>-l &lt;username&gt;</code> (this is the username of your virtual host account)</li>
<li><code>-i &lt;location of your ssh private key for Subversion&gt;</code></li>
</ul>
<p>And that&#8217;s all there is to it!  You can get Subversion SSH keys from each of your team members, and put them in the <code>~/.ssh/authorized_keys2</code> file, and they&#8217;ll have secure access to your archive, with full accountability of checkins.</p>
<p>Your urls will be of the form:<br />
<code>svn+ssh://example.com/directory</code></p>
<p>Again, I&#8217;m a big fan of Subversion, and I&#8217;ll probably be blogging more about it later.  All of the information in this article came from the <a href="http://svnbook.red-bean.com/">Subversion Book</a> &#8211; a must-read for Subversion administrators.  Subversion users can generally skip it, and just follow their noses in their Subversion client.</p>
<p>dhw</p>
<p>
    <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88"/></a></p>
]]></content:encoded>
			<wfw:commentRss>http://conecuh.com/2007/02/subversion-configuration-on-a-virtual-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

