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

Client's --ssl-* options (without --ssl-verify-server-cert) are silently ignored if TLS is not possible

Details

    Description

      If the client provides --ssl-* options, but a TLS connection to the server is not possible, then the client simply silently ignores the provided --ssl-* options if the --ssl-verify-server-cert option is not also provided. The user may think that their connection is encrypted, but it is not.

      The current behavior is probably the "expected" behavior according to Engineering. See MDEV-16409 for some details on previous discussion. However, I don't think this behavior is the behavior that would be expected by most users. When implementing security features, the industry standard for design is to fail safe. Security features may be mandatory for compliance reasons, and the fault of a security control may silently increase risk.

      Consider an example: if you typed https://mybank.com into your browser's URL bar, would you be happy if the browser silently used an unencrypted connection, even though you requested HTTPS? This is basically what MariaDB's clients are doing.

      For example, let's say that TLS is not enabled on our server:

      $ sudo mariadb --execute="SHOW GLOBAL VARIABLES LIKE 'ssl%'"
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | ssl_ca        |       |
      | ssl_capath    |       |
      | ssl_cert      |       |
      | ssl_cipher    |       |
      | ssl_crl       |       |
      | ssl_crlpath   |       |
      | ssl_key       |       |
      +---------------+-------+
      

      If a client tries to connect via TLS, then they will not see an error, and their connection will be unencrypted:

      $ mariadb --user=myuser --password=password --host=127.0.0.1 --ssl --ssl-ca=/home/vagrant/ca.pem --execute="SHOW SESSION STATUS LIKE 'Ssl_cipher'"
      +---------------+-------+
      | Variable_name | Value |
      +---------------+-------+
      | Ssl_cipher    |       |
      +---------------+-------+
      

      The client will only see an error if they also provide the --ssl-verify-server-cert option:

      $ mariadb --user=myuser --password=password --host=127.0.0.1 --ssl --ssl-ca=/home/vagrant/ca.pem --ssl-verify-server-cert --execute="SHOW SESSION STATUS LIKE 'Ssl_cipher'"
      ERROR 2026 (HY000): SSL connection error: SSL is required, but the server does not support it
      

      MySQL fixed this problem by introducing the --ssl-mode client option in MySQL 5.7.11 that provides more configurable TLS behavior.

      https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#option_general_ssl-mode

      Part of the new MySQL behavior made it so that if the client specifies the --ssl-ca or --ssl-capath option, then that will imply --ssl-mode=VERIFY_CA. by default.

      The --ssl-mode option interacts with CA certificate options as follows:

      • If --ssl-mode is not explicitly set otherwise, use of --ssl-ca or --ssl-capath implies --ssl-mode=VERIFY_CA.
      • For --ssl-mode values of VERIFY_CA or VERIFY_IDENTITY, --ssl-ca or --ssl-capath is also required, to supply a CA certificate that matches the one used by the server.
      • An explicit --ssl-mode option with a value other than VERIFY_CA or VERIFY_IDENTITY, together with an explicit --ssl-ca or --ssl-capath option, produces a warning that no verification of the server certificate will be done, despite a CA certificate option being specified.

      In my opinion, we should take one of the following actions:

      • Throw a warning if the client provides --ssl-* options, but a TLS connection to the server is not possible.
      • Or make the --ssl-ca and --ssl-capath options imply the --ssl-verify-server-cert option by default (similar to MySQL 5.7+ behavior).
      • Or port MySQL's --ssl-mode behavior.

      Attachments

        Issue Links

          Activity

            GeoffMontee Geoff Montee (Inactive) created issue -
            GeoffMontee Geoff Montee (Inactive) made changes -
            Field Original Value New Value
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            jacob.moorman Jacob Moorman (Inactive) made changes -
            Component/s Scripts & Clients [ 14977 ]
            Component/s SSL [ 14980 ]
            Component/s Scripts & Clients [ 11002 ]
            Component/s SSL [ 10112 ]
            Fix Version/s 10.2 [ 23606 ]
            Fix Version/s 10.3 [ 23605 ]
            Fix Version/s 10.4 [ 23604 ]
            Fix Version/s 10.5 [ 23608 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.1 [ 16100 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Key MDEV-23148 MENT-861
            Affects Version/s 10.1.45 [ 23913 ]
            Affects Version/s 10.2.32 [ 24221 ]
            Affects Version/s 10.3.23 [ 24222 ]
            Affects Version/s 10.4.13 [ 24223 ]
            Affects Version/s 10.5.4 [ 24264 ]
            Project MariaDB Server [ 10000 ] MariaDB Enterprise [ 11500 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Affects Version/s 10.2 [ 23606 ]
            Affects Version/s 10.3 [ 23605 ]
            Affects Version/s 10.4 [ 23604 ]
            Affects Version/s 10.5 [ 23608 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 111130 ] MariaDB v4 [ 135817 ]
            julien.fritsch Julien Fritsch made changes -
            Labels skysql
            julien.fritsch Julien Fritsch made changes -
            Issue Type Bug [ 1 ] New Feature [ 2 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Assignee Ralf Gebhardt [ ralf.gebhardt@mariadb.com ] Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Component/s Scripts & Clients [ 11002 ]
            Component/s SSL [ 10112 ]
            Component/s Scripts & Clients [ 14977 ]
            Component/s SSL [ 14980 ]
            Fix Version/s 10.10 [ 27530 ]
            Fix Version/s 10.4 [ 23604 ]
            Fix Version/s 10.3 [ 23605 ]
            Fix Version/s 10.2 [ 23606 ]
            Fix Version/s 10.5 [ 23608 ]
            Key MENT-861 MDEV-28634
            Affects Version/s 10.4 [ 23604 ]
            Affects Version/s 10.3 [ 23605 ]
            Affects Version/s 10.2 [ 23606 ]
            Affects Version/s 10.5 [ 23608 ]
            Issue Type New Feature [ 2 ] Task [ 3 ]
            Project MariaDB Enterprise [ 11500 ] MariaDB Server [ 10000 ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            serg Sergei Golubchik made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            serg Sergei Golubchik made changes -
            elenst Elena Stepanova made changes -
            Assignee Sergei Golubchik [ serg ] Ramesh Sivaraman [ JIRAUSER48189 ]
            serg Sergei Golubchik made changes -
            Assignee Ramesh Sivaraman [ JIRAUSER48189 ] Sergei Golubchik [ serg ]
            serg Sergei Golubchik made changes -
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 10.10 [ 27530 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.12 [ 28320 ]
            Fix Version/s 10.11 [ 27614 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.1 [ 28549 ]
            Fix Version/s 11.0 [ 28320 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.3 [ 28565 ]
            Fix Version/s 11.1 [ 28549 ]
            dlenski Daniel Lenski (Inactive) made changes -
            dlenski Daniel Lenski (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Status Stalled [ 10000 ] Needs Feedback [ 10501 ]
            serg Sergei Golubchik made changes -
            Status Needs Feedback [ 10501 ] Open [ 1 ]
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            dlenski Daniel Lenski (Inactive) made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 11.3 [ 28565 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.4.1 [ 29523 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

              serg Sergei Golubchik
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 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.