[MDEV-15421] max allowed bad password attempts from ip Created: 2018-02-26 Updated: 2019-03-22 Resolved: 2019-03-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Authentication and Privilege System |
| Fix Version/s: | 10.4.2 |
| Type: | Task | Priority: | Major |
| Reporter: | Robert Dyas | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||
| Description |
|
It seems like it would be very desirable to have a max allowed bad password attempts for a given user from a given ip address, and then a timeout period. Both could be configured at server startup. Maybe: --max-bad-passwords-for-ipaddress=10 So if a login attempts like root@'34.56.123.56' got the password wrong 10 times, that user@ipaddress combination would be locked out for 120 seconds. That same user can login from another ip immediately... it only blocks the login for that user from the ip address that failed multiple times. This seems like an easy way to help prevent DOS and brute force attacks. Can someone confirm that they would not be able to spoof an ip address and therefore create a DOS attack by locking out legitimate attempts? |
| Comments |
| Comment by Daniel Black [ 2018-02-26 ] |
|
TCP connections are generally considered to be proof against IP spoofing. If pam_set_item(sshpam_handle, PAM_RHOST, pam_rhost); was set in the the MariaDB pam plugin there might be a way to implement this as a PAM module. |
| Comment by Robert Dyas [ 2018-02-26 ] |
|
This seems like it would be a highly desirable feature, and even one that should be shipped with the default installation set to 5 failed logins per user/ip and then lockout for 300 seconds. So the default installation is as secure as possible. What is needed to get this assigned to someone? |
| Comment by Daniel Black [ 2018-02-26 ] |
|
What's your use case? The default installation listens to only the localhost interface. Most common cases the exposure of a database port is to only the LAN that's needed. Common connections are for applications can have large complex passwords immune to brute forcing. TLS is there for interfaces with stricter requirements. You did inspire me to write https://github.com/MariaDB/server/pull/631 however I'll probably rewrite it to pull out the real origin from vio rather than the host field in the user table. Alternately fail2ban has a MySQL password filter. There's very little motivation to add more complexity to the authentication path of MariaDB without making it general like PAM. This is quite similar to |
| Comment by Robert Dyas [ 2018-02-26 ] |
|
Our database servers are in the cloud and have an external IP address. Several of the accounts, including root, can be accessed remotely and we don't normally restrict the ip addresses they can be logged in from because of Google App Engine coming from a wide range of (changing) IP addresses. SSL is required, tls 1.1 min. Yes, we have large (30 char) high entropy passwords on everything and require certificate validation. So, because our mid-tier is on Google App Engine, we can only restrict to a large range of possible IP addresses, and these keep changing... so user@% is our use case. In our use case, end users never type a password (except under edge cases) as they are authenticated by google, and we use that authentication to lookup the database credentials. We have noticed that various servers (some apparently from hong kong and eastern europe where we have no customers) are trying repeat attempts to brute force attack root@someip and mysqld@someip. We would like to lock these ip addresses out for a long time after only a few number of failed login attempts. For our use case, we might lock out for 6 hours after 5 failed attempts. I agree the very complex password largely solves the problem for now, but I would like to make it even more difficult by adding the above capability if at all possible. It is a very common practice in computer security to lock for X time after Y failed password attempts... we are just tweaking the model so it applies to user@someip so that denials of root@12.12.12.12 doesn't prevent root@12.13.14.15 from legitimately logging in. |
| Comment by Sergei Golubchik [ 2019-03-04 ] |
|
Let's consider it's done in |
| Comment by Robert Dyas [ 2019-03-09 ] |
|
It is unclear to me what was actually implemented by looking at the other MDEVs. |
| Comment by Sergei Golubchik [ 2019-03-22 ] |
|
It's documented here: https://mariadb.com/kb/en/library/server-system-variables/#max_password_errors It works per user account, that is, per one row in mysql.user table. |