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

allow empty lists in SSL_CTX_set_ciphersuites #1511

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

samuel40791765
Copy link
Contributor

Description of changes:

MySQL deprecated the usage of weaker ciphers in their test suite: mysql/mysql-server@bc14366 This brought an additional gap to light, where OpenSSL allows the setting of empty strings in the Ciphersuite string configuration. This is known behavior since 1.1.1 and still exists today.

I've reconfigured the behavior for SSL_[CTX]_set_cipher_list which is our OpenSSL compat layer, but kept the same behavior for SSL_[CTX]_set_strict_cipher_list.

Call-outs:

N/A

Testing:

Test tweaking

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@samuel40791765 samuel40791765 requested a review from a team as a code owner March 26, 2024 23:30
@codecov-commenter
Copy link

codecov-commenter commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.99%. Comparing base (d09d423) to head (2e961c2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1511      +/-   ##
==========================================
+ Coverage   76.95%   76.99%   +0.03%     
==========================================
  Files         425      425              
  Lines       71546    71547       +1     
==========================================
+ Hits        55056    55085      +29     
+ Misses      16490    16462      -28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

smittals2
smittals2 previously approved these changes Mar 27, 2024
Comment on lines -5764 to -5765
// Configuring the empty cipher list fails.
EXPECT_FALSE(SSL_CTX_set_ciphersuites(ctx.get(), ""));
Copy link

Choose a reason for hiding this comment

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

Instead of deleting this check for failure… should it be replaced with an explicit check for success of setting the (TLSv1.3) ciphersuite list to an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explicit check for success for SSL[_CTX]_set_cipher_list is on L5758-5763 in the new change :)
But I just realized that I forgot about SSL[_CTX]_set_ciphersuites...

Comment on lines +5764 to +5767
// Configuring the empty cipher list with |SSL_CTX_set_ciphersuites|
// also succeeds.
EXPECT_TRUE(SSL_CTX_set_ciphersuites(ctx.get(), ""));
EXPECT_EQ(0u, sk_SSL_CIPHER_num(SSL_CTX_get_ciphers(ctx.get())));
Copy link

@dlenski dlenski Mar 27, 2024

Choose a reason for hiding this comment

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

Thanks, this is good.

Although this doesn't fully verify the pattern used by MySQL+MariaDB with OpenSSL, which is as follows…

  1. Call both:
    • SSL_CTX_set_cipher_list("NON-EMPTY list for TLSv1.2")
    • and SSL_CTX_set_ciphersuites("") // empty list for TLSv1.3
  2. Expect that there will be a non-zero number of TLSv1.2 (or earlier) ciphers available for new connections, and zero TLSv1.3 ciphersuites available 😅

As described in openssl/openssl#13704 (comment), it seems like it's quite complicated to get a list of only the TLSv1.3 ciphersuites or only the TLSv1.2 ciphers ☹️

Copy link
Contributor Author

@samuel40791765 samuel40791765 Mar 27, 2024

Choose a reason for hiding this comment

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

We have an integration build with mysql that runs against the tests that consume this behavior. We're in the process of updating to 8.3

Comment on lines +5764 to +5767
// Configuring the empty cipher list with |SSL_CTX_set_ciphersuites|
// also succeeds.
EXPECT_TRUE(SSL_CTX_set_ciphersuites(ctx.get(), ""));
EXPECT_EQ(0u, sk_SSL_CIPHER_num(SSL_CTX_get_ciphers(ctx.get())));
Copy link

@dlenski dlenski Mar 27, 2024

Choose a reason for hiding this comment

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

Thanks, this is good.

Although this doesn't fully verify the pattern used by MySQL+MariaDB with OpenSSL, which is as follows…

  1. Call both:
    • SSL_CTX_set_cipher_list("NON-EMPTY list for TLSv1.2")
    • and SSL_CTX_set_ciphersuites("") // empty list for TLSv1.3
  2. Expect that there will be a non-zero number of TLSv1.2 (or earlier) ciphers available for new connections, and zero TLSv1.3 ciphersuites available 😅

As described in openssl/openssl#13704 (comment), it seems like it's quite complicated to get a list of only the TLSv1.3 ciphersuites or only the TLSv1.2 ciphers ☹️

@samuel40791765 samuel40791765 merged commit 3fa0916 into aws:main Apr 10, 2024
44 checks passed
@samuel40791765 samuel40791765 deleted the ssl-string-empty branch April 10, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants