Skip to content
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

Make agent fail when getting unknown authority #4617

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

MarcosDY
Copy link
Collaborator

Make agent fails when getting unknown authority trying to get authorized entries from spire-server.
This can happen when not using an upstream authority and the server crashes.
If the server crashes, and it is no able to load previous bundles, Server will sign new authorities. In this case, the agent will still have an agent SVID using the old bundle, and communication will be broken for ever.

…tries with spire server

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
evan2645
evan2645 previously approved these changes Nov 16, 2023
Copy link
Member

@evan2645 evan2645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MarcosDY! One small nit about error message, rest looks good.

@@ -285,6 +285,9 @@ func (m *manager) runSynchronizer(ctx context.Context) error {

err := m.synchronize(ctx)
switch {
case nodeutil.IsUnknownAuthorityError(err):
m.c.Log.WithError(err).Info("Synchronize failed, non-recoverable error")
return fmt.Errorf("agent SVID is signed by unknow authority: %w", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent SVID or Server SVID?

I think the error message we print with %w is going to be roughly the same as this one? Does it include any add'l information? Maybe the string should be something like failed to sync with SPIRE Server: %w?

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
@MarcosDY MarcosDY merged commit 7016629 into spiffe:main Dec 1, 2023
31 checks passed
@MarcosDY MarcosDY deleted the crash-agent-when-unknown-athority branch December 1, 2023 12:18
faisal-memon pushed a commit to faisal-memon/spire that referenced this pull request Dec 2, 2023
* Make agent crash when getting an unknown authority error when sync entries with spire server

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Signed-off-by: Faisal Memon <fymemon@yahoo.com>
@azdagron azdagron added this to the 1.8.7 milestone Dec 15, 2023
rushi47 pushed a commit to rushi47/spire that referenced this pull request Apr 11, 2024
* Make agent crash when getting an unknown authority error when sync entries with spire server

Signed-off-by: Marcos Yacob <marcos.yacob@hpe.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants