-
Notifications
You must be signed in to change notification settings - Fork 890
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
How to encrypt a file locally with an assumed KMS role and decrypt it AWS without any role #555
Comments
SOPS will try all keys, so it doesn't really matter whether you specify them or not (other than for cost savings for KMS API requests). In your case, I would give whoever has access to the first key Encrypt access (but not Decrypt access) through AWS IAM. Is there any reason you can't do that? In the current model, whoever creates the file needs encryption access to all keys, and changing that wouldn't be easy. You could alternatively create the file with key 1, and whoever has access to key 2 can then use |
I do not think your proposal would work in our case. We have our EKS cluster running in AWS. The nodes in AWS are running with a different Role and this role has already the capability to decrypt using the key Now we the above .sops.yaml configuration sops will fail because the user assure cannot use the key directly.
Now in our pipeline this will fail because sops will try to assume the role specified |
@ajvb I have the same issue. I need to use an IAM role when encrypting/decrypting on my local machine, then forego the IAM role during the CD pipeline. The IAM role for the CD pipeline grants access to the KMS key. I came up with a similar solution. I parse the YAML file and drop the What do you think of this use case? It seems reasonable to assume that humans will need roles and that machines may not (given they're authorized by AWS instance profiles or similar). |
REF: getsops/sops#555 Remove "role" references from content before passing to the sops library. Activate the feature by exporting SOPS_SKIP_KMS_ASSUME_ROLE=1
I currently face the same issue, is there a proper solution for this ? |
#650 (comment) seems familiar and led me to this solution:
--> decrypting in both accounts or ec2 in one of the accounts, without any specific role (as long it's able to use the key) works just fine @autrilla actually i'd expect that "tampering" with the final encrypted file would result in a way that sops can't decrypt it anymore 🤔 |
Thanks parkwart. This even works with multiple accounts, but only if the aws_profile setting is filled. If you try to encrypt with one empty, not logged in profile, you'll end up with an empty file again. |
I have similar issue with EKS, IRSA and ksops. In my setup, I want to avoid using static AWS access keys, then I created 2 roles:
On EKS cluster:
|
Problem description:
I am going to use Sops in Aws EKS. The current workflow presume that the developer will encrypt a secret assuming a special role. Later, such encrypted file, is used in AWS and needs to be decrypted without such role ( The AWS node has the proper access to do it )
Follow my .sops.yaml file
With the above config the encryption process will fail because the user cannot use the 2 key directly, even though is the same.
My current workaround is to comment the last 2 lines from the .sops.yaml, encrypt the file, and remove the "role:" line from the encrypted file.
In this way I can decrypt the key in AWS.
Ideas
Have the possibility to specify which key to use to decrypt
Rewrite the encrypted the file with the specified arn independently from the one used for encryption
Other ideas are welcome.
The text was updated successfully, but these errors were encountered: