How can I defend my server against a Brute-force attack?

Unfortunately Brute-force attack are a common phenomena on the internet.

When you're using strong passwords you don't have a reason to be very worried about this. If you want to do something about it you can run your SSH daemon on another port. You have to edit the ssh port in /etc/ssh/sshd_config and restart your sshd daemon.

Fail2Ban scans log files (e.g. /var/log/apache/error_log) and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. Generally Fail2Ban is then used to update firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary other action (e.g. sending an email) could also be configured. Out of the box Fail2Ban comes with filters for various services (apache, courier, ssh, etc).

Fail2Ban is able to reduce the rate of incorrect authentications attempts however it cannot eliminate the risk that weak authentication presents. Configure services to use only two factor or public/private authentication mechanisms if you really want to protect services.

Have more questions? Submit a request


Article is closed for comments.