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

Ensure file doesn't exist when doing initial key rotation #143

Closed
doanac opened this issue Jan 27, 2022 · 0 comments · Fixed by #144
Closed

Ensure file doesn't exist when doing initial key rotation #143

doanac opened this issue Jan 27, 2022 · 0 comments · Fixed by #144
Assignees

Comments

@doanac
Copy link
Member

doanac commented Jan 27, 2022

This is an edge case, but its an easy fix to save someone a little pain:

I'm in multiple factories (uncommon but possible) say "foo" and "bar". fioctl was configured with "foo" as my default factory. I wanted to get my root keys for bar and ran:

 fioctl keys rotate-root --initial keys.tgz

I noticed that my bar root.json didn't change and realized I'd mistakenly changed "foo". Then without giving much thought I hit the up arrow in my terminal and added -f bar which ran:

 fioctl keys rotate-root --initial keys.tgz --factory bar

At this point I'd fixed bar but overwrote the keys for foo. That root key is now lost forever. We can add a simple fix here:

key, err := api.TufRootFirstKey(factory)

to ensure the destination doesn't exist.

Note - this only matters for initial rotations. After that we'd fail to rotate keys if the user pointed at the wrong .tgz.

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 a pull request may close this issue.

2 participants