Repository navigation
fix(agent): an enrollment that cannot reach the gateway says why, not that verification failed - #500
Merged
Merged
Conversation
… that verification failed Every dial error of the trust probe became "gateway TLS verification failed", including a gateway that was not listening yet: on a single machine the installer restarts Docker, the agent starts first, and docker-proxy accepts then closes the connection. The error now wraps its cause; a real verification failure keeps its own message from VerifyConnection. Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Collaborator
Author
|
@coderabbitai review |
Action not completed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
When enrollment's TLS probe of the gateway fails, the agent's error now wraps the cause (
gateway TLS handshake: …) instead of always sayinggateway TLS verification failed.Why
Found while installing the published
v0.1.0-alpha.5on a single machine for #480. The installer restarts Docker for the egress proxy, and the agent started one second before the control plane's gateway listened. docker-proxy accepted the connection on127.0.0.1:7443, then closed it. The agent loggedgateway TLS verification failedand exited. systemd started it again 5 seconds later, and it enrolled.The outcome was fine. The message was not: it reported a trust failure where the gateway was simply not up yet, and an operator would look in the wrong place. A real verification failure still says what failed, because its error comes from
VerifyConnection("installation CA fingerprint mismatch", "invalid gateway certificate").How it was tested
TestEnrollmentErrorsKeepTheirCause:EOFand must not say "verification".installation CA fingerprint mismatch.The first case failed on the old code, with
gateway TLS verification failed. The gateway package tests pass, andgolangci-lint run ./agent/...reports 0 issues.Security considerations
The probe sends no application data, and the join token is sent only after the probe succeeds (
TestUntrustedGatewayNeverReceivesTokenis unchanged). The wrapped error holds a network error or one of the verifier's own messages, never the token.