Subversionの認証をRedmine認証で代替するのにRedmine.pmを使う方法にしました。しかし、BitnamiRedmineのWikiにある設定をしてもうまく動きません。
Apacheのhttpd.confの修正 †
- redmine用の設定を別ファイルにします。
sudo sh -c 'echo Include \"/opt/redmine/apache2/conf/redmine.conf\" >> /opt/redmine/apache2/conf/httpd.conf'
- 別ファイルを作成します。
cat << EEOOFF | sudo tee /opt/redmine/apache2/conf/redmine.conf
LoadModule perl_module modules/mod_perl.so
PerlLoadModule Apache::Authn::Redmine
<Location /svn>
DAV svn
SVNParentPath "/opt/redmine/repos"
# Order deny,allow
# Deny form all
# Satisfy any
# PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler
AuthType Basic
AuthName "SVN Repository"
Require valid-user
RedmineDSN "DBI:mysql:database=bitnami_redmine;host=127.0.0.1"
RedmineDbUser "root"
RedmineDbPass "bitnami"
</Location>
EEOOFF
access_handlerはバグっているようです。Subversionへの無名アクセスができなくなるのを我慢すれば、authen_handlerで間に合うのでaccess_handlerはコメントアウトします。
項番 | ユーザ権限 | 制御方法(Original) | 制御方法(当方のやり方) | 備考 |
1 | Anonimous非公開 | access_handler | × | authen_handlerのBasic認証が必ず行われるのでAnonimous非公開となります。 |
2 | Anonimous公開 | access_handler | × | Anonimous公開したい場合は、Redmine.pm内のコメント欄にあるように別名でLocation設定を行うことにより可能。ただしリポジトリごとに変える場合は、リポジトリごとのLocation設定が必要になります。 |
3 | Redmineユーザ(参照権なし) | authen_handler | authen_handler | |
4 | Redmineユーザ(更新権なし) | authen_handler | authen_handler | |
5 | Redmineユーザ(参照権あり) | authen_handler | authen_handler | |
6 | Redmineユーザ(更新権あり) | authen_handler | authen_handler | |
- Redmine.pmを有効にします。
sudo mkdir /opt/redmine/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi/Apache/Authn
sudo cp /opt/redmine/apps/redmine/htdocs/extra/svn/Redmine.pm /opt/redmine/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi/Apache/Authn/Redmine.pm
- Redmine.pmを改造します。
patchfile=`mktemp`
cat << EEOOFF > ${patchfile}
243c243
< FROM projects, users, roles
---
> FROM projects, users, roles, repositories
246c246,247
< AND projects.identifier=?
---
> AND repositories.identifier=?
> AND projects.id = repositories.project_id
EEOOFF
sudo patch /opt/redmine/perl/lib/site_perl/5.16.3/x86_64-linux-thread-multi/Apache/Authn/Redmine.pm ${patchfile}
rm ${patchfile}