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

CORE-5589 Add config to select minimum TLS version #21372

Merged

Conversation

michael-redpanda
Copy link
Contributor

@michael-redpanda michael-redpanda commented Jul 12, 2024

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.1.x
  • v23.3.x
  • v23.2.x

Release Notes

Features

  • Adds new cluster config tls_min_version that allows users of Redpanda to specify the minimum version of TLS Redpanda will support. By default, the value is TLS v1.2.

@michael-redpanda
Copy link
Contributor Author

/dt

@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Jul 12, 2024

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51444#0190a8ff-f282-4962-9130-cdae90c56395:
pandatriage cache was not found

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51444#0190a8ff-f283-4374-b05f-c8f3ace0da97:
pandatriage cache was not found

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51444#0190a900-3c9c-4c3d-bb30-f7515b63be79:
pandatriage cache was not found

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51444#0190a900-3c9a-47f4-a945-b7234c7c4231:
pandatriage cache was not found

skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51444#0190a900-3c9e-4f7b-99bc-0f992927e9c8:
pandatriage cache was not found

@michael-redpanda
Copy link
Contributor Author

/dt

@michael-redpanda michael-redpanda marked this pull request as ready for review July 16, 2024 14:54
@michael-redpanda michael-redpanda requested a review from a team as a code owner July 16, 2024 14:54
@michael-redpanda michael-redpanda requested review from a team, pgellert and oleiman and removed request for a team July 16, 2024 14:54
@michael-redpanda
Copy link
Contributor Author

Force push 9620dba:

  • Switched from minimum_tls_version to tls_min_version

@michael-redpanda michael-redpanda requested review from aanthony-rp, BenPope and deniscoady and removed request for pgellert July 16, 2024 15:27
@Deflaimun
Copy link
Contributor

What specific string do we want our users using in this property?
"v.1.3" or "1.3" ?

, tls_min_version(
*this,
"tls_min_version",
"The minimum version of TLS that Redpanda will support.",
Copy link

@kbatuigas kbatuigas Jul 16, 2024

Choose a reason for hiding this comment

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

Suggested change
"The minimum version of TLS that Redpanda will support.",
"The minimum TLS version that Redpanda supports.",

Nit, for economy / alignment with docs style guide

@michael-redpanda
Copy link
Contributor Author

What specific string do we want our users using in this property? "v.1.3" or "1.3" ?

"v1.3"

Copy link
Member

@oleiman oleiman left a comment

Choose a reason for hiding this comment

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

looks good. i need to go over the dt tests in a bit more detail, but I wanted to flag the legacy_default thing before bed.

.match(to_string_view(tls_version::v1_0), tls_version::v1_0)
.match(to_string_view(tls_version::v1_1), tls_version::v1_1)
.match(to_string_view(tls_version::v1_2), tls_version::v1_2)
.match(to_string_view(tls_version::v1_3), tls_version::v1_3);
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: a default match to avoid throwing?

Copy link
Member

Choose a reason for hiding this comment

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

suggestion: a default match to avoid throwing?

Yeah, and I think this can be reused in the next commit.

tests/rptest/tests/tls_version_test.py Show resolved Hide resolved
tls_version::v1_1,
tls_version::v1_2,
tls_version::v1_3},
legacy_default<tls_version>(tls_version::v1_0, legacy_version{12})) {}
Copy link
Member

Choose a reason for hiding this comment

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

So this is the issue from late last year that @dotnwat was referring to. I think we're subject to this weird behavior here as well. You might try:

  • upgrade from <= logical 12 to HEAD
  • set the min tls version to 1.2
  • restart the broker
  • see whether the min tls version is set back to 1.0

In this case I think the escape hatch would be to set something other than the current version non-legacy default (e.g. 1.1 or 1.3), but it's worth being aware of, esp. if this is a compliance concern.

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 flagging. I'll write up a DT test for this specifically

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah thanks for flagging that is an issue. Setting to v1.2 and then restarting resets it back to v1.0....

.match(to_string_view(tls_version::v1_0), tls_version::v1_0)
.match(to_string_view(tls_version::v1_1), tls_version::v1_1)
.match(to_string_view(tls_version::v1_2), tls_version::v1_2)
.match(to_string_view(tls_version::v1_3), tls_version::v1_3);
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: a default match to avoid throwing?

Yeah, and I think this can be reused in the next commit.

src/v/config/convert.h Show resolved Hide resolved
Comment on lines 621 to 633
if (
std::find(acceptable_values.begin(), acceptable_values.end(), value)
== acceptable_values.end()) {
return false;
}

rhs = string_switch<type>(std::string_view{value})
.match(to_string_view(type::v1_0), type::v1_0)
.match(to_string_view(type::v1_1), type::v1_1)
.match(to_string_view(type::v1_2), type::v1_2)
.match(to_string_view(type::v1_3), type::v1_3);

return true;
Copy link
Member

Choose a reason for hiding this comment

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

is acceptable_values used anywhere else?

perhaps:

Suggested change
if (
std::find(acceptable_values.begin(), acceptable_values.end(), value)
== acceptable_values.end()) {
return false;
}
rhs = string_switch<type>(std::string_view{value})
.match(to_string_view(type::v1_0), type::v1_0)
.match(to_string_view(type::v1_1), type::v1_1)
.match(to_string_view(type::v1_2), type::v1_2)
.match(to_string_view(type::v1_3), type::v1_3);
return true;
auto out = string_switch<std::optional<type>>(std::string_view{value})
.match(to_string_view(type::v1_0), type::v1_0)
.match(to_string_view(type::v1_1), type::v1_1)
.match(to_string_view(type::v1_2), type::v1_2)
.match(to_string_view(type::v1_3), type::v1_3)
.default_match(std::nullopt);
if(out.has_value()) {
rhs = out.value();
}
return out.has_value();

aanthony-rp
aanthony-rp previously approved these changes Jul 17, 2024
Copy link
Contributor

@aanthony-rp aanthony-rp left a comment

Choose a reason for hiding this comment

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

couple nits, not blocking. Looks clear to me what's going on. nice work, good tests.

src/v/config/convert.h Show resolved Hide resolved
tests/rptest/tests/cluster_config_test.py Show resolved Hide resolved
Signed-off-by: Michael Boquard <michael@redpanda.com>
Signed-off-by: Michael Boquard <michael@redpanda.com>
Signed-off-by: Michael Boquard <michael@redpanda.com>
Signed-off-by: Michael Boquard <michael@redpanda.com>
@michael-redpanda
Copy link
Contributor Author

Force push 1cb3b6d:

  • Lint zee python

oleiman
oleiman previously approved these changes Jul 17, 2024
Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

lgtm.

curious why legacy_default was removed? it's not that i think it should or short not be used, but rather, if it was thought to have been needed before, it's surprising that the need disappeared given it solves such a specific problem.

BenPope
BenPope previously approved these changes Jul 18, 2024
@@ -33,6 +33,8 @@ build_tls_credentials(
cred_builder.set_ciphersuites(
{config::tlsv1_3_ciphersuites.data(),
config::tlsv1_3_ciphersuites.size()});
cred_builder.set_minimum_tls_version(
Copy link
Member

Choose a reason for hiding this comment

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

I'm intrigued, why is it set here, but not, for example, for the oidc client or the cloud_roles client?

Which also begs the question, should it be possible to configure this per client, or listener?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm intrigued, why is it set here, but not, for example, for the oidc client or the cloud_roles client?

Thanks for pointing that out, definitely a miss. I'll make the changes, but it's probably not as big as a deal as ensuring our services can be selective of what TLS version they support.

Which also begs the question, should it be possible to configure this per client, or listener?

Maybe in a future update. For now, to get something done to help our customers was to provide a single cluster config.

@michael-redpanda
Copy link
Contributor Author

michael-redpanda commented Jul 18, 2024

lgtm.

curious why legacy_default was removed? it's not that i think it should or short not be used, but rather, if it was thought to have been needed before, it's surprising that the need disappeared given it solves such a specific problem.

  1. Because it was broken for this use case. If I started with a v24.1 cluster and upgraded it, yes the value of the config went to v1.0, but if I tried to set it to v1.2 (the default value) and restarted, the legacy default code would reset it to v1.0.
  2. @deniscoady did some analysis using telemetry data and saw that the TLSv1.2 and TLSv1.3 were the only protocols in use
  3. Other products by default only enable TLSv1.2 and TLSv1.3 out of the box

@michael-redpanda
Copy link
Contributor Author

Force push c3a61b3:

  • Added set_minimum_tls_version to remaining users of TLS

Signed-off-by: Michael Boquard <michael@redpanda.com>
Signed-off-by: Michael Boquard <michael@redpanda.com>
@michael-redpanda
Copy link
Contributor Author

Force push 8bf2e75:

  • Being consistent in how tls_min_version is accessed

@dotnwat
Copy link
Member

dotnwat commented Jul 18, 2024

Because it was broken for this use case. If I started with a v24.1 cluster and upgraded it, yes the value of the config went to v1.0, but if I tried to set it to v1.2 (the default value) and restarted, the legacy default code would reset it to v1.0.

The feature being broken doesn't eliminate a problem that exists, right?

@deniscoady did some analysis using telemetry data and saw that the TLSv1.2 and TLSv1.3 were the only protocols in use
Other products by default only enable TLSv1.2 and TLSv1.3 out of the box

I guess these are the reasons why altered upgrade behavior is no longer needed?

@michael-redpanda
Copy link
Contributor Author

Because it was broken for this use case. If I started with a v24.1 cluster and upgraded it, yes the value of the config went to v1.0, but if I tried to set it to v1.2 (the default value) and restarted, the legacy default code would reset it to v1.0.

The feature being broken doesn't eliminate a problem that exists, right?

Correct but....

@deniscoady did some analysis using telemetry data and saw that the TLSv1.2 and TLSv1.3 were the only protocols in use
Other products by default only enable TLSv1.2 and TLSv1.3 out of the box

I guess these are the reasons why altered upgrade behavior is no longer needed?

yes this eliminated the need.

@michael-redpanda
Copy link
Contributor Author

michael-redpanda commented Jul 18, 2024

CI Failure:

@michael-redpanda michael-redpanda merged commit 9e44166 into redpanda-data:dev Jul 18, 2024
17 of 20 checks passed
vuldin added a commit to redpanda-data/docs that referenced this pull request Jul 29, 2024
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.

8 participants