Use multiple KMS keys from different AWS accounts
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
I've got KMS keys on accounts A and B. I need to be able to decrypt my secrets with both A and B keys. Sadly, due to security limitations I cannot use SOPS feature which assumes AWS role with the access to other account resources.
The work around I was thinking about was:
- Assume role for AWS account A
- Create encrypted file with key A
- Open encrypted file for manual edition with
sops -s -i <file> - Add there new arn to KMS entries
- Assume role for AWS account B
- Save the file and close the editor which should trigger adding my additional KMS key from account B (I presume at this moment current encryption key is already encrypted so there's no need to reach account A since SOPS only needs to encrypt it with account B - is this correct?)
Alas, when I close the editor I receive:
[CMD] ERRO[0020] SOPS metadata is invalid. Press a key to return to the editor, or Ctrl+C to exit. error="parsing time \"\" as \"2006-01-02T15:04:05Z07:00\": cannot parse \"\" as \"2006\""
Is it a known issue? Maybe I open it wrong. Are there any other solutions to my problem? I was also trying updatekeys and --add-kms options but these requires both AWS accounts to be reachable at the same time.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the editor flow with sops -s -i and the reported metadata error, then inspect the updatekeys and --add-kms entry points. Determine how adding a KMS key across separate AWS sessions should work without requiring both accounts to be reachable. Done means keys from both accounts can be added and used to decrypt the same file, with valid metadata.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, go
- Domain
- cli, cloud, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100