Open dimrozakis opened 3 years ago
Hmm, probably not. When changing the Shamir threshold, you should rotate the data key entirely (since the old shards will exist forever, and be able to decrypt the file!).
@autrilla rotating the key doesn't seem to work either:
shamir_threshold
in creation_rules
of .sops.yaml
.sops -r -i path/to/file
.shamir_threshold
.shamir_threshold
is still in effect.Key rotation doesn't seem to read .sops.yaml
(see also #365).
You're right, I don't think there's currently a way to do this. I see two ways of implementing this, either adding a shamir threshold flag to the rotate command, or making updatekeys take the shamir threshold into account, letting the user know that the data key must be changed (and doing that for them).
Either would work, I'd prefer updatekeys
taking care of this automatically instead of having to pass an extra flag to the rotate command. One could easily forget to pass said flag and end up with an insecure set up without realizing it (for example because the user would think that the threshold is higher than that which is in effect).
PS: In the same vein of doing the safe thing without expecting the user to run extra commands, perhaps updatekeys
should always rotate the key, or at least if not doing so would result in an insecure setup as you mentioned in https://github.com/mozilla/sops/issues/365#issuecomment-400962200
in the case where you're removing a master key from the file, I think you have to rotate the data key, as you want people who previously had access to that key to stop having access to the file, so if you keep the same data key, they can still decrypt the file
When using groups to split a key using shamir secret sharing, modifying a key in any group in
.sops.yaml
will cause the file to be reencrypted after runningupdatekeys
. The same is not true when changing theshamir_threshold
option in.sopsyaml
. Do you think it'd make sense for this to also trigger reencryption?