{
  "created": "2015-12-20T19:56:53Z",
  "hierarchy": [
    {
      "name": "ROOT",
      "type": "folder",
      "uri": "/ROOT"
    },
    {
      "name": "Subversion Installation and Configuration",
      "type": "article",
      "uri": "Subversion_Installation_and_Configuration"
    }
  ],
  "html": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\"/>\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n    <meta property=\"og:image\" content=\"/img/logo512.png\"/>\n    <meta property=\"og:site_name\" content=\"Nikhil's Personal Wiki\"/>\n    <link rel=\"og:image\" href=\"/img/logo512.png\"/>\n    <link rel=\"icon\" href=\"/img/favicon.png\"/>\n    <link rel=\"apple-touch-icon\" href=\"/img/logo192.png\"/>\n    <link rel=\"stylesheet\" href=\"/css/styles.css\"/>\n    <link rel=\"stylesheet\" href=\"/css/highlight.css\"/>\n    <title>Subversion Installation and Configuration &ndash; Nikhil's Personal Wiki</title>\n    <script type=\"text/javascript\" id=\"MathJax-script\" defer src=\"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js\"></script>\n    <script defer data-domain=\"wiki.nikhil.io\" src=\"https://plausible.io/js/plausible.js\"></script>\n  </head>\n  <body>\n    <noscript>\n      👉 A few things won&#8217;t work if you have JavaScript disabled.\n    </noscript>\n    <div class=\"container article\">\n      <header>\n        <nav>\n          <ul>\n            <li>\n              <a href=\"/archive\"  title=\"Archive\">\n                <span>Archive</span>\n              </a>\n            </li>\n            <li>\n              <a href=\"/Home\"  title=\"Home\">\n                <span>Home</span>\n              </a>\n            </li>\n            <li>\n              <a href=\"/random\"  title=\"See a random article\">\n                <span>Random</span>\n              </a>\n            </li>\n            \n            \n              \n                <li>\n                  <a href=\"/Subversion_Installation_and_Configuration/raw\"  title=\"View Source\">\n                    <span>Raw</span>\n                  </a>\n                </li>\n              \n              \n            \n            \n            \n            \n              \n                <li>\n                  <a href=\"/Subversion_Installation_and_Configuration/revisions\" >\n                    <span>Revisions</span>\n                  </a>\n                </li>\n              \n            \n            \n              \n                \n                  <li>\n                    <a href=\"/Subversion_Installation_and_Configuration/index.json\" title=\"View JSON Object\">\n                      <span>JSON</span>\n                    </a>\n                  </li>\n                \n              \n            \n          </ul>\n        </nav>\n      </header>\n      <main>\n        \n  <nav>\n  <ul>\n    \n      <li>\n        <a data-entity-type=\"folder\" href=\"/ROOT\" title=\"ROOT\">Root</a>\n      </li>\n    \n      <li>\n        <a data-entity-type=\"article\" href=\"/Subversion_Installation_and_Configuration\" title=\"Subversion Installation and Configuration\">Subversion Installation and Configuration</a>\n      </li>\n    \n    \n    \n    \n    \n  </ul>\n</nav>\n\n  <h1>Subversion Installation and Configuration\n    \n  </h1>\n  <p>[TOC]</p>\n<p>Host is <strong>svn.example.com</strong>. There are basically two ways of serving up<br />\na subversion repository. One uses <code>svnserve</code>, a lightweight server<br />\n(default port 3690). The other is leveraging Apache (<code>httpd</code>) via the<br />\nWebDAV protocol.</p>\n<p>The latter is more complex. But it is extremely flexible in terms of<br />\nadministration and is the basis for this setup guide. I will be setting<br />\nup a single repository at <code>https://svn.example.com/repository</code> with SSL,<br />\nLDAP-based authentication, and project-specific access control.</p>\n<h2>Installation</h2>\n<h3>Getting the RPM</h3>\n<p>I&rsquo;m putting the SVN root in /home/svn as well. This can be anywhere.</p>\n<pre><code>yum install subversion mod_dav_svn\n</code></pre>\n<p>This will install Apache and other dependencies as well.</p>\n<pre><code>service httpd start  \nchkconfig --level 345 httpd on\n</code></pre>\n<p>Make sure it&rsquo;s working, and that <code>iptables</code> is not causing any issues.<br />\nYou can use <code>nmap</code> for this purpose or just go to<br />\n<a href=\"http://svn.example.com\">http://svn.example.com</a>.</p>\n<h3>Preparing <code>subversion.conf</code></h3>\n<p>Installing the packages will create a new apache configuration directive<br />\nin <code>/etc/httpd/conf.d</code> called <code>subversion.conf</code>. You need to edit this<br />\nfile to set up the location of the repository.</p>\n<p>First uncomment these files if they&rsquo;ve not been uncommented:</p>\n<pre><code>LoadModule dav_svn_module     modules/mod_dav_svn.so  \nLoadModule authz_svn_module   modules/mod_authz_svn.so\n</code></pre>\n<p>Define the SVN root:</p>\n<pre><code>&lt;Location /repository&gt;  \n        DAV svn  \n        SVNPath /home/svn/repository  \n&lt;/Location&gt;\n</code></pre>\n<p>Now you can add simple authentication or use LDAP.</p>\n<h2>Configuration</h2>\n<h3>Simple Authentication</h3>\n<p>This uses basic <code>htpasswd</code> based authentication. Passwords may be sent<br />\nin the clear if you don&rsquo;t enable SSL. You can also use digest-based<br />\nauthentication which is slightly more secure.</p>\n<p>For this scheme, our <code>/etc/httpd/conf.d/subversion.conf</code> file will have<br />\nthe following directive:</p>\n<pre><code>&lt;Location /repository&gt;  \n        DAV svn  \n        SVNPath /home/svn/repository  \n          \n        # Simple authentication  \n        AuthType Basic  \n        AuthName &quot;SVN Server&quot;  \n        AuthUserFile /home/svn/basic-authentication  \n        Require valid-user  \n&lt;/Location&gt;\n</code></pre>\n<p>Here, we use /home/svn/authorized-users to authenticate. Create this<br />\nfile and add a user with:</p>\n<pre><code>[root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \nNew password:   \nRe-type new password:   \nAdding password for user testuser\n</code></pre>\n<h3>Setting up the repository</h3>\n<pre><code>svnadmin create /home/svn/repository\n</code></pre>\n<p>Make absolutely sure that Apache owns this directory and its<br />\ndescendants!</p>\n<pre><code>chown -R apache:apache /home/svn/repository\n</code></pre>\n<h3>Testing the Configuration</h3>\n<p>At this point, you should have a repo accessible via Apache, with<br />\npassword sent in clear text (we&rsquo;ll change that). I went to<br />\n<code>http://svn.example.com</code> and saw the image to the right after entering<br />\nmy credentials for testuser.</p>\n<p>Excellent! Test it now! I tested this config with Eclipse (with the<br />\nSubclipse plugin.)</p>\n<h3>Securing with SSL</h3>\n<p>To secure stuff with SSL, generate or use a certificate and enable<br />\nApache with <code>mod_ssl</code>. Change <code>subversion.conf</code> so that all traffic on<br />\nport 80 is redirected to port 443 (which uses the certs we&rsquo;ve created.)</p>\n<pre><code> &lt;VirtualHost *:80&gt;  \n         ServerName svn.example.com  \n         RewriteEngine On  \n         RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n &lt;/VirtualHost&gt;\n</code></pre>\n<p>Restart <code>httpd</code> and you&rsquo;re good to go!</p>\n<h3>LDAP integration</h3>\n<p>In this example, I will be using <strong>directory.example.com</strong> as the (Open<br />\nDirectory-based) LDAP provider. Change the basic authentication scheme<br />\nto match this:</p>\n<pre><code> # # If using some CA file  \n # LDAPTrustedMode NONE    \n # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n # LDAPVerifyServerCert off\n\n # Define the repository location  \n &lt;Location /repository&gt;  \n         DAV svn  \n         SVNPath /home/svn/repository  \n   \n         # Integrate with LDAP server  \n         AuthType Basic  \n         AuthBasicProvider ldap  \n         AuthName &quot;SVN Server&quot;  \n         AuthzLDAPAuthoritative off  \n         AuthLDAPURL &quot;(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)&quot;  \n         Require valid-user  \n         AuthzSVNAccessFile /home/svn/repository/conf/authz  \n &lt;/Location&gt;\n</code></pre>\n<p><strong>It is important</strong> that you set <code>AuthBasicProvider ldap</code>. If not,<br />\nApache will look for a password file and not even bother to authenticate<br />\nagainst your LDAP server. You&rsquo;ll also see something like this when<br />\nrestarting the <code>httpd</code> daemon:</p>\n<pre><code>Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n</code></pre>\n<p>I had terrible luck with setting <code>AuthzLDAPAuthoritative</code> to &ldquo;on&rdquo;. You<br />\ncan read the Apache <code>mod_authnz_ldap</code> page for more information on these<br />\ndirectives. They&rsquo;re quite flexible when configuring multiple<br />\nrepositories, with respect to user and group access.</p>\n<p>Now that you have a single repository, you can fine tune access with the<br />\n<code>AuthzSVNAccessFile</code> directive. By default, and when you use<br />\n<code>svnadmin create</code>, you get an <code>authz</code> file in your repository&rsquo;s <code>conf</code><br />\nfolder. In the Apache configuration above, it&rsquo;s the file I&rsquo;ve used to<br />\ntweak folder access.</p>\n<h2>Project Management within a Repository</h2>\n<h3>Creating a project</h3>\n<p>This is very simple. It&rsquo;s vitally important that your project folder<br />\ncontains three sub-folders: <strong>trunk</strong>, <strong>branches</strong> and <strong>tags</strong>. All<br />\nthe code you want to check into the repository must be in <strong>trunk</strong>.</p>\n<h4>Step 1: Create the required directory structure</h4>\n<pre><code>mkdir -p /tmp/newproject/{trunk,branches,tags}\n</code></pre>\n<h4>Step 2: Copy/move project files into <code>trunk</code></h4>\n<pre><code>cp -R /path/to/project/files/* /tmp/newproject/trunk/\n</code></pre>\n<h4>Step 3: Perform the first commit</h4>\n<pre><code>cd /tmp\nsvn import newproject https://svn.example.com/repository/myproject --message &quot;Initial import&quot; --username myuser\n</code></pre>\n<p>Observe that my project is called <code>newproject</code> on my local machine but<br />\nis <code>myproject</code> on the SVN server. You may or may not choose to do this,<br />\nbut the option is available.</p>\n<p>You may get a dialog about the certificate used to secure the<br />\ntransaction. Accept the key permanently. You will then be required to<br />\nsupply a password.</p>\n<h4>Step 4: Working with your project</h4>\n<p>Most typical CVS actions should apply (prefixed with an <code>svn</code> of<br />\ncourse.) For example, to check out the project created above.</p>\n<pre><code>svn checkout https://username@svn.example.com/repository/myproject\n</code></pre>\n<p>The Google teems with SVN cheatsheets.</p>\n<h3>Modifying Access Control</h3>\n<p><strong>Important</strong>: Only root can do this. Talk to your friendly sysadmin for<br />\nproject-specific access control. By default, your newly created project<br />\nwill be world accessible (i.e. to <em>all authenticated</em> users.)</p>\n<p>Here&rsquo;s an example where I created a folder for a rather sinister project<br />\ncalled <code>thiswillendpoorly</code> and have given write access only to user<br />\n<code>nanand</code> and read access to <code>machrist</code>. <em>The leading slash is<br />\nimportant!</em></p>\n<pre><code># Deny world access to repository root (noone needs to get a project listing)  \n[/]  \n* =  \n  \n# Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n[/thiswillendpoorly]  \nnanand = rw  \nmachrist = r  \n* =\n</code></pre>\n<p>If you had multiple repositories, you would need to:</p>\n<ul>\n<li>Change the Apache directive <code>SVNPath</code> to <code>SVNParentPath</code></li>\n<li>Specify the repository in the <code>authz</code> file</li>\n</ul>\n<p>Here&rsquo;s an example:</p>\n<pre><code>[repository1:/path]  \nuser1 = rw  \nuser2 = r  \n  \n[repository2:/path]  \n* = rw\n</code></pre>\n<p>If you specified a path without specifying the repository, the filter is<br />\napplied across <em>all</em> repositories! This <a href=\"http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2\">is explained<br />\nhere</a>.</p>\n<h2>Miscellaneous</h2>\n<h3>Special note about LDAP groups</h3>\n<p>You cannot do LDAP group-based authentication in SVN with the <code>authz</code><br />\nfile. However, I&rsquo;ve seen <a href=\"http://www.thoughtspark.org/node/26\">a python<br />\nscript</a> which can import LDAP<br />\ngroups.</p>\n<h3>Few pointers on multiple repository configuration</h3>\n<ul>\n<li>If you plan on hosting multiple repositories, you need to change<br />\n<code>SVNPath</code> to &ldquo;SVNParentPath&rdquo;.</li>\n<li><em>Apache will NOT allow you to access the root defined as<br />\n<code>SVNParentPath</code>!</em> You need to create repositories using<br />\n<code>svnadmin create</code> and can then access them through<br />\n<code>http://svn.example.com/{path in SVNParentPath}/{name of repository}</code>.<br />\nThere&rsquo;s <a href=\"http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic\">more information in the official handbook about<br />\nthis</a>.</li>\n</ul>\n<h3>Configuring for use with Self-Signed Certificates</h3>\n<p>Assuming that your Root CA is called <strong><code>root_ca.crt</code></strong>. Create and edit<br />\n<code>/etc/sysconfig/servers</code> to add the following:</p>\n<pre><code>[global]  \nssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n</code></pre>\n<p>The other option is to use the system-wide keystore at<br />\n<code>/etc/pki/tls/certs/ca-bundle.crt</code> by appending the ASCII version to the<br />\nend of this file.</p>\n<h2>Resources</h2>\n<ul>\n<li><a href=\"http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html\">mod_authnz_ldap directives - Apache page</a></li>\n<li><a href=\"http://wiki.centos.org/HowTos/Subversion\">Subversion on CentOS (Wiki)</a></li>\n<li><a href=\"http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717\">Single or multiple repositories?</a></li>\n<li><a href=\"http://svnbook.red-bean.com/\">Version Control with Subversion</a></li>\n<li><a href=\"http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html\">SubVersion with Apache and LDAP integration</a></li>\n<li><a href=\"http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2\">Per-directory access control in SVN</a></li>\n</ul>\n<h3>Active Directory Integration</h3>\n<ul>\n<li><a href=\"http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/\">Apache and Subversion authentication with Microsoft Active Directory</a></li>\n<li><a href=\"http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/\">mod_auth_kerb and mod_authnz_ldap bring Apache web apps into the Enterprise</a></li>\n<li><a href=\"http://michele.pupazzo.org/diary/?p=227\">Apache 2.2 – authnz_ldap – Active Directory</a></li>\n</ul>\n\n\n      </main>\n      <footer>\n        <p>\n          \n        </p>\n        <ul>\n          \n  <li>10,580 bytes</li>\n  \n    <li>Created on Sunday, 20 December 2015 at 19:56 UTC</li>\n    <li>Modified on Tuesday, 13 January 2026 at 18:47 UTC</li>\n    <br/>\n    <li>\n      <a\n        href=\"https://github.com/afreeorange/wiki.nikhil.io.articles/edit/master/Subversion Installation and Configuration.md\"\n        title=\"Edit this article\">Edit this article</a>\n    </li>\n  \n\n          <li>\n            <a href=\"https://github.com/afreeorange/bock\" title=\"View the project that generates this wiki on Github\">bock\n            5.2.0-beta</a>\n          </li>\n        </ul>\n      </footer>\n    </div>\n    \n    \n      <script type=\"text/javascript\">\n        /**\n         * Quick shortcut to take me to the search box which is 90% of how I navigate\n         * this wiki anyway.\n         */\n        document.body.addEventListener(\n          \"keypress\", (e) => e.key === \"f\"\n          ? window.location.assign(\"/archive\")\n          : null);\n        window.MathJax = {\n          tex: {\n            inlineMath: [\n              [\n                '$', '$'\n              ],\n              [\n                '\\\\(', '\\\\)'\n              ]\n            ]\n          },\n          svg: {\n            fontCache: 'global'\n          }\n        };\n      </script>\n    \n  </body>\n</html></head></html>\n",
  "id": "5decb36b-7994-5d47-9853-b3ae27946d76",
  "modified": "2026-01-13T18:47:28Z",
  "revisions": [
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2026-01-13T18:47:28Z",
      "id": "2436477560f26e23d00a24add1cbfeafdca4af78",
      "shortId": "24364775",
      "subject": "No compression\n",
      "content": "[TOC]\n\nHost is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at `https://svn.example.com/repository` with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n    yum install subversion mod_dav_svn\n\nThis will install Apache and other dependencies as well.\n\n    service httpd start  \n    chkconfig --level 345 httpd on\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n    LoadModule dav_svn_module     modules/mod_dav_svn.so  \n    LoadModule authz_svn_module   modules/mod_authz_svn.so\n\nDefine the SVN root:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n    </Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n              \n            # Simple authentication  \n            AuthType Basic  \n            AuthName \"SVN Server\"  \n            AuthUserFile /home/svn/basic-authentication  \n            Require valid-user  \n    </Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n    [root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \n    New password:   \n    Re-type new password:   \n    Adding password for user testuser\n\n### Setting up the repository\n\n    svnadmin create /home/svn/repository\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n    chown -R apache:apache /home/svn/repository\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n`http://svn.example.com` and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n     <VirtualHost *:80>  \n             ServerName svn.example.com  \n             RewriteEngine On  \n             RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n     </VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n     # # If using some CA file  \n     # LDAPTrustedMode NONE    \n     # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n     # LDAPVerifyServerCert off\n\n     # Define the repository location  \n     <Location /repository>  \n             DAV svn  \n             SVNPath /home/svn/repository  \n       \n             # Integrate with LDAP server  \n             AuthType Basic  \n             AuthBasicProvider ldap  \n             AuthName \"SVN Server\"  \n             AuthzLDAPAuthoritative off  \n             AuthLDAPURL \"(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)\"  \n             Require valid-user  \n             AuthzSVNAccessFile /home/svn/repository/conf/authz  \n     </Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n    Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n    mkdir -p /tmp/newproject/{trunk,branches,tags}\n\n#### Step 2: Copy/move project files into `trunk`\n\n    cp -R /path/to/project/files/* /tmp/newproject/trunk/\n\n#### Step 3: Perform the first commit\n\n    cd /tmp\n    svn import newproject https://svn.example.com/repository/myproject --message \"Initial import\" --username myuser\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n    svn checkout https://username@svn.example.com/repository/myproject\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n    # Deny world access to repository root (noone needs to get a project listing)  \n    [/]  \n    * =  \n      \n    # Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n    [/thiswillendpoorly]  \n    nanand = rw  \n    machrist = r  \n    * =\n\nIf you had multiple repositories, you would need to:\n\n*   Change the Apache directive `SVNPath` to `SVNParentPath`\n*   Specify the repository in the `authz` file\n\nHere's an example:\n\n    [repository1:/path]  \n    user1 = rw  \n    user2 = r  \n      \n    [repository2:/path]  \n    * = rw\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n*   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n*   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n    [global]  \n    ssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n*   [mod\\_authnz\\_ldap directives - Apache page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n*   [Subversion on CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n*   [Single or multiple repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n*   [Version Control with Subversion](http://svnbook.red-bean.com/)\n*   [SubVersion with Apache and LDAP integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n*   [Per-directory access control in SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n*   [Apache and Subversion authentication with Microsoft Active Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n*   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into the Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n*   [Apache 2.2 – authnz\\_ldap – Active Directory](http://michele.pupazzo.org/diary/?p=227)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2025-06-06T14:38:23Z",
      "id": "c94a7e7ca1fce8cd9c634d81b8b5711166546c9c",
      "shortId": "c94a7e7c",
      "subject": "Merge branch 'master' of github.com:afreeorange/wiki.nikhil.io.articles\n",
      "content": "[TOC]\n\nHost is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at `https://svn.example.com/repository` with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n    yum install subversion mod_dav_svn\n\nThis will install Apache and other dependencies as well.\n\n    service httpd start  \n    chkconfig --level 345 httpd on\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n    LoadModule dav_svn_module     modules/mod_dav_svn.so  \n    LoadModule authz_svn_module   modules/mod_authz_svn.so\n\nDefine the SVN root:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n    </Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n              \n            # Simple authentication  \n            AuthType Basic  \n            AuthName \"SVN Server\"  \n            AuthUserFile /home/svn/basic-authentication  \n            Require valid-user  \n    </Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n    [root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \n    New password:   \n    Re-type new password:   \n    Adding password for user testuser\n\n### Setting up the repository\n\n    svnadmin create /home/svn/repository\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n    chown -R apache:apache /home/svn/repository\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n`http://svn.example.com` and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n     <VirtualHost *:80>  \n             ServerName svn.example.com  \n             RewriteEngine On  \n             RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n     </VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n     # # If using some CA file  \n     # LDAPTrustedMode NONE    \n     # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n     # LDAPVerifyServerCert off\n\n     # Define the repository location  \n     <Location /repository>  \n             DAV svn  \n             SVNPath /home/svn/repository  \n       \n             # Integrate with LDAP server  \n             AuthType Basic  \n             AuthBasicProvider ldap  \n             AuthName \"SVN Server\"  \n             AuthzLDAPAuthoritative off  \n             AuthLDAPURL \"(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)\"  \n             Require valid-user  \n             AuthzSVNAccessFile /home/svn/repository/conf/authz  \n     </Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n    Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n    mkdir -p /tmp/newproject/{trunk,branches,tags}\n\n#### Step 2: Copy/move project files into `trunk`\n\n    cp -R /path/to/project/files/* /tmp/newproject/trunk/\n\n#### Step 3: Perform the first commit\n\n    cd /tmp\n    svn import newproject https://svn.example.com/repository/myproject --message \"Initial import\" --username myuser\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n    svn checkout https://username@svn.example.com/repository/myproject\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n    # Deny world access to repository root (noone needs to get a project listing)  \n    [/]  \n    * =  \n      \n    # Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n    [/thiswillendpoorly]  \n    nanand = rw  \n    machrist = r  \n    * =\n\nIf you had multiple repositories, you would need to:\n\n*   Change the Apache directive `SVNPath` to `SVNParentPath`\n*   Specify the repository in the `authz` file\n\nHere's an example:\n\n    [repository1:/path]  \n    user1 = rw  \n    user2 = r  \n      \n    [repository2:/path]  \n    * = rw\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n*   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n*   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n    [global]  \n    ssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n*   [mod\\_authnz\\_ldap directives - Apache page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n*   [Subversion on CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n*   [Single or multiple repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n*   [Version Control with Subversion](http://svnbook.red-bean.com/)\n*   [SubVersion with Apache and LDAP integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n*   [Per-directory access control in SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n*   [Apache and Subversion authentication with Microsoft Active Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n*   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into the Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n*   [Apache 2.2 – authnz\\_ldap – Active Directory](http://michele.pupazzo.org/diary/?p=227)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2021-06-04T03:04:37Z",
      "id": "fa9f7632d7901e6f9bb62b88594735ccc3588d28",
      "shortId": "fa9f7632",
      "subject": "Update Dovecot.md\n",
      "content": "[TOC]\n\nHost is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at `https://svn.example.com/repository` with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n    yum install subversion mod_dav_svn\n\nThis will install Apache and other dependencies as well.\n\n    service httpd start  \n    chkconfig --level 345 httpd on\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n    LoadModule dav_svn_module     modules/mod_dav_svn.so  \n    LoadModule authz_svn_module   modules/mod_authz_svn.so\n\nDefine the SVN root:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n    </Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n              \n            # Simple authentication  \n            AuthType Basic  \n            AuthName \"SVN Server\"  \n            AuthUserFile /home/svn/basic-authentication  \n            Require valid-user  \n    </Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n    [root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \n    New password:   \n    Re-type new password:   \n    Adding password for user testuser\n\n### Setting up the repository\n\n    svnadmin create /home/svn/repository\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n    chown -R apache:apache /home/svn/repository\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n`http://svn.example.com` and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n     <VirtualHost *:80>  \n             ServerName svn.example.com  \n             RewriteEngine On  \n             RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n     </VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n     # # If using some CA file  \n     # LDAPTrustedMode NONE    \n     # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n     # LDAPVerifyServerCert off\n\n     # Define the repository location  \n     <Location /repository>  \n             DAV svn  \n             SVNPath /home/svn/repository  \n       \n             # Integrate with LDAP server  \n             AuthType Basic  \n             AuthBasicProvider ldap  \n             AuthName \"SVN Server\"  \n             AuthzLDAPAuthoritative off  \n             AuthLDAPURL \"(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)\"  \n             Require valid-user  \n             AuthzSVNAccessFile /home/svn/repository/conf/authz  \n     </Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n    Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n    mkdir -p /tmp/newproject/{trunk,branches,tags}\n\n#### Step 2: Copy/move project files into `trunk`\n\n    cp -R /path/to/project/files/* /tmp/newproject/trunk/\n\n#### Step 3: Perform the first commit\n\n    cd /tmp\n    svn import newproject https://svn.example.com/repository/myproject --message \"Initial import\" --username myuser\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n    svn checkout https://username@svn.example.com/repository/myproject\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n    # Deny world access to repository root (noone needs to get a project listing)  \n    [/]  \n    * =  \n      \n    # Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n    [/thiswillendpoorly]  \n    nanand = rw  \n    machrist = r  \n    * =\n\nIf you had multiple repositories, you would need to:\n\n*   Change the Apache directive `SVNPath` to `SVNParentPath`\n*   Specify the repository in the `authz` file\n\nHere's an example:\n\n    [repository1:/path]  \n    user1 = rw  \n    user2 = r  \n      \n    [repository2:/path]  \n    * = rw\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n*   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n*   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n    [global]  \n    ssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n*   [mod\\_authnz\\_ldap directives - Apache page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n*   [Subversion on CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n*   [Single or multiple repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n*   [Version Control with Subversion](http://svnbook.red-bean.com/)\n*   [SubVersion with Apache and LDAP integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n*   [Per-directory access control in SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n*   [Apache and Subversion authentication with Microsoft Active Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n*   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into the Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n*   [Apache 2.2 – authnz\\_ldap – Active Directory](http://michele.pupazzo.org/diary/?p=227)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-27T07:27:56Z",
      "id": "1aa29105a45aa67523ffb61e73bcc415f935a47e",
      "shortId": "1aa29105",
      "subject": "Fix Markdown conversion\n\nSaw half a season of The Office\n",
      "content": "[TOC]\n\nHost is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at `https://svn.example.com/repository` with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n    yum install subversion mod_dav_svn\n\nThis will install Apache and other dependencies as well.\n\n    service httpd start  \n    chkconfig --level 345 httpd on\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n    LoadModule dav_svn_module     modules/mod_dav_svn.so  \n    LoadModule authz_svn_module   modules/mod_authz_svn.so\n\nDefine the SVN root:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n    </Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n              \n            # Simple authentication  \n            AuthType Basic  \n            AuthName \"SVN Server\"  \n            AuthUserFile /home/svn/basic-authentication  \n            Require valid-user  \n    </Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n    [root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \n    New password:   \n    Re-type new password:   \n    Adding password for user testuser\n\n### Setting up the repository\n\n    svnadmin create /home/svn/repository\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n    chown -R apache:apache /home/svn/repository\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n`http://svn.example.com` and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n     <VirtualHost *:80>  \n             ServerName svn.example.com  \n             RewriteEngine On  \n             RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n     </VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n     # # If using some CA file  \n     # LDAPTrustedMode NONE    \n     # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n     # LDAPVerifyServerCert off\n\n     # Define the repository location  \n     <Location /repository>  \n             DAV svn  \n             SVNPath /home/svn/repository  \n       \n             # Integrate with LDAP server  \n             AuthType Basic  \n             AuthBasicProvider ldap  \n             AuthName \"SVN Server\"  \n             AuthzLDAPAuthoritative off  \n             AuthLDAPURL \"(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)\"  \n             Require valid-user  \n             AuthzSVNAccessFile /home/svn/repository/conf/authz  \n     </Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n    Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n    mkdir -p /tmp/newproject/{trunk,branches,tags}\n\n#### Step 2: Copy/move project files into `trunk`\n\n    cp -R /path/to/project/files/* /tmp/newproject/trunk/\n\n#### Step 3: Perform the first commit\n\n    cd /tmp\n    svn import newproject https://svn.example.com/repository/myproject --message \"Initial import\" --username myuser\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n    svn checkout https://username@svn.example.com/repository/myproject\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n    # Deny world access to repository root (noone needs to get a project listing)  \n    [/]  \n    * =  \n      \n    # Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n    [/thiswillendpoorly]  \n    nanand = rw  \n    machrist = r  \n    * =\n\nIf you had multiple repositories, you would need to:\n\n*   Change the Apache directive `SVNPath` to `SVNParentPath`\n*   Specify the repository in the `authz` file\n\nHere's an example:\n\n    [repository1:/path]  \n    user1 = rw  \n    user2 = r  \n      \n    [repository2:/path]  \n    * = rw\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n*   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n*   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n    [global]  \n    ssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n*   [mod\\_authnz\\_ldap directives - Apache page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n*   [Subversion on CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n*   [Single or multiple repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n*   [Version Control with Subversion](http://svnbook.red-bean.com/)\n*   [SubVersion with Apache and LDAP integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n*   [Per-directory access control in SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n*   [Apache and Subversion authentication with Microsoft Active Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n*   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into the Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n*   [Apache 2.2 – authnz\\_ldap – Active Directory](http://michele.pupazzo.org/diary/?p=227)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-21T02:30:47Z",
      "id": "d658e80d1ecb97b196531c7b15a0f9af709c05de",
      "shortId": "d658e80d",
      "subject": "Incremental\n",
      "content": "Host is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at <https://svn.example.com/repository> with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n` yum install subversion mod_dav_svn`\n\nThis will install Apache and other dependencies as well.\n\n` service httpd start`  \n` chkconfig --level 345 httpd on`\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n` LoadModule dav_svn_module     modules/mod_dav_svn.so`  \n` LoadModule authz_svn_module   modules/mod_authz_svn.so`\n\nDefine the SVN root:\n\n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n` `</Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n`         `  \n`         # Simple authentication`  \n`         AuthType Basic`  \n`         AuthName \"SVN Server\"`  \n`         AuthUserFile /home/svn/basic-authentication`  \n`         Require valid-user`  \n` `</Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n`[root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser`  \n`New password: `  \n`Re-type new password: `  \n`Adding password for user testuser`\n\n### Setting up the repository\n\n` svnadmin create /home/svn/repository`\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n` chown -R apache:apache /home/svn/repository`\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n<http://svn.example.com> and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n` `<VirtualHost *:80>  \n`         ServerName svn.example.com`  \n`         RewriteEngine On`  \n`         RewriteRule .* `[`https://svn.example.com%{REQUEST_URI}`](https://svn.example.com%%7BREQUEST_URI%7D)` [L,R=301]`  \n` `</VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n` # # If using some CA file`  \n` # LDAPTrustedMode NONE  `  \n` # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt`  \n` # LDAPVerifyServerCert off`\n\n` # Define the repository location`  \n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n` `  \n`         # Integrate with LDAP server`  \n`         AuthType Basic`  \n`         AuthBasicProvider ldap`  \n`         AuthName \"SVN Server\"`  \n`         AuthzLDAPAuthoritative off`  \n`         AuthLDAPURL \"`[`ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub`](ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)`?(objectClass=*)\"`  \n`         Require valid-user`  \n`         AuthzSVNAccessFile /home/svn/repository/conf/authz`  \n` `</Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n` Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration`\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n`  mkdir -p /tmp/newproject/{trunk,branches,tags}`\n\n#### Step 2: Copy/move project files into `trunk`\n\n` cp -R /path/to/project/files/* /tmp/newproject/trunk/`\n\n#### Step 3: Perform the first commit\n\n` cd /tmp`  \n` svn import newproject `[`https://svn.example.com/repository/myproject`](https://svn.example.com/repository/myproject)` --message \"Initial import\" --username myuser`\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n` svn checkout `[`https://username@svn.example.com/repository/myproject`](https://username@svn.example.com/repository/myproject)\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n` # Deny world access to repository root (noone needs to get a project listing)`  \n` [/]`  \n` * =`  \n` `  \n` # Allow only Nikhil and Mark to access this terrible project (Mark can only read)`  \n` [/thiswillendpoorly]`  \n` nanand = rw`  \n` machrist = r`  \n` * =`\n\nIf you had multiple repositories, you would need to:\n\n-   Change the Apache directive `SVNPath` to `SVNParentPath`\n-   Specify the repository in the `authz` file\n\nHere's an example:\n\n` [repository1:/path]`  \n` user1 = rw`  \n` user2 = r`  \n` `  \n` [repository2:/path]`  \n` * = rw`\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n-   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n-   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n` [global]`  \n` ssl-authority-files = /etc/pki/tls/certs/root_ca.crt`\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n-   [mod\\_authnz\\_ldap directives - Apache\n    page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n-   [Subversion on\n    CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n-   [Single or multiple\n    repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n-   [Version Control with Subversion](http://svnbook.red-bean.com/)\n-   [SubVersion with Apache and LDAP\n    integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n-   [Per-directory access control in\n    SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n-   [Apache and Subversion authentication with Microsoft Active\n    Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n-   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into\n    the\n    Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n-   [Apache 2.2 – authnz\\_ldap – Active\n    Directory](http://michele.pupazzo.org/diary/?p=227)\n"
    },
    {
      "authorEmail": "mail@nikhil.io",
      "authorName": "Nikhil Anand",
      "date": "2015-12-20T19:56:53Z",
      "id": "3c3214678f7c710096c7f134e724e5b6d51a12bb",
      "shortId": "3c321467",
      "subject": "Subversion Installation and Configuration : First Draft\n",
      "content": "Host is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at <https://svn.example.com/repository> with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n` yum install subversion mod_dav_svn`\n\nThis will install Apache and other dependencies as well.\n\n` service httpd start`  \n` chkconfig --level 345 httpd on`\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n` LoadModule dav_svn_module     modules/mod_dav_svn.so`  \n` LoadModule authz_svn_module   modules/mod_authz_svn.so`\n\nDefine the SVN root:\n\n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n` `</Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n`         `  \n`         # Simple authentication`  \n`         AuthType Basic`  \n`         AuthName \"SVN Server\"`  \n`         AuthUserFile /home/svn/basic-authentication`  \n`         Require valid-user`  \n` `</Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n`[root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser`  \n`New password: `  \n`Re-type new password: `  \n`Adding password for user testuser`\n\n### Setting up the repository\n\n` svnadmin create /home/svn/repository`\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n` chown -R apache:apache /home/svn/repository`\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n<http://svn.example.com> and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n` `<VirtualHost *:80>  \n`         ServerName svn.example.com`  \n`         RewriteEngine On`  \n`         RewriteRule .* `[`https://svn.example.com%{REQUEST_URI}`](https://svn.example.com%%7BREQUEST_URI%7D)` [L,R=301]`  \n` `</VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n` # # If using some CA file`  \n` # LDAPTrustedMode NONE  `  \n` # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt`  \n` # LDAPVerifyServerCert off`\n\n` # Define the repository location`  \n` <Location /repository>`  \n`         DAV svn`  \n`         SVNPath /home/svn/repository`  \n` `  \n`         # Integrate with LDAP server`  \n`         AuthType Basic`  \n`         AuthBasicProvider ldap`  \n`         AuthName \"SVN Server\"`  \n`         AuthzLDAPAuthoritative off`  \n`         AuthLDAPURL \"`[`ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub`](ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)`?(objectClass=*)\"`  \n`         Require valid-user`  \n`         AuthzSVNAccessFile /home/svn/repository/conf/authz`  \n` `</Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n` Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration`\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n`  mkdir -p /tmp/newproject/{trunk,branches,tags}`\n\n#### Step 2: Copy/move project files into `trunk`\n\n` cp -R /path/to/project/files/* /tmp/newproject/trunk/`\n\n#### Step 3: Perform the first commit\n\n` cd /tmp`  \n` svn import newproject `[`https://svn.example.com/repository/myproject`](https://svn.example.com/repository/myproject)` --message \"Initial import\" --username myuser`\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n` svn checkout `[`https://username@svn.example.com/repository/myproject`](https://username@svn.example.com/repository/myproject)\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n` # Deny world access to repository root (noone needs to get a project listing)`  \n` [/]`  \n` * =`  \n` `  \n` # Allow only Nikhil and Mark to access this terrible project (Mark can only read)`  \n` [/thiswillendpoorly]`  \n` nanand = rw`  \n` machrist = r`  \n` * =`\n\nIf you had multiple repositories, you would need to:\n\n-   Change the Apache directive `SVNPath` to `SVNParentPath`\n-   Specify the repository in the `authz` file\n\nHere's an example:\n\n` [repository1:/path]`  \n` user1 = rw`  \n` user2 = r`  \n` `  \n` [repository2:/path]`  \n` * = rw`\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n-   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n-   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n` [global]`  \n` ssl-authority-files = /etc/pki/tls/certs/root_ca.crt`\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n-   [mod\\_authnz\\_ldap directives - Apache\n    page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n-   [Subversion on\n    CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n-   [Single or multiple\n    repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n-   [Version Control with Subversion](http://svnbook.red-bean.com/)\n-   [SubVersion with Apache and LDAP\n    integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n-   [Per-directory access control in\n    SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n-   [Apache and Subversion authentication with Microsoft Active\n    Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n-   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into\n    the\n    Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n-   [Apache 2.2 – authnz\\_ldap – Active\n    Directory](http://michele.pupazzo.org/diary/?p=227)\n\n[Category:Nikhil's Notes](Category:Nikhil's_Notes \"wikilink\")\n[Category:From a past sysadmin\nlife](Category:From_a_past_sysadmin_life \"wikilink\")\n"
    }
  ],
  "sizeInBytes": 10580,
  "source": "[TOC]\n\nHost is **svn.example.com**. There are basically two ways of serving up\na subversion repository. One uses `svnserve`, a lightweight server\n(default port 3690). The other is leveraging Apache (`httpd`) via the\nWebDAV protocol.\n\nThe latter is more complex. But it is extremely flexible in terms of\nadministration and is the basis for this setup guide. I will be setting\nup a single repository at `https://svn.example.com/repository` with SSL,\nLDAP-based authentication, and project-specific access control.\n\nInstallation\n------------\n\n### Getting the RPM\n\nI'm putting the SVN root in /home/svn as well. This can be anywhere.\n\n    yum install subversion mod_dav_svn\n\nThis will install Apache and other dependencies as well.\n\n    service httpd start  \n    chkconfig --level 345 httpd on\n\nMake sure it's working, and that `iptables` is not causing any issues.\nYou can use `nmap` for this purpose or just go to\n<http://svn.example.com>.\n\n### Preparing `subversion.conf`\n\nInstalling the packages will create a new apache configuration directive\nin `/etc/httpd/conf.d` called `subversion.conf`. You need to edit this\nfile to set up the location of the repository.\n\nFirst uncomment these files if they've not been uncommented:\n\n    LoadModule dav_svn_module     modules/mod_dav_svn.so  \n    LoadModule authz_svn_module   modules/mod_authz_svn.so\n\nDefine the SVN root:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n    </Location>\n\nNow you can add simple authentication or use LDAP.\n\nConfiguration\n-------------\n\n### Simple Authentication\n\nThis uses basic `htpasswd` based authentication. Passwords may be sent\nin the clear if you don't enable SSL. You can also use digest-based\nauthentication which is slightly more secure.\n\nFor this scheme, our `/etc/httpd/conf.d/subversion.conf` file will have\nthe following directive:\n\n    <Location /repository>  \n            DAV svn  \n            SVNPath /home/svn/repository  \n              \n            # Simple authentication  \n            AuthType Basic  \n            AuthName \"SVN Server\"  \n            AuthUserFile /home/svn/basic-authentication  \n            Require valid-user  \n    </Location>\n\nHere, we use /home/svn/authorized-users to authenticate. Create this\nfile and add a user with:\n\n    [root@svn ~]# htpasswd -cm /home/svn/authorized-users testuser  \n    New password:   \n    Re-type new password:   \n    Adding password for user testuser\n\n### Setting up the repository\n\n    svnadmin create /home/svn/repository\n\nMake absolutely sure that Apache owns this directory and its\ndescendants!\n\n    chown -R apache:apache /home/svn/repository\n\n### Testing the Configuration\n\nAt this point, you should have a repo accessible via Apache, with\npassword sent in clear text (we'll change that). I went to\n`http://svn.example.com` and saw the image to the right after entering\nmy credentials for testuser.\n\nExcellent! Test it now! I tested this config with Eclipse (with the\nSubclipse plugin.)\n\n### Securing with SSL\n\nTo secure stuff with SSL, generate or use a certificate and enable\nApache with `mod_ssl`. Change `subversion.conf` so that all traffic on\nport 80 is redirected to port 443 (which uses the certs we've created.)\n\n     <VirtualHost *:80>  \n             ServerName svn.example.com  \n             RewriteEngine On  \n             RewriteRule .* https://svn.example.com%{REQUEST_URI} [L,R=301]  \n     </VirtualHost>\n\nRestart `httpd` and you're good to go!\n\n### LDAP integration\n\nIn this example, I will be using **directory.example.com** as the (Open\nDirectory-based) LDAP provider. Change the basic authentication scheme\nto match this:\n\n     # # If using some CA file  \n     # LDAPTrustedMode NONE    \n     # LDAPTrustedGlobalCert CA_DER /etc/pki/tls/certs/root_ca.crt  \n     # LDAPVerifyServerCert off\n\n     # Define the repository location  \n     <Location /repository>  \n             DAV svn  \n             SVNPath /home/svn/repository  \n       \n             # Integrate with LDAP server  \n             AuthType Basic  \n             AuthBasicProvider ldap  \n             AuthName \"SVN Server\"  \n             AuthzLDAPAuthoritative off  \n             AuthLDAPURL \"(ldap://directory.example.com/cn=users,dc=directory,dc=example,dc=com?uid?sub)?(objectClass=*)\"  \n             Require valid-user  \n             AuthzSVNAccessFile /home/svn/repository/conf/authz  \n     </Location>\n\n**It is important** that you set `AuthBasicProvider ldap`. If not,\nApache will look for a password file and not even bother to authenticate\nagainst your LDAP server. You'll also see something like this when\nrestarting the `httpd` daemon:\n\n    Invalid command 'AuthLDAPAuthoritative', perhaps misspelled or defined by a module not included in the server configuration\n\nI had terrible luck with setting `AuthzLDAPAuthoritative` to \"on\". You\ncan read the Apache `mod_authnz_ldap` page for more information on these\ndirectives. They're quite flexible when configuring multiple\nrepositories, with respect to user and group access.\n\nNow that you have a single repository, you can fine tune access with the\n`AuthzSVNAccessFile` directive. By default, and when you use\n`svnadmin create`, you get an `authz` file in your repository's `conf`\nfolder. In the Apache configuration above, it's the file I've used to\ntweak folder access.\n\nProject Management within a Repository\n--------------------------------------\n\n### Creating a project\n\nThis is very simple. It's vitally important that your project folder\ncontains three sub-folders: **trunk**, **branches** and **tags**. All\nthe code you want to check into the repository must be in **trunk**.\n\n#### Step 1: Create the required directory structure\n\n    mkdir -p /tmp/newproject/{trunk,branches,tags}\n\n#### Step 2: Copy/move project files into `trunk`\n\n    cp -R /path/to/project/files/* /tmp/newproject/trunk/\n\n#### Step 3: Perform the first commit\n\n    cd /tmp\n    svn import newproject https://svn.example.com/repository/myproject --message \"Initial import\" --username myuser\n\nObserve that my project is called `newproject` on my local machine but\nis `myproject` on the SVN server. You may or may not choose to do this,\nbut the option is available.\n\nYou may get a dialog about the certificate used to secure the\ntransaction. Accept the key permanently. You will then be required to\nsupply a password.\n\n#### Step 4: Working with your project\n\nMost typical CVS actions should apply (prefixed with an `svn` of\ncourse.) For example, to check out the project created above.\n\n    svn checkout https://username@svn.example.com/repository/myproject\n\nThe Google teems with SVN cheatsheets.\n\n### Modifying Access Control\n\n**Important**: Only root can do this. Talk to your friendly sysadmin for\nproject-specific access control. By default, your newly created project\nwill be world accessible (i.e. to *all authenticated* users.)\n\nHere's an example where I created a folder for a rather sinister project\ncalled `thiswillendpoorly` and have given write access only to user\n`nanand` and read access to `machrist`. *The leading slash is\nimportant!*\n\n    # Deny world access to repository root (noone needs to get a project listing)  \n    [/]  \n    * =  \n      \n    # Allow only Nikhil and Mark to access this terrible project (Mark can only read)  \n    [/thiswillendpoorly]  \n    nanand = rw  \n    machrist = r  \n    * =\n\nIf you had multiple repositories, you would need to:\n\n*   Change the Apache directive `SVNPath` to `SVNParentPath`\n*   Specify the repository in the `authz` file\n\nHere's an example:\n\n    [repository1:/path]  \n    user1 = rw  \n    user2 = r  \n      \n    [repository2:/path]  \n    * = rw\n\nIf you specified a path without specifying the repository, the filter is\napplied across *all* repositories! This [is explained\nhere](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2).\n\nMiscellaneous\n-------------\n\n### Special note about LDAP groups\n\nYou cannot do LDAP group-based authentication in SVN with the `authz`\nfile. However, I've seen [a python\nscript](http://www.thoughtspark.org/node/26) which can import LDAP\ngroups.\n\n### Few pointers on multiple repository configuration\n\n*   If you plan on hosting multiple repositories, you need to change\n    `SVNPath` to \"SVNParentPath\".\n*   *Apache will NOT allow you to access the root defined as\n    `SVNParentPath`!* You need to create repositories using\n    `svnadmin create` and can then access them through\n    `http://svn.example.com/{path in SVNParentPath}/{name of repository}`.\n    There's [more information in the official handbook about\n    this](http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.basic).\n\n### Configuring for use with Self-Signed Certificates\n\nAssuming that your Root CA is called **`root_ca.crt`**. Create and edit\n`/etc/sysconfig/servers` to add the following:\n\n    [global]  \n    ssl-authority-files = /etc/pki/tls/certs/root_ca.crt\n\nThe other option is to use the system-wide keystore at\n`/etc/pki/tls/certs/ca-bundle.crt` by appending the ASCII version to the\nend of this file.\n\nResources\n---------\n\n*   [mod\\_authnz\\_ldap directives - Apache page](http://httpd.apache.org/docs/2.1/mod/mod_authnz_ldap.html)\n*   [Subversion on CentOS (Wiki)](http://wiki.centos.org/HowTos/Subversion)\n*   [Single or multiple repositories?](http://stackoverflow.com/questions/252459/one-svn-repository-or-many/252717#252717)\n*   [Version Control with Subversion](http://svnbook.red-bean.com/)\n*   [SubVersion with Apache and LDAP integration](http://blogs.open.collab.net/svn/2009/03/subversion-with-apache-and-ldap-updated.html)\n*   [Per-directory access control in SVN](http://svnbook.red-bean.com/en/1.0/svn-book.html#svn-ch-6-sect-4.4.2)\n\n### Active Directory Integration\n\n*   [Apache and Subversion authentication with Microsoft Active Directory](http://www.jejik.com/articles/2007/06/apache_and_subversion_authentication_with_microsoft_active_directory/)\n*   [mod\\_auth\\_kerb and mod\\_authnz\\_ldap bring Apache web apps into the Enterprise](http://www.wadewoolwine.com/2009/01/28/mod_auth_kerb-and-mod_authnz_ldap-bring-apache-web-apps-into-the-enterprise/)\n*   [Apache 2.2 – authnz\\_ldap – Active Directory](http://michele.pupazzo.org/diary/?p=227)\n",
  "title": "Subversion Installation and Configuration",
  "untracked": false,
  "uri": "/Subversion_Installation_and_Configuration",
  "relativePath": "Subversion Installation and Configuration.md"
}
