The Wayback Machine - https://web.archive.org/web/20201101090255/https://github.com/mysqljs/mysql/pull/2304
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

#2301 Unable to set minimum TLS version #2304

Open
wants to merge 14 commits into
base: master
from

Conversation

@alexburley
Copy link

@alexburley alexburley commented Feb 24, 2020

#2301

Since Node 9 and before don't support min/max version these won't be set and the tests won't fail for those versions.

Node default TLS version is set to 1.2 for tests as Node 10 has not enabled support for 1.3 by default.

Tested against mysql 5.5 and mysql 8 servers

@alexburley alexburley requested a review from dougwilson Feb 24, 2020
alexburley added 2 commits Feb 24, 2020
@alexburley
Copy link
Author

@alexburley alexburley commented Mar 2, 2020

@dougwilson Do you know when we'd be able to get this merged?

@dougwilson
Copy link
Member

@dougwilson dougwilson commented Mar 2, 2020

Apologies, I will review today.

- `ciphers`: Cipher suite specification, replacing the default.
- `key`: Private keys in PEM format.
- `passphrase`: Shared passphrase used for a single private key and/or a PFX.
- `minVersion`: Optionally set the minimum TLS version to allow. One of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`.

This comment has been minimized.

@dougwilson

dougwilson Mar 3, 2020
Member

nit: we probably want to order these alphabetically (a "nit" to me is something I will change on landing, but if you want to change it earlier, even better).

passphrase : config.ssl.passphrase
passphrase : config.ssl.passphrase,
minVersion : config.ssl.minVersion,
maxVersion : config.ssl.maxVersion

This comment has been minimized.

@dougwilson

dougwilson Mar 3, 2020
Member

nit: we probably want to order these alphabetically

Copy link
Member

@dougwilson dougwilson left a comment

Awesome job! I just saw a couple things in tests I noted here. Please note that nothing here to me is at a level where I won't do anything until you do something; I will liekly work on the changes in here this weekend if you don't get to them first. But if you can get to them earlier, it's that much easier & faster for me to get landed ❤️

var NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
if (err) throw err;
connection.ping(function(err) {
if (!err && NODE_MAJOR_VERSION >= 10) assert.fail('Expected to fail due to mismatched TLS versions for Node12+');

This comment has been minimized.

@dougwilson

dougwilson Mar 3, 2020
Member

I would guess that getting past this point (expecting it to fail) the test should assert that it is failing for the reason we expect it to. Found quite a few bugs a while back when I added those kinds of tests in this lib.


connection.ping(function(err) {
var NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
if (!err && NODE_MAJOR_VERSION >= 10) assert.fail('Expected to fail due to mismatched TLS versions for Node12+');

This comment has been minimized.

@dougwilson

dougwilson Mar 3, 2020
Member

I would guess that getting past this point (expecting it to fail) the test should assert that it is failing for the reason we expect it to. Found quite a few bugs a while back when I added those kinds of tests in this lib.

@@ -138,12 +138,16 @@ common.getTestConfig = function(config) {
return mergeTestConfig(config);
};

common.getSSLConfig = function() {
common.getSSLConfig = function(options) {

This comment has been minimized.

@dougwilson

dougwilson Mar 3, 2020
Member

Rather than passing in the options here, the common functions in here expect the caller to use common.extend to augment after the fact.

This comment has been minimized.

@alexburley

alexburley Mar 4, 2020
Author

How do you mean?

This comment has been minimized.

@dougwilson

dougwilson Mar 16, 2020
Member

common.extend(common.getSSLConfig(), { minVersion: ... })

@dougwilson dougwilson self-assigned this Mar 3, 2020
@dougwilson dougwilson added the feature label Mar 3, 2020
@alexburley
Copy link
Author

@alexburley alexburley commented Mar 4, 2020

@dougwilson Thx for review 👍 Making some ammendments now, not sure if I understand what you mean about how i'm generating the test SSL config

@wobushiguojing
Copy link

@wobushiguojing wobushiguojing commented Mar 5, 2020

alexburley added 2 commits Mar 5, 2020
This reverts commit d82d3cc.
@alexburley alexburley requested a review from dougwilson Mar 5, 2020
@alexburley
Copy link
Author

@alexburley alexburley commented Mar 12, 2020

@dougwilson Any luck? Sorry to keep badgering, I just want to make sure I can update our service and get it running on Node12 before I forget.

connection.ping(function(err) {
var NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0], 10);
if (NODE_MAJOR_VERSION >= 10) {
if (!err) assert.fail('Expected to fail due to mismatched TLS versions for Node12+');

This comment has been minimized.

@dougwilson

dougwilson Mar 17, 2020
Member

I think the error message should be Node10+ (or the check should be fixed to match the error message).

connection.ping(function(err) {
if (NODE_MAJOR_VERSION >= 10) {
if (!err) {
assert.fail('Expected to fail due to mismatched TLS versions for Node12+');

This comment has been minimized.

@dougwilson

dougwilson Mar 17, 2020
Member

I think the error message should be Node10+ (or the check should be fixed to match the error message).

@alexburley alexburley requested a review from dougwilson Mar 17, 2020
@alexburley
Copy link
Author

@alexburley alexburley commented May 4, 2020

@dougwilson Any update on when this can be merged?

@antonisa-proto
Copy link

@antonisa-proto antonisa-proto commented Jul 23, 2020

Hello,
Can anyone review this PR @alexburley @dougwilson ? It seems that a lot of people have the same problem and this PR is going to solve it!

@dougwilson
Copy link
Member

@dougwilson dougwilson commented Jul 23, 2020

Sorry this fell off my radar. Thanks for the ping I will push it forward tonight

@rathboma
Copy link

@rathboma rathboma commented Jul 23, 2020

Just found this -- excited to see the work done already!

It has come up as an issue with our mysql integration in Beekeeper Studio. Think it's the cause of beekeeper-studio/beekeeper-studio#254

@dougwilson thanks so much for helping to get this merged. @alexburley thanks for doing the work!

Readme.md Outdated
- `cert`: Cert chains in PEM format.
- `ciphers`: Cipher suite specification, replacing the default.
- `key`: Private keys in PEM format.
- `maxVersion`: Optionally set the minimum TLS version to allow.

This comment has been minimized.

@rathboma

rathboma Jul 23, 2020

should this say Optionally set the MAXIMUM TLS version to allow?

@BrandonNoad
Copy link

@BrandonNoad BrandonNoad commented Aug 20, 2020

@dougwilson Is there anything I can do to help get this PR merged?

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

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.