-
Notifications
You must be signed in to change notification settings - Fork 656
ca: more informational error messages and debug logs #1912
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,7 +189,7 @@ func GenerateJoinToken(rootCA *RootCA) string { | |
|
|
||
| func getCAHashFromToken(token string) (digest.Digest, error) { | ||
| split := strings.Split(token, "-") | ||
| if len(split) != 4 || split[0] != "SWMTKN" || split[1] != "1" { | ||
| if len(split) != 4 || split[0] != "SWMTKN" || split[1] != "1" || len(split[2]) != base36DigestLen || len(split[3]) != maxGeneratedSecretLength { | ||
| return "", errors.New("invalid join token") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps not for this PR, but should we mention what it's expected to look like? "token should start with SWMTKN, followed by a 36 character alphanumeric code"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether that may be too much information to give in an error message, just because the the swarm token is:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although at this point, there is only 1 version, so maybe we can deal with messaging other versions later :)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I wasn't sure either; also not if that should be done in swarmkit, or "prettied" in docker |
||
| } | ||
|
|
||
|
|
@@ -273,7 +273,7 @@ func LoadSecurityConfig(ctx context.Context, rootCA RootCA, krw *KeyReadWriter) | |
| } | ||
|
|
||
| // Check to see if this certificate was signed by our CA, and isn't expired | ||
| if _, err := X509Cert.Verify(opts); err != nil { | ||
| if err := verifyCertificate(X509Cert, opts); err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
|
|
||
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.
Just want to confirm that
x509.Expiredis returned whenNotBeforeis violated as well as theNotAftercase.Uh oh!
There was an error while loading. Please reload this page.
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.
Yes: https://golang.org/src/crypto/x509/verify.go?#L162 (from https://golang.org/src/crypto/x509/verify.go?#L253)
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.
Thanks