MySQL – Limit Server Login Attempts Without Fail2ban

MySQLphpmyadmin

I would like to limit login attempts via phpMyAdmin to protect against brute-force attacks. I found solution above, but it is based on fail2ban.

[mysqld-iptables]
enabled  = true
filter   = mysqld-auth
action   = iptables[name=mysql, port=3306, protocol=tcp]
       sendmail-whois[name=MySQL, dest=root, sender=fail2ban@example.com]
logpath  = /var/log/mysqld.log
maxretry = 5

Are there any other, maybe "native" solution for this purpose? Should I use maybe access restriction instead of limiting?

Best Answer

No, phpMyAdmin doesn't have any built-in protection directly against brute force attacks. phpMyAdmin can log failed connection attempts to syslog, a feature which was added specifically so that fail2ban could be easily used for this protection (rather than re-developing the wheel in the application itself). You may be able to work something out with MySQL's resource limits, but those are really designed for restricting valid authenticated users, not stopping brute force attacks. As an alternative, if you have a firewall front end, you may be able to enact some protections there if you really wish to not use fail2ban, but the officially sanctioned means is indeed using fail2ban.