[MDEV-25701] Two-way TLS does not work with WolfSSL and version1 certificates Created: 2021-05-17 Updated: 2023-12-15 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Documentation |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Joe Cotellese |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
I generated certificates according to the instructions in the KnowledgeBase: https://mariadb.com/kb/en/certificate-creation-with-openssl/ I created a ca-cert, a server and a client certificate and set up the server using:
In the following snippets 192.168.23.15 is my linux server, 192.168.23.66 a Windows10 machine. The database user name I use is "secure". I can connect from linux clients using the client certificate just fine, e.g.:
and I can verify that encryption is indeed used: Trying to connect from the Windows machine I can't connect though:
I CAN connect from windows to linux using encryption when just giving the --ssl option without explicit client certificate:
When setting up MariaDB server on the windows size with the same server certificate as on Linux, and trying to connect locally using the client certificate I'm getting:
And when trying to connect to that windows server from linux (only server IP changed from .15 to .66 after verifying that things work locally):
Again, when just using the --ssl option without explicit client certificate the connection is established using TLS v1.2 just fine. Also when using MySQL 5.7 on the windows side, which uses OpenSSL instead of WolfSSL, things work just fine both ways with explicit client certificate. So there seems to be some problem with WolfSSL and certificate verification, at least when the certificates were created using OpenSSL as described in our knowledge base. |
| Comments |
| Comment by Hartmut Holzgraefe [ 2021-05-17 ] | ||
|
I also tested with 10.3 instead of 10.5 on both sides, and while some error messages are not exactly the same, the basic problem remains the same | ||
| Comment by Vladislav Vaintroub [ 2021-05-23 ] | ||
|
Did you notice, things work "just fine" only with OpenSSL, neither Schannel (Windows client) nor WolfSSL (Windows server) like that certificate. Since 2 independent SSL libraries think there is some problem with it, maybe there is some problem with it? | ||
| Comment by Vladislav Vaintroub [ 2021-05-25 ] | ||
|
it is clearly possible to generate cerficates with OpenSSL, and use them with all other implementations https://github.com/MariaDB/server/blob/10.6/mysql-test/lib/generate-ssl-certs.sh - this is how they are generated. I did not check whether KB description works, because I do not usually have a platform where openssl is installed. I suppose it does not even on Linux, once you use tar.gz packages, since they are WolfSSL-based. | ||
| Comment by Vladislav Vaintroub [ 2021-05-25 ] | ||
|
Forwarding to Documentation. | ||
| Comment by Hartmut Holzgraefe [ 2021-05-27 ] | ||
|
"it is clearly possible to generate cerficates with OpenSSL, and use them with all other implementations https://github.com/MariaDB/server/blob/10.6/mysql-test/lib/generate-ssl-certs.sh - this is how they are generated." that solves the Linux->Windows and Windows->Windows problems, by generating v3 certificates instead of v1 ones, which WolfSSL requires for TLS >= v1.2. So the
and
Problems reported above are gone when using cacert, server-cert and client-cert from mysql-test/std-data. But the "No matching cipher" problem when trying to connect from Windows/WolfSSL builds to Linux/OpenSSL is unfortunately still there. Now checking if the same is true between Linux/OpenSSL and Linux/WolfSSL builds, too ... | ||
| Comment by Vladislav Vaintroub [ 2021-05-27 ] | ||
|
hholzgra, can you upload certiicates that demonstrate "no matching cipher" only, and have anything else fixed? | ||
| Comment by Hartmut Holzgraefe [ 2021-05-27 ] | ||
|
So the "no matching cipher" problem is specific to SChannel based clients on Windows, it is reproducible with both v1 and v3 certificates. Splitting that out to a new MDEV soon ... | ||
| Comment by Hartmut Holzgraefe [ 2021-05-27 ] | ||
|
I now changed the ticket title to refer to the WolfSSL / certificate version problem only. | ||
| Comment by Hartmut Holzgraefe [ 2021-05-27 ] | ||
|
"No matching cipher" part split out to new | ||
| Comment by chylex [ 2023-04-21 ] | ||
|
Hi, I did some research and was able to generate V3 certificates with: openssl x509 -req -days 365000 -set_serial 1 -CA ca_cert.pem -CAkey ca_key.pem -in "server_req.pem" -out "server_cert.pem" -extfile /etc/ssl/openssl.cnf -extensions usr_cert It's very similar to the command in the original documentation. Please try if it fixes the issue, it would be great if the documentation could be updated and this issue finally resolved. When setting up SSL for my database, I found a few more things I think could improve the documentation, for ex.:
Let me know if there's interest in opening a new discussion about these things. I ended up writing a blog post that addresses all the issues I found, but I'd be happy to contribute my findings to the official documentation to make setting up SSL easier for others. |