About managing multiple recipients #3
Replies: 3 comments 8 replies
-
The tool already supports multiple recipients, and the recipients are listed in each encrypted value. Let's create 2 identities, Bob and Alice $ yage keygen -o bob.key -p bob.pub
Public key: age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3
$ yage keygen -o alice.key -p alice.pub
Public key: age16wa42pta47k4fjl9yn2edfj0pvp58pu3stmkt2st027er4k6uvxsr4mzav Then encrypt a yaml file for both Alice and Bob: $ cat foo.yaml
foo: aaaaa
bar: 42
$ yage encrypt -R bob.pub -R alice.pub -i foo.yaml
$ cat foo.yaml
foo: yage[YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB3M0QzZjBmZmdNNVkxNkZXY0JBUGFVN21kanFlRnl4QlZUeU1EN1d4bkVvCkJZc3lqWndYY055VVpyZzgrTFZaSnlHZlM5VHdiTTBrQXE1ckRUYmdrclUKLT4gWDI1NTE5IEdFY2JhajRPRmwxYnB4a3VsOXltZlV3VkpTelM5QUtsaVU0NEF3SE5mQUEKTUtwQkFldkVFblJtdGhKQW1hV0srUXdOUXR5N0ZoWUFIUUFVYkJuZHQ5dwotPiAlQydSZi1ncmVhc2UgL2VKNEJfSywgXTovJGIkMSBJMWVEX3oqOCBbcykKVTlFeXpBRUJuazU3MGJzN3VpUGZ5TVFtM2IrWWRGZ1BtZk5aCi0tLSBvT0Joa2xOM2hpZjQzbzRtYWkreW1JUHBwSzlRMElVVU5jcklobUFpSkpnCi7J6bApB15AS1rN9luYrX4Ah+QWHdK8GMswluUxiU4E4iUgaZKa|r:age16wa42pta47k4fjl9yn2edfj0pvp58pu3stmkt2st027er4k6uvxsr4mzav,age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3]
bar: yage[YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAza01ES0ZqaXh2MXJaVWpldWoxK1Z0M0NNUzVaL29JU0hHUFlHQTJ5czJFCjVjWkVtdy9Oc213Zlg1VDRMdXpPY3Z4YkU5M3FCTllrNFEvU2RMazM2UHMKLT4gWDI1NTE5IDhSRHhRMHcvVVh5SFNVV0lYQU9TdkFFamxIL2F0cVRaTnZwSVhxWm5vMzgKUW5OMm82U0JoTUNldGhOY1RJdElUdldTZ3pNcWtwRktDZjNOeXBsaXJrWQotPiA/MXAtZ3JlYXNlIF1Hc0N8I2NUClVwMnNMT2lKZXNNQ0Z2dTRsdTV4empEWFZmaU8xbDNwa3orNXlRdUsrZW8rbW5YdUhIVmZsc3N0UVI1aThzZmwKSVVCOE13ZDdRS0EKLS0tIHAveXg5QWQ2WUlzZFUxZzIxbFN1VGFDQkxwbFdobStlVW9BVEFJVkI2VGcKdUp6AGVRGFM6XclyvCHGmW6NDL4iKMI+nx38KWGahzDAfi7tZg==|r:age16wa42pta47k4fjl9yn2edfj0pvp58pu3stmkt2st027er4k6uvxsr4mzav,age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3] There is a command to list the recipients of an encrypted file: $ yage recipients foo.yaml
foo.yaml: age16wa42pta47k4fjl9yn2edfj0pvp58pu3stmkt2st027er4k6uvxsr4mzav
foo.yaml: age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 and both Bob and Alice are able to decrypt the file $ yage decrypt -K bob.key foo.yaml
foo: aaaaa
bar: 42
$ yage decrypt -K alice.key foo.yaml
foo: aaaaa
bar: 42
$ yage keygen -o helen.key -p helen.pub
Public key: age14g73g384ds46uudqhflqa8xne3cz73l4yu2d56k4u4nxe3znd97s00g7pm
$ yage re-encrypt -K bob.key --keep-recipients -D alice.pub -R helen.pub -i foo.yaml
$ yage recipients foo.yaml
foo.yaml: age14g73g384ds46uudqhflqa8xne3cz73l4yu2d56k4u4nxe3znd97s00g7pm
foo.yaml: age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 I may be missing something, but I think your use case is quite well covered already :-) Note that re-encrypting the values is not enough when someone is leaving though — Alice still has access to the older versions, so the secrets should be rotated. Thanks for your interest in yage! |
Beta Was this translation helpful? Give feedback.
-
Indeed, I'll add a section about multi-recipients 👍 |
Beta Was this translation helpful? Give feedback.
-
There is nothing specific to search for some files that may have been encrypted and visible by a user, but $ find . -name '*.yaml' | xargs yage recipients | grep age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3
./foo.yaml: age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 or if you are in a git repository and only want to check the files already added to the repository: $ git ls-files '*.yaml' | xargs yage recipients | grep age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3
./foo.yaml: age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 If you don't mind relying on the internal yage format, a simple $ rg -g '*.yaml' -l age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3
foo.yaml
$ grep -rl age1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 .
./foo.yaml
./bob.pub
git provides some tools to search for a specific string — we can you that to search for the occurrence of the public key of the person who is leaving: $ git log --stat -Sage1gx7xge9kmhkxl557ypgl8hj89rvvkk6h724dz80axlxplzc0laqsyhg8c3 that's not as easy as working with the files in the current directory, but I'm not sure what we could do to make it more practical. |
Beta Was this translation helpful? Give feedback.
-
At the moment, if I understand correctly, the tool is able to encrypt a YAML file for a single recipient, whose private key should be in the possession of everyone interested of decrypting the file.
However, I wonder if you've taken into account the following use-cases which involve multiple recipients:
Unless the scope of the project is to be as simple as possible -- which is a valid desire -- I think some thought should be given to how to manage these multiple recipients:
.gitignore
) that states which file should be encrypted to which recipients;Beta Was this translation helpful? Give feedback.
All reactions