To expand on HzMeister's firewall example, here is part of my standard firewall rules addressing unsolicited incoming traffic. What I like about this set of rules is I can apply it to any protocols and port(s) that I wish. I found the basic example for blacklisting some time ago I believe on the MT forums, wiki or somewhere and expanded on it somewhat.
In this example, after checking the whitelist (whitelist.mgmt), any new connection attempt received on ether1 is processed through and will end up in the blacklist after a certain number of connection attempts within a certain time window. The jump rule can be more specific, such as for specific protocols and ports. It can also be used for traffic in the forward chain in case you are exposing an internal host service to the internet, such as a web server or FTP simply by adding a matching jump rule.
/ip firewall address-list
add address=<mgmt subnets> list=whitelist.mgmt
/ip firewall filter
add action=jump chain=input connection-state=new in-interface=ether1 jump-target=blacklist src-address-list=blacklist
add action=add-src-to-address-list address-list=blacklist address-list-timeout=1w chain=blacklist comment="Blacklist processing" log=yes log-prefix="Blacklisted: " src-address-list=pre-blacklist4
add action=add-src-to-address-list address-list=pre-blacklist4 address-list-timeout=5m chain=blacklist src-address-list=pre-blacklist3
add action=add-src-to-address-list address-list=pre-blacklist3 address-list-timeout=5m chain=blacklist src-address-list=pre-blacklist2
add action=add-src-to-address-list address-list=pre-blacklist2 address-list-timeout=5m chain=blacklist src-address-list=pre-blacklist1
add action=add-src-to-address-list address-list=pre-blacklist1 address-list-timeout=5m chain=blacklist log=yes log-prefix="pre-bl1: "
add action=accept chain=blacklist src-address-list=!blacklist
add action=drop chain=blacklist log=yes log-prefix="Blacklist Drop: "
/ip firewall raw
add action=accept chain=prerouting src-address-list=whitelist.mgmt
add action=add-src-to-address-list address-list=blacklist address-list-timeout=1w chain=prerouting log=yes log-prefix="Blacklist renew: " src-address-list=blacklist
add action=drop chain=prerouting src-address-list=blacklist
add action=drop chain=prerouting dst-address-list=blacklist log=yes log-prefix="Traffic to BL host: "