CGI auth not working behind reverse proxy
Posted: Wed Aug 24, 2016 2:45 pm
Hey all!
First of all thank you for making this amazing piece of software. It's been working out great for me, except for this small issue.
I'm running Zoneminder 1.29.0 on Debian Jessie (8.5), from the repo's (1.29.0+dfsg-1~bpo8+1). It's sitting behind a reverse proxy (for SSL offloading), both sides run nginx (1.10.1) so there's no apache in my setup. For the purpose of debugging this problem I have taken SSL out of the equation though, so right now it's all plain HTTP.
The problem appears to be that nph-zms refuses to accept the auth hash when it comes from the reverse proxy. Below are three scenarios with how the /cgi-bin/nph-zms call appears in the access logs of the zoneminder webserver (so not the reverse proxy).
Without ZM auth, with reverse proxy: everything works. (pages, static assets, live streams, FPS display etc)
With ZM auth, without reverse proxy: everything works. (login, pages, static assets, live streams, FPS display etc)
With ZM auth and reverse proxy: everything works except live streams. (login, pages, static assets etc)
Is there perhaps some kind of IP-based auth hash validation that does not take the X_FORWARDED_FOR headers into account?
Any and all help is greatly appreciated. Thanks for taking the time!
First of all thank you for making this amazing piece of software. It's been working out great for me, except for this small issue.
I'm running Zoneminder 1.29.0 on Debian Jessie (8.5), from the repo's (1.29.0+dfsg-1~bpo8+1). It's sitting behind a reverse proxy (for SSL offloading), both sides run nginx (1.10.1) so there's no apache in my setup. For the purpose of debugging this problem I have taken SSL out of the equation though, so right now it's all plain HTTP.
The problem appears to be that nph-zms refuses to accept the auth hash when it comes from the reverse proxy. Below are three scenarios with how the /cgi-bin/nph-zms call appears in the access logs of the zoneminder webserver (so not the reverse proxy).
Without ZM auth, with reverse proxy: everything works. (pages, static assets, live streams, FPS display etc)
Code: Select all
HTTP 200 - /cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=1&connkey=90632&rand=1472048641
Code: Select all
HTTP 200 - /cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=1&auth=dd941637871904efbbdd41d7ebf379f8&connkey=394253&rand=1472045506
Code: Select all
HTTP 502 - /cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=1&auth=dd941637871904efbbdd41d7ebf379f8&connkey=985236&rand=1472047522
Any and all help is greatly appreciated. Thanks for taking the time!