Setup: HestiaCP + nginx on Ubuntu 24.04
All HTTP/HTTPS traffic passes through Cloudflare (active proxy), and the cloud firewall only releases Cloudflare’s IP addresses. Please note, there is no direct connection to the server.
The real_ip is already configured (set_real_ip_from as CF settings + real_ip_header CF-Connecting-IP), then the log of nginx records the real IP of the visitor and the fail2ban correctly identifies the offender.
The problem is or ban em if: the action usually uses iptables/nftables, but the package always checks Cloudflare’s IP, never the real IP. The door never comes home and the block does not have any effect.
I wanted to avoid the action cloudflare-token (API), due to rate limit, token to maintain and more an external dependence to break in silence.
I thought about some alternatives:
- Nginx blocking: o fail2ban escreve
deny IP;include file number and reload. It works, but only with the receipt of the volume of reloads at peak of varredura. - map/geo do nginx aiming for a file that fail2ban feeds — would you avoid reloading?
- Somehow do iptables/nftables add the header
CF-Connecting-IP(I imagine it doesn’t, it’s L7, but probably).
Do you have any items in production with HestiaCP? Which one is more stable and requires less maintenance?
Valeu.