mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-06-25 22:05:46 -04:00
When AUTH_HASH_IPS is enabled and ZoneMinder is behind a reverse proxy (e.g. Nginx in front of Apache), the hash is generated using HTTP_X_FORWARDED_FOR (the real client IP) but was validated using only REMOTE_ADDR (the proxy's IP), causing all authentication to fail. Fix by consistently using HTTP_X_FORWARDED_FOR (first IP only, to guard against spoofed multi-value headers) with REMOTE_ADDR as fallback in all three places: - web/includes/session.php: where remoteAddr is stored for hash generation - web/includes/auth.php: getAuthUser() validation (PHP, also used by zms CGI) - src/zm_user.cpp: zmLoadAuthUser() validation (C++ zms binary) refs #4758 Agent-Logs-Url: https://github.com/ZoneMinder/zoneminder/sessions/959dfe9d-edea-4de5-a3a0-f90b758e5628 Co-authored-by: connortechnology <925519+connortechnology@users.noreply.github.com>
6.8 KiB
6.8 KiB