-
Notifications
You must be signed in to change notification settings - Fork 87
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
SASL login brutforce mitigation #53
Comments
It took me some time to make it work. Main issue - with correct regex - due to wrong timezone, date wasn't properly matched, so bans were not applied. Here are my solution:
[DEFAULT]
sender = root@localhost
destemail = root@localhost
action = %(action_mwl)s
[saslmail]
enabled = true
port = 25
protocol = udp
filter = saslmail
logpath = /var/lib/docker/containers/<container>/<container>-json.log
maxretry = 2
bantime = 3600 [INCLUDES]
before = common.conf
`/etc/fail2ban/filter.d/saslmail.conf`
[Definition]
failregex = ^.*\[<HOST>\]: SASL (?:LOGIN|PLAIN|(?:CRAM|DIGEST)-MD5) authentication failed.*$
^.*reject: RCPT from \S+\[<HOST>\]:.*Relay access denied.*$
^.*lost connection after .*\[<HOST>\].*$
datepattern =%%b %%d %%H:%%M:%%S |
Please update README with security issues. |
@saikek Thanks for filing this issue. Could you please help us to submit a PR to update the README for the project? Because I'm not very familiar with this problem. Thank you very much. |
@saikek Thank you very much for your ground work. I now have this:
The filter is working, but somehow no bans are applied whatsoever when running the container. Any clues? |
Many reasons why:
|
I've ended up stopping service until I would have time to fix it. Better safe then sorry. |
It's working for me now! I've used a docker container with fail2ban ( https://github.com/crazy-max/docker-fail2ban )
Notice the horrible path of the docker container for simple-mail-forwarder because there is no postfix log. This path is different for every installation. You can easily find the path by running
Where "simple-mail-forward" is the name of your SMF docker container. saslmail.conf (filter.d)
saslmail.conf (jail.d)
Because the timezone is incorrect in the SMF container I have to account for 2 extra hours for findtime & bantime. This might differ according to your timezone. Result:
Send to mail log files are finally silent after continuous hammering. |
@me1299 - try this line in your
This should would work without docker-compose file. Also you can use path for logs:
I don't think it would create big overhead even if you are running multiple containers. Also Also: |
Timezone is now fixed in the latest release, so that isn't an issue anymore. I like your idea of mapping all log files, but I'm not a fan of the overhead it creates. And yes, I'm 100% sure the requests are blocked. My iptables on the host:
|
Hello,
on my private hosting, i'm getting lots of hits on mail port with
SASL authentication attempts
.Could you please mention to the main page
fail2ban SASL
mitigation? Otherwise we would end up with lots of mail-bots. (If this issue is valid with your server).For example:
https://bobcares.com/blog/fail2ban-postfix-sasl/
The text was updated successfully, but these errors were encountered: