問題描述
我正在嘗試通過 MySQL 設(shè)置每個存儲庫的 SVN 身份驗證,但我遇到了一些問題.
I'm trying to setup per repository SVN authentication via MySQL but I'm having a few problems.
首先mod_authn_dbd和mod_auth_mysql有什么區(qū)別?
其次,我已經(jīng)有一個 MySQL 數(shù)據(jù)庫設(shè)置,其中包含一個用于用戶、組和權(quán)限的表.是否可以使用這些 mod 中的任何一個鏈接到我當(dāng)前的權(quán)限系統(tǒng),其中需要用戶名、密碼和權(quán)限才能訪問存儲庫(每個存儲庫最好具有讀取權(quán)限和寫入權(quán)限)
Secondly I already have a MySQL database setup with a table for users, groups and permissions. Is it possible using either of these mods to link into my current permission system where by a username, password and permission is required to access the repository (Preferable with a read permission and write permission per repository)
tbl_users:user_id、user_name、user_hash
tbl_users: user_id, user_name, user_hash
tbl_group: group_id, group_name
tbl_group: group_id, group_name
tbl_permission:permission_id、permission_name
tbl_permission: permission_id, permission_name
tbl_user_group: user_id, group_id
tbl_user_group: user_id, group_id
tbl_group_permission:group_id、permission_id
tbl_group_permission: group_id, permission_id
tbl_user_permission:user_id、permission_id
tbl_user_permission: user_id, permission_id
推薦答案
首先是區(qū)別.
mod_authn_dbd 提供身份驗證前端,例如 mod_auth_digest 和 mod_auth_basic通過在 SQL 表中查找用戶來驗證用戶.
mod_authn_dbd provides authentication front-ends such as mod_auth_digest and mod_auth_basic to authenticate users by looking up users in SQL tables.
mod_auth_mysql 是一個 Apache 模塊,允許使用存儲在 MySQL 數(shù)據(jù)庫中的用戶和組數(shù)據(jù)進(jìn)行身份驗證.該項目似乎自 2005 年以來就沒有更新過,所以我會選擇 mod_authn_dbd一>.
mod_auth_mysql is an Apache module that allows authentication using user and group data stored in MySQL databases. The project seems to not have updated since 2005, so I'd go for mod_authn_dbd.
要正確設(shè)置,首先需要在 apache 配置中正確配置 mod_authn_dbd 和 mod_dbd,mod_dbd 負(fù)責(zé)數(shù)據(jù)庫連接.完成此操作后(確保您的 Apache 在這些模塊處于活動狀態(tài)的情況下運行),然后您可以繼續(xù)配置它們.
To set this up properly, first you need to configure mod_authn_dbd and mod_dbd up properly in your apache configuration, mod_dbd takes care of your database connection. Once you've done this (make sure your Apache is running with those modules active), then you can go ahead configuring them.
在您的 apache 配置中添加類似的內(nèi)容以配置數(shù)據(jù)庫連接:
Add something like this to your apache configuration to configure the database connection:
<IfModule mod_dbd.c>
DBDriver mysql
DBDParams "host=(your_db_server, p.e. 127.0.0.1) dbname=your_db_name user=your_db_user pass=your_db_pass"
DBDMin 1
DBDKeep 8
DBDMax 20
DBDExptime 200
</IfModule>
現(xiàn)在將您想要的身份驗證配置添加到 apache 配置中:
Now add your desired authentication configuration into the apache configuration:
<Directory "/your/svn/repository/path/">
Options FollowSymLinks Indexes MultiViews
AuthType Basic
AuthName "Allowed users Only"
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT pwd FROM tbl_users, tbl_user_group WHERE tbl_users.user_id=%s AND tbl_user.user_id=tbl_user_group.user_id"
Require valid-user
AllowOverride None
Order allow,deny
Allow from all
</Directory>
為了更好的可讀性,我已經(jīng)簡化了 SELECT 語句,您必須擴(kuò)展它以完善您的配置.
I've simplified the SELECT-statement for better readability, you have to expand this to get your configuration refined.
打字后我在網(wǎng)上找到了一個很好的例子,也許可以閱讀它此處,也是.它比我的簡化答案更深入.
After typing I've found a very good example in the web, maybe read it here, too. It goes alot deeper than my simplified answer.
這篇關(guān)于使用 MySQL 的 SVN 身份驗證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!