我在我的服务器上安装了bugzilla和subversion。 我希望他们分享帐户。 所以我GOOGLE了,并在这里find这个职位。 我安装了mod_auth_mysql,为Apache 2.2.3应用补丁,但它不起作用。 当查看我的apache的错误日志时,我发现密码不匹配:/让我们假设我有一个这样的用户在bugzilla:
[email protected],密码:test1234
当我尝试进入我的SVN回购,login表单popup,但我不能login。 在服务器错误日志中,我发现:
[Sat Dec 18 15:25:10 2010] [error] [client 83.4.164.217] user [email protected]: password mismatch: /svn
我也debugging发送到服务器的mysql查询,我发现这个:
101218 15:25:10 85 Connect bugs@localhost on 85 Init DB bugs 85 Query SELECT cryptpassword, length(cryptpassword) FROM profiles WHERE login_name='[email protected]' AND disabledtext = ''
当我手动执行相同的查询时,我得到以下结果:
mysql> SELECT cryptpassword, length(cryptpassword) FROM profiles WHERE login_name='[email protected]' AND disabledtext = ''; +--------------------------------------------------------------+-----------------------+ | cryptpassword | length(cryptpassword) | +--------------------------------------------------------------+-----------------------+ | Jnm2qVBMbifU7PEZyl+exbYEAsO8SZh1x2ratGhqfikMg1bxYFg{SHA-256} | 60 | +--------------------------------------------------------------+-----------------------+ 1 row in set (0.00 sec)
而我在我的apache conf:
<Location /svn > DAV svn SVNPath /etc/subversion AuthzSVNAccessFile /home/yuri/.svncontrol AuthType Basic AuthMySQLSaltField <> AuthName "Mwuahahaha this is protected!" AuthMySQLPwEncryption crypt AuthMySQLUser bugs AuthMySQLPassword <some_pass> AuthMySQLDB bugs AuthMySQLUserTable profiles AuthMySQLNameField login_name AuthMySQLPasswordField cryptpassword AuthMySQLUserCondition "disabledtext = ''" Require valid-user </Location>
相同的configuration,但没有AuthMySQLPwEncryption crypt和AuthMySQLSaltField <>行给出同样的问题
mod_auth_mysql的encryptionalgorithm使用不同的哈希格式,例如crypt SHA-256密码看起来像这样:
$5$rounds=5000$usesomesillystri$KqJWpanXZHKq2BOB43TSaYhEWsQ1Lr5QNyPCDH/Tp.6
基于此,你的linux发行版不太可能提供crypt命令和sha-256algorithm。 mod_auth_mysql使用c库的crypt函数来执行此操作。
你最好的select可能是将Bugzilla切换到不太安全的encryptionalgorithm(md5),并设置mod_auth_mysql来代替:
AuthMySQLPwEncryption md5