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

Do not rotate JWT keys if X509 preparation failed during initialization #5064

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

amartinezfayo
Copy link
Member

@amartinezfayo amartinezfayo commented Apr 11, 2024

Do not try to rotate JWT keys if X509 preparation failed during initialization (there is no current X509 authority slot).
In this condition, even if the JWT keys can be rotated, the rotate operation will return an unrecoverable error that will make the server to shut down.

Additionally, make sure to add a new CA journal record when we have an active X509 authority ID.

Fixes #5038.

Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
@amartinezfayo amartinezfayo added this to the 1.9.5 milestone Apr 11, 2024
@amartinezfayo amartinezfayo changed the title Do not rotate JWT keys if X509 preparation failed Do not rotate JWT keys if X509 preparation failed during initialization Apr 11, 2024
@rturner3 rturner3 self-assigned this Apr 11, 2024
pkg/server/ca/rotator/rotator.go Show resolved Hide resolved
@@ -231,6 +231,10 @@ func (j *Journal) saveInDatastore(ctx context.Context, entriesBytes []byte) (caJ
// Check if we already identified what's the CA journal for this server in
// the datastore. If not, log that we are creating a new CA journal entry.
if j.caJournalID == 0 {
if j.activeX509AuthorityID == "" {
j.config.log.Debug("There is no active X509 authority yet. Can't save CA journal in the datastore")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
j.config.log.Debug("There is no active X509 authority yet. Can't save CA journal in the datastore")
j.config.log.Debug("There is no active X.509 authority yet. Can't save CA journal in the datastore")

nit

Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
@amartinezfayo amartinezfayo merged commit 8e8f747 into spiffe:main Apr 17, 2024
32 checks passed
@amartinezfayo amartinezfayo modified the milestones: 1.9.5, 1.9.6 May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants