Skip to content
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

Request: Connection Example for TLS #103

Open
dickson-michael opened this issue Jan 5, 2021 · 4 comments
Open

Request: Connection Example for TLS #103

dickson-michael opened this issue Jan 5, 2021 · 4 comments

Comments

@dickson-michael
Copy link
Contributor

I'm trying to debug an issue connecting to a vendor's database, and they recommended connecting with TLS.

Connection worked fine when run against my local Dockerized MySQL-8 container, but when I set the MySQL flag require_secure_transport it would disconnect (HY000 Connections using insecure transport are prohibited), as expected.

I modified the 2-simple-query.php file to read:

$context = (new Socket\ConnectContext)->withTlsContext(new Socket\ClientTlsContext(DB_HOST));
$config = new Mysql\ConnectionConfig(DB_HOST, 3306, DB_USER, DB_PASS, DB_NAME, $context);

However, this results in a promptly closed connection.

Debug output (without TLS context):

81 bytes read (version, caching_sha2_password)
101 bytes written (user, database, caching_sha2_password)
6 bytes read
5 bytes written
456 bytes read (public key)
[etc]

Debug output (with TLS context):

81 bytes read (version, caching_sha2_password)
36 bytes written
[disconnect]

If you can include an example for how to connect to a server that requires secure transport, it would be helpful.

@trowski
Copy link
Member

trowski commented Jan 5, 2021

Ping @bwoebi, possibly a bug here?

@bwoebi
Copy link
Member

bwoebi commented Jan 6, 2021

Not sure whether we currently support TLS on initial connect at all (only upgrade to tls). Need to check and try myself.

@trowski
Copy link
Member

trowski commented Feb 27, 2022

@dickson-michael Did you ever find a solution to this or did you move on to another approach?

I tried testing this myself but wasn't having luck even getting SSL to work on the test mysql server.

@bwoebi Do you have some time to look into this? Feel free to only apply fixes to v3 branch.

@dickson-michael
Copy link
Contributor Author

@trowski I don't remember the details, but we ended up not requiring this so I never went further. In addition, our vendor upgraded our production environment a few months later which broke the library and I had to revert to a synchronous wrapper. I haven't had a chance to revisit the project since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants