nginxinc / nginx-ldap-auth

Example of LDAP authentication using ngx_http_auth_request_module
BSD 2-Clause "Simplified" License
678 stars 202 forks source link

/auth returning 200, but looping back to /login #92

Open rsulliv1 opened 2 years ago

rsulliv1 commented 2 years ago

From what i'm seeing, my protected resource is correctly redirecting to the login form, but i'm not sure why i can't seem to get the resource to register the 200 /auth response:

172.18.0.1 - usrname [28/Dec/2021 04:57:31] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:36] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:36] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:36] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:36] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:36] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:36] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:36] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:36] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:36] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:36] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:38] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:38] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:38] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:38] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:38] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:39] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:39] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:39] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:39] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:39] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:39] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] "GET /auth HTTP/1.0" 200 -
172.18.0.1 - - [28/Dec/2021 05:22:39] using username/password from cookie nginxauth
172.18.0.1 - - [28/Dec/2021 05:22:39] Trying to dechipher credentials...
172.18.0.1 - usrname [28/Dec/2021 05:22:39] searching on server "ldap://192.168.1.1:389" with base dn "ou=users,dc=company,dc=net" with filter "(cn=usrname)"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] Auth OK for user "usrname"
172.18.0.1 - usrname [28/Dec/2021 05:22:39] "GET /auth HTTP/1.0" 200 -

from that GET response in the log, i'm thinking that the following should catch that 200 and allow the access to proceed to the resource:

auth_request /auth;
error_page 401 = /login;

The first oddity that jumps out is that it seems like there are a number of requests going through with the same timestamp; I wouldn't expect multiple calls over the same second.

The experience is that if you try to access the protected resource, you're redirected to the login form. then, upon submitting, i'm dropped back onto the login form.

I get the exact same form, without error or help message, regardless of correct credentials, invalid username, or invalid password.


I can use the test page successfully: accessing http://dns:9000/auth returns: Hello, world! Requested URL: /auth