-
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
Decryption failed when different aws-profile names used #614
Comments
If I do the reverse and send the file I can decrypt to another person, then THEY cannot decrypt this one with:
Pretty confused by this since all are set to use the same KMS keys. When encrypting with --verbose set it also confirms that both files were encrypted with the same key.. hmm |
Its something to do with In Not sure if I am misunderstanding what the |
It does let you tell sops which block of credentials to use. And also yes, setting |
In that case there is a bug. Reproduce with:
Even though both computers/users are using the same KMS ARN it will fail |
Is the profile the same?
…On Fri, 24 Jan 2020 at 18:10, richstokes ***@***.***> wrote:
In that case there is a bug. Reproduce with:
1. Computer 1: Encrypt a file with an aws profile named "foo"
2. Computer 2: Try and decrypt the same file with an aws profile named
"foo"
Even though both computers/users are using the same KMS ARN it will fail
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#614>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARH4VY65NF46JPLIBKWZM3Q7MOHZANCNFSM4KK7UCMQ>
.
|
The profiles are different - they are different users who have named their block of credentials differently |
The AWS profile name used by any user should be totally arbitrary, right? And have no impact on how the files are encrypted? Wondering if I'm doing something wrong or if this is a confirmed bug |
I don't think it should have any impact. Are you sure you're using the correct accounts etc? Your error:
Seems to indicate you just need to reauth (re-MFA, or whatever your setup is) |
I tried reauthing, and can encrypt and decrypt my own files OK. I only see the problem when trying to decrypt files created by another user (even though we both use the same KMS keys). And they see the reverse, they are unable to decrypt my files. However if we both establish our AWS Credential file ( |
OK I found something else, if I manually edit the encrypted file and edit the So this is definitely a bug. sops should ignore that field when decrypting, and/or override it when the --aws-profile flag is set on the command line. So long as both users have access to the same KMS keys it should work regardless of their local aws-profile name. Before manually editing the
After manually editing the
|
Why? It's stored exclusively to use the same profile (by name) every time you decrypt.
I think |
Well then shouldn't Otherwise all users in a company would need to make sure they use the exact same AWS profile name when working with sops. Which seems silly because the profile name is totally arbitrary and has no impact on whether they can access the same KMS keys or not. |
No, just like using
Well... yeah. That's the whole point why the feature was implemented AFAIK. I would expect people in the same company to use the same profile names. Why not set the |
The The docs say that "Similarly the --aws-profile flag can be set with the command line with any of the KMS commands." And earlier in this ticket you agreed that the name should not matter. :-) May be worth adding something to do the docs saying that you have to use the same AWS Profile name for both encrypting and decrypting. That is not clear, and in all other AWS operations the profile name is totally arbitrary and local to your machine, the name alone shouldn't impact your access/permissions/ability to do something. |
Hmmm, if it does, I'd consider that the bug. The
Yeah, that doc line is not great. It kind of tells you the right thing (if you know what the right thing is): it can be set with any of the other KMS-related flags, and there is only one of those: And yes, you're right. Sorry for misleading you!
That should only be the case if you use the |
Thank you, no worries -- for now I will make sure our own internal processes are well documented to always use a specific profile name to avoid any confusion! |
@richstokes seem to be running into this too. I don't know what changed. I was working with a developer the other day and nothing would work until added a role into the .sops.yaml and/or the encrypted file. Simply would not assume a role no matter what env vars we set. |
I was having a similar issue. I was able to get around needing to use any aws-profile name but running |
I have this issue when I configure sops with According to this documentation https://github.com/mozilla/sops#25kms-aws-profiles I understand that this value should be taken from the sops configuration. Example file:
|
Having the same issue.
|
For me assuming of aws roles did not work in any way through a profile. I found the following workaround for the assuming role: $(aws sts assume-role --role-arn $ARN_OF_ROLE_TO_ASSUME --role-session-name manual | jq -r '.Credentials | "export AWS_ACCESS_KEY_ID=\(.AccessKeyId) AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey) AWS_SESSION_TOKEN=\(.SessionToken)"')
sops -i production/secrets.yaml
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN |
Run into the same issue and was mislead by the documentation:
This flag is only taken into account during encryption and as far as I experienced ignored during decryption. ' |
The only solution for me so far when I'm using SSO for initial profile. Without SSO everything working as expected but with SSO I have:
but if I do aws sts assume-role I have no errors and then able to decrypt values. |
It works for SSO if you are using their manual legacy way https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html
|
This is a strange one, I seem to only be able to decrypt files that are made by the user that created the file.
If I try and decrypt another file it fails. Even though both files are encrypted with the same KMS key and both users have permissions to access the key within AWS.
sops --verbose --aws-profile saml -d madebyme.yaml
sops --verbose --aws-profile saml -d madebyanother.yaml
If I use the AWS CLI I can also encrypt and decrypt files manually. Any ideas what else I should try?
The text was updated successfully, but these errors were encountered: