I was trying restoration of backups on another machine and had synced the config to the other machine, excluding the private key. Then running duply, it noticed the sign private key was missing (which is intentional) and tried to import it. Rather than noticing that the private key was not present, it imported the public key and set it to autotrust. This was a bit annoying because of the autotrust bug (I was still running 2.2), but even with that fixed, I think it will try to import the same key on every run.
This made me realize that automatically importing a key and more importantly automatically setting it to ultimate trust, is really not something I want to happen. Setting a key to trusted is something that should be done consciently IMHO. If somehow an incorrect key would find its way into my key backup, this would end up being marked as trusted, making this also a (small) vector for privilege escalation.
For me, I'd probably just want to disable importing of keys completely, and do it manually. A step more complex would be to let duply handle the importing but only when explicitly requested, or only after explicit approval (but this requires the issue in the first paragraph to be fixed, to prevent a prompt on every run to import a key that is not available).
it shouldn't. importing should only happen if a saved key does not exist in your keyring.
it's getting a bit academic here. if you can't trust the content of your profile, you probably can trust your backup anymore. that's why you should keep a copy of your profile safely somewhere and not just simply copy the latest from the old box ;)
although i do not generally agree with your conclusions i see no hurt in making it possible to disable ex-/importing keys. default will surely stay status quo though
..ede
Here's what happens:
- Duply considers using the first GPG key id as the sign key, so it needs the private key for that.
- This private key is not available in the keyring, so it tries to import it.
- It imports the public key
- It fails to import the private key, since it is not present (I excluded it while syncing the duply profile to this machine).
So, every time I start duply, it goes through these same steps again.
That's certainly true, but that only extends to the backup. When keys are inserted and trusted into my keyring without confirmation, I also can no longer trust my GPG setup, or any GPG-signed incoming email, which is a lot bigger than just not trusting my backups.
Yeah, for most people it is probably fine. Though it might still be worthwhile to add a confirmation when importing keys, so people can at least tell when something fishy is going on when duply asks to import a key when it does not make sense.
Another approach, I realized, could be to let duply keep its own, private, keyring and import (and generate) keys into that. It would probably be useful to use keys from both this private and the default keyring (e.g. when decrypting with your personal regular GPG key that is in the default keyring), but I suspect gpg kan access multiple keyrings already.
If you would then have some
duply generate-key
command to generate a new key in this private keyring and also limit exporting secret keys from this private keyring only, you would maybe also solve #50 in an elegant way: Duply would only export private keys that it auto-generated or imported itself, and any keys manually generated by the user in their default keyring would never leave that default keyring?On 20.07.2020 11:53, Matthijs Kooijman wrote:
ic, that's because of the invalid secret key file. makes sense now.
surely it's a convenience functionality, which in turn lessens security in a sense. agreed.
that sounds reasonable.
the gpg man pages read as if multiple keyrings are supported since forever. so good idea.
..ede
Not invalid, but missing (probably what you meant, but just to prevent misunderstanding). It seems that duply does not check whether the private key backup file is present before deciding to try an import.
On 20.07.2020 13:29, Matthijs Kooijman wrote:
hmm, will have to check that. would be a bug :).. ede
sorry for the delay. today i checked and could reproduce it. what i did
output is the below. importing the public key, when it is available is obviously wrong. i'll disable that and make the warnings more explanatory.
watch out for the next release.. ede
closing as double pubkey import is adressed already.
for disabling gpg key im/exports refer to https://sourceforge.net/p/ftplicity/feature-requests/50/