-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: connect using TLS #118
Comments
This should be possible using only stable APIs in Deno 1.16.0, due to the stabilization of |
It's now possible to use stable |
@dangdennis i hacked together a quick spike that works against Planetscale and local mysql with a custom CA. I can share my fork here in a bit! |
Here's my branch with the basic mechanics for getting TLS working. Examples: const client = await new Client().connect({
hostname: "xyz.psdb.cloud",
tls: {
enabled: true,
}
});
// Custom CA for self-signed cert
const client = await new Client().connect({
hostname: "localhost",
tls: {
enabled: true,
caCertificates: [
await Deno.readTextFile("./certs/ca.crt")
]
}
}); Things missing:
I currently don't have time to work on this any further for at least a couple of weeks, but feel free to use my branch as the basis for a proper implementation. |
Just testing @codeflows TLS branch to connect to PlanetScale Mysql DB to a great success! Thanks @codeflows I hope you can create a PR on this. |
@codeflows I test the TLS branch to connect to TiDB Cloud. But fail with
I am not familiar with MySQL protocol and can't find what is going wrong. Could you give me some suggestions? |
just a guess. this error appears because of deno driver does not handle the switch method case |
any update on this? |
It would be nice if this mysql-driver supported connecting through TLS. This issue (to keep it simple) talks about one-way TLS, not including client-certificates.
Unfortunately, this does not mean it simply works by replacing
tcp://
bytls://
, as MySQL has its own protocol for that.Basically, instead of the client immediately replying to the handshake with a
HandshakeResponse
, it first sends aSSLRequest
to the server, then the server callsSSL_connect()
which does the TLS handshake, and once a TLS session is up, the client resumes normally with aHandshakeResponse
over that upgraded TLS connection.Useful resources:
This would require some new fields in the ClientConfig:
The text was updated successfully, but these errors were encountered: