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

Inconsistency in config for TLS vs Auth #4028

Closed
bogdandrutu opened this issue Sep 13, 2021 · 19 comments
Closed

Inconsistency in config for TLS vs Auth #4028

bogdandrutu opened this issue Sep 13, 2021 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@bogdandrutu
Copy link
Member

bogdandrutu commented Sep 13, 2021

It seems to be very confusing in confighttp and configgrpc that TLS is a special configuration embedded into the main config, and "Auth" is separated.

We need to look into this and confirm the right design/configuration for TLS and other Authentications. Another inconsistency that I remember is the KafkaReceiver/Exporter where these options are combined under an "authentication" sub-layer.

Investigate how other projects are dealing with this and try to use the "standard" across projects (Prometheus, Kafka, Grafana, K8S, etc.).

@bogdandrutu bogdandrutu added the bug Something isn't working label Sep 13, 2021
@bogdandrutu bogdandrutu added this to the Configuration stability milestone Sep 13, 2021
@alolita
Copy link
Member

alolita commented Sep 13, 2021

@jpkrohling can you please take a look at this issue and share your design input for auth configs.

@jpkrohling
Copy link
Member

Looking at it now, I believe that it should indeed be squashed, like TLS. It did make sense in the past to be conservative about this and group all auth options under auth, but I don't foresee any other option within that config option.

@mxiamxia
Copy link
Member

mxiamxia commented Sep 15, 2021

It seems there is no consistent design pattern among these projects for TLS and Auth configurations. I found Prometheus and Grafna try to group TLS and Auth configs together, but k8s Kubelet separates them out in the configuration when doing API server authenticating.
Eg,

  1. Prometheus configuration groups TLS and Auth secrets together in one tls_config structure. Here is Prom auth reference doc and code.
  2. Grafana uses key value pairs in its ini config file. It also tries to group TLS and Auth secrets entries in the same section within configurations. See example.

However, in Kubelet Configuration

We can combine TLS and Authenticator in confighttp and configgrpc as one config. But it seems will only be useful for OLTP receiver/exporter or common cases. Because there are so many authentication protocols and custom authentication options, we can't have a generic TLS/Authentication config or custom authenticator extension that could satisfy the different auth use cases in different receivers/exporters. Take Kafka exporter as example, it supports multiple authentication protocols including basic plain text auth, SASL and Kerberos, we can't apply TLS/Authentication config directly from confighttp and configgrpc for Kafka components. it has to define its own customized authentication config in Kafka components.

I'd like to help on this issue. pls let me know if you want me help on anything. @jpkrohling @bogdandrutu @alolita

@jpkrohling
Copy link
Member

The authenticator options will still be part of the extension's own configuration. confighttp and configgrpc would include a configauth with squash mode, similar to what they do with configtls. At least, that's how I understand the original concern.

@mxiamxia
Copy link
Member

Agree that we should place TLS and authenticator in the same config level to reduce the confusing. We can either simply squash configauth in confighttp and configgrpc or combine them under a new auth config structure. I listed these 2 option examples below, pls let me know which one is preferred.

Option#1 - simply squash configauth

otlp:
  endpoint: "1.2.3.4:1234"
  timeout: 10s
  ca_file: ca.pem
  cert_file: cert.pem
  key_file: key.pem
  authenticator: oAuth      

Option#2 - put both TLS and Authenticator under a new auth

otlp:
  endpoint: "1.2.3.4:1234"
  timeout: 10s
  auth:
    ca_file: ca.pem
    cert_file: cert.pem
    key_file: key.pem
    authenticator: oAuth

@Aneurysm9
Copy link
Member

I think that either auth should be squashed (as in #1 above) or that tls should not, like this:

otlp:
  endpoint: "1.2.3.4:1234"
  timeout: 10s
  tls:
    ca_file: ca.pem
    cert_file: cert.pem
    key_file: key.pem
  auth:
    authenticator: oAuth

@alolita
Copy link
Member

alolita commented Sep 15, 2021

Thanks Anthony. I agree having TLS and Auth as siblings would provide more flexibility. You can have Auth with TLS but TLS can standalone without Auth.

@alolita
Copy link
Member

alolita commented Sep 15, 2021

@bogdandrutu @tigrannajaryan @jpkrohling Can you weigh in on what your final recommendation is? Based on that we will file a PR.

@mxiamxia
Copy link
Member

mxiamxia commented Sep 16, 2021

All these options will introduce the break changes. Option#1 has the minimal impact since Authenticator is newer that has not been commonly applied yet compare to tls.

@jpkrohling
Copy link
Member

I prefer the non-squashed versions, as it makes the context clear: we know that key_file is related to TLS. For the auth part, I don't have a strong opinion for the current implementation, as the only property inside it is authenticator.

@alolita
Copy link
Member

alolita commented Sep 16, 2021

@bogdandrutu looks like non-squashed version is the way to do - can you weigh in with your comments so that we can make progress.

@tigrannajaryan
Copy link
Member

I think that either auth should be squashed (as in #1 above) or that tls should not, like this:

otlp:
  endpoint: "1.2.3.4:1234"
  timeout: 10s
  tls:
    ca_file: ca.pem
    cert_file: cert.pem
    key_file: key.pem
  auth:
    authenticator: oAuth

This looks better to me. I don't like the squashed version since it is not clear what keys are about (what is key_file?)
It is unfortunate that this is going to be a breaking change but I think we need too fix it.

@mxiamxia
Copy link
Member

I think that either auth should be squashed (as in #1 above) or that tls should not, like this:

otlp:
  endpoint: "1.2.3.4:1234"
  timeout: 10s
  tls:
    ca_file: ca.pem
    cert_file: cert.pem
    key_file: key.pem
  auth:
    authenticator: oAuth

This looks better to me. I don't like the squashed version since it is not clear what keys are about (what is key_file?)
It is unfortunate that this is going to be a breaking change but I think we need too fix it.

Thanks @tigrannajaryan. Has sent the PR above (#4063) for this option. Please help review it.

@alolita
Copy link
Member

alolita commented Sep 17, 2021

@tigrannajaryan can you please help review and merge?

@bogdandrutu
Copy link
Member Author

@jpkrohling @tigrannajaryan @mxiamxia we need to make sure we are consistent with Server side correct? See https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confighttp/confighttp.go#L143. I think personally both should be "tls"

@jpkrohling
Copy link
Member

Agree, consistency FTW!

@bogdandrutu
Copy link
Member Author

@mxiamxia please think about #4063 (comment)

@tigrannajaryan
Copy link
Member

@mxiamxia please close this when you consider it done.

tigrannajaryan pushed a commit that referenced this issue Sep 27, 2021
Change TLSClient config to pointer type in `confighttp` and `configgrpc` config

**Related Issue**
#4028
#4063 (comment)
@mxiamxia
Copy link
Member

mxiamxia commented Sep 28, 2021

@mxiamxia please close this when you consider it done.

Hi @tigrannajaryan , I'm fine to close this issue and also take a look the comment you put in PR #4104 which is the existing behavior not related to this config inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants