Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The last few days I have been trying to set up my home SVN server using MySQL authentication. I believe I have all the applications installed, and hoped everything was configured right... but it still won't work.

I am running a Debian server, svn 1.5.1 and apache2. This is my dav_svn.conf file:

<Location /svn>
  DAV svn
  SVNParentPath /var/svn-repos
  AuthBasicAuthoritative Off

  # our access control policy
  AuthzSVNAccessFile /var/svn-access/accessfile

  AuthMYSQL on
  AuthMySQL_Authoritative on
  AuthMySQL_DB svn
  AuthMySQL_Password_Table users
  AuthMySQL_Username_Field login
  AuthMySQL_Password_Field pass
  AuthMySQL_Empty_Passwords off
  AuthMySQL_Encryption_Types Crypt_MD5

  # try anonymous access first, resort to real
  # authentication if necessary.
  Satisfy Any
  Require valid-user

  AuthType Basic
  AuthName "Subversion repository"
  #AuthUserFile /var/www/svn-access/htpasswdsvnrepos
</Location>

I don't really know what I should put into my "accessfile" but maybe someone can explain that for me.

I get the following errors in my logs:

==> access.log <==
10.0.1.1 - - [25/Aug/2010:17:20:00 +0200] "GET /svn/project_wombat HTTP/1.1" 401 384 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"

==> error.log <==
[Wed Aug 25 17:20:00 2010] [error] [client 10.0.1.1] Failed to load the AuthzSVNAccessFile: An authz rule refers to group '@project_wombat', which is undefined

==> access.log <==
10.0.1.1 - paulp [25/Aug/2010:17:20:03 +0200] "GET /svn/project_wombat HTTP/1.1" 401 384 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"

==> error.log <==
[Wed Aug 25 17:20:03 2010] [error] Internal error: pcfg_openfile() called with NULL filename
[Wed Aug 25 17:20:03 2010] [error] [client 10.0.1.1] (9)Bad file descriptor: Could not open password file: (null)

On top of these issue I would like to define in a mysql db which users have access to which repositories.

This is my db setup:

CREATE TABLE IF NOT EXISTS `groups` (
  `gid` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`gid`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

CREATE TABLE IF NOT EXISTS `usergroup` (
  `uid` int(10) unsigned NOT NULL default '0',
  `gid` int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (`uid`,`gid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `users` (
  `uid` int(10) unsigned NOT NULL auto_increment,
  `login` varchar(20) NOT NULL default '',
  `pass` varchar(60) NOT NULL default '',
  `firstname` varchar(255) NOT NULL default '',
  `lastname` varchar(255) NOT NULL default '',
  `email` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`uid`),
  UNIQUE KEY `login` (`login`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

Anyone who can help me, maybe put me in the right direction?

Regards, Paul Peelen

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I got it working, for now.

I still don't got the project grouping working, but thats a problem for later.

I used the drupal user table layout (don't ask me why! ;) ) And this is my dav_svn.conf:

<Location /svn>
    DAV svn
    SVNParentPath /var/svn-repos
    Order Deny,Allow
    Allow from All

    # basic settings
    AuthType Basic
    AuthName "Stare SVN Server"
    Auth_MySQL On
    Auth_MySQL_Authoritative On

    # work-around for "Bad file descriptor"
    AuthUserFile /dev/null
    AuthBasicAuthoritative Off

    #MySQL DB
    Auth_MySQL_Host localhost
    Auth_MySQL_DB "svn"
    Auth_MySQL_User "root"
    Auth_MySQL_Password "password"

    #User Tables
    Auth_MySQL_Password_Table "users"
    Auth_MySQL_Username_Field "name"
    Auth_MySQL_Password_Field "pass"
    Auth_MySQL_Encryption_Types PHP_MD5
    Auth_MySQL_Empty_Passwords off

    #Group Tables
    Auth_MySQL_Group_Table "users, users_roles"
    Auth_MySQL_Group_Field users_roles.rid

    #WHERE Clauses
    Auth_MySQL_Password_Clause " AND status = 1"
    Auth_MySQL_Group_Clause " AND users_roles.uid = users.uid"

    #read access
    <Limit GET PROPFIND OPTIONS REPORT>
        Require valid-user
    </Limit>

    #write access
    <LimitExcept GET PROPFIND OPTIONS REPORT>
        # change this to the rid of the role you allow to commit
        Require group 4
    </LimitExcept>

</Location>

/P

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.