##// END OF EJS Templates
Redmine.pm: HEAD is not considered as a read-only method (#11749)....
Redmine.pm: HEAD is not considered as a read-only method (#11749). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10279 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r10096:94db7c0029ac
r10096:94db7c0029ac
Show More
Redmine.pm
543 lines | 16.0 KiB | text/x-perl | PerlLexer
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 package Apache::Authn::Redmine;
=head1 Apache::Authn::Redmine
Redmine - a mod_perl module to authenticate webdav subversion users
against redmine database
=head1 SYNOPSIS
This module allow anonymous users to browse public project and
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 registred users to browse and commit their project. Authentication is
done against the redmine database or the LDAP configured in redmine.
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
This method is far simpler than the one with pam_* and works with all
database without an hassle but you need to have apache/mod_perl on the
svn server.
=head1 INSTALLATION
For this to automagically work, you need to have a recent reposman.rb
(after r860) and if you already use reposman, read the last section to
migrate.
Sorry ruby users but you need some perl modules, at least mod_perl2,
DBI and DBD::mysql (or the DBD driver for you database as it should
work on allmost all databases).
On debian/ubuntu you must do :
aptitude install libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 If your Redmine users use LDAP authentication, you will also need
Jean-Philippe Lang
Redmine.pm doc update...
r1322 Authen::Simple::LDAP (and IO::Socket::SSL if LDAPS is used):
aptitude install libauthen-simple-ldap-perl libio-socket-ssl-perl
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 =head1 CONFIGURATION
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 ## This module has to be in your perl path
## eg: /usr/lib/perl5/Apache/Authn/Redmine.pm
PerlLoadModule Apache::Authn::Redmine
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 <Location /svn>
DAV svn
SVNParentPath "/var/svn"
AuthType Basic
AuthName redmine
Require valid-user
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 ## for mysql
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 RedmineDSN "DBI:mysql:database=databasename;host=my.db.server"
Liwiusz Ociepa
Memory leak (postgres -> zlib + ssl) has been fixed by apache developers....
r1423 ## for postgres
# RedmineDSN "DBI:Pg:dbname=databasename;host=my.db.server"
Liwiusz Ociepa
Merge changes from branch swistak....
r1410
RedmineDbUser "redmine"
RedmineDbPass "password"
## Optional where clause (fulltext search would be slow and
## database dependant).
# RedmineDbWhereClause "and members.role_id IN (1,2)"
## Optional credentials cache size
# RedmineCacheCredsMax 50
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 </Location>
To be able to browse repository inside redmine, you must add something
like that :
<Location /svn-private>
DAV svn
SVNParentPath "/var/svn"
Order deny,allow
Deny from all
# only allow reading orders
<Limit GET PROPFIND OPTIONS REPORT>
Allow from redmine.server.ip
</Limit>
</Location>
and you will have to use this reposman.rb command line to create repository :
reposman.rb --redmine my.redmine.server --svn-dir /var/svn --owner www-data -u http://svn.server/svn-private/
Jean-Philippe Lang
Makes Redmine.pm work with multiple repositories per project (#779)....
r9136 =head1 REPOSITORIES NAMING
A projet repository must be named with the projet identifier. In case
of multiple repositories for the same project, use the project identifier
and the repository identifier separated with a dot:
/var/svn/foo
/var/svn/foo.otherrepo
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 =head1 MIGRATION FROM OLDER RELEASES
If you use an older reposman.rb (r860 or before), you need to change
rights on repositories to allow the apache user to read and write
S<them :>
sudo chown -R www-data /var/svn/*
sudo chmod -R u+w /var/svn/*
And you need to upgrade at least reposman.rb (after r860).
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 =head1 GIT SMART HTTP SUPPORT
Git's smart HTTP protocol (available since Git 1.7.0) will not work with the
above settings. Redmine.pm normally does access control depending on the HTTP
method used: read-only methods are OK for everyone in public projects and
members with read rights in private projects. The rest require membership with
commit rights in the project.
However, this scheme doesn't work for Git's smart HTTP protocol, as it will use
POST even for a simple clone. Instead, read-only requests must be detected using
the full URL (including the query string): anything that doesn't belong to the
git-receive-pack service is read-only.
To activate this mode of operation, add this line inside your <Location /git>
block:
RedmineGitSmartHttp yes
Here's a sample Apache configuration which integrates git-http-backend with
a MySQL database and this new option:
SetEnv GIT_PROJECT_ROOT /var/www/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<Location /git>
Order allow,deny
Allow from all
AuthType Basic
AuthName Git
Require valid-user
PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
# for mysql
RedmineDSN "DBI:mysql:database=redmine;host=127.0.0.1"
RedmineDbUser "redmine"
RedmineDbPass "xxx"
RedmineGitSmartHttp yes
</Location>
Make sure that all the names of the repositories under /var/www/git/ have a
matching identifier for some project: /var/www/git/myproject and
/var/www/git/myproject.git will work. You can put both bare and non-bare
repositories in /var/www/git, though bare repositories are strongly
recommended. You should create them with the rights of the user running Redmine,
like this:
cd /var/www/git
sudo -u user-running-redmine mkdir myproject
cd myproject
sudo -u user-running-redmine git init --bare
Once you have activated this option, you have three options when cloning a
repository:
- Cloning using "http://user@host/git/repo(.git)" works, but will ask for the password
all the time.
- Cloning with "http://user:pass@host/git/repo(.git)" does not have this problem, but
this could reveal accidentally your password to the console in some versions
of Git, and you would have to ensure that .git/config is not readable except
by the owner for each of your projects.
- Use "http://host/git/repo(.git)", and store your credentials in the ~/.netrc
file. This is the recommended solution, as you only have one file to protect
and passwords will not be leaked accidentally to the console.
IMPORTANT NOTE: It is *very important* that the file cannot be read by other
users, as it will contain your password in cleartext. To create the file, you
can use the following commands, replacing yourhost, youruser and yourpassword
with the right values:
touch ~/.netrc
chmod 600 ~/.netrc
echo -e "machine yourhost\nlogin youruser\npassword yourpassword" > ~/.netrc
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 =cut
use strict;
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 use warnings FATAL => 'all', NONFATAL => 'redefine';
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
use DBI;
Jean-Philippe Lang
Use Digest::SHA instead of Digest::SHA1 in Redmine.pm (#10242)....
r8762 use Digest::SHA;
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 # optional module for LDAP authentication
my $CanUseLDAPAuth = eval("use Authen::Simple::LDAP; 1");
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
use Apache2::Module;
use Apache2::Access;
use Apache2::ServerRec qw();
use Apache2::RequestRec qw();
use Apache2::RequestUtil qw();
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 use Apache2::Const qw(:common :override :cmd_how);
use APR::Pool ();
use APR::Table ();
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 # use Apache2::Directive qw();
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my @directives = (
{
name => 'RedmineDSN',
req_override => OR_AUTHCFG,
args_how => TAKE1,
errmsg => 'Dsn in format used by Perl DBI. eg: "DBI:Pg:dbname=databasename;host=my.db.server"',
},
{
name => 'RedmineDbUser',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
{
name => 'RedmineDbPass',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
{
name => 'RedmineDbWhereClause',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
{
name => 'RedmineCacheCredsMax',
req_override => OR_AUTHCFG,
args_how => TAKE1,
errmsg => 'RedmineCacheCredsMax must be decimal number',
},
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 {
name => 'RedmineGitSmartHttp',
req_override => OR_AUTHCFG,
args_how => TAKE1,
},
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 );
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895 sub RedmineDSN {
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my ($self, $parms, $arg) = @_;
$self->{RedmineDSN} = $arg;
my $query = "SELECT
Jean-Philippe Lang
Makes Redmine.pm handle project status (#3640)....
r9704 users.hashed_password, users.salt, users.auth_source_id, roles.permissions, projects.status
Jean-Philippe Lang
Fixed: Redmine.pm considers all projects private when login_required is enabled (#9566)....
r7714 FROM projects, users, roles
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 WHERE
Jean-Philippe Lang
Fixed: Redmine.pm considers all projects private when login_required is enabled (#9566)....
r7714 users.login=?
AND projects.identifier=?
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 AND users.status=1
Jean-Philippe Lang
Fixed: Redmine.pm considers all projects private when login_required is enabled (#9566)....
r7714 AND (
roles.id IN (SELECT member_roles.role_id FROM members, member_roles WHERE members.user_id = users.id AND members.project_id = projects.id AND members.id = member_roles.member_id)
OR
(roles.builtin=1 AND cast(projects.is_public as CHAR) IN ('t', '1'))
) ";
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 $self->{RedmineQuery} = trim($query);
}
Jean-Philippe Lang
Fixes Redmine.pm broken by r2726 (#3330)....
r2633
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 sub RedmineDbUser { set_val('RedmineDbUser', @_); }
sub RedmineDbPass { set_val('RedmineDbPass', @_); }
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895 sub RedmineDbWhereClause {
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my ($self, $parms, $arg) = @_;
$self->{RedmineQuery} = trim($self->{RedmineQuery}.($arg ? $arg : "")." ");
}
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895 sub RedmineCacheCredsMax {
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my ($self, $parms, $arg) = @_;
if ($arg) {
$self->{RedmineCachePool} = APR::Pool->new;
$self->{RedmineCacheCreds} = APR::Table::make($self->{RedmineCachePool}, $arg);
$self->{RedmineCacheCredsCount} = 0;
$self->{RedmineCacheCredsMax} = $arg;
}
}
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 sub RedmineGitSmartHttp {
my ($self, $parms, $arg) = @_;
$arg = lc $arg;
if ($arg eq "yes" || $arg eq "true") {
$self->{RedmineGitSmartHttp} = 1;
} else {
$self->{RedmineGitSmartHttp} = 0;
}
}
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 sub trim {
my $string = shift;
$string =~ s/\s{2,}/ /g;
return $string;
}
sub set_val {
my ($key, $self, $parms, $arg) = @_;
$self->{$key} = $arg;
}
Apache2::Module::add(__PACKAGE__, \@directives);
Jean-Philippe Lang
Redmine.pm: HEAD is not considered as a read-only method (#11749)....
r10096 my %read_only_methods = map { $_ => 1 } qw/GET HEAD PROPFIND REPORT OPTIONS/;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 sub request_is_read_only {
my ($r) = @_;
my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
# Do we use Git's smart HTTP protocol, or not?
if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp}) {
my $uri = $r->unparsed_uri;
my $location = $r->location;
my $is_read_only = $uri !~ m{^$location/*[^/]+/+(info/refs\?service=)?git\-receive\-pack$}o;
return $is_read_only;
} else {
# Standard behaviour: check the HTTP method
my $method = $r->method;
return defined $read_only_methods{$method};
}
}
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 sub access_handler {
my $r = shift;
unless ($r->some_auth_required) {
$r->log_reason("No authentication has been configured");
return FORBIDDEN;
}
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 return OK unless request_is_read_only($r);
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
my $project_id = get_project_identifier($r);
$r->set_handlers(PerlAuthenHandler => [\&OK])
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 if is_public_project($project_id, $r) && anonymous_role_allows_browse_repository($r);
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
return OK
}
sub authen_handler {
my $r = shift;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 my ($res, $redmine_pass) = $r->get_basic_auth_pw();
return $res unless $res == OK;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 if (is_member($r->user, $redmine_pass, $r)) {
return OK;
} else {
$r->note_auth_failure();
return AUTH_REQUIRED;
}
}
Eric Davis
Have Redmine.pm respect the Authentication Required setting. #5797...
r3717 # check if authentication is forced
sub is_authentication_forced {
my $r = shift;
my $dbh = connect_database($r);
my $sth = $dbh->prepare(
"SELECT value FROM settings where settings.name = 'login_required';"
);
$sth->execute();
my $ret = 0;
if (my @row = $sth->fetchrow_array) {
if ($row[0] eq "1" || $row[0] eq "t") {
$ret = 1;
}
}
$sth->finish();
undef $sth;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Eric Davis
Have Redmine.pm respect the Authentication Required setting. #5797...
r3717 $dbh->disconnect();
undef $dbh;
$ret;
}
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 sub is_public_project {
my $project_id = shift;
my $r = shift;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Jean-Philippe Lang
Reverted r7808 (#9566)....
r7693 if (is_authentication_forced($r)) {
return 0;
}
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
my $dbh = connect_database($r);
my $sth = $dbh->prepare(
Jean-Philippe Lang
Makes Redmine.pm handle project status (#3640)....
r9704 "SELECT is_public FROM projects WHERE projects.identifier = ? AND projects.status <> 9;"
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 );
$sth->execute($project_id);
Jean-Philippe Lang
Fixes Redmine.pm for SQLite (#4205)....
r3132 my $ret = 0;
if (my @row = $sth->fetchrow_array) {
if ($row[0] eq "1" || $row[0] eq "t") {
$ret = 1;
}
}
Jean-Philippe Lang
Close statement handler in Redmine.pm (#1433)....
r1525 $sth->finish();
Jean-Philippe Lang
Fixes Redmine.pm error "closing dbh with active statement handles at /usr/lib/perl5/Apache/Redmine.pm" (#4205)....
r3186 undef $sth;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 $dbh->disconnect();
Jean-Philippe Lang
Fixes Redmine.pm error "closing dbh with active statement handles at /usr/lib/perl5/Apache/Redmine.pm" (#4205)....
r3186 undef $dbh;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
$ret;
}
Jean-Philippe Lang
Reverted r7808 (#9566)....
r7693 sub anonymous_role_allows_browse_repository {
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 my $r = shift;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 my $dbh = connect_database($r);
my $sth = $dbh->prepare(
Jean-Philippe Lang
Reverted r7808 (#9566)....
r7693 "SELECT permissions FROM roles WHERE builtin = 2;"
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 );
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Jean-Philippe Lang
Reverted r7808 (#9566)....
r7693 $sth->execute();
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 my $ret = 0;
if (my @row = $sth->fetchrow_array) {
if ($row[0] =~ /:browse_repository/) {
$ret = 1;
}
}
$sth->finish();
undef $sth;
$dbh->disconnect();
undef $dbh;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Toshi MARUYAMA
Restrict anonymous read access with Redmine.pm...
r7459 $ret;
}
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 # perhaps we should use repository right (other read right) to check public access.
# it could be faster BUT it doesn't work for the moment.
# sub is_public_project_by_file {
# my $project_id = shift;
# my $r = shift;
# my $tree = Apache2::Directive::conftree();
# my $node = $tree->lookup('Location', $r->location);
# my $hash = $node->as_hash;
# my $svnparentpath = $hash->{SVNParentPath};
# my $repos_path = $svnparentpath . "/" . $project_id;
# return 1 if (stat($repos_path))[2] & 00007;
# }
sub is_member {
my $redmine_user = shift;
my $redmine_pass = shift;
my $r = shift;
my $dbh = connect_database($r);
my $project_id = get_project_identifier($r);
Jean-Philippe Lang
Use Digest::SHA instead of Digest::SHA1 in Redmine.pm (#10242)....
r8762 my $pass_digest = Digest::SHA::sha1_hex($redmine_pass);
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 my $access_mode = request_is_read_only($r) ? "R" : "W";
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
my $usrprojpass;
if ($cfg->{RedmineCacheCredsMax}) {
Jean-Philippe Lang
Fixed: Redmine.pm potential security issue with cache credential enabled and subversion (#9567)....
r7689 $usrprojpass = $cfg->{RedmineCacheCreds}->get($redmine_user.":".$project_id.":".$access_mode);
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 return 1 if (defined $usrprojpass and ($usrprojpass eq $pass_digest));
}
my $query = $cfg->{RedmineQuery};
my $sth = $dbh->prepare($query);
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 $sth->execute($redmine_user, $project_id);
my $ret;
Jean-Philippe Lang
Makes Redmine.pm handle project status (#3640)....
r9704 while (my ($hashed_password, $salt, $auth_source_id, $permissions, $project_status) = $sth->fetchrow_array) {
if ($project_status eq "9" || ($project_status ne "1" && $access_mode eq "W")) {
last;
}
Jean-Philippe Lang
Merged nbc branch @ r1812 (commit access permission and reposman improvements)....
r1812
unless ($auth_source_id) {
Jean-Philippe Lang
Adds random salt to user passwords (#7410)....
r4816 my $method = $r->method;
Jean-Philippe Lang
Use Digest::SHA instead of Digest::SHA1 in Redmine.pm (#10242)....
r8762 my $salted_password = Digest::SHA::sha1_hex($salt.$pass_digest);
Jean-Philippe Lang
Fixed: Redmine.pm potential security issue with cache credential enabled and subversion (#9567)....
r7689 if ($hashed_password eq $salted_password && (($access_mode eq "R" && $permissions =~ /:browse_repository/) || $permissions =~ /:commit_access/) ) {
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 $ret = 1;
last;
}
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 } elsif ($CanUseLDAPAuth) {
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 my $sthldap = $dbh->prepare(
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 "SELECT host,port,tls,account,account_password,base_dn,attr_login from auth_sources WHERE id = ?;"
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 );
Jean-Philippe Lang
Merged nbc branch @ r1812 (commit access permission and reposman improvements)....
r1812 $sthldap->execute($auth_source_id);
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 while (my @rowldap = $sthldap->fetchrow_array) {
Jean-Philippe Lang
Fixed that Redmine.pm does not support "bind as user" ldap authentication (#11046)....
r9572 my $bind_as = $rowldap[3] ? $rowldap[3] : "";
my $bind_pw = $rowldap[4] ? $rowldap[4] : "";
if ($bind_as =~ m/\$login/) {
# replace $login with $redmine_user and use $redmine_pass
$bind_as =~ s/\$login/$redmine_user/g;
$bind_pw = $redmine_pass
}
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 my $ldap = Authen::Simple::LDAP->new(
Jean-Baptiste Barth
Fixed Redmine.pm not working with LDAPS on a non-standard port. #4065...
r4195 host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0],
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 port => $rowldap[1],
basedn => $rowldap[5],
Jean-Philippe Lang
Fixed that Redmine.pm does not support "bind as user" ldap authentication (#11046)....
r9572 binddn => $bind_as,
bindpw => $bind_pw,
Jean-Philippe Lang
Redmine.pm for webdav authentication:...
r1321 filter => "(".$rowldap[6]."=%s)"
);
Eric Davis
Check the browse repository or commit access permissions in Redmine.pm with LDAP. #5797...
r3718 my $method = $r->method;
Jean-Philippe Lang
Fixed: Redmine.pm potential security issue with cache credential enabled and subversion (#9567)....
r7689 $ret = 1 if ($ldap->authenticate($redmine_user, $redmine_pass) && (($access_mode eq "R" && $permissions =~ /:browse_repository/) || $permissions =~ /:commit_access/));
Eric Davis
Check the browse repository or commit access permissions in Redmine.pm with LDAP. #5797...
r3718
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 }
$sthldap->finish();
Jean-Philippe Lang
Fixes Redmine.pm error "closing dbh with active statement handles at /usr/lib/perl5/Apache/Redmine.pm" (#4205)....
r3186 undef $sthldap;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 }
}
Jean-Philippe Lang
Redmine.pm support for LDAP authentication (patch by Liwiusz Ociepa). Closes #879, #918....
r1320 $sth->finish();
Jean-Philippe Lang
Fixes Redmine.pm error "closing dbh with active statement handles at /usr/lib/perl5/Apache/Redmine.pm" (#4205)....
r3186 undef $sth;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 $dbh->disconnect();
Jean-Philippe Lang
Fixes Redmine.pm error "closing dbh with active statement handles at /usr/lib/perl5/Apache/Redmine.pm" (#4205)....
r3186 undef $dbh;
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 if ($cfg->{RedmineCacheCredsMax} and $ret) {
if (defined $usrprojpass) {
Jean-Philippe Lang
Fixed: Redmine.pm potential security issue with cache credential enabled and subversion (#9567)....
r7689 $cfg->{RedmineCacheCreds}->set($redmine_user.":".$project_id.":".$access_mode, $pass_digest);
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 } else {
if ($cfg->{RedmineCacheCredsCount} < $cfg->{RedmineCacheCredsMax}) {
Jean-Philippe Lang
Fixed: Redmine.pm potential security issue with cache credential enabled and subversion (#9567)....
r7689 $cfg->{RedmineCacheCreds}->set($redmine_user.":".$project_id.":".$access_mode, $pass_digest);
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 $cfg->{RedmineCacheCredsCount}++;
} else {
$cfg->{RedmineCacheCreds}->clear();
$cfg->{RedmineCacheCredsCount} = 0;
}
}
}
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 $ret;
}
sub get_project_identifier {
my $r = shift;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 my $location = $r->location;
Jean-Philippe Lang
Adds support for Git's smart HTTP protocol to Redmine.pm (#4905)....
r9646 $location =~ s/\.git$// if (defined $cfg->{RedmineGitSmartHttp} and $cfg->{RedmineGitSmartHttp});
Jean-Philippe Lang
Makes Redmine.pm work with multiple repositories per project (#779)....
r9136 my ($identifier) = $r->uri =~ m{$location/*([^/.]+)};
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 $identifier;
}
sub connect_database {
my $r = shift;
Toshi MARUYAMA
remove trailing white-spaces except SQL from extra/svn/Redmine.pm...
r7895
Liwiusz Ociepa
Merge changes from branch swistak....
r1410 my $cfg = Apache2::Module::get_config(__PACKAGE__, $r->server, $r->per_dir_config);
return DBI->connect($cfg->{RedmineDSN}, $cfg->{RedmineDbUser}, $cfg->{RedmineDbPass});
Nicolas Chuche
* add Redmine.pm to authenticate with mod_perl...
r903 }
1;