Skip to content

Add fernet key rotation - #478

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
xek:fernet-rotation
Oct 18, 2024
Merged

Add fernet key rotation#478
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
xek:fernet-rotation

Conversation

@xek

@xek xek commented Oct 4, 2024

Copy link
Copy Markdown
Contributor

As part of this work, we needed to implement more than 2 keys, since rotating 2 would expire sessions on every rotation. There are new settings and the defaults are the same as in "old-gen" Tripelo.

jira: OSPRH-9309

@openshift-ci

openshift-ci Bot commented Oct 4, 2024

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@xek

xek commented Oct 4, 2024

Copy link
Copy Markdown
Contributor Author

/test all

@xek

xek commented Oct 15, 2024

Copy link
Copy Markdown
Contributor Author

/test all

@xek
xek force-pushed the fernet-rotation branch from 97df3e8 to 2a84e5e Compare October 15, 2024 10:39
@xek

xek commented Oct 15, 2024

Copy link
Copy Markdown
Contributor Author

/test all

@xek
xek force-pushed the fernet-rotation branch 2 times, most recently from 54fc55a to de882bc Compare October 17, 2024 09:20
@xek
xek marked this pull request as ready for review October 17, 2024 09:21
@openshift-ci
openshift-ci Bot requested review from stuggi and viroel October 17, 2024 09:21
@xek

xek commented Oct 17, 2024

Copy link
Copy Markdown
Contributor Author

This pull request now also contains all changes needed in the keystone-operator to support variable number of keys

@dprince

dprince commented Oct 17, 2024

Copy link
Copy Markdown
Collaborator

If we land this PR please add the associated RELATED_IMAGE into the openstack-operator here: https://github.com/openstack-k8s-operators/openstack-operator/blob/main/config/default/manager_default_images.yaml

Comment thread api/v1beta1/keystoneapi_types.go Outdated
Comment thread api/v1beta1/keystoneapi_types.go
Comment thread controllers/keystoneapi_controller.go Outdated
Comment thread controllers/keystoneapi_controller.go Outdated
@xek
xek force-pushed the fernet-rotation branch from 73e0b28 to 44f38b7 Compare October 18, 2024 13:08
Comment thread api/v1beta1/keystoneapi_types.go Outdated
@xek
xek force-pushed the fernet-rotation branch from 44f38b7 to 9615b6e Compare October 18, 2024 13:26
Comment thread controllers/keystoneapi_controller.go
@xek
xek force-pushed the fernet-rotation branch from 9615b6e to 3bea5aa Compare October 18, 2024 14:09
Comment thread controllers/keystoneapi_controller.go Outdated
Comment thread controllers/keystoneapi_controller.go Outdated
Comment thread controllers/keystoneapi_controller.go
@xek
xek force-pushed the fernet-rotation branch from 3bea5aa to aa395f6 Compare October 18, 2024 15:09
}
rotatedAt, err := time.Parse(time.RFC3339, secret.Annotations[fernetAnnotation])

var duration int

@olliewalsh olliewalsh Oct 18, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: would move this (L1392-L1397) up so that err is checked right after setting

Comment thread controllers/keystoneapi_controller.go
Add configuration for specifying the number of
fernet keys stored in the keystone secret.
More than 2 keys are needed, since rotating 2
keys would expire sessions on every rotation.

After configuration change, keys need to be
added/removed and rotated in the proper order,
to ensure that the sessions don't expire
prematurely.

Fernet key rotation is triggered in the reconcile
loop. The "rotated at" timestamp is set in the
secret annotation.

Co-Authored-By: Grzegorz Grasza <xek@redhat.com>
@xek
xek force-pushed the fernet-rotation branch from aa395f6 to c05fc7b Compare October 18, 2024 16:34

@olliewalsh olliewalsh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci

openshift-ci Bot commented Oct 18, 2024

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: olliewalsh, xek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 61e711f into openstack-k8s-operators:main Oct 18, 2024
@xek xek changed the title Add fernet key rotation cronjob Add fernet key rotation Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants