Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15421

max allowed bad password attempts from ip

Details

    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
      --max-bad-passwords-lockout-reset=120

      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?

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            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.

            danblack Daniel Black added a comment - 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.
            rdyas Robert Dyas added a comment -

            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?

            rdyas Robert Dyas added a comment - 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?
            danblack Daniel Black added a comment -

            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 MDEV-13096.

            danblack Daniel Black added a comment - 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 MDEV-13096 .
            rdyas Robert Dyas added a comment -

            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.

            rdyas Robert Dyas added a comment - 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.

            Let's consider it's done in MDEV-7598. Not exactly as described here, but close enough.

            serg Sergei Golubchik added a comment - Let's consider it's done in MDEV-7598 . Not exactly as described here, but close enough.
            rdyas Robert Dyas added a comment -

            It is unclear to me what was actually implemented by looking at the other MDEVs.
            Can you point me to the MDEV or anything that describes the final implemented solution?
            Does it count retry's only for user@someip as described? I can't use it if brute force of root@somebadip blocks root@agoodip

            rdyas Robert Dyas added a comment - It is unclear to me what was actually implemented by looking at the other MDEVs. Can you point me to the MDEV or anything that describes the final implemented solution? Does it count retry's only for user@someip as described? I can't use it if brute force of root@somebadip blocks root@agoodip

            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.

            serg Sergei Golubchik added a comment - 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.

            People

              Unassigned Unassigned
              rdyas Robert Dyas
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.