-
Notifications
You must be signed in to change notification settings - Fork 20
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
support rekey #18
support rekey #18
Conversation
why? |
Let's say
To support adding and removing keys which can access my passwords, a convenient function to re-encrypt all passwords would be helpful. |
with this implementation you'd still need to manually add the keys to the store, right? so the workflow would go something like: ~> cd ~/.local/share/pa
~/.local/share/pa> age-keygen -o new_identities
Public key: age1decux8l6p7pjps9grm0f7ld4cue27lja26err8fq2hmmx8pqg5ysqrcwxk
~/.local/share/pa> age-keygen -y new_identities >> recipients
~/.local/share/pa> pa rekey
~/.local/share/pa> mv new_identities identities
~/.local/share/pa> ex -c ':1d' -c ':wq' recipients it doesn't seem like a good UX for a command, at least it should rotate the keys automatically... but then I think a separate script would be a better fit, because it looks like a one-shot operation that doesn't really need to be a core feature, and it also could be used independently of pa store as a solution for FiloSottile/age#136 |
so I think the ability to rotate keys and reencrypt all passwords easily is a useful suggestion, I just don't like how it's done here and I'm not sure if it should be a separate command. how about this contrib/ script? you just run it and you're all set with the new keys #!/bin/sh
basedir="${XDG_DATA_HOME:=$HOME/.local/share}/pa"
: "${PA_DIR:=$basedir/passwords}"
umask 077
age-keygen -o "$basedir/identities.tmp" 2>/dev/null
age-keygen -y -o "$basedir/recipients.tmp" "$basedir/identities.tmp" 2>/dev/null
pa list | while read -r name; do
pa show "$name" |
age --encrypt -R "$basedir/recipients.tmp" -o "$PA_DIR/$name.tmp.age"
mv "$PA_DIR/$name.tmp.age" "$PA_DIR/$name.age"
done
mv "$basedir/identities.tmp" "$basedir/identities"
mv "$basedir/recipients.tmp" "$basedir/recipients" |
love the idea of keeping this in contrib, makes sense to me |
Ok, from a unix perspective, having From my perspective, the creation of the identities and recipients shouldn't be part of the contrib tool. This infrastructure is up to the use case or how the end user would like to have their keys organized. for me:
Does that make sense? |
ok, got it, here's the simple solution for the aforementioned script (let's call it pa-rekey): -age-keygen -y -o "$basedir/recipients.tmp" "$basedir/identities.tmp" 2>/dev/null
+age-keygen -y "$basedir/identities.tmp" >>"$basedir/recipients.tmp" 2>/dev/null then this should do what you need: ~> cp ~/.local/share/pa/recipients ~/.local/share/pa/recipients.tmp
~> pa-rekey |
let's move to #27 |
I want to have an option to re-encrypt my password-store with a new recipient.