[MXS-1462] MaxScale erroneously connects to MySQLBackend servers via TLS1.0 rather than TLS1.2 Created: 2017-10-05 Updated: 2017-11-30 Resolved: 2017-11-24 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | mariadbbackend |
| Affects Version/s: | 2.1.9 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Pak Chan | Assignee: | markus makela |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04, MariaDB Galera, MariaDB 10.1.28 |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 2017-45, 2017-46 | ||||||||||||||||
| Description |
|
Hi, I'm in the process of setting up MaxScale on Ubuntu 16.04 fronting a Galera cluster where the MariaDB database nodes (also on Ubuntu 16.04) are set to use TLSv1.2. I have another Ubuntu 16.04 server, which is where I'm testing from (using a MariaDB "mysql" client, set up with the same client certificate as is used by MaxScale to connect to the Galera cluster). There is a "test" user (requiring SSL) and a "galeramon" user on the database. According to the documentation, I can configure this in MaxScale as follows:
However, this never successfully connects. I ran a tcpdump packet capture on the connection, and found that the reason it was failing was that MaxScale was trying to connect using TLSv1.0 despite the specification. Changing the "ssl_version" setting in the "dbnode*" sections to "MAX" had no effect; neither did commenting out that setting altogether. I've attached a log of a sample session. The version of openssl and libssl1.0.0 on the server are both 1.0.2g-1ubuntu4.8, so it should support TLSv1.2. I installed MaxScale with:
I can disable the TLS requirement for the "galeramon" user, which allows MaxScale to start up, but the moment I log into the database via MaxScale as the "test" user, the connection fails, as the following transcript (from a different server) shows:
I can connect to a database instance over TLSv1.2 from the mysql client on another machine using the mysql client with the same ("db-client-*") certificate as specified above, and I can connect to the MaxScale "Galera Listener" using the same mysql client, also over TLSv1.2 (as indicated via tcpdump packet captures), so the "ssl_version" setting is being honoured by the MaxScale listener, just not the MySQLBackend server. |
| Comments |
| Comment by markus makela [ 2017-11-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Managed to reproduce it:
Generated certs with:
Configuration:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-08 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sadly, the earlier error was due to faulty server SSL configuration. These are my results after testing with MaxScale 2.1.10 on CentOS 7 with MariaDB 10.0.32. This would point towards this being a problem with the OS SSL version. I'll continue investigations on Ubuntu.
Here's the MaxScale configuration.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PC Please try with ssl_version=TLSv11 and ssl_version=TLSv10 to see if either one of them works. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pak Chan [ 2017-11-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It works with ssl_version=TLSv10; I couldn't find a setting to set the MariaDB server to use TLSv1.1, so I couldn't test that. I've updated to the latest release of openssl (1.0.2g-1ubuntu4.9) on Ubuntu as that was released recently, but it hasn't made any difference to the TLSv1.2 backend issue. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks, I'll continue investigating why it doesn't work. You can define MaxScale to offer only TLSv1.1 with the ssl_version=TLSv11 parameter regardless of what the server is configured with. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-17 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PC Just to confirm that the server also uses and recognizes the TLSv1.0, please execute SHOW STATUS LIKE 'Ssl_version' through MaxScale and with a direct connection. If MaxScale truly connects with TLSv1.0, then it should produce the following output when queried through MaxScale.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pak Chan [ 2017-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi Markus, If I set "ssl_version=MAX" in the server definitions, and set the backend MariaDB database cipher suite to TLSv1 ("ssl-cipher=TLSv1" in the "mysqld" section), the MySQL client does connect via TLSv1.2; running "show status like 'ssl_version';show status like 'ssl_cipher';" results in the following:
However, the Galera Monitor is only using TLSv1.0 when connecting with TLS, and so if I change the MariaDB configuration to only offer TLSv1.2 ("ssl-cipher=TLSv1.2"), the Galera Monitor is unable to connect as MariaDB rejects the connection, so MaxScale doesn't list any servers as being available, and thus doesn't allow any connections to them. That's probably the issue. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK, then we have ruled out MaxScale itself as a source of problems and now we can focus on the Connector-C that MaxScale uses to connect to the server. We'll continue investigating this. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Georg Richter [ 2017-11-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi. forcing the server or client to use a certain tls protocol version is not possible yet (see If you specify a cipher like DHE-RSA-AES256-SHA which is an extended TLSv1.0 cipher, you can't expect that the selected protocol will be TLSv1.0. If both client and server supports TLSv1.2 (or TLSv1.1), the protocol will be TLSv1.2 and the cipher in use will be the TLSv1.0 cipher DHE-RSA-AES256-SHA. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Closing this as Incomplete since the Connector-C appears to be functioning correctly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pak Chan [ 2017-11-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If I configure the MariaDB backend databases offer both a TLSv1.2-only cipher and a TLSv1.0 cipher via "ssl-cipher=DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA", and monitor the network traffic, I get the following results:
Now, there's no apparent (to me) reason why Galera Monitor will choose a different TLS version from the MaxScale database connection, but this is a problem for me, given that Galera Monitor uses a relatively insecure TLS version and cipher suite. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by markus makela [ 2017-11-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
PCI've opened a bug report for the Connector-C about the usage of TLSv1.0 when TLSv1.2 is available: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pak Chan [ 2017-11-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks Markus. |