Thank you very much, I really appreciate it. I’m here for tests.
Fully agree, this isn’t applicable in LAN.
That’s true for this case but guessing the domain could be easy:
[root@node state]# telnet 192.168.3.141 25
Trying 192.168.3.141...
Connected to 192.168.3.141.
Escape character is '^]'.
220-node.ns8rockytest2.com ESMTP Postfix
The domain could be ns8rockytest2.com
If we lowered the attempts to 2 and raised the timeframe to 2 days instead of 1 minute, this case would have been banned after 2 days.
I think we need to check for alerts instead of bans to ban it much faster.
Following 10 alerts are inside a timeframe of 5 minutes.
If we don’t look for IPs but for range 81.30.107.0/24 we would have banned it after the first 10 tries.
Each attempts of a unique IP but if we check the range, it should work
2025-06-30T01:40:22-07:00 [1:crowdsec1:crowdsec1] time="2025-06-30T08:40:22Z" level=info msg="Ip 81.30.107.67 performed 'crowdsecurity/postfix-non-smtp-command' (1 events over 0s) at 2025-06-30 08:40:22.032615581 +0000 UTC"
2025-06-30T01:40:22-07:00 [1:crowdsec1:crowdsec1] time="2025-06-30T08:40:22Z" level=info msg="(localhost/crowdsec) crowdsecurity/postfix-non-smtp-command by ip 81.30.107.67 (IR/215930) : 8m ban on Ip 81.30.107.67"
2025-07-01T19:40:23-07:00 [1:crowdsec1:crowdsec1] time="2025-07-02T02:40:23Z" level=info msg="Ip 81.30.107.177 performed 'crowdsecurity/postfix-non-smtp-command' (1 events over 0s) at 2025-07-02 02:40:23.282585287 +0000 UTC"
2025-07-01T19:40:24-07:00 [1:crowdsec1:crowdsec1] time="2025-07-02T02:40:24Z" level=info msg="(localhost/crowdsec) crowdsecurity/postfix-non-smtp-command by ip 81.30.107.177 (IR/215930) : 4m ban on Ip 81.30.107.177"
root@r3-pve:/# cscli scenarios list root@r3-pve:/# cscli scenarios install custom/distributed-postfix-bruteforce
Explanation
filter: Matches your SASL failed attempts.
groupby: Uses evt.Enriched.SourceRange (which, thanks to geoip-enrich, should be the /24 subnet of the source IP).
capacity: 10 (ban after 10 failed attempts in 1 minute from the same subnet).
leakspeed: 10m (window of 10 minute).
blackhole: 5m (no re-processing for 5 minutes after a ban).
remediation: true (enables ban).
spoofable: 1 (distributed attacks are more likely to be spoofed, so confidence is a bit lower).
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="Ip 5 sources performed 'custom/distributed-postfix-bruteforce' (12 events over 1m11.999757317s) at 2025-07-03 13:59:30.456053973 +0000 UTC"
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="(localhost/crowdsec) custom/distributed-postfix-bruteforce by ip 192.168.3.144 : 12m ban on Ip 192.168.3.144"
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="(localhost/crowdsec) custom/distributed-postfix-bruteforce by ip 192.168.3.133 : 4m ban on Ip 192.168.3.133"
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="(localhost/crowdsec) custom/distributed-postfix-bruteforce by ip 192.168.3.46 : 8m ban on Ip 192.168.3.46"
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="(localhost/crowdsec) custom/distributed-postfix-bruteforce by ip 192.168.3.41 : 12m ban on Ip 192.168.3.41"
2025-07-03T15:59:30+02:00 [1:crowdsec1:crowdsec1] time="2025-07-03T13:59:30Z" level=info msg="(localhost/crowdsec) custom/distributed-postfix-bruteforce by ip 192.168.3.40 : 12m ban on Ip 192.168.3.40"