-
Notifications
You must be signed in to change notification settings - Fork 137
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
Stop serving and fetching the tls cert used for gRPC #584
Conversation
Codecov Report
@@ Coverage Diff @@
## main #584 +/- ##
==========================================
- Coverage 46.22% 45.86% -0.36%
==========================================
Files 56 56
Lines 3310 3268 -42
==========================================
- Hits 1530 1499 -31
+ Misses 1690 1686 -4
+ Partials 90 83 -7
Continue to review full report at Codecov.
|
fa05ac2
to
b1e4f5b
Compare
4af365c
to
b885e17
Compare
See tinkerbell/tink#567 and tinkerbell/tink#584. Signed-off-by: Manuel Mendez <[email protected]>
@mmlb looks like this will need a rebase and to follow along with @micahhausler's refactoring done in #598 |
bfab656
to
23596ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! Just a few minor comments
This was only ever a hack that was moderately ok when it was done in Cacher when running in an old EM orchestration stack. IT was ok because we *always* fetched the cert via a "normal" tls connection via a tls terminating proxy. This was not guaranteed in tinkerbell land and actually exists insecurely in the sandbox at the moment (see sandbox fetching the cert via http). Having this here made self-signed certs "easier" but also less safe while making the normal and desired behavior more difficult. The normal being tinkerbell using cert generated by a trusted CA. This way certificate revokation can actually happen, where as with the /cert method all clients would have to redownload the /cert after figuring out the cert is no longer valid (somehow). This should never have made it into tinkerbell from cacher. Signed-off-by: Manuel Mendez <[email protected]>
Now that we don't need the certificate in pem format nor the cert's modification time we can drop a whole lot of complexity and use more functionality from the imported libs. Signed-off-by: Manuel Mendez <[email protected]>
They no longer matter. Signed-off-by: Manuel Mendez <[email protected]>
It's just one member so might as well drop it in favor of just passing value as an arg. Signed-off-by: Manuel Mendez <[email protected]>
It's just two members so might as well drop it in favor of just passing values as a args. Signed-off-by: Manuel Mendez <[email protected]>
Get rid of init() func and the function it calls too. I find it much easier to understand the code flow and how viper/cobra interact by setting evertying up in Execute. Signed-off-by: Manuel Mendez <[email protected]>
Previously rootCmd's cobra.Command had not been able to run and thus the command line arguments weren't yet parsed by the time we were connecting to tinkerbell. Environment vars would work which is how we usually set everything up so went undetected. By waiting until PreRun we give cobra a chance to parse the command line and thus we do the right thing. Signed-off-by: Manuel Mendez <[email protected]>
It really is. Signed-off-by: Manuel Mendez <[email protected]>
We don't generate certificates in tink-server any more. Signed-off-by: Manuel Mendez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Manuel Mendez <[email protected]>
For easier back-and-forth mental-modelling. Signed-off-by: Manuel Mendez <[email protected]>
Aborting from withing a library package...., should never have been committed! Signed-off-by: Manuel Mendez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
## Description I was getting ready to PR my branch that is updated to work in /cert-less tink (now that tinkerbell/tink#584 is merged) and it was basically a situation where pulling one thread unraveled a bunch of other things. Dropping /cert begot some refactors (started by dropping the `buildWorkerParams` silliness) which begot some test fixes which begot some other refactors which was also dumb to do for rancher, nixos, and centos. So here we are. ## Why is this needed Makes updating to post tinkerbell/tink#584 easier/nicer. ## How Has This Been Tested? Ran unit tests. ## How are existing users impacted? What migration steps/scripts do we need? Less EM specific junk is always good. Less duplicate/unclear tests too. This PR does introduce a change wrt sandbox, where MIRROR_HOST is dropped in favor of MIRROR_BASE_URL, I'll follow up with a PR there once this merges. ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
Description
These were used to get around having lots of parameters and the long lines that caused, but now are just one or two values.
Why is this needed
The whole serving of the gRPC certificate via http as
/cert
should never have made it to tinkerbell.It's too easy to use incorrectly and fall into a sense of security that may not be there.
Its also a pain to actually use in production when following modern best practices of short lived TLS certificates.
Clients can't use gRPC's/Go's builtin certificate handling of when certs are rotated.
This is not a lot of good, yet a bunch of bad only to make a corner case easier at the expense of normal route.
/cert
makes self-sigend certs "easy"ish (see cert rotation issue still) but it's just not worth it.If someone can handle the implications of self-signed certs in production (#567 can be used for dev envs) then they can figure out how to embed their CA into hook or roll their own tink-worker environment.
How Has This Been Tested?
Compiles and tests pass.
How are existing users impacted? What migration steps/scripts do we need?
This is a breaking change for out-of-tree clients, I think its worth it compared to the ops / security benefits.
Fixes #324