[MDEV-10658] Support TLS SNI in MariaDB Created: 2016-08-24 Updated: 2023-08-14 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Felipe Gasper | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 7 |
| Labels: | beginner-friendly, compat81 | ||
| Issue Links: |
|
||||||||
| Description |
|
Support for TLS SNI (“Server Name Indication”) in MariaDB would be a boon. OpenSSL and other TLS libraries make it pretty straightforward to do … would MariaDB consider adding support for this? Preferably, please be flexible as to how to specify the logic for fetching the certificate for a given domain name. |
| Comments |
| Comment by Daniël van Eeden [ 2017-03-14 ] | |
|
Related: https://bugs.mysql.com/bug.php?id=84849 This can also be useful for proxy solutions to determine to which backend database a connection should be routed. | |
| Comment by Sergei Golubchik [ 2017-05-27 ] | |
|
What could be the use case? In the proxy — yes, I understand. In the client — ditto, for proxy to work. But why one may need it in the database server? | |
| Comment by Oli Sennhauser [ 2018-03-05 ] | |
|
serg: Use case: I am at a very big German company atm. And they want to build their own Kubernets DBaaS with MySQL Enterprise. They do not have enough IP addresses so they have to bind mysql to different ports. And thus TLS/SSL termination does not work per IP. So they want SNI in MySQL. At least that's what I have understood. And I am not sure that it will change the game when mariadb can offer this features (I am personally not convinced that it is the right approach, private Class A network, IPv6, etc...) | |
| Comment by Daniel Black [ 2018-03-05 ] | |
|
oli perhaps If SNI is required in the server what is expected? Sure you need to deliver a different server certificate based on the SNI name but then what? They end up at the same DB server instance. If there's no difference at that point why get clients connect to different database server names? | |
| Comment by Roel Arents [ 2019-02-28 ] | |
|
Imagine a multi tenant server for which you rent out accounts. E.g. a cloud vendor could do this. The infrastructure around this server might change (e.g. as you grow). But you want to provide your clients a stable hostname to which they can connect (securely). E.g. you have a MariaDB server at hostname db1.my-awesome-cloud.com. You're still small, with one MariaDB server. In the next months, 100 more clients sign up and you need to add another MariaDB server and divide the accounts between. Now, you don't want to have half of your clients change the host they connect to into db2.my-awesome-cloud.com. Instead, you were smart and actually gave them each individual hostnames (CNAMED to db1.etc). For each hostname you signed a certificate with an authority your tenants trusted from the beginning. Now when adding the new server and migrating the tenants to it, you only have to change the DNS records. | |
| Comment by Felipe Gasper [ 2019-06-13 ] | |
|
ISTM an ideal SNI implementation can accommodate arbitrarily many domain names without making the server preload a certificate for each domain. Yet more ideally, allow server admins to specify custom lookup logic for each domain name—e.g., via a script. The Pure-FTPd project has a protocol for SNI support that could be useful here: Maybe have a global variable `tls_sni_method` that can accept values:
| |
| Comment by Luke Meyer [ 2020-08-29 ] | |
|
Is there a client-only version of this request? It seems like it ought to be comparatively trivial (maybe just require a client flag --enable-sni or something so those who don't want SNI aren't surprised). I assumed this had been done years ago, once "PaaS" and "DBaaS" terms were coined. Imagine my surprise when, after setting up, securing, and creating a passthrough route to my MariaDB instance on OpenShift, I found... there's no way to reach it with an external client. The router would know what to do with the request if the client would simply... TELL IT... which hostname it wants to reach. I tried to put stunnel in front instead, but haven't been able to get it to work yet. Not sure if that's my ignorance or if there's a technical reason it won't work. | |
| Comment by VAROQUI Stephane [ 2023-05-23 ] | |
|
After facing the issue i was looking for implementation in HaProxy, inspecting the MySQL protocol for _server_host is not valid unless you use commercial version with lua plugin to decode handshake. the alternative approach layer 7 chain to other layer 7 proxy is a pure wast of ressources and most layer7 proxy can not expose multi server certifcate in frontend . Exposing SNI in | |
| Comment by raven [ 2023-08-10 ] | |
|
Seems like mysql client v8.1.0 has added client-side add sni feature
Can I assume it is compatible with mariadb server? What I want to achieve is to use sni hostname to route the client request to different mariadb server instance backend (ip address) |