-
Notifications
You must be signed in to change notification settings - Fork 496
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
Integrate builder and validator #3869
Conversation
Also: - moves validator into own package - deletes unused signing code from jwtsvid package Signed-off-by: Andrew Harding <[email protected]>
1f47635
to
41ec0d4
Compare
@@ -0,0 +1,227 @@ | |||
package jwtsvid |
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 is just a renamed token_test.go with just the validation test portion remaining.
@@ -40,31 +40,28 @@ type Config struct { | |||
Clock clock.Clock | |||
DataStore datastore.DataStore | |||
ServerCA ca.ServerCA | |||
AgentTTL time.Duration |
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.
AgentTTL is now handled in the builder.
@@ -398,93 +398,6 @@ func (b *Builder) buildX509SVIDTemplate(spiffeID spiffeid.ID, publicKey crypto.P | |||
return tmpl, nil | |||
} | |||
|
|||
func (b *Builder) ValidateX509CA(ca *x509.Certificate) 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.
These moved into the credvalidator package.
@@ -0,0 +1,176 @@ | |||
package credvalidator |
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 is just existing code split out from the credtemplate.Builder.
@@ -0,0 +1,395 @@ | |||
package credvalidator_test |
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.
These tests are just existing code moved out from the credtemplate.Builder
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 great!!!
@@ -86,6 +86,7 @@ func (ca *UpstreamCA) SignCSR(ctx context.Context, csrDER []byte, preferredTTL t | |||
x509.KeyUsageCRLSign, | |||
BasicConstraintsValid: true, | |||
IsCA: true, | |||
ExtraExtensions: csr.ExtraExtensions, |
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.
is it a change to what we have on previous versions? why is it required?
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.
The CredentialComposers can add extra extensions to the CSR that is signed upstream.
pkg/server/ca/ca.go
Outdated
} | ||
telemetry_server.IncrServerCASignX509CACounter(ca.c.Metrics) |
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.
signing X509 SVIDS will increment ServerCASignX509CA is that ok?
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.
Copy-paste bug! Fixed.
@@ -250,3 +253,27 @@ func makePublicKey(t *testing.T, kid string) *common.PublicKey { | |||
PkixBytes: pkixBytes, | |||
} | |||
} | |||
|
|||
func generateServerCACSR() ([]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.
since error is not used, may we fatal here? or just ignore and depends on getting an empty csr is enough?
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.
Sure. I changed it to panic since it is only used in tests and run at init time.
Signed-off-by: Andrew Harding <[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!!!
* Integrate builder and validator Also: - moves validator into own package - deletes unused signing code from jwtsvid package Signed-off-by: Andrew Harding <[email protected]>
Also: