Limits of connection attempts to an htaccess

Hello!

I am using nginx and I am on Debian 9. I currently have cloudflare enabled on one of my domains, and the domain in question is protected by an htaccess/htpasswd.

I would like to limit the number of connection attempts to the protected url in order to counter bruteforces attacks.

In my nginx.conf, I have filled in the cloudflare IPs to get the end user’s ip.

Is the configuration with fail2ban ([nginx-http-auth]

I have done some tests on my side and for the moment it is not conclusive. My server says I’m banned, but I can still make connection attempts and even connect.

I would like to know, is this normal and therefore related to cloudflare? If so, what alternative do I have to limit the number of attempts?

If it is not related to cloudflare, I will do more research on my problem.

Thank you

After checking, I saw that it is normal that fail2ban does not work to ban an ip when we have cloudflare enabled.

So I found another solution which is to transmit the ip to ban to cloudflare. The API call works, but when I put it in the jail.local file, it doesn’t seem to work (the ip is well banned on iptables, but not on cloudflare).

I specify that the curl command works from the terminal, the ip is added correctly. Here is my configuration: [nginx-http-auth]enabled = truefilter = nginx-http-authport = http,h - Pastebin.com

Any idea ?

I would take a look at this post

If you are open to suggestions, there is a better alternative. Fail2Ban is good, and I have used it myself in some scenarios. However, for this case, I’d use:

CF Access allows you to lock down any URL from your site, allowing you to lock them against any brute force attacks effectively.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.