WordPress Simple Firewall does it for me.
http://wordpress.org/plugins/wp-simple-firewall/

Free plugin, which is updated regularly and gets a 4.9 rating.

The developers are also super helpful.