[MDEV-18277] Client can't validate server certificate if SAN name used. Created: 2019-01-16 Updated: 2019-05-02 Resolved: 2019-04-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | SSL |
| Affects Version/s: | 10.3.12 |
| Fix Version/s: | 10.2.23, 10.1.39, 10.3.14, 10.4.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | John Anderson | Assignee: | Daniel Bartholomew |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
CentOS Linux release 7.6.1810 (Core) Name : MariaDB-client Name : MariaDB-server |
||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
I have a MariaDB 10.3.12 server configured with SSL. The SAN certificate presented by the server looks like this:
When I connect to the server using the --host option that corresponds to the DNS entry of the Common Name, the connection succeeds.
However, if I attempt to connect using any of the DNS entries which correspond to the SAN name, the connection fails with an SSL error.
There is another issue, |
| Comments |
| Comment by Elena Stepanova [ 2019-01-17 ] | |||||||||||||||
|
It appears to be the same as | |||||||||||||||
| Comment by John Anderson [ 2019-01-17 ] | |||||||||||||||
|
The two could definitely be related, but
In the current ( | |||||||||||||||
| Comment by Christian Schrötter [ 2019-01-31 ] | |||||||||||||||
|
I can reproduce this issue with MariaDB 10.3.12-2 at Debian 10 (Buster) from Debian's package repository.
Connection to public.example.net works fine. But it fails with --ssl-verify-server-cert to internal.example.net:
| |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-04-05 ] | |||||||||||||||
|
It looks like the X509_check_host function that includes the SAN in server certificate verification is only called if the HAVE_X509_check_host macro is defined: https://github.com/MariaDB/server/blob/mariadb-10.3.14/sql-common/client.c#L1834 And it looks like that macro is only defined if the binaries are built on a system that has OpenSSL 1.0.2 or later: https://github.com/MariaDB/server/blob/mariadb-10.3.14/include/ssl_compat.h#L22 This makes sense, because the function does not seem to be present in OpenSSL 1.0.1 or earlier. However, we also know that our MariaDB RPMs are built on systems that use OpenSSL 1.0.1 because of
| |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-04-11 ] | |||||||||||||||
|
After the changes introduced to fix
So if anyone is having this issue with server certificate verification with SANs, you might want to see if it works if you update your clients to one of these versions that are built with OpenSSL 1.0.2. | |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-04-11 ] | |||||||||||||||
|
I've confirmed that one user was able to solve this problem on CentOS/RHEL 7 by upgrading to one of the versions with the changes introduced to fix I added the following note to the documentation:
https://mariadb.com/kb/en/library/secure-connections-overview/#server-certificate-verification | |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-04-11 ] | |||||||||||||||
|
serg, Should we go ahead and close this? Or is there something else that you think should be done for this? | |||||||||||||||
| Comment by Sergei Golubchik [ 2019-04-15 ] | |||||||||||||||
|
Let's close it, as seems to work now. | |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2019-05-02 ] | |||||||||||||||
|
I believe that MariaDB 10.1.39 should also be fixed, since it is also built with OpenSSL 1.0.2:
And 10.1.39 also contains the relevant compile-time checks: https://github.com/MariaDB/server/blob/mariadb-10.1.39/sql-common/client.c#L1840 https://github.com/MariaDB/server/blob/mariadb-10.1.39/sql-common/client.c#L1790 |