kubo icon indicating copy to clipboard operation
kubo copied to clipboard

Private keys should be encrypted

Open BrendanBenshoof opened this issue 10 years ago • 14 comments

You could encrypt the entire config file, but by default ipfs should password protect the private key (setup during init process) and not store the private key in the clear on disk (or ideally in memory that could be leaked, but that is a lot harder).

BrendanBenshoof avatar Feb 25 '15 20:02 BrendanBenshoof

We are going to move the key out of the config file and encrypt it at some point.

whyrusleeping avatar Feb 25 '15 22:02 whyrusleeping

related #783

whyrusleeping avatar Feb 25 '15 22:02 whyrusleeping

This should be addressed once the keystore is implemented

whyrusleeping avatar Aug 23 '16 21:08 whyrusleeping

My proposal for multikey was embedding key protection schema in to the multikey itself, I don't know if we want to go with it, but it would be nice thing to have.

Kubuxu avatar Aug 24 '16 11:08 Kubuxu

@kubuxu can you explain more? On Wed, Aug 24, 2016 at 07:48 Jakub Sztandera [email protected] wrote:

My proposal for multikey was embedding key protection schema in to the multikey itself, I don't know if we want to go with it, but it would be nice thing to have.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ipfs/go-ipfs/issues/826#issuecomment-242036390, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIcofbJAvaf0rNCNfwDr2fnt3rElrimks5qjC-YgaJpZM4Dl4DP .

jbenet avatar Aug 26 '16 03:08 jbenet

https://github.com/ipfs/specs/issues/58 In short terms: first varint describes key protection schema which has to be applied to decrypt the key.

Kubuxu avatar Aug 26 '16 06:08 Kubuxu

While on my work on the #5947, which I am now porting to js-ipfs I saw that js-ipfs uses https://github.com/libp2p/js-libp2p-keychain

Is this desired way how to approach this? To my understanding, it does not use multikey/linked-data key, but it implements encrypted keys handling.

AuHau avatar May 28 '19 21:05 AuHau

Hmmm it seems like they follow this spec: https://github.com/ipfs/specs/tree/master/keystore

AuHau avatar May 28 '19 22:05 AuHau

Eventually, yes. I have a PR that I never really finished to add pluggable keystore support to enable use-cases like this: https://github.com/ipfs/go-ipfs/pull/6069.

However, go-ipfs doesn't currently have a way to prompt the user for a passphrase.

Stebalien avatar May 28 '19 23:05 Stebalien

Hmm. From what I see js-ipfs does not really prompt for a passphrase either, they require (for operations that uses keystore) to pass it using parameter --pass.

What do you think is currently the right way to approach this? Or should this be postponed for now?

AuHau avatar May 28 '19 23:05 AuHau

What do you think is currently the right way to approach this?

I'd rather not go that route. Any password passed with --pass will:

  1. Get logged to some shell history somewhere.
  2. Appear in ps -eF.

That just shuffles the problem around a bit.

Stebalien avatar May 28 '19 23:05 Stebalien

Same as with ssh, the password should be passed with stdin.

ssh-add goes even further and prohibits non-interactive input of a password. The only way to automatically input password to ssh is using expect

Kubuxu avatar May 30 '19 16:05 Kubuxu

Yeah, I figured that this might be a problem and I have guessed right that similar approach to ssh should be the way.

Only I am a bit worried about the UX implications of this. As for every invocation of a command that needs keystore access, there would have to be this prompt (eq. reentering passphrase all the time). What sort of commands require keystore access? daemon, key *, name *?

What about ssh-agent approach? Since there is already a background process ( daemon), this could be used to spawn another process that would behave as ssh-agent (eq. expose socket that all keystore dependant commands would use for key manipulations). The only problem is that it would complicate things quite a bit since to not compromise on security, the keys would have to stay in the agent process and hence all the actions with keys would have to be proxied through it.

AuHau avatar May 30 '19 16:05 AuHau

Any updates on this problem?

Don't know if it is relevant, but maybe for inspiration, you can also have a look at how ethsigner solves this problem: https://consensys.net/docs/ethsigner/en/latest/Concepts/Overview/

kimborgen avatar Jul 28 '22 15:07 kimborgen