[MDEV-29209] Implement connection response delay after a number of failed login attempts Created: 2022-07-29  Updated: 2024-01-09

Status: Stalled
Project: MariaDB Server
Component/s: Authentication and Privilege System, Plugins
Fix Version/s: 11.5

Type: New Feature Priority: Major
Reporter: Ian Gilfillan Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: compat57, compat80

Issue Links:
PartOf
is part of MDEV-28906 MySQL 8.0 desired compatibility Open
Relates
relates to MDEV-7598 Block user accounts after failed logi... Closed
relates to MDEV-23729 INFORMATION_SCHEMA Table info. abou... Stalled
relates to MDEV-19133 Limit / throttle connection attempts Open

 Description   

MySQL 5.7 introduced the Connection Control plugins to implement an increasing delay in server response to connection attempts after a configurable number of consecutive failed attempts.
https://dev.mysql.com/doc/refman/5.7/en/connection-control.html

This is aimed as a deterrent for brute force attacks. A user requested this feature - https://mariadb.com/kb/en/is-there-a-mariadb-equivalent-to-mysql-connection_control-plugin/



 Comments   
Comment by Sergei Golubchik [ 2022-08-06 ]

MariaDB has @@max_password_errors variable, MDEV-7598

Comment by Hartmut Holzgraefe [ 2022-09-28 ]

max_password_errors totally blocks a user though, and excludes SUPER and local users from being blocked at all

So it does not protect against attacks on the users that are the "most valuable prey".

I understand why these are included as otherwise an attacker could lock out everyone able to do a FLUSH PRIVILEGES so that a block reset could only be done by a hard server restart.

But with the throttling approach there wouldn't really be a need to exclude special users, an actual admin user could still log in manually, just with an acceptable delay, while malicious or otherwise misbehaving clients would be limited to one request per delay period while basically being starved by the server.

Comment by kurt.ding [ 2022-11-24 ]

PR is avaliable , it would be nice if PR got comments.

Comment by Sergei Golubchik [ 2022-11-27 ]

commented

Comment by kurt.ding [ 2022-11-29 ]

How about this idea ? Imlement this feature like check_for_max_user_connections feature , not as mysql which implement this as an audit plugin .

Comment by Sergei Golubchik [ 2022-12-01 ]

something like that would be much simpler, indeed. But not in {{ check_for_max_user_connections()}}, because see how it's used:

  if (thd->user_connect &&
      (thd->user_connect->user_resources.conn_per_hour ||
       thd->user_connect->user_resources.user_conn ||
       max_user_connections_checking) &&
       check_for_max_user_connections(thd, thd->user_connect))

it's only invoked if there's some max_... liimit.

And I suggest not to implement complex user-configurable timeouts with min/max and a threshold. Just hard-code all these values, hardly anybody will want to fine-tune them

Comment by kurt.ding [ 2022-12-02 ]

Hard code for min/max and a threshold values is much simpler. I will start do this work today

Comment by kurt.ding [ 2022-12-22 ]

PR is ready , it would be nice if PR got comments.

Comment by Sergei Golubchik [ 2023-01-04 ]

It will. At the moment we're mainly working on bugs, though. and will start looking into features again in February.

Comment by Vicențiu Ciorbaru [ 2024-01-09 ]

This patch needs additional work. When I get back to working on this task, I'll mark it into in-progress.

Generated at Thu Feb 08 10:06:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.