Since I installed and set up varnish caching, failed logins are being logged to auth.log with the IP of the cache (127.0.0.1) instead of the attacker. e.g.
Jul 8 14:48:06 host wordpress(hostname.com)[7285]: Authentication failure for admin from 127.0.0.1
In my config Varnish serves HTTP, HTTPS is served from apache2 both as the reverse proxy and the backend webserver. Internal and external web requests are logged separately.. All appears working correctly, except brute force logins are now not being picked up by fail2ban as they all appear to originate from the server.
sub vcl_recv is set to 'pass' the login pages;
if (req.url ~ "/wp-(login|admin)") {
return (pass);
}
How can I get the requesting IP logged to auth.log instead of 127.0.0.1 ?