Linux and Open Source Blog

  • Home
  • WordPress Plugins
  • About
  • Contact

How to Password Protect Redmine using mod_perl, Apache and Redmine.pm – HOWTO

Posted on December 18, 2011 by Linewbie.com Posted in how to .
Facebook0
Google+0
Twitter0
Pinterest0

Currently I was required to password-protect some sort of Redmine setting up. I’ve commonly used mod_auth_mysql intended for similar initiatives, but Redmine relies on a salted code format that’s incompatible having mod_auth_mysql. And so, I taken on Apache/Perl authentication, a first in my opinion (When i rarely hint Perl) and could make the item work.

1.Install mod_perl, and the DBI, MySQL, and Digest (SHA1) Perl modules.

$ apt-get install libapache-dbi-perl libapache2-mod-perl2 libdbd-

2. Copy Redmine.pm to the relevant Perl location.

$ cd /path/to/redmine
$ mkdir -p /usr/lib/perl5/Apache/Authn
$ cp extra/svn/Redmine.pm /usr/lib/perl5/Apache/Authn/

3. Maybe I’m not using Redmine’s projects/members/permissions right, but I had to patch Redmine.pm to get it to function for me. I simplified the SQL statement used to auth a user. There’s no sense of permissions; it’s pretty much a yes/no for authed users.

--- Redmine.pm  2011-11-12 17:33:10.000000000 -0700
+++ Redmine.richardkmiller.pm   2011-11-12 17:37:26.000000000 -0700
@@ -148,16 +148,11 @@
   my ($self, $parms, $arg) = @_;
   $self->{RedmineDSN} = $arg;
   my $query = "SELECT
-                 hashed_password, salt, auth_source_id, permissions
-              FROM members, projects, users, roles, member_roles
+                 hashed_password, salt
+              FROM users
               WHERE
-                projects.id=members.project_id
-                AND member_roles.member_id=members.id
-                AND users.id=members.user_id
-                AND roles.id=member_roles.role_id
-                AND users.status=1
-                AND login=?
-                AND identifier=? ";
+                    users.status=1
+                AND login=?";
   $self->{RedmineQuery} = trim($query);
 }

@@ -336,11 +331,12 @@
   }
   my $query = $cfg->{RedmineQuery};
   my $sth = $dbh->prepare($query);
-  $sth->execute($redmine_user, $project_id);
+  $sth->execute($redmine_user);

   my $ret;
-  while (my ($hashed_password, $salt, $auth_source_id, $permissions) = $sth->fetchrow_array) {
-
+  while (my ($hashed_password, $salt) = $sth->fetchrow_array) {
+      my $permissions = ":commit_access";
+      my $auth_source_id = 0;
       unless ($auth_source_id) {
                my $method = $r->method;
           my $salted_password = Digest::SHA1::sha1_hex($salt.$pass_digest);

4. Configure and restart Apache.


    ServerName example.com
    DocumentRoot "/var/www/sites/example.com/public"
    RailsEnv production

    PerlLoadModule Apache::Authn::Redmine


        AuthType basic
        AuthName "Private Area"
        Require valid-user
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        RedmineDSN "DBI:mysql:database=my_database;host=localhost"
        RedmineDbUser my_db_user
        RedmineDbPass my_db_password


Also note that, I’m running Ubuntu 11.10 (oneiric), Apache 2.2, MySQL 5.1, and Redmine 1.2.2.

random friendly ad link:
clicky
clicky
clicky
clicky
clicky
clicky

1 Comment
« How to Dual Boot Windows 8 and Linux Mint on the Same PC – Howto
Puppy Linux Review for 2012 »

One Response

  1. Noom_Nt says
    November 15, 2012 at 2:21 pm

    tang

    Reply

Leave a comment

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Refresh

*

Recent Posts

  • Does an un-confirmed Bitcoin transaction expire?
  • Looting of the Fox: The Story of Sabotage at ShapeShift
  • Decentralization, Scalability, and Fault Tolerance of Bitcoin
  • Stripe will soon accept Bitcoin payments
  • Zynga announces Bitcoin acceptance in game
  • How to import very large sql dump via phpmyadmin
  • How to compare the content of two folders automatically
  • Top 5 reasons to start experimenting with Linux
  • The day our mind became open sourced
  • Mark Shuttleworth wants to turn canonical (ubuntu) into the next Apple Inc.

Categories

  • applications/software (26)
    • browsers (2)
    • development (1)
    • information management (1)
    • Mobility (1)
    • multimedia (5)
    • office suites (2)
    • security (6)
    • servers (6)
    • system (2)
  • audio/video/pics (3)
  • Bitcoin (3)
  • books & literature (1)
  • cms/portals (1)
  • desktop environments (7)
    • gnome (2)
    • kde (5)
  • events/shows (3)
    • interviews (1)
    • people (1)
    • surveys (1)
  • games & gaming (2)
  • general topics (4)
  • guides (112)
    • how to (105)
    • tips (87)
    • tutorials (86)
  • hardware (8)
    • desktop & laptop pc (5)
    • gadgets & mobiles (2)
  • howtoforge (47)
  • internet/web (4)
    • design & development (2)
  • linux and open source blog (49)
  • linux.com (76)
  • linux/unix/os distros (113)
    • debian/ubuntu based (10)
    • mac/osx (2)
    • other distros (3)
  • news (217)
  • open source (8)
    • business & foss (2)
  • other (26)
    • uncategorized (26)
  • Programming (3)
    • PHP (2)
  • quotes & thoughts (10)
  • random stuff (4)
    • cool stuff (3)
    • funny stuff (1)
  • review/preview/tests (7)
  • wordpress/blogging (3)

Archives

  • July 2016
  • April 2016
  • January 2015
  • April 2014
  • January 2014
  • November 2013
  • February 2013
  • November 2012
  • April 2012
  • March 2012
  • January 2012
  • December 2011
  • August 2011
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2006

Recent Posts

  • Does an un-confirmed Bitcoin transaction expire?
  • Looting of the Fox: The Story of Sabotage at ShapeShift
  • Decentralization, Scalability, and Fault Tolerance of Bitcoin
  • Stripe will soon accept Bitcoin payments
  • Zynga announces Bitcoin acceptance in game
  • How to import very large sql dump via phpmyadmin
  • How to compare the content of two folders automatically
  • Top 5 reasons to start experimenting with Linux
  • The day our mind became open sourced
  • Mark Shuttleworth wants to turn canonical (ubuntu) into the next Apple Inc.

Categories

  • applications/software (26)
    • browsers (2)
    • development (1)
    • information management (1)
    • Mobility (1)
    • multimedia (5)
    • office suites (2)
    • security (6)
    • servers (6)
    • system (2)
  • audio/video/pics (3)
  • Bitcoin (3)
  • books & literature (1)
  • cms/portals (1)
  • desktop environments (7)
    • gnome (2)
    • kde (5)
  • events/shows (3)
    • interviews (1)
    • people (1)
    • surveys (1)
  • games & gaming (2)
  • general topics (4)
  • guides (112)
    • how to (105)
    • tips (87)
    • tutorials (86)
  • hardware (8)
    • desktop & laptop pc (5)
    • gadgets & mobiles (2)
  • howtoforge (47)
  • internet/web (4)
    • design & development (2)
  • linux and open source blog (49)
  • linux.com (76)
  • linux/unix/os distros (113)
    • debian/ubuntu based (10)
    • mac/osx (2)
    • other distros (3)
  • news (217)
  • open source (8)
    • business & foss (2)
  • other (26)
    • uncategorized (26)
  • Programming (3)
    • PHP (2)
  • quotes & thoughts (10)
  • random stuff (4)
    • cool stuff (3)
    • funny stuff (1)
  • review/preview/tests (7)
  • wordpress/blogging (3)

Archives

  • July 2016
  • April 2016
  • January 2015
  • April 2014
  • January 2014
  • November 2013
  • February 2013
  • November 2012
  • April 2012
  • March 2012
  • January 2012
  • December 2011
  • August 2011
  • March 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2006
Privacy Policy

Est. 2002

linewbie.com serving the linux and open source community since April 09, 2002

CyberChimps WordPress Themes

© Linux and Open Source Blog