-
-
Notifications
You must be signed in to change notification settings - Fork 888
Access logfile for Fail2ban #584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have the same problem, examining the logs of
|
Same here, so I extract some lines from the docker-compose follow to be able to do the bans afterwards. |
Nice idea @v1ru535 !! |
It turns out it's not only about I've spent about 1.5 hours trying different solutions of blocking traffic to mailu containers without success. I'd appreciate it if someone has an idea how to. In the meanwhile I ended up doing the following to combat those pesky hackers:
|
Personally I extract some strings from the docker logs and put everything in a log in a screen command. After that I extract IPs and null routing using ip command like that It's waiting to do better naturally, but with that I already have over 2000 banned IPs. Hope this helps you |
I found a useful post about the issue: http://blog.amigapallo.org/2016/04/14/configuring-fail2ban-and-iptables-to-get-along-with-docker/ It turns out, that even if you configure fail2ban properly, there is still some issues with blocking attempts to brute force through the web UI, when running behind nginx proxy and docker. This is because the logs will look like this:
There original IP is lost because of the forwarding. |
See above PR. I was annoyed I couldn't write something useful for the FAQ, so wrote an actual solution. I'm looking into suitable regex for documentation, but that is not my field of sport. So help would be appreciated. The standard Nginx regex supplied by Fail2Ban don't catch the login fails for Mailu. |
Attempt 2, using Docker logging drivers. Please have a look. |
Implemented in #661, we can close this. |
Thanks for this! I went from version 1.5 to master to get these options, then added the necessary modifications on env and docker-compose.yml. If you wish I can provide the jail for the faq. |
It would be nice if you could share the complete fail2ban rules here, so we can add it to the FAQ for other users. |
For my environment, I put the log to syslog, so in env: For the jail, I've set blackhole route, but it's possible with iptable with: Jail with maxretry to be adapted according to needs:
Action fail2ban: "action.d/route.conf" Filter fail2ban: "filter.d/bad-auth.conf"
It may also be useful to adjust the bantime of the recidive jail to fine-tune the configuration. |
I figured out that I have a lot of connections attempts from weird IPs and wanted to add a jail to fail2ban to block it, but I don't have much knowledge with it. Would you mind share your process to achieve that? That would be super useful! Thanks |
Can we mount a volume for logs to use Fail2Ban ?
The text was updated successfully, but these errors were encountered: