开发者

Redmine svn repository - can't auth from remote

开发者 https://www.devze.com 2023-03-27 21:00 出处:网络
Here\'s my setup: Ubuntu Server 11.04 Apache 2.2.17 MySQL 5.1.54 RAILS_ENV=production /usr/share/redmine/script/about

Here's my setup:

Ubuntu Server 11.04

Apache 2.2.17

MySQL 5.1.54

RAILS_ENV=production /usr/share/redmine/script/about

About your application's environment
Ruby version              1.8.7 (i686-linux)
RubyGems version          1.3.7
Rack version              1.1
Rails version             2.3.11
Active Record version     2.3.11
Active Resource version   2.3.11
Action Mailer version     2.3.11
Active Support version    2.3.11
Edge Rails revision       unknown
Application root          /usr/share/redmine
Environment               production
Database adapter          mysql
Database schema version   20110511000000

/etc/apache2/sites-available/default

<VirtualHost *:80>
        DocumentRoot /mnt/data/vortex/Dev/Web
        ErrorLog ${APACHE_LOG_DIR}/apache_error.log
        CustomLog ${APACHE_LOG_DIR}/apache_access.log combined
</VirtualHost>

/etc/apache2/sites-available/redmine

DocumentRoot /mnt/data/vortex/Dev/Web/redmine

PassengerDefaultUser www-data
RailsEnv production
RailsBaseURI /redmine

ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined

/etc/apache2/conf.d/redmine-svn.conf

PerlLoadModule Apache::Authn::Redmine
<Location /svn>
        DAV svn
        SVNParentPath "/mnt/data/svn" 

        AuthType Basic
        AuthName Redmine
        Require valid-user

        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler

        RedmineDSN "DBI:mysql:database=redmine_default;host=localhost" 

        RedmineDbUser "redmine" 
        RedmineDbPass "***" 
</Location>

/etc/cron.d/redmine

*/10 * * * * root ruby /usr/share/redmine/extra/svn/reposman.rb --redmine localhost/redmine --svn-dir /mnt/data/svn --owner www-data --url file:///mnt/data/svn --key=***

Everything in Redmine is working fine, the repositories get created by reposman and can be browsed from their project page. The problem arises when i try to access a svn repo via a remote pc.

If i type svn ls http://server-ip/svn/prj it shows me the repo content without asking for login.

With svn mkdir http://server-ip/svn/prj/dir instead it asks for password but as i enter 开发者_Python百科it, I get prompted for login again. After the third try i get the following error:

svn: MKACTIVITY di '/svn/test1/!svn/act/25265483-dc10-4e3b-a7a5-a2e5bb84486f': authorization failed: Could not authenticate to server: rejected Basic challenge (http://192.168.1.201)
  1. I can't figure out why authentication doesn't work.
  2. I was expecting a login prompt also for the svn ls command.

I also checked the sessions on MySQL server and I can't see any for the user 'redmine' when i try to access the repository, so it seems Apache/Redmine don't even try to connect to MySQL for authentication. I followed this guide to set up svn access.

Does someone knows how to fix my problem?

Thank you


I had the same issue. The problem is with the accounts that use LDAP authentication. If you create an internal account and add it to the project as a developer you will be able to commit.

To get Redmine, LDAP, and SVN to work you need to add "PerlLoadModule Authen::Simple::LDAP" to you apache configuration As mentioned here:
http://www.redmine.org/projects/redmine/wiki/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl#optional-LDAP-Authentication

You should have better luck on Ubuntu but to get Authen::Simple::LDAP installed on OpenSUSE 11.3 inside our corperate firewall I had to:

  • get CPAN to FTP in passive mode http://www.netadmintools.com/art273.html
  • configure CPAN and install in the following order

cpan> install Module::Implementation

cpan> install Attribute::Handlers

cpan> install Params::Validate

cpan> install Authen::Simple

cpan> install Authen::Simple::LDAP

  • After this it still was not working so I started debugging. I installed tcpdump and figured out that it was not using the configured port to do the authentication. I modified Redmine.pm from a hostname to a URL and that fixed it

        # open (LEELOG, ">>/tmp/leelog");
        # print LEELOG "-----------\n";
        # print LEELOG "$rowldap[0]\n";
        # print LEELOG "$rowldap[1]\n";
        # print LEELOG "$rowldap[2]\n";
        # print LEELOG "$rowldap[3]\n";
        # print LEELOG "$rowldap[4]\n";
        # print LEELOG "$rowldap[5]\n";
        # print LEELOG "$rowldap[6]\n";
    
        my $ldap = Authen::Simple::LDAP->new(
            host    =>      ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : "ldap://$rowldap[0]:$rowldap[1]",
            port    =>      $rowldap[1],
            basedn  =>      $rowldap[5],
            binddn  =>      $rowldap[3] ? $rowldap[3] : "",
            bindpw  =>      $rowldap[4] ? $rowldap[4] : "",
            filter  =>      "(".$rowldap[6]."=%s)"
    

This page is helpful:
http://www.rhonabwy.com/wp/2009/12/24/debugging-active-directory-ldap-authentication-in-redmine/


In my situation, I just unclick Settings-Information-Public and it works! Public projects don't need auth and I cannot commit.

I didn't use LDAP.

0

精彩评论

暂无评论...
验证码 换一张
取 消