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

Adding min version and cipher suite variables to tls client configuration #217

Merged
merged 6 commits into from Sep 28, 2022

Conversation

Red-GV
Copy link
Contributor

@Red-GV Red-GV commented Sep 6, 2022

What this PR does:
This PR adds MinVersion and CipherSuites to the TLS configuration. This allows these TLS configuration paramters to be configurable outside of the defaults set by golang.

Which issue(s) this PR fixes:

Checklist

  • Tests updated
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@CLAassistant
Copy link

CLAassistant commented Sep 6, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

Just commenting on some nits, but you also need to fix the build (linting fails) and to sign the CLA.

crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
@aknuds1 aknuds1 requested a review from a team September 7, 2022 08:34
@aknuds1 aknuds1 added the enhancement New feature or request label Sep 7, 2022
@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 7, 2022

Thanks @aknuds1 !
I have addressed the issues you highlighted.

Copy link
Member

@pstibrany pstibrany 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 your PR.

crypto/tls/tls.go Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@bboreham
Copy link
Contributor

bboreham commented Sep 7, 2022

Is this the same change (roughly) as weaveworks/common#256 ?

Oh I see, this is client, while the common one is server-side.

Still, we should make the naming consistent, and I coded the other PR to avoid bringing in Kubernetes as a dependency.

@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 7, 2022

Hello @bboreham @pstibrany,

Yes, this is more or less the same (goal-wise of allowing a configurable TLS config) as the weaveworks PR. I had just pulled in the K8s dependency for an easier look up, but I can make a map for all the values for a lookup table instead.

@pstibrany
Copy link
Member

This is different in that it configures client side rather than server.

Copy link
Collaborator

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

I think it looks pretty good now, thanks for dropping the new dependency!

Leaving some suggestions that come to mind.

CHANGELOG.md Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls_test.go Outdated Show resolved Hide resolved
@Red-GV Red-GV force-pushed the cli-tls-variables branch 3 times, most recently from ed372fc to 6bf3fe3 Compare September 8, 2022 17:03
Copy link
Member

@pstibrany pstibrany 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 addressing my feedback.

crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Outdated Show resolved Hide resolved
crypto/tls/tls.go Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 13, 2022

Hello @pstibrany , your comments have been addressed.

@pstibrany
Copy link
Member

pstibrany commented Sep 14, 2022

Hello @pstibrany , your comments have been addressed.

Thank you for your work on this. I would like to make sure that this PR and grafana/mimir#2898 end up using same constants and help strings. /cc @bboreham

I have tried to integrate this PR into Mimir to see what the documentation and help string will look like.

Here is an example for CLI flags:

 -compactor.ring.etcd.tls-cipher-suites string
      Override the default cipher suite list (separated by commas). Allowed values:

      Secure Ciphers:
      - TLS_RSA_WITH_AES_128_CBC_SHA
      - TLS_RSA_WITH_AES_256_CBC_SHA
      - TLS_RSA_WITH_AES_128_GCM_SHA256
      - TLS_RSA_WITH_AES_256_GCM_SHA384
      - TLS_AES_128_GCM_SHA256
      - TLS_AES_256_GCM_SHA384
      - TLS_CHACHA20_POLY1305_SHA256
      - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
      - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
      - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
      - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
      - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
      - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
      - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
      - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
      - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
      - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256

      Insecure Ciphers:
      - TLS_RSA_WITH_RC4_128_SHA
      - TLS_RSA_WITH_3DES_EDE_CBC_SHA
      - TLS_RSA_WITH_AES_128_CBC_SHA256
      - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
      - TLS_ECDHE_RSA_WITH_RC4_128_SHA
      - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
      - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
      - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

  -compactor.ring.etcd.tls-min-version string
       Override the default minimum TLS version. Allowed values: VersionTLS10, VersionTLS11, VersionTLS12, VersionTLS13

and documentation:

# (advanced) Override the default cipher suite list (separated by commas).
# Allowed values:
#
# Secure Ciphers:
# - TLS_RSA_WITH_AES_128_CBC_SHA
# - TLS_RSA_WITH_AES_256_CBC_SHA
# - TLS_RSA_WITH_AES_128_GCM_SHA256
# - TLS_RSA_WITH_AES_256_GCM_SHA384
# - TLS_AES_128_GCM_SHA256
# - TLS_AES_256_GCM_SHA384
# - TLS_CHACHA20_POLY1305_SHA256
# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
# - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
# - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
# - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
# - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
#
# Insecure Ciphers:
# - TLS_RSA_WITH_RC4_128_SHA
# - TLS_RSA_WITH_3DES_EDE_CBC_SHA
# - TLS_RSA_WITH_AES_128_CBC_SHA256
# - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
# - TLS_ECDHE_RSA_WITH_RC4_128_SHA
# - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
# CLI flag: -<prefix>.etcd.tls-cipher-suites
[tls_cipher_suites: <string> | default = ""]

# (advanced) Override the default minimum TLS version. Allowed values:
# VersionTLS10, VersionTLS11, VersionTLS12, VersionTLS13
# CLI flag: -<prefix>.etcd.tls-min-version
[tls_min_version: <string> | default = ""]

@bboreham
Copy link
Contributor

That list of strings seems way too long for help text, to me.

@pstibrany
Copy link
Member

That list of strings seems way too long for help text, to me.

In Mimir we can extract it to a single doc block so that it doesn't repeat. Would that help? (I agree it's a bit long, and this is quite low-level option, so not many people will need it.)

@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 20, 2022

So, should I revert the help text change on the cipher_suites?

@pstibrany
Copy link
Member

pstibrany commented Sep 20, 2022

So, should I revert the help text change on the cipher_suites?

I still think it's valuable to have it in the help without the need for additional lookup in another documentation. Please keep it. In Mimir we will try to minimise the repetition by introducing new doc block.

@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 20, 2022

Okay, so then I just need to fix the conflict in the Changelog then. I will do that today.

@Red-GV
Copy link
Contributor Author

Red-GV commented Sep 26, 2022

Hello @pstibrany,

I was just what is the status of this PR? Is there anything more I need to do in order to get this PR through?

@bboreham bboreham changed the title Adding min version and cipher suite variables to tls configuration Adding min version and cipher suite variables to tls client configuration Sep 27, 2022
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Good job! CLI flags naming and supported values match the server side ones (weaveworks/common#256) so I'm happy with it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants