<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Wojno: Tag apache2</title>
    <link>http://christopher.wojno.com/articles/tag/apache2</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Exploration through Code</description>
    <item>
      <title>Creating your own Apache SSL Certificate Signed by your Root CA</title>
      <description>&lt;p&gt;This article is part 2 of &lt;a href="http://christopher.wojno.com/articles/2008/11/04/going-ssl-with-your-own-root-ca"&gt;Going &lt;span class="caps"&gt;SSL&lt;/span&gt; with Your Own Root CA&lt;/a&gt;&lt;/p&gt;


	&lt;h1&gt;Putting your Root CA to work&lt;/h1&gt;


	&lt;p&gt;Now that you have your own Root CA, it doesn&amp;#8217;t do anyone any good unless you use it. You use it by creating certificates for services. The rule is one certificate per-IP address. If you need additional certificates, you should have an IP address for each certificate. Any domain (or sub-domain, etc.) listed in the Certificate&amp;#8217;s CN (Common Name) should resolve to its own unique IP address. Now, nothing is set in stone. But that&amp;#8217;s the way it should be done. I&amp;#8217;ve used multiple certificates for different domains on the same server using Virtual Hosts (same IP) before, but Apache warned me every time I started the server that this is bad practice. If you&amp;#8217;re using Apache, it will still work, but you&amp;#8217;ve been warned (again).&lt;/p&gt;


	&lt;h2&gt;Disclaimers&lt;/h2&gt;


	&lt;p&gt;This guide is for amateur, non-production use only. I make no warranties or guarantees as to the correctness of this document. This guide involves escalating privileges and may cause irreparable damage if used improperly. You use this document at your own risk and I hereby disclaim any responsibility or liability for your actions or non-actions.&lt;/p&gt;


	&lt;h2&gt;Assumptions&lt;/h2&gt;


	&lt;p&gt;I&amp;#8217;m assuming you&amp;#8217;re using Apache 2.X with mod_ssl already installed. I&amp;#8217;m also assuming you&amp;#8217;ve already set-up a vhost file with the site you want to &lt;span class="caps"&gt;SSL&lt;/span&gt; already created and configured minus the specification of the server certificate, and trust chain. I realize this is a lot to assume. &lt;a href="http://tud.at/programm/apache-ssl-win32-howto.php3"&gt;This&lt;/a&gt; can help you setup an Apache server with &lt;span class="caps"&gt;SSL&lt;/span&gt;.&lt;/p&gt;


	&lt;h1&gt;Creating a Server Key&lt;/h1&gt;


	&lt;p&gt;Just as with the Root CA key, you need a server key. Now, if you already have one, relax, skip this step (though I still urge you to create and migrate to the &amp;#8220;secure&amp;#8221; environment created in the next step). You can re-use your server key as many times as you like until you want to upgrade the private key quality (or the key is compromised). If you have &lt;em&gt;not&lt;/em&gt; created a server key, you&amp;#8217;ll need to do so now.&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;ll use OpenSSL again, but first, let&amp;#8217;s create a safe place for our key. The key needs to be readable by the server upon start-up (meaning, the key cannot be encrypted) or Apache (or any other server) will be unable to use it without first asking you for a password. If you don&amp;#8217;t mind typing it in each time, that&amp;#8217;s your prerogative. However, for live or even development environments, it&amp;#8217;s simply impractical.&lt;/p&gt;


	&lt;p&gt;Just as with the Root CA key, you must keep this server key confidential as well. If it is breached, anyone can masquerade as your web server; thus defeating the purpose of the certificate. If you need to move the key, you are advised to use OpenSSL to encrypt it first, however, that is a tutorial for another day.&lt;/p&gt;


	&lt;h2&gt;Create the &amp;#8220;secure&amp;#8221; environment&lt;/h2&gt;


	&lt;p&gt;Create a comfy place for your key. I like to put it in /etc/apache2/ssl with Gentoo, but the better place is likely /usr/local/etc/apache2/ssl and if you use Windows: there are no rules for file placement. With that: create your directory:&lt;/p&gt;


&lt;pre&gt;sudo mkdir /usr/local/etc/apache2
sudo mkdir /usr/local/etc/apache2/ssl
sudo chmod 0770 /usr/local/etc/apache2/ssl
sudo groupadd apache_ssl_admins
sudo chown :apache_ssl_admins /usr/local/etc/apache2/ssl
sudo usermod -a -G apache_ssl_admins YOURUSERNAME # varies by OS&lt;/pre&gt;

	&lt;p&gt;Here&amp;#8217;s what I&amp;#8217;ve done:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Created an apache2 directory (if it didn&amp;#8217;t exist, if this call fails, just make sure the directory is there)&lt;/li&gt;
		&lt;li&gt;Created the &lt;span class="caps"&gt;SSL&lt;/span&gt; directory where we&amp;#8217;ll store the server key&lt;/li&gt;
		&lt;li&gt;Changed the permissions for the directory such that only root can access it&lt;/li&gt;
		&lt;li&gt;Created a group called &amp;#8220;apache_ssl_admins&amp;#8221; &lt;/li&gt;
		&lt;li&gt;Changed the ownership of the new directory to allow members of the apache_ssl_admins access&lt;/li&gt;
		&lt;li&gt;Added you to the new group called &amp;#8220;apache_ssl_admins&amp;#8221;, note that this step may vary among Operating Systems so modify this command as required.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;You&amp;#8217;ll need to log out and log back into your server for the group membership to take effect.&lt;/p&gt;


	&lt;p&gt;Now, I&amp;#8217;ve put the word &amp;#8220;secure&amp;#8221; in quotes as if anyone were to compromise the server and gain access to the apache_ssl_admins group, your key is then accessible. Your key is only as secure as your server.&lt;/p&gt;


	&lt;p&gt;Once you&amp;#8217;ve logged back in, cd to the newly created &amp;#8220;secure&amp;#8221; environment.&lt;/p&gt;


&lt;pre&gt;cd /usr/local/etc/apache2/ssl&lt;/pre&gt;

	&lt;h1&gt;Creating the server key&lt;/h1&gt;


	&lt;p&gt;You will now generate a server key. I highly recommend that you study the &lt;a href="http://www.openssl.org/docs/apps/openssl.html"&gt;documentation&lt;/a&gt; for OpenSSL. It&amp;#8217;s very very rough, but it will help you understand the commands you&amp;#8217;re entering. It may be necessary to update these commands as machines become faster and the encryption level becomes insufficient.&lt;/p&gt;


&lt;pre&gt;openssl genrsa -out www.pem 2048&lt;/pre&gt;

	&lt;p&gt;This generates a new file called www.pem in your &amp;#8220;secure&amp;#8221; environment. This is an &lt;span class="caps"&gt;RSA&lt;/span&gt; private key with a bit length of 2048. This bit-length is considered to be good by today&amp;#8217;s standards. You may use any power of two; though, be warned, larger numbers require more time to initiate &lt;span class="caps"&gt;SSL&lt;/span&gt; connections. Smaller numbers will result in a less secure &lt;span class="caps"&gt;SSL&lt;/span&gt; handshake (and vicariously a less secure &lt;span class="caps"&gt;SSL&lt;/span&gt; session).&lt;/p&gt;


	&lt;p&gt;Again, it is a good idea to encrypt this key with 3des. I&amp;#8217;ve not done so to facilitate this demonstration. Please see the previous tutorial for instructions about encrypting your server&amp;#8217;s private key. The instructions for encrypting your Root CA private key are applicable to this purpose.&lt;/p&gt;


	&lt;h1&gt;Generate a Certificate Signing Request&lt;/h1&gt;


	&lt;p&gt;The Certificate Signing Request (CSR) is used by Root CA&amp;#8217;s to create certificates for people who need them. &lt;span class="caps"&gt;A CSR&lt;/span&gt; is a uniform way to telling Root CA&amp;#8217;s exactly what the certificate should say. The Root CA merely signs the &lt;span class="caps"&gt;CSR&lt;/span&gt; and viola: a certificate. Well, it&amp;#8217;s not all that simple. The Root CA also adds an expiration date to the signature or other fields deemed necessary or desired. But before it can be signed, the &lt;span class="caps"&gt;CSR&lt;/span&gt; must be generated by using the server&amp;#8217;s key:&lt;/p&gt;


&lt;pre&gt;openssl req -new -sha1 -out www.csr -key www.pem&lt;/pre&gt;

	&lt;p&gt;This command will create a file called www.csr in your &amp;#8220;secure&amp;#8221; environment. This file is a Certificate Signing Request. You may expose this file publicly, though that is not required if you&amp;#8217;re signing it yourself. This new request requires that it be identified using the &lt;span class="caps"&gt;SHA1&lt;/span&gt; hashing algorithm. This algorithm is safer than &lt;span class="caps"&gt;MD5&lt;/span&gt; as it has been proven that &lt;span class="caps"&gt;MD5&lt;/span&gt; collisions can be generated in a reasonable time.&lt;/p&gt;


	&lt;p&gt;You will be asked a series of questions after running this command. Answer them honestly. When you see the CN (Common Name), enter the domain name and subdomain for your certificate. I.E. for my domain: christopher.wojno.com, use as the CN: &amp;#8220;christopher.wojno.com&amp;#8221;&lt;/p&gt;


	&lt;h1&gt;Sign your &lt;span class="caps"&gt;CSR&lt;/span&gt; and create a real server Certificate&lt;/h1&gt;


	&lt;p&gt;Now that you have a &lt;span class="caps"&gt;CSR&lt;/span&gt;, we&amp;#8217;ll use our Root CA certificate and key to sign the &lt;span class="caps"&gt;CSR&lt;/span&gt;. This creates a certificate you can use in your Apache server (or other &lt;span class="caps"&gt;SSL&lt;/span&gt;-capable web server). If you created your Root CA using my previous article, then you may use the paths I have specified here. Otherwise, you&amp;#8217;ll need to adjust the -CA, -CAkey and -CAserial parameters to match what you have used.&lt;/p&gt;


&lt;pre style="overflow:scroll;"&gt;openssl x509 -req -days 365 -in www.csr -CA /usr/local/etc/certificate_authority/certs/cacert.crt -CAkey /usr/local/etc/certificate_authority/private/cakey.pem -CAserial /usr/local/etc/certificate_authority/serial.srl -out www.crt&lt;/pre&gt;

	&lt;p&gt;This is a lot to swallow in one step. This used to be where I became completely lost with regard to &lt;span class="caps"&gt;SSL&lt;/span&gt; Certificate generation. The command is very complex so I&amp;#8217;ll break it down part by part:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;We&amp;#8217;re asking OpenSSL to do something&lt;/li&gt;
		&lt;li&gt;Specifically, we&amp;#8217;re asking it to invoke it&amp;#8217;s x509 library (SSL certificate chains)&lt;/li&gt;
		&lt;li&gt;We&amp;#8217;re then specifying that our input will be a &lt;span class="caps"&gt;CSR&lt;/span&gt; (-req)&lt;/li&gt;
		&lt;li&gt;We want the resulting certificate to be valid for 365 days (-days 365) from date of signing&lt;/li&gt;
		&lt;li&gt;The &lt;span class="caps"&gt;CSR&lt;/span&gt; is the input (-in www.csr)&lt;/li&gt;
		&lt;li&gt;We&amp;#8217;re using the CA public certificate created in the previous tutorial: (-CA /usr/local/etc/certificate_authority/certs/cacert.crt)&lt;/li&gt;
		&lt;li&gt;We&amp;#8217;re using the CA&amp;#8217;s private key created in the previous tutorial to sign this &lt;span class="caps"&gt;CSR&lt;/span&gt;: (-CAkey /usr/local/etc/certificate_authority/private/cakey.pem)&lt;/li&gt;
		&lt;li&gt;We&amp;#8217;re using the CA&amp;#8217;s serial file to mark the resulting certificate: (-CAserial /usr/local/etc/certificate_authority/serial.srl)&lt;/li&gt;
		&lt;li&gt;Finally, we&amp;#8217;re outputting a new certificate for the web server: (-out ../www.crt)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;That little command does quite a bit. After running it, you will be prompted for the CA Root private key password (if you created one as I recommended that you do). It should automatically increment the serial file (serial.srl) so that future certificates do not have the same serial number used to identify certificates.&lt;/p&gt;


	&lt;p&gt;Now we have an &lt;span class="caps"&gt;SSL&lt;/span&gt; certificate for your server located in /usr/local/etc/apache2. Time to tell Apache where it is.&lt;/p&gt;


	&lt;h1&gt;Telling Apache about our certificate&lt;/h1&gt;


	&lt;p&gt;This next step takes place in the Virtual Host configuration file (or in your httpd.conf if your OS distro has not broken that file up yet). The true location of this next step can only be described in a universal fashion by describing the purpose: website configuration. Locate that file. In Gentoo, it&amp;#8217;s located at: /etc/apache2/vhosts.d/00_default_ssl_vhost.conf I am unsure as to its location on other operating systems.&lt;/p&gt;


	&lt;p&gt;Once you&amp;#8217;ve located this file, you&amp;#8217;ll need to edit it (this may require privilege escalation). Edit this file in your favorite editor (or least favorite, there is no favorite requirement).&lt;/p&gt;


	&lt;p&gt;Add or amend the following lines in the VirtualHost section of the website you wish to secure using the new &lt;span class="caps"&gt;SSL&lt;/span&gt; Certificate. The hostname of this virtual host must match the CN name you specified when you created the &lt;span class="caps"&gt;CSR&lt;/span&gt; for this site.&lt;/p&gt;


&lt;pre&gt;SSLCertificateFile /usr/local/etc/apache2/ssl/www.crt
SSLCertificateKeyFile /usr/local/etc/apache2/ssl/www.pem
SSLCertificateChainFile /usr/local/certificate_authority/certs/cacert.crt&lt;/pre&gt;

	&lt;p&gt;This tells Apache:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Where our certificate can be accessed so that the server may present it to requesters&lt;/li&gt;
		&lt;li&gt;Where the server&amp;#8217;s private key file is so that the certificate may be used to decrypt encrypted requests from requesters (these requests are encrypted using the certificate in step 1)&lt;/li&gt;
		&lt;li&gt;Where the certificate authority&amp;#8217;s certificate is located so that Apache is able to append it to the certificate presented in step 1 (to avoid having the user&amp;#8217;s browser look it up first)&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Again, I&amp;#8217;m assuming that you&amp;#8217;ve already set up Apache to use &lt;span class="caps"&gt;SSL&lt;/span&gt;:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;You&amp;#8217;ve installed mod_ssl&lt;/li&gt;
		&lt;li&gt;You have enabled it in the /etc/conf.d/apache2 file&lt;/li&gt;
		&lt;li&gt;You&amp;#8217;ve allowed access to port 443 through all firewalls (or other port you wish to use for &lt;span class="caps"&gt;SSL&lt;/span&gt;)&lt;/li&gt;
		&lt;li&gt;You&amp;#8217;ve configured your Apache instance to listen on the &lt;span class="caps"&gt;SSL&lt;/span&gt; port&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;If you&amp;#8217;ve not done so, Apache will not understand the &lt;span class="caps"&gt;SSL&lt;/span&gt; commands and will not start.&lt;/p&gt;


	&lt;p&gt;If all goes well, when you access the website at the CN name on your certificate and use the https protocol (i.e. https://CN where CN is the name used when you were asked for the Common Name when generating the &lt;span class="caps"&gt;CSR&lt;/span&gt;), you will see your website and will not be prompted to accept the authenticity of the certificate. Again, I assume you&amp;#8217;ve completed the previous tutorial and have installed your own Root CA (used to sign this certificate) into your machine&amp;#8217;s trusted Root certificates.&lt;/p&gt;


	&lt;h1&gt;Should something go wrong&lt;/h1&gt;


	&lt;p&gt;Debugging OpenSSL certificate problems is tricky and complicated. OpenSSL provides a tool for doing so over the network. I used it extensively during my first attempts at creating my certificates. Use:&lt;/p&gt;


&lt;pre&gt;openssl s_client -connect CN:PORT -debug&lt;/pre&gt;

	&lt;p&gt;See the &lt;a href="http://www.openssl.org/docs/apps/s_client.html"&gt;documentation&lt;/a&gt;# for more information. Be warned, this is a developer tool and comes with few instructions and brief explanations.&lt;/p&gt;</description>
      <pubDate>Sat, 08 Nov 2008 15:17:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:82d8d7ac-85b3-4b26-8f9c-8143e6478025</guid>
      <author>Christopher Wojno</author>
      <link>http://christopher.wojno.com/articles/2008/11/08/creating-your-own-apache-ssl-certificate-signed-by-your-root-ca</link>
      <category>How-Tos</category>
      <category>Security</category>
      <category>ssl</category>
      <category>apache2</category>
      <category>ca</category>
      <category>root</category>
      <category>certificate</category>
      <category>tls</category>
      <category>self</category>
      <category>web</category>
      <category>signing</category>
      <category>request</category>
      <category>csr</category>
    </item>
    <item>
      <title>What is mod_authz_svn_db?</title>
      <description>&lt;h1&gt;Abstract&lt;/h1&gt;


	&lt;p&gt;The Authorization Subversion Database &lt;a href="http://httpd.apache.org/"&gt;Apache&lt;/a&gt; &lt;a href="http://httpd.apache.org/docs/2.2/mod/"&gt;Module&lt;/a&gt; is an implementation of database driven permissions of groups and individuals for &lt;a href="http://subversion.tigris.org/"&gt;subversion&lt;/a&gt; repositories. Think &lt;a href="http://svnbook.red-bean.com/en/1.1/ch06s04.html"&gt;mod_authz_svn&lt;sup&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/a&gt; but instead of using a file to support your permissions, you can use a database. This will allow a single server repository collection the ability to host, control (via a web application with &lt;span class="caps"&gt;PHP&lt;/span&gt;/Ruby/&lt;acronym title="but why?"&gt;ASP&lt;/acronym&gt;), and create permissions policies for multiple subversion repositories.&lt;/p&gt;


	&lt;h1&gt;Motivation&lt;/h1&gt;


	&lt;p&gt;While attending &lt;a href="http://www.usc.edu"&gt;&lt;span class="caps"&gt;USC&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://tjohns.net"&gt;Trevor Johns&lt;/a&gt; and I were stymied by the lack of companion collaboration software for classes which either required it or lent themselves well to practice with those tools. While most students e-mailed (or worse: shared their user accounts to share) their code, Trevor and I were the only ones with the resources to deploy a source code management server of our own. Even in our capstone classes where the use of subversion was attempted, it&amp;#8217;s complexity quickly dazed the rest of the students and in my case, subversion fell by the wayside.&lt;/p&gt;


	&lt;p&gt;Trevor had more luck, as he spent hours developing a smiling slide presentation which explained (with more clarity than my demonstration) the benefits and use of subversion. He succeeded in getting the class to use subversion, but the deployment was still a nightmare.&lt;/p&gt;


	&lt;h1&gt;History&lt;/h1&gt;


	&lt;p&gt;As you may or may not be aware, Trevor and I are members of &lt;a href="http://upe.usc.edu/" title="Upsilon Pi Epsilon"&gt;&lt;span class="caps"&gt;UPE&lt;/span&gt;&lt;/a&gt;, a computer science honor society. That is related only in that Ross Boucher, a fellow member, suggested that &lt;span class="caps"&gt;UPE&lt;/span&gt; create some sort of software to manage subversion projects and permissions.&lt;/p&gt;


	&lt;p&gt;I took a special interest in the project and began planning its development. I realized that we would need two separate components, the web application to provide an interface for policy setting, and the means to enforce the policies. Enforcement fell to an Apache2 (sorry Apache1 users) module. I dubbed it the mod_authz_svn_db (Module Authorization Subversion Database) after mod_authz_svn, mod_authz_mysql, mod_authz_pgsql2, mod_authz_dbd.&lt;/p&gt;


	&lt;p&gt;As a small note of interest, there was a heated battle about just using a flat file with Subversion&amp;#8217;s mod_dav_svn module (which already existed) to manage the permissions. However, the biggest problems concern flat-file parsing for thousands of users and repositories and concurrency (writing such a huge file is bound to provoke inconsistencies in permissions). That balloons to file-system level locking. Is it ugly enough for you yet?  Imagine parsing a 5,000+ line authorization file in a &lt;span class="caps"&gt;PHP&lt;/span&gt; application to figure out who has access to what. Then, imagine &lt;span class="caps"&gt;WRITING&lt;/span&gt; that data back to the file. And whatever help you if your &lt;span class="caps"&gt;PHP&lt;/span&gt; application hiccups mid-write. &lt;span class="caps"&gt;BYE BYE&lt;/span&gt; file! Better write a backup script! See why I wanted a database back-end? I&amp;#8217;m not saying it&amp;#8217;s impossible, it&amp;#8217;s just not for me and maybe not for you.&lt;/p&gt;


	&lt;h1&gt;Structure&lt;/h1&gt;


	&lt;p&gt;I wanted this module to be useful for more than just our little web application (SwitchYard). There is no reason why other people should be forced to use our web application for use with subversion. I therefore, designed it to be as modular as possible. Mod_authz_svn_db has nothing to do with SwitchYard. You are able to use it in conjunction with other implementations.&lt;/p&gt;


	&lt;p&gt;Conforming to my modularity motif, I developed a &amp;#8220;base&amp;#8221; module where the bulk of the heavy lifting and programming lives. Therefore, all database specific code can be delegated to a select few functions: open, close, query. Porting this module to other databases is extremely easy. To support a new database, simply include the &amp;#8220;base&amp;#8221; module code and define the database specific functions. This reduces errors and speeds integration with new database technology. It also allows for database speed-up customizations (write the code optimized for your database). By far, the most difficult part is writing the &lt;span class="caps"&gt;SQL&lt;/span&gt; in C-code.&lt;/p&gt;


	&lt;p&gt;Admittedly, I used the mod_authz_svn module source code as a template (knowing nothing about Apache module programming, I figured working code is a good place to start). Some of the old structure still remains, but all of the controlling code has been gutted and replaced. I used the per-directory configuration structure to hold the database configuration. As the database configuration is flexible, it also ballooned the number of variables that are stored. Each of those had to be connected to the Apache configuration file. Because the permissions were no longer being read from a file, I had to replace the file-reading with a database call (3 of them: open, query, close).&lt;/p&gt;


	&lt;h1&gt;How it works&lt;/h1&gt;


It is an Apache2 module so it works just as those work, here&amp;#8217;s the environment setup:
	&lt;ol&gt;
	&lt;li&gt;Build the module (or otherwise obtain it built)&lt;/li&gt;
		&lt;li&gt;Tell Apache where to find it (when Apache starts up, it will load that code in as a shared library and execute the hook scripts so that the module is installed and called correctly)&lt;/li&gt;
		&lt;li&gt;Build/acquire &lt;a href="http://www.diegonet.com/support/mod_auth_mysql.shtml"&gt;mod_auth_mysql&lt;/a&gt; or &lt;a href="http://www.giuseppetanzilli.it/mod_auth_pgsql2/"&gt;mod_auth_pgsql2&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;Configure mod_auth_pgsql2 or mod_auth_mysql in the httpd.conf or in the .htaccess (as applicable)&lt;/li&gt;
		&lt;li&gt;Configure your httpd.conf (or .htaccess files) to use the mod_dav_svn and the mod_authz_svn_db&lt;/li&gt;
		&lt;li&gt;Configure the location of your repository&lt;/li&gt;
		&lt;li&gt;Create a repository&lt;/li&gt;
		&lt;li&gt;Create the database as per the schema&lt;/li&gt;
		&lt;li&gt;Put in a user (or define the anonymous group and permissions)&lt;/li&gt;
		&lt;li&gt;(Re)Start Apache&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Once you have a working environment, here is how requests are handled for anonymous users:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Browser/SVN client requests (GET) document within your repositories path; Example: svn.myserver.com/svnrepos/repositoryX/document.txt&lt;/li&gt;
		&lt;li&gt;Apache handles the &lt;span class="caps"&gt;GET&lt;/span&gt; request and passes it to the authorization chain&lt;/li&gt;
		&lt;li&gt;mod_authz_svn_db is invoked (as it sits in the aforementioned chain)&lt;/li&gt;
		&lt;li&gt;mod_authz_svn_db looks at the database for the user, in this case, since no authorization is present, the default of &amp;#8220;anonymous&amp;#8221; is used&lt;/li&gt;
		&lt;li&gt;Database returns a list of permissions associated with the repository and path for anonymous&lt;/li&gt;
		&lt;li&gt;Module rejects if no permissions found (permissions &lt;em&gt;can&lt;/em&gt; be inherited from parent directories), or if permission is explicitly denied&lt;/li&gt;
		&lt;li&gt;Apache returns the success code (200 OK) if anonymous is allowed or an authorization failure (401) if anonymous is not allowed. If you are authorized in part, but not in another, you will receive a 403 (Forbidden) error, meaning you are not authorized, even if you are authorized to view other parts of the repository.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Anonymous access has two flavors: can be an explicit pseudo-user (you log-in as anonymous and supply a password, but you can explicity reject anonymous users in the database) or it can be an understood default pseudo-user (you never log-in, it automatically assumes your user name is anonymous). Either way, you can control, with very very fine detail what anonymous users can see or do. When you come to a section of the repository that needs permission beyond the anonymous user, you&amp;#8217;ll be prompted for a password and username.&lt;/p&gt;


	&lt;p&gt;For non-anonymous users, it works &lt;span class="caps"&gt;EXACTLY&lt;/span&gt; the same as the explicit anonymous users, only you &lt;em&gt;must&lt;/em&gt; provide a user name and password. Remember: anonymous is a special, reserved, username for anonymous users (so you can&amp;#8217;t use it to identify a specific user).&lt;/p&gt;


	&lt;h1&gt;What can you do with it?&lt;/h1&gt;


	&lt;p&gt;Well, you can create a single directory for lots of repositories. That&amp;#8217;s not novel, mod_dav_svn already lets you do that. You can also deploy permissions for your repositories. That&amp;#8217;s not new either, mod_authz_svn lets you do &lt;em&gt;that.&lt;/em&gt; So what can you do? You can support your permissions with a database. So you can build a web application to manage your repositories and permissions. Trevor and I are working on a Ruby on Rails version we call &amp;#8220;SwitchYard.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Like the name? I thought of it myself ;-). We&amp;#8217;re using rails, so we &lt;em&gt;had&lt;/em&gt; to go with the train theme. Real-life switch yards multiplex few tracks onto many tracks so trains can be connected with various cars and freight. In the same way, SwitchYard is the place where code can be moved, shared, and collaborated on to form a select, productive set of applications built on all the sub-components. SwitchYard, with the help of mod_authz_svn_db and friends, allows you to give &lt;em&gt;wide&lt;/em&gt; and &lt;em&gt;fine&lt;/em&gt; control over their own repositories. No need to get a system administrator involved.&lt;/p&gt;


	&lt;p&gt;SwitchYard talks with the database, the Apache module also talk to the database. Combined, you can do nearly anything, even develop an online community of coders&amp;#8230; Such as &lt;a href="http://www.collab.net/"&gt;CollabNet.&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;What databases?&lt;/h2&gt;


	&lt;p&gt;Right now, the module only supports MySQL and PostgreSQL (my favorite). There is an edge version of SQLite3, but it has not been approved for the trunk build yet. While the source code is provided for each, you have the option of building only the module for the database you desire. Or you can build all and play!&lt;/p&gt;


	&lt;h1&gt;How can I get it?&lt;/h1&gt;


	&lt;p&gt;&lt;del&gt;-Well, Trevor has graciously decided to host it on his server at: &lt;a href="http://tjohns.net/svn/mod_authz_svn_db/"&gt;http://tjohns.net/svn/mod_authz_svn_db/&lt;/a&gt; -&lt;/del&gt;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve moved it to my own server because Trevor shouldn&amp;#8217;t have to host my stuff. It is available here: &lt;a href="http://svn.wojno.com/mod_authz_svn_db"&gt;http://svn.wojno.com/mod_authz_svn_db&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve decided to release this one on the FreeBSD license under the CollabNet license (I borrowed some of their code, so credit is due). I have provided basic make files, guaranteed to build on FreeBSD 6.1. I make no guarantees about other platforms (or any platform for that matter), though Michael Rodgers has informed me that it works (with minor tweaks) on SuSE 10.2. No Windows support yet. I&amp;#8217;ll have to think about how to approach that one. I&amp;#8217;m sure it will build and run, I just am not sure how easy it will be to configure that build script.&lt;/p&gt;


	&lt;p&gt;Anyway: please, take a look and tell me what you think. Took me about a week to code the base, and it&amp;#8217;s been on-going development as of late for the database specific stuff. I hope that one day, this may replace mod_authz_svn! Wish us luck!&lt;/p&gt;


	&lt;p id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; This comes with subversion, you need to build it along with your subversion installation. Sorry there is no page dedicated to this module from subversion at this time (that I could find)&lt;/p&gt;</description>
      <pubDate>Sun, 19 Aug 2007 13:31:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:be73cd2b-7227-4d8c-953d-873ab9e80344</guid>
      <author>Christopher Wojno</author>
      <link>http://christopher.wojno.com/articles/2007/08/19/what-is-mod_authz_svn_db</link>
      <category>SwitchYard</category>
      <category>module</category>
      <category>mod_authz_svn_db</category>
      <category>db</category>
      <category>mod</category>
      <category>authz</category>
      <category>svn</category>
      <category>swichyard</category>
      <category>subversion</category>
      <category>apache</category>
      <category>apache2</category>
    </item>
  </channel>
</rss>
