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

Active key rotation #1898

Open
bbockelm opened this issue Jan 15, 2025 · 1 comment
Open

Active key rotation #1898

bbockelm opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels
cache Issue relating to the cache component director Issue relating to the director component enhancement New feature or request origin Issue relating to the origin component registry Issue relating to the registry component

Comments

@bbockelm
Copy link
Collaborator

One of the challenges for the key rotation PR (#1748) is deciding when it is "OK" to start signing tokens with the latest generated key.

The answer is certainly not "immediately" -- it takes 10-15 minutes for a key to propagate from registry to director due to caching effects.

In the first attempt at #1748, we tried keeping a copy of the "previous key" in memory with the idea that the previous key, after some time period, would become the most recent key. That was also futile as, if the server restarts, we have no clue how long the "latest" has been the latest.

I think a spin on that "previous key" idea is going to be the best option. However, instead of keeping the previous key in memory, we should persist to the server's SQLite database.

The table should have a row per key ID keeping the following data:

  • First observed
  • Last observed
  • First upload to registry (hopefully this is quite close to the "first observed"!)

Then, the active key can be used if it's been X minutes since the upload to the registry (should be a configurable parameter with a default of 20 minutes). Keep the database updates out of any hot paths -- instead, we only need to synchronize it every few minutes. An opportune time would be around when config.RefreshKeys() is invoked.

Please coordinate with @patrickbrophy to ensure this goes into a generic "server" database, not the per-service type database.

@bbockelm bbockelm added the enhancement New feature or request label Jan 15, 2025
@bbockelm bbockelm added cache Issue relating to the cache component origin Issue relating to the origin component director Issue relating to the director component registry Issue relating to the registry component labels Jan 15, 2025
@bbockelm
Copy link
Collaborator Author

Additional note -- we should be careful to execute this logic only for the server case. I don't want to accidentally introduce a database for the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cache Issue relating to the cache component director Issue relating to the director component enhancement New feature or request origin Issue relating to the origin component registry Issue relating to the registry component
Projects
None yet
Development

No branches or pull requests

2 participants