-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Max workload cert lifetime should not apply to istiod's server cert #28640
Conversation
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 but should there be some unit tests of this?
// returns the certificate chain and the private key. | ||
func (ca *IstioCA) GenKeyCert(hostnames []string, certTTL time.Duration) ([]byte, []byte, error) { |
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.
Would it be a good idea to pass in the checkLifetime parameter to this function as well? This function appears to be called by a couple of test_functions that use it to generate a key-cert pair for workload certs as well. Perhaps we just don't need lifetime checking in those cases?
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.
Yeah, that works. I can do that.
pilot/pkg/xds/ads_test.go
Outdated
@@ -80,7 +80,7 @@ func TestAgent(t *testing.T) { | |||
defer tearDown() | |||
|
|||
// TODO: when authz is implemented, verify labels are checked. | |||
cert, key, err := bs.CA.GenKeyCert([]string{spiffe.Identity{"cluster.local", "test", "sa"}.String()}, 1*time.Hour) | |||
cert, key, err := bs.CA.GenKeyCertNoLifetimeCheck([]string{spiffe.Identity{"cluster.local", "test", "sa"}.String()}, 1*time.Hour) |
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.
Looks like we are generating certs for a workload. Should be okay to not check the lifetime in this case though...
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.
Oh, I didn't notice this test is generating for a workload... I can write a function GenKeyCert() for this test, to make this 100% accurate.
@howardjohn I'll add a unit test for it. |
/test release-notes_istio |
/test integ-multicluster-k8s-tests_istio |
/retest |
When using self-signed Istiod CA, Istiod server needs a long-lived cert signed by Istiod CA itself (we make its lifetime equals the CA cert lifetime). Because the Istiod CA checks the requested lifetime should be smaller than the max workload cert lifetime, we extended the max workload cert to be equal to the CA cert lifetime. This actually makes the max workload cert lifetime effectiveless.
This PR fixes this by not conducting the max workload cert lifetime check for the Istiod server's certificate issuance (called via GenKeyCertNoLifetimeChecking). The max workload cert lifetime is still effective (by default 90 days) against normal workload cert issuance.
[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ ] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ X ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure
Pull Request Attributes
Please check any characteristics that apply to this pull request.
[ ] Does not have any changes that may affect Istio users.