Port scanning can be trivially distributed over multiple IP addresses and rate limited. So blocking one IP address won't do much to block a port scan coming from another IP address. When I tried to apply somewhat similar solutions in the past (e.g. fail2ban), I ended losing access to the server a few times (misconfiguration/bugs/daemon killed/firewall rule conflicts/etc.). A more secure way to prevent port scanning i…
to add to that, I absolutely despise any IP related blocks, Since most residential ISPs use Dynamic IPs, you can easily end up being on one of these "IPs" with poor reputation and have to restart your router because cloudflare blocks you.