Hash Apache2AuthDBD-md5在数据库中哈希密码,但apache将其与原始密码进行比较
我在Apache2中通过pgsql进行身份验证时遇到问题。连接到数据库是成功的,若我将哈希放入密码字段,它将得到验证,但如何使Apache2.4将数据库密码与尚未哈希的本地插入密码进行比较呢。我想我必须把auth散列方法放到md5中,但由于某些原因,文档有点不完整Hash Apache2AuthDBD-md5在数据库中哈希密码,但apache将其与原始密码进行比较,hash,config,basic-authentication,apache2.4,Hash,Config,Basic Authentication,Apache2.4,我在Apache2中通过pgsql进行身份验证时遇到问题。连接到数据库是成功的,若我将哈希放入密码字段,它将得到验证,但如何使Apache2.4将数据库密码与尚未哈希的本地插入密码进行比较呢。我想我必须把auth散列方法放到md5中,但由于某些原因,文档有点不完整 <Location "/something"> Header add Pragma "must-revalidate no-cache" Header add X-RequestTime "%t %D"
<Location "/something">
Header add Pragma "must-revalidate no-cache"
Header add X-RequestTime "%t %D"
ExpiresActive on
ExpiresDefault "now"
AuthName "Something"
AuthType Basic
AuthUserFile "L:\Docs\mgrpass.txt" #does not take usernames and passwords
#from there anymore. Takes them from database instead.
Order allow,deny
Allow from all
SetEnv ERR_MAIL "sysadmin@mywebsite.com"
SetEnv SCHEMA "manager"
SetEnv AUTHTYPE "manager"
AuthBasicProvider socache dbd
AuthnCacheProvideFor dbd
AuthnCacheContext myServer
# Here should be some hash config to convert local password
# to md5 encrypted one... Help please :(
Require valid-user
AuthDBDUserPWQuery "SELECT parool as password FROM _usr WHERE email = %s"
SetEnv "FORMAT" "json"
php_flag pgsql.log_notice off
php_flag magic_quotes_gpc off
php_flag output_buffering off
php_admin_flag safe_mode_gid on
Header add X-Timing "%D microseconds"
</Location>
找到了答案
Apache解析密码本身。只需在密码前添加{SHA1}或$apr1$
AuthDBDUserPWQuery "SELECT CONCAT('{SHA}',parool_sha1) as password FROM _usr WHERE email = %s"