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

Connection reset by peer (nginx-ldap-auth-daemon.py) #72

Open SlickNutter opened 4 years ago

SlickNutter commented 4 years ago

When I try to access my protected location / , I get the following error in nginx:

2019/09/18 13:45:48 [error] 6#6: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.253.1, server: , request: "GET / HTTP/1.1", subrequest: "/auth-proxy", upstream: "http://127.0.0.1:8888/auth-proxy", host: "localhost:3000"
2019/09/18 13:45:48 [error] 6#6: *1 auth request unexpected status: 502 while sending to client, client: 192.168.253.1, server: , request: "GET / HTTP/1.1", host: "localhost:3000"
192.168.253.1 - - [18/Sep/2019:13:45:48 +0000] "GET / HTTP/1.1" 500 579 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36"

When using the following command:

curl -v \
    -H "X-Ldap-URL ldap://my-ldap" \
    -H "X-Ldap-BaseDN ou=User,dc=Domain" \
    -H "X-Ldap-BindDN OU=Groups,OU=User,DC=Domain" \
    -H "X-Ldap-BindPass password" \
    -H "X-Ldap-Template (&(sAMAccountName=%(username)s)" \
    -H "X-Ldap-DisableReferrals true" \
localhost:3001;

I get the response:

* Rebuilt URL to: localhost:3001/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3001 (#0)
> GET / HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/7.58.0
> Accept: */*
> X-Ldap-URL ldap://my-ldap
> 
* Recv failure: Connection reset by peer
* stopped the pause stream!
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer