Project

General

Profile

Multiple redmine authentication

Added by Jaroslav . over 11 years ago

Hi everyone,

Problem

There are multiple redmine instances in my environment separated using apache2-mpm-itk. Each instance has own user and home directory. Redmine instances are working very well. The problem is Redmine.pm auth module for Apache2. Only one (the last virtualhost) is working well. The rest show me error:

[Sat Apr 20 02:22:18 2013] [error] [client 127.0.0.1] Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /var/www/redmine_test2/redmine/extra/svn/Redmine.pm line 541\n

Directory design

  • All data in /var/www/redmine_test* (change star for redmine instance id)
  • /var/www/redmine_test*/redmine - redmine source files
  • /var/www/redmine_test*/log - apache2 error and access log
  • /var/www/redmine_test*/git - git repozitories

Apache2 virtualhost

  • Virtualhost is for all redmine instances the same - only changing redmine_test(ID).
<VirtualHost _default_:443>
    DocumentRoot /var/www/redmine_test2/redmine/public
    ServerName redmine_test2

    SSLEngine On
    SSLCertificateFile /etc/ssl/ssl/redmine_test.pem

    RewriteEngine on

    # ITK

    AssignUserId redmine_test2 redmine_test2
    MaxClientsVHost 10

    # Directories

    <Directory /var/www/redmine_test2/redmine/public>
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>

    # Redmine

    PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.19/
    PassengerRuby /usr/bin/ruby1.8
    PassengerDefaultUser redmine_test2
    PassengerUserSwitching on
    PassengerUseGlobalQueue off
    PassengerRestartDir /var/local/passenger
    RailsEnv production
    RailsBaseURI /redmine

    # Git

    PerlOptions +Parent
    PerlOptions -GlobalRequest
    PerlSwitches -I/var/www/redmine_test2/redmine/extra/svn

    PerlLoadModule Redmine
    SetEnv GIT_PROJECT_ROOT /var/www/redmine_test2/git/
    SetEnv GIT_HTTP_EXPORT_ALL

    <Directory "/var/www/redmine_test2/git/">
        Options None
        AllowOverride None
        Order Allow,Deny
        Allow from all
    </Directory>

    <Location "/git/">
        AuthType Basic
        AuthName "GM Git Repositories
        Require valid-user

        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=redmine_test2;host=localhost" 
        RedmineDbUser "redmine_test2" 
        RedmineDbPass "..." 
        RedmineGitSmartHttp yes
    </Location>

    ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

    # Logs

    LogLevel debug
    ErrorLog /var/www/redmine_test2/log/error.log
    CustomLog /var/www/redmine_test2/log/access.log combined
</VirtualHost>

Server informations

  • System: Debian Squeeze
  • Webserver: apache2-mpm-itk 2.2.16 (each redmine = 1 system user)
  • Ruby: libapache2-mod-passenger 2.2.11debian-2
  • Mod_perl: libapache2-mod-perl2 2.0.4-7+squeeze1

Redmine informations

Environment:
  Redmine version                          2.3.0.stable
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.13
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  no plugin installed

Replies (2)

RE: Multiple redmine authentication - Added by Paresh Patel over 11 years ago

hi,Jaroslav

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
UseCanonicalName Off
Include /etc/apache2/conf/redmine.conf
</VirtualHost>

<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cert.pem
Include /etc/apache2/conf/redmine.conf
RequestHeader set X_FORWARDED_PROTO 'https'
</VirtualHost>

above configure your file add then old configuration remove

i 100% sure your problem solve then any problem occur reply me

Your Regrade
Paresh.Patel
Email Id :

RE: Multiple redmine authentication - Added by Jaroslav . about 11 years ago

Hi Paresh,

thanks for reply. After a lot of spent time I have found the solution.

I copied Redmine.pm file to /usr/share/perl/5.14/Redmine.pm, so it is now shared between all redmine instances.

Current version is: mod_passenger + mod_perl2 + apache2-mpm-itk + debian wheezy. I have to admit, that I also migrated from squeeze to wheezy. Unfortunately, there is something wrong with combination mpm-itk and mod_perl. When I added: PerlOptions +Parent, apache segfaulted:

[64545.894938] /usr/sbin/apach[5556]: segfault at c ip 00007f56fdc5143d sp 00007fffd8d59cc0 error 4 in libperl.so.5.14.2[7f56fdbfd000+177000]

Working virtualhost for each redmine:

<VirtualHost _default_:443>
    DocumentRoot /var/www/redmine.mydomain.tld/redmine/public
    ServerName redmine.mydomain.tld

    SSLEngine On
    SSLCertificateFile /etc/ssl/ssl/default.pem

    RewriteEngine on

    # ITK

    AssignUserId user1 user1
    MaxClientsVHost 10

    # Directories

    <Directory /var/www/redmine.mydomain.tld/redmine/public>
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>

    # Redmine
    PassengerDefaultUser user1
    PassengerUploadBufferDir /var/www/redmine.mydomain.tld/temp/
    PassengerUseGlobalQueue off
    PassengerMinInstances 1
    RailsEnv production
    RackBaseURI /redmine

    # Git

    PerlLoadModule Redmine
    SetEnv GIT_PROJECT_ROOT /var/www/redmine.mydomain.tld/git/
    SetEnv GIT_HTTP_EXPORT_ALL

    <Directory "/var/www/redmine.mydomain.tld/git/">
        Options None
        AllowOverride None
        Order Allow,Deny
        Allow from all
    </Directory>
    <Location "/git/">
        AuthType Basic
        AuthName "GM Git Repositories
        Require valid-user
        AuthBasicAuthoritative Off
        AuthUserFile /dev/null

        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=user1;host=localhost" 
        RedmineDbUser "user1" 
        RedmineDbPass "" 
        RedmineGitSmartHttp yes
    </Location>

    ScriptAlias /git/ /usr/lib/git-core/git-http-backend/

    # Logs

    ErrorLog /var/www/redmine.mydomain.tld/log/error.log
    CustomLog /var/www/redmine.mydomain.tld/log/access.log combined
</VirtualHost>

    (1-2/2)