I used following guides to finally come up with this: https://www.the-lazy-dev.com/en/install-fail2ban-with-docker/ - iptable commands etc .. Hope this helps some one like me who is trying to solve the issues they face with fail2ban and docker networks :). Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Connections to the frontend show the visitors IP address, while connections made by HAProxy to the backends use HAProxys IP address. Ive been victim of attackers, what would be the steps to kick them out? Sign in You'll also need to look up how to block http/https connections based on a set of ip addresses. But i dont want to setup fail2ban that it blocks my proxy so that it gets banned and nobody can access those webservices anymore because blocking my proxys ip will result in blocking every others ip, too. For instance, for the Nginx authentication prompt, you can give incorrect credentials a number of times. in this file fail2ban/data/jail.d/npm-docker.local It works for me also. To do so, you will have to first set up an MTA on your server so that it can send out email. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Nginx proxy manager, how to forward to a specific folder? I'm not an regex expert so any help would be appreciated. https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-14-04. Because how my system is set up, Im SSHing as root which is usually not recommended. This was something I neglected when quickly activating Cloudflare. [PARTIALLY SOLVED, YOU REFER TO THE MAPPED FOLDERS] my logs make by npm are all in in a logs folder (no log, logS), and has the following pattern: /logs/proxy-host-*.log and also fallback*.log; [UPDATE, PARTIALLY SOLVED] the regex seems to work, files proxy* contain: Yes this is just relative path of the npm logs you mount read-only into the fail2ban container, you have to adjust accordingly to your path. You can add additional IP addresses or networks delimited by a space, to the existing list: Another item that you may want to adjust is the bantime, which controls how many seconds an offending member is banned for. Learn more about Stack Overflow the company, and our products. How to increase the number of CPUs in my computer? However, by default, its not without its drawbacks: Fail2Ban uses iptables What does a search warrant actually look like? i.e. In your instructions, you mount the NPM files as /data/logs and mount it to /log/npm, but in this blog post, the author specifically mentions "Ensure that you properly bind mount the logs at /data/logs of your NPM reverse proxy into the Fail2ban docker container at /var/log/npm. So I added the fallback__.log and the fallback-_.log to my jali.d/npm-docker.local. But is the regex in the filter.d/npm-docker.conf good for this? People really need to learn to do stuff without cloudflare. It works form me. Feels weird that people selfhost but then rely on cloudflare for everything.. Who says that we can't do stuff without Cloudflare? Complete solution for websites hosting. Your browser does not support the HTML5