mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-11-06 15:33:07 -05:00
With "Verify SSL" working, the login request checks the Pi-hole certificate when that setting is on. In a live test with the setting on and Pi-hole behind a reverse proxy with an untrusted certificate, the login failed with "Connection error during Pi-hole auth. Check PIHOLEAPI_URL and PIHOLEAPI_PASSWORD", although URL and password were right. requests.exceptions.SSLError is a subclass of ConnectionError, so the certificate error fell into that branch. Changes: - pihole_api_auth() catches requests.exceptions.SSLError before ConnectionError (server/plugins/pihole_api_scan/pihole_api_scan.py) and logs: "TLS certificate check failed during Pi-hole auth: <error>. Turn off PIHOLEAPI_VERIFY_SSL if Pi-hole uses a self-signed certificate." - test/plugins/test_pihole_api_scan_verify_ssl.py: _login_failure() runs pihole_api_auth() with a failing login request. test_certificate_error_points_to_verify_ssl_setting checks the new message (fails without this change); test_plain_connection_error_still_points_to_url_and_password checks that other connection errors keep the old one. Impact: A user who turns on "Verify SSL" while Pi-hole uses a self-signed or otherwise untrusted certificate gets a log line that names the cause and the setting. Other connection errors are reported as before.