Question Fail2ban for Docker Containers

Currently reading
Question Fail2ban for Docker Containers

Last edited:
I tried what you suggested earlier and it didn't work. Resolving the real IP isn't the problem, that works. I can see it in the log files and from that fail2ban creates the iptables rules. But then the actual blocking isn't happening. This is what iptables shows:
Code:
sudo iptables -S | grep f2b
-N f2b-nginx-proxy-manager
-A DOCKER -p tcp -j f2b-nginx-proxy-manager
-A f2b-nginx-proxy-manager -s 185.128.25.52/32 -j DROP
-A f2b-nginx-proxy-manager -j RETURN
From what I understand from iptables is that the package meets te INPUT chain table filter and the package should be dropped. But... it probably depends on what iptables is comparing it with, right? I mean, it's basically a "if X = Y then drop" question/command. So "if X = 185.128.25.52/32 then drop", clearly X isn't the real IP address (probably a CF address). I guess the real IP address is received from upstream but then not used for iptable rules. Then
the penny dropped, and I can strike through all of the above, as CF is the one who makes the connection because... <drumroll, thank you one-eyed-king> this idiot (that's me just to be absolutely clear - lol) forgot to disable the proxy mode and switch to dns only... duh! 🥴
So regarding ban and block with fail2ban... long story short: if one is using CF as a proxy, use 'cloudflare' ban action. If one is using CF dns only then use 'iptables' action.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Not sure why the script hadn't historically worked, but it started working for me yesterday. It also...
Replies
6
Views
3,293
Looks like I triggered you somehow with my post: it was not my intention. I have no idea whether bash or...
Replies
4
Views
408
Use bind volumes, and the CM Project feature. Hyper Backup can then backup the volumes, and with a copy of...
Replies
2
Views
322
Those are two different layers: one is the management ui to perform actions on the api. the other is the...
Replies
12
Views
544
Thanks for your replies, but I found the solution: I had to allow port 8083 in the firewall.
Replies
5
Views
505
Thank you for this - I'll give it a go and see where I get - worst case I learn something as I go!
Replies
6
Views
634
I have no idea what you are doing, but I just tested it based on the instructions of the guide you linked...
Replies
11
Views
1,379

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top