-
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
Deprecate storing aws profile within the encrypted file / with the key #634
Comments
@autrilla What do you think? |
Given all the confusion around it I think we should probably deprecate it, and also deprecate |
It's really useful to pass the profile using thanks |
I really like how we implemented this in You can pass in a profile using I'd also consider expanding this to removing support for setting AWS roles in the config. Most tools that interact with AWS via the command line require you to authenticate to AWS outside of the context of the tool and it makes sense to me that sops functions the same way. It seems like most of the issues are around people being confused it doesn't work that way (i.e. #555). |
Why do you prefer using a flag vs an environment variable? It’s kind of the
same thing with different syntax, no?
Using a flag would let us simplify the code a bit...
…On Thu, 20 Feb 2020 at 23:21, Paul Nguyen ***@***.***> wrote:
It's really useful to pass the profile using --aws-profile. I can
understand reducing confusion but is it possible to just deprecate storing
the aws profile in the encrypted file and keep --aws-profile?
thanks
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#634>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARH4V7JG5KURGVFRD6LHWDRD366JANCNFSM4KYXW3EQ>
.
|
Original support for that came from a requirement to invoke KMS from various accounts transparently, by having Sops assume roles in those accounts. I believe this feature is still in use in our own teams. |
I agree with @jvehent, we use sops in the company I work for and being able to use multiple accounts transparently on the same shell is very important to us. Changing environment variables before running a sops command is pretty dirty, especially in automation scripts. |
I assume you mean the removal of the feature from the config file. I personally find it very hard to care about the difference in spelling between:
and
But if there's some specific reason you care about this, I'd love to hear about it.
Hm, I wonder if it is? I don't think the |
I agree with ajvb. |
One vote to deprecate - it's standard practice in our pipelines and locally to set up the AWS env for each CI/CD step. We've used SOPS for a while now and never touched (maybe never even knew about) embedding the aws_profile in the encrypted file. |
I'd add that, although the AWS CLI could just pick one of |
Not having the --aws-profile makes things more difficult for beginners - how do you communicate that the AWS_PROFILE env and AWS_SDK_LOAD_CONFIG=1 are needed? Not having the profile in the encrypted file makes sense. I initially had expected the aws profile to be settable in the .sops.yaml file -- since you specify the kms id there. Not specifying the role makes in the .sops.yaml makes sense, I created a policy that allowed access to the sops key. I then assigned the policy to the user. This means, you don't directly have to specify permissions in the key policy. If you keep the role - then the aws user specified by the AWS_PROFILE must have sts:AssumeRole to be able to use it -- I find this more complicated. I found the docs to be difficult to use, and had to dig before I got things to work with AWS keys.
It would also be good to have a terraform example to create the key / policy etc, like https://github.com/minamijoyo/terraform-kms-example, so that this can be done in code rather than with the AWS console. |
This is also an issue with the role that is used to encrypt the secret is being persisted into the encrypted metadata and attempted to always be used in decryption. SOPS config
The encryption works fine, but it fails to decrypt because the role is persisted to the enc.yaml metadata file and in the where I am running the decrypt step does not have access to the original role used for encryption (it does have access to the KMS key using a separate role). Example SOPS encrypted metadata with role hardcoded.
|
I'd like to voice my opinion on this: please do not deprecate this feature. The "confusion" of needing to have the same profiles as other users is not the responsibility, nor is it relevant, to the SOPS tool. It's a problem to be solved with policy and convention within a team. Removing this feature would force anyone using this tool to follow one very narrow convention. If you are getting SOPS files with profiles in the file's config, then that's a breakdown of team collaboration, not a break in this tool. If someone is planning on sharing a file with someone (and those people don't use the same profile names), then they should not be using the I'd like to, as an example, explain my team's use-case for SOPS. We "enforce" specifically-named AWS profiles for anyone working on our codebase. This makes our particular AWS account/IAM design much easier to maintain and implement. So, for our team, we expect and require any humans or machines decrypting the SOPS files to have those profiles present in their config. If the ability to store the profile in any given SOPS file's config is removed, our team would have to use a shim/wrapper around In summary: deprecating this feature would move the burden of enforcing team standards from the teams to this tool. |
@zhimsel thanks a lot for your feedback, it's good to hear from someone from the other side of the argument :) I agree with what you say, pretty much. If you don't want to store the profile in the SOPS file, why do you even need to tell SOPS about it? I haven't used AWS in a while, but IIRC it's pretty easy to change profiles. Having heard this viewpoint, my stance is that we should document this better, and show users this is probably not what they want to do, but leave |
Just to add, being forced to use environment variables instead of the |
Having In chronological order:
|
It's so annoying.. SOPS should work with ANY credentials it finds on the path, and for w/e reason always fails if |
Is there any good workaround for this or dirty hacks? I would also vote to do this in native way - the same way is on my side, I encrypt locally with profile and pass it to argoCD (which doesn't know anything about my local profile) |
There is nothing wrong with having profile in the encrypted file. This matches the practice in many other tools, eg. terraform/terragrunt. The problem is with how you use the aws config profiles. A practice that we found very useful is to name aws profile by access scope instead of the actual role name, and redefine it in different environments. For instance: For developers: [profile serviceA]
credential_process = aws configure export-credentials --profile=devops
[profile devops]
sso_start_url = ... For CI/CD service: [profile serviceA]
credential_source = Environment By doing this, the sops yaml will always use |
SOPS does not follow default credentials chain in that case. Which means it works exactly the opposite of many industry standard tools like aws cli or terraform. |
This is actually the standard aws sdk behavior, and has nothing to do with individual tool. If you specify profile for the session, it will skip the default cred provider chain entirely. |
We talk here about storing authentication configuration in the sops encrypted file. I might run Running Another example - encrypting a file with kms key using |
I hope I'm not repeating what has been said already, but I haven't seen it here. We're using profiles for encryption, and we have a central repo where we are working, all the secrets are stored there and they are encrypted with a KMS key that is available for our Admin AWS profile. But we also have different organizations, and each organization has its CD runners, and those runners can't have the same access as the Admin profile, so we're adding a second KMS key to each encryption rule, and it's available only for the role assigned to a runner. That means that our logic looks approximately like that:
Neither For the local development, having the But for the runners, that don't have this concept of profiles, it's not working, and we need to go through all the files and remove the So if I may, I would suggest not removing the
This approach would help us working on the secrets without thinking about environment variables and flag, use multiple aws profiles and let runners decrypt secrets without workarounds Thanks |
There seems to have been a number of issues surrounding our use of AWS profiles:
--kms
,--aws-profile
options when decryption #471Storing the AWS Profile in the encrypted file breaks expectations because it cannot be decrypted on systems where that profile doesn't exist. This is very different from how folks are used to interacting with AWS.
I'd propose that we deprecate storing the aws profile within the key and instead require users to pass
--aws-profile
every time they want to use an AWS profile.The text was updated successfully, but these errors were encountered: