-
Notifications
You must be signed in to change notification settings - Fork 958
Allow shamir_threshold: 1 #1123
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
Conversation
This allows the case where multiple keygroups are used, but any one of the groups needs to be able to decrypt the secret. This is for example useful if some people use age keys and some use pgp, but each of them should be able to decrypt the secret by themselves. Fixes: getsops#878
You can actually mix PGP and age keys together in a single group to accomplish this.
Note the lack of a In case someone stumbles upon this PR after trying to use both age and gpg keys at the same time. Putting them in different groups is NOT a requirement |
Well, this allows grouping multiple keys together, which is currently not possible: keys:
dept_a: &dept_a
age:
- &user_a age...
- &user_b age
dept_b: &dept_b
age:
- &user_c age...
- &user_d age
creation_rules:
- path_regex: \.*flux/.*
encrypted_regex: '^(stringData|data)$'
shamir_threshold: 1
key_groups:
- *dept_a
- *dept_b To explain the issue in more detail: The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks correct.
I'm still not convinced that this is a really good idea, since there is no good reason to allow the threshold to be 1, except as a hack. It might be better to extend the config file format instead to make joining lists for the same key type using YAML anchors easier.
On the other hand, allowing a threshold of 1 doesn't really hurt. The worst case I can think of is that some user notices that a threshold of 1 works and thinks that it is the smallest value that forces that keys from more than one group. (I do hope nobody tries that, but on the other hand some folks also decided to use an exponent of 1 for RSA, so... :) )
for _, share := range out { | ||
if len(share) != len(secret)+1 { | ||
t.Fatalf("bad: %v", out) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably also check that the first four bytes of each share are identical to secret
.
Using a threshold=1 as a means to merge key groups is a hack, which also removes the ability to use shamir thresholding should it be needed. I'm rather in favor of either flattening lists, or introducing a Flattening only works within each type of key: keys:
dept_a: &dept_a
- &user_a age...
- &user_b age...
dept_b: &dept_b
- &user_c age...
- &user_d age...
creation_rules:
- path_regex: \.*flux/.*
encrypted_regex: '^(stringData|data)$'
shamir_threshold: 1
key_groups:
- age:
- *dept_a
- *dept_b While a keys:
dept_a: &dept_a
age:
- &user_a age...
- &user_b age...
dept_b: &dept_b
age:
- &user_c age...
- &user_d age...
creation_rules:
- path_regex: \.*flux/.*
encrypted_regex: '^(stringData|data)$'
shamir_threshold: 1
key_groups:
- merge:
- *dept_a
- *dept_b |
I would opt for the |
|
closes getsops#1123 Signed-off-by: Jonas Badstübner <jonas.badstuebner@hetzner-cloud.de>
closes getsops#1123 Signed-off-by: Jonas Badstübner <jonas.badstuebner@hetzner-cloud.de>
closes getsops#1123 Signed-off-by: Jonas Badstübner <jonas.badstuebner@hetzner-cloud.de>
closes getsops#1123 Signed-off-by: Jonas Badstübner <jonas.badstuebner@hetzner-cloud.de>
While the problem sketched in #878 can now be solved with merge groups, I'm not sure about what was mentioned in this PR:
@puiterwijk I think this can also all be covered with merge groups, but maybe I'm missing something? |
This allows the case where multiple keygroups are used, but any one of the groups needs to be able to decrypt the secret. This is for example useful if some people use age keys and some use pgp, but each of them should be able to decrypt the secret by themselves.
Fixes: #878