hello guys
I have problem with spamhaus, all of my ip blocked in spamhaus
I wanna set rule in firewall to limit 5 Email per hour
how to configuration this rule ?
can you help me ?
/ip firewall mangle add action=jump chain=prerouting dst-port=25,587 jump-target=prerouting_smtp protocol=tcp src-address-list=lista_ip_clienti add action=add-src-to-address-list address-list=@SMTP_troppi_src chain=prerouting_smtp \ connection-limit=5,32 protocol=tcp src-address-list=!@SMTP_troppi_src add action=return chain=prerouting_smtp
lista_ip_clienti = user list created dynamically from PPPoE Server
@SMTP_troppi_src
connect to SMTP Server more than 5 times in a minute
/ip firewall mangle
chain=prerouting
add action=return chain=prerouting_smtp
; Create chain for handling SMTP outbound connection attempts. ; Putting the match rules here avoids the need to repeat them ; in each action below, and it makes the overall firewall faster. add action=jump jump-target=SMTP-rate-limit \ protocol=tcp tcp-flags=syn out-interface=ether1 chain=forward \ dst-port=25,587,465,2525 dst-address-list=!LAN ; Drop conns that reach stage 5 per the limits below. add action=reject reject-with=icmp-port-unreachable \ src-address-list=SMTP-stage-5 chain=SMTP-rate-limit \ log=yes log-prefix="rejected for 1h" ; Ratcheting connection mechanism: conns move from one stage to ; the next as long as the prior stage doesn't expire, so you need ; 5 conns within a 1-hour span to make it to stage 5. add action=add-src-to-address-list address-list=SMTP-stage-5 \ address-list-timeout=1h src-address-list=SMTP-stage-4 \ chain=SMTP-rate-limit add action=return src-address-list=SMTP-stage-5 chain=SMTP-rate-limit add action=add-src-to-address-list address-list=SMTP-stage-4 \ address-list-timeout=1h src-address-list=SMTP-stage-3 \ chain=SMTP-rate-limit add action=return src-address-list=SMTP-stage-4 chain=SMTP-rate-limit add action=add-src-to-address-list address-list=SMTP-stage-3 \ address-list-timeout=1h src-address-list=SMTP-stage-2 \ chain=SMTP-rate-limit add action=return src-address-list=SMTP-stage-3 chain=SMTP-rate-limit add action=add-src-to-address-list address-list=SMTP-stage-2 \ address-list-timeout=1h src-address-list=SMTP-stage-1 \ chain=SMTP-rate-limit add action=return src-address-list=SMTP-stage-2 chain=SMTP-rate-limit add action=add-src-to-address-list address-list=SMTP-stage-1 \ address-list-timeout=1h chain=SMTP-rate-limit
Sidenote, 587 is submission port that always requires login, you can't use it for unauthorized spamming. And 465 was reinstated/repurposed as replacement for 587 with implicit TLS (RFC 8314).And not only 25, but also 587 (I ignore deprecated 465 and 2525)
hello guys I have problem with spamhaus, all of my ip blocked in spamhaus I wanna set rule in firewall to limit 5 Email per hour how to configuration this rule ? can you help me ?
It is best to solve that in your mailserver. Also, block all outgoing TCP port 25 traffic except from your mailserver.thanks guys
yes you right
but I have access to mail server
Regular email clients are not dependent on smtp since they connect using other ports as @rextended explained.
it doesn't matter if the bot sends only 5 emails since you might get blocked anyway because the content itself risks being marked as spam.
Why? How do you figure that will help??hello guys
I have problem with spamhaus, all of my ip blocked in spamhaus
I wanna set rule in firewall to limit 5 Email per hour
how to configuration this rule ?
can you help me ?