help icon indicating copy to clipboard operation
help copied to clipboard

MySQL protocol SSL

Open prettydiff opened this issue 3 years ago • 2 comments

Details

I am trying to write a Node application from scratch that connects to MySQL via the MySQL protocol. I can open a NET (TCP) socket to my MySQL server and receive the MySQL greeting packet. The relevant documentation is at: https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_ssl_request.html

At this stage in the connection process the documentation states the SSL exchange occurs without further guidance. I suspect I am upgrading the socket to TLS incorrectly. I provided the code of how I am executing.

Node.js version

19.4.0

Example code

let socket:Socket = connectInsecure({
    host: env[environment].host,
    port: env[environment].port
});
socket.once("data", greeting);

// receive the MySQL greeting packet and parse it out in the 'greeting' callback

// send the MySQL SSL request as:
// <Buffer 20 00 00 01 ff ff ff cf 00 00 ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
// 
socket.write(requestBody);

socket = new TLSSocket(socket);

socket.on("secureConnect", function connection_envCallback_sslRequest_secure(err):void {
    // callback never fires
    console.log(err);
    console.log("ssl connected");
});

Operating system

Windows

Scope

Runtime.

Module and version

Not applicable.

prettydiff avatar Feb 09 '23 14:02 prettydiff

Guess you need to use wireshark or similar tools as to what is happening on the connection

preveen-stack avatar Apr 27 '23 12:04 preveen-stack

There has been no activity on this issue for 11 months. The help repository works best when sustained engagement moves conversation forward. The issue will be closed in 1 month. If you are still experiencing this issue on the latest supported versions of Node.js, please leave a comment.

github-actions[bot] avatar Mar 23 '24 01:03 github-actions[bot]

Closing after no activity on this issue for 12 months.

github-actions[bot] avatar Apr 22 '24 01:04 github-actions[bot]