简体   繁体   中英

Getting Apache 2.4 and mod_authn_dbd to work with a Wordpress user database

Has anybody managed to use a Wordpress wp_users table as input for apache's mod_authn_dbd ? This used to work for the apache 2.2 mod_auth_mysql, which had

Auth_MySQL_Encryption_Types PHPass PHP_MD5

but after a lot of searching, I still fail to understand how I can possibly make mod_authn_dbd to match the "$P$B / md5" passwords it gets from the wp_users table.

Here's the base config I'm starting with:

DBDriver mysql
DBDParams "dbname=wp_test host=127.0.0.1 port=3306 user=root pass=rootpass"
DBDMin  2
DBDKeep 4
DBDMax  10
DBDExptime 300

Alias /test /home/test/test
<Directory "/home/test/test">
    Options +Indexes
    AuthType Basic
    AuthName "Authentication required"
    AuthBasicProvider dbd
    AuthDBDUserPWQuery "SELECT user_pass as password FROM wp_users WHERE user_login = %s"
    Require valid-user
</Directory>

The error I'm getting is

[auth_basic:error] [pid 14812] [client 192.168.0.2:57126] AH01617: user test: authentication failure for "/test/": Password Mismatch

So it's obvious that apache uses a different hash format as wordpress - but is there any way to match these 2 up for the required comparison?

实际上,解决方案是安装WP插件,例如PHP本机密码哈希-将密码更改为bcrypt,然后由apache识别。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM