For me, there were a bunch of really annoying requests coming in from some presumably bot servers trying to hack me? Not exactly sure what their purpose was, but they were muddying up my logs so I wanted them gone.UFW (Uncomplicated Firewall) is a really simple and useful firewall tool on linux. With it you're able to defined rules to either allow or block ip addresses, ports, etc. It is by far the easiest way I know of to block ip addresses from a server. The command to block an ip address is simply
$ sudo ufw deny from [ip] to anyIn this case:
$ sudo ufw deny from 188.8.131.52 to any Rule added
except when I checked the logs I still saw the annoying requests still coming in.With UFW rules have an order to them and the deny rules I added went after other rules which rendered them useless.
$ sudo ufw status numbered Status: active To Action From -- ------ ---- [ 1] 22 ALLOW IN Anywhere [ 2] 80 ALLOW IN Anywhere [ 3] 443 ALLOW IN Anywhere [ 4] 115/tcp ALLOW IN Anywhere [ 5] Anywhere DENY IN 184.108.40.206 [ 6] Anywhere DENY IN 220.127.116.11 [ 7] 22 (v6) ALLOW IN Anywhere (v6) [ 8] 80 (v6) ALLOW IN Anywhere (v6) [ 9] 443 (v6) ALLOW IN Anywhere (v6)  115/tcp (v6) ALLOW IN Anywhere (v6)And to delete a rule:
$ sudo ufw delete 5 Deleting: deny from 18.104.22.168 Proceed with operation (y|n)? y Rule deletedThen to add a rule at the top so it overrides all other rules:
$ sudo ufw insert 1 deny from 22.214.171.124 to any
And with that, the bot requests are no longer getting in.