Simplified path of our setup:
Client ->
VM1- instance on aws, haproxy terminating ssl configured to use acl to direct traffic by requested domain to appropriate backend through wireguard tunnel ->
VM2- VM at local site, nginx reverse proxy directing traffic to services -> services on multiple VMs
.
Problem: Decided to implement fail2ban (f2b) for additional security. Installed at the reverse proxy and the entries created by f2b in iptables have no affect. Actually, any ip based entry has zero affect regardless of who or how it was entered in the chain.
Nginx access logs do show the ip of client however ufw logs show ip of nginx proxy. I'm learning that this could be due to the actions of iptables being at the tcp layer and the headers which contain the client ip passed along are not at that layer. I assume nginx is reading headers and ufw is looking tcp packets?
...firewalls like iptables work at the tcp layer. To look at the x-forwarded-for http header you need to accept the connection and accept at least the request headers from the client before you can evaluate the x-forwarded-for IP.
I'm thinking of these questions while preferring to limit aws responsabilties...
Is there a method to block traffic at the reverse proxy?
Is there a way to remotely send iptables instruction to haproxy?
Is there a way to remotely retrieve logs from nginx?
.
Any pointers graciously accepted.