Skip to content

Conversation

matthewstevenson88
Copy link
Contributor

@matthewstevenson88 matthewstevenson88 commented Apr 2, 2021

This should hopefully fix the remaining bugs we found in #24960. More precisely, it does the following:

  • In test/core/handshake/server_ssl_common.cc, defer cleanup of the SSL libraries until all tests have finished. This is needed because cleanup of the SSL libraries must be done manually when building against OpenSSL 1.0.2, whereas it is done automatically for newer OpenSSL versions.

  • In test/core/handshake/client_ssl.cc, prevent a race condition in initializing the SSL libraries and similarly defer cleanup of the SSL libraries, add substantial logging to the test server, add a check for compatibility of the cert and private key to the test server, and have the test server do automatic curve selection (otherwise, the test server may not have a shared cipher with the client).

  • In src/core/lib/security/security_connector/ssl_utils.cc , remove the TLS 1.3-specific ciphers from the list of allowed ciphers, because they are not needed. This was suggested by @davidben in the review of Enable TLS 1.3 in the C-core and all wrapped languages. #23165. This will be done in a follow-up PR.

@matthewstevenson88 matthewstevenson88 added area/security area/test release notes: no Indicates if PR should not be in release notes labels Apr 2, 2021
@matthewstevenson88
Copy link
Contributor Author

@veblush FYI: still getting one weird failure, will look into it this week. Sorry for the delay.

@veblush
Copy link
Contributor

veblush commented Apr 13, 2021

@matthewstevenson88 No worry and please take your time!

@matthewstevenson88 matthewstevenson88 marked this pull request as ready for review June 2, 2021 19:39
@@ -70,9 +70,6 @@ static const char* cipher_suites = nullptr;
// All cipher suites for default are compliant with HTTP2.
GPR_GLOBAL_CONFIG_DEFINE_STRING(
grpc_ssl_cipher_suites,
"TLS_AES_128_GCM_SHA256:"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidben told me a while ago it was ok to drop this. David: could you confirm?

Copy link
Contributor

@davidben davidben Jun 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java and OpenSSL don't have the same API. Cipher suite configuration is a TLS implementation thing, not a TLS protocol thing. The TLS protocol doesn't have opinions on which part is configurable by callers. (Making them configurable was probably a mistake, but so it goes.)

So it depends on what this list is for. I see it's not defined in an OpenSSL-specific file, so gRPC seems to think it's a generic cross-TLS-implementation thing? Yet it uses OpenSSL-specific cipher suite names (the odd shortened spelling with hyphens is unique to OpenSSL), so there seems to be something strange going on here.

Anyway, the short answer is yes, they're unnecessary in the OpenSSL API. The long answer is:

  • In BoringSSL, we do not let you configure TLS 1.3 cipher suites. That configurability was a mistake. So any you pass into SSL_CTX_set_cipher_list are just ignored.
  • In OpenSSL 1.0.2 and 1.1.0, TLS 1.3 is not supported, so any you pass into SSL_CTX_set_cipher_list are just ignored.
  • In OpenSSL 1.1.1, SSL_CTX_set_cipher_list does not impact TLS 1.3 cipher suites, so any you pass into SSL_CTX_set_cipher_list are irrelevant. If you call SSL_CTX_set_ciphersuites, the TLS 1.3 cipher suites do matter. (This is necessary for compatibility so TLS 1.3 doesn't break in old applications that only configure TLS 1.2 ciphers.)

However, all of this is specific to the OpenSSL API. If this is meant to be a cross-TLS thing, you probably shouldn't make that assumption. But the format you all use isn't suitable for a cross-TLS thing so I dunno.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying David! The only use of this cipher list is to pass in to the SSL_CTX_set_cipher_list API. However, this is poorly documented and this list is used very far away from where it is defined. To be safe, I've removed this change from this PR and will send a follow-up PR that changes the cipher list and adds documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed context!

Copy link
Contributor

@veblush veblush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! I'll try to rerun the test once this is merged!

@matthewstevenson88 matthewstevenson88 merged commit 57dd2eb into grpc:master Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security area/test release notes: no Indicates if PR should not be in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants