使用AuthQuery的mod_dbd处理MD5和Salt无法正常工作

时间:2018-10-31 19:41:48

标签: mysql apache centos7

运行centOS 7.5,mysql 8,php 7.2,apache 2.4.6 试图让mysql身份验证适用于php应用程序,我使用它将密码存储为  md5(md5('pass')。salt)

我已确认已加载正确的模块(如果需要,可以提供列表)

我密码不匹配 [auth_basic:错误] [pid 5195] [客户端10.10.10.111:49234] AH01617:用户ecourt:“ /中央”身份验证失败:密码不匹配

这是我的/etc/httpd/conf.d目录中的central.conf文件中的代码

# mod_dbd configuration
# UPDATED to include authentication cacheing
DBDriver mysql
DBDParams "host=localhost dbname=bb user=userU pass=somepass"

DBDMin  4
DBDKeep 8
DBDMax  20
DBDExptime 300

<Directory "/webroot/test/www/central">
  # mod_authn_core and mod_auth_basic configuration
  # for mod_authn_dbd
  AuthType Basic
  AuthName "central login" 

  # To cache credentials, put socache ahead of dbd here
  AuthBasicProvider socache dbd

  # Also required for caching: tell the cache to cache dbd lookups!
  AuthnCacheProvideFor dbd
  AuthnCacheContext my-server

  # mod_authz_core configuration
  Require valid-user
  # Require group 10 8 6

   # mod_authn_dbd SQL query to authenticate a user
   #AuthDBDUserPWQuery "SELECT password FROM user WHERE username = %s"
   AuthDBDUserPWQuery "SELECT MD5(MD5(password) + 'salt') AS password FROM     user WHERE username = %s"

</Directory>

感谢您的帮助。 谢谢

1 个答案:

答案 0 :(得分:1)

“ salt”是一个字符串(“单引号”),也许您是指“ salt”(“ backticks”)列?

请参阅: