atomx / nginx-http-auth-digest

Digest Authentication for Nginx
Other
44 stars 14 forks source link

Authentication always fail #13

Closed RockNHawk closed 6 years ago

RockNHawk commented 7 years ago

Hello. I have already generated the password file & the file is touchable & configured for nginx .

` server { listen 80; listen 443 ssl;

#if ($server_port !~ 443){
#      rewrite ^(/.*)$ https://$host$1 permanent;
#}
error_page 497  https://$host$request_uri;

server_name domain.com;

error_page 497  https://$host$request_uri;

access_log  /www/wwwlogs/site1.log;
root /www/wwwroot/site1;

resolver 8.8.8.8;

location /{
    auth_digest 'this is not for you'; # set the realm for this location block
    # a file created with htdigest
    auth_digest_user_file /etc/nginx-http-auth-digest/users.digest;
    auth_digest_maxtries 9999;
}

# location / {
#   google on;
# }

} `

And The access log is:

But the authentication always fail, browser always popup the "Authentication Required" dialog.

screen shot 2017-08-05 at 11 48 00 am

Can you help me review the problem ?

erikdubbelboer commented 7 years ago

How did you generate the users.digest file?

RockNHawk commented 7 years ago

I use htdigest.py passwdfile username 'realm name' to generate it.

here is the generated password: username:n1:00a002db781cb62154383ec438b05e72 username:n2:8f19e5da450121388a6d1abef6e8730a

and the password both are 1.

erikdubbelboer commented 7 years ago

And you are using the same realm (this is not for you) that you use in your nginx config when you generate the password?

Everything seems correct so it should be working. The only thing I can think of is that the realm isn't matching or you are providing a different username/password then what you generated.