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

no-tls should be an explicitly handled case #143

Closed
ciroque opened this issue Nov 27, 2023 · 3 comments · Fixed by #154
Closed

no-tls should be an explicitly handled case #143

ciroque opened this issue Nov 27, 2023 · 3 comments · Fixed by #154

Comments

@ciroque
Copy link
Collaborator

ciroque commented Nov 27, 2023

Sauce: #120 (comment)

If someone were to typo the TLS Mode in the config, we may wish to fail startup. Couple of thoughts here:

  • If the choice is to fail startup, how to best raise an alert that can be seen? Is it better to start in insecure mode (no-tls) or possibly fail to start and have it not be noticed?
  • As an implementation detail (hate to be too prescriptive, but in this case I'm going to be), the TLS Modes should be iota-based values, NOT STRINGS. This will help avoid a whole class of issues.
@ciroque
Copy link
Collaborator Author

ciroque commented Nov 29, 2023

NOTE: The documentation states that no-tls is the default mode. Just be sure to update the docs if that changes!

@ciroque
Copy link
Collaborator Author

ciroque commented Dec 7, 2023

How about this, make this configurable: failOnInsecure where the Controller will fail on startup when no-tls is chosen. The default would be on, turn it off to succeed with starting in no-tls mode.

Something to consider here: the only time no-tls is highly recommended is in production. Through development, and most likely testing, startup failure due to no-tls mode will be irritating at best.

@4141done thoughts?

@ciroque ciroque mentioned this issue Dec 7, 2023
4 tasks
@4141done
Copy link
Collaborator

4141done commented Dec 8, 2023

So I think having the controller default to no-tls is fine and probably does not need an additional flag (if you're going to set the additional flag, you would want to just set the tls-mode right?). The main thing I think is an issue is defaulting to no-tls if the value of tls-mode is specified but not one of the supported values.

I would not want to have a scenario where tls-mode: ca-ntls makes it through code review and then it's running unsecured but the deployer thinks that it is.

My proposal is:

  • We document no-tls as the default
  • If tls-mode is specified in the config map and is NOT one of the supported values, we fail as loudly as possible in the kubernetes context.

Cases

I think we'd ideally handle the following cases:

  • First time application of the ConfigMap -> Don't apply the config, generate an error Event, log errors
  • Applying a new ConfigMap when one is already valid and in use -> Don't apply the new config, old config is maintained, generate an Error event, log errors.

These should be true whether or not the controller is installed.

Possible solutions

Admission Control

I think the best approach based on my reading is to gate the application of a ConfigMap on validation of the values. I'm new to that concept but it looks like Admission Control would be the way or Dynamic Admission Control. Implementing Admission controllers would allow us to handle all the above cases

Error event dispatch

This would likely be a smaller lift, but we'd ideally:

  • Log an error
  • Dispatch an error event
  • Annotate the resource with an error status
  • Not apply the configuration change under the hood.

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

Successfully merging a pull request may close this issue.

2 participants