1

Is it possible to check if a MySQL server has SSL connections enabled without logging in, assuming we have port and IP?

1 Answer 1

2

Theoretically it is possible to do that, but it requires understanding of MySQL's own protocol and advanced socket programming.

As part of the initial handshake process, the mysql server sends an initial handshake packet. As part of capability flags the MySQL server sets the CLIENT_SSL flag if it supports SSL:

The SSL support is announced in Initial Handshake Packet sent by the server via CLIENT_SSL and is enabled if the client returns the same capability.

This packet is sent before the authentication, so you do not have to authenticate to determine if MySQL server support SSL. However, in the various MySQL APIs you cannot simply ask for the initial handshake packet to be sent. Even in the C API you only have mysql_real_connect() that will connect you to the server immediately. So, you need to write your own code to initiate the connection to mysql server, process the server's initial handshake packet, determine if it supports SSL and close the connection.

Sign up to request clarification or add additional context in comments.

1 Comment

This answer is quite helpful. I am using php right now. I guess I have to proceed with using socket programming in php. Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.