Skip to content
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

Clients’ keys are world-readable #3716

Closed
4 tasks
alexanderbez opened this issue Feb 22, 2019 · 10 comments
Closed
4 tasks

Clients’ keys are world-readable #3716

alexanderbez opened this issue Feb 22, 2019 · 10 comments
Assignees
Labels
C:Keys Keybase, KMS and HSMs S:proposed

Comments

@alexanderbez
Copy link
Contributor

alexanderbez commented Feb 22, 2019

Client keys are stored on the filesystem via LevelDB for multiple operations. These include use by validators, client wallets, and other functions. The keys themselves are stored within the .gaiacli​ directory of the user’s home directory by default.

However, the permissions on this directory and subdirectories is ​0755​ (RWX for user and RX for group/world), with file permissions of ​0644​ (RW for user and R for group/world).

While the contents of the LevelDB files are in plain text, they are protected via Bcrypt.

Proposal

Short Term (prior to or at launch):

At the very least, the file and directory permissions should be updated to 0700 (RWX for user only).

Long Term: (post launch):

Use an audited key/secret local vault.

/cc @cwgoes @zmanian


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alexanderbez alexanderbez added C:Keys Keybase, KMS and HSMs S:proposed labels Feb 22, 2019
@zmanian
Copy link
Member

zmanian commented Feb 22, 2019

I'm a fan of https://github.com/99designs/keyring for key storage.

@cwgoes
Copy link
Contributor

cwgoes commented Feb 22, 2019

I'm a fan of https://github.com/99designs/keyring for key storage.

That looks compelling. Do you know if it's been subjected to third-party review (or has some major users)?

@alexanderbez
Copy link
Contributor Author

I'm a fan of https://github.com/99designs/keyring for key storage.

Would we use the Filesystem backend? I doubt we want to leverage a local client/server model here, right?

@zmanian
Copy link
Member

zmanian commented Feb 24, 2019

I'd suggest using the OSX keyring and Windows credential store and then falling back to encrypted file if neither are available

@alexanderbez alexanderbez self-assigned this Feb 25, 2019
@cwgoes cwgoes added this to the v0.33.0 (Launch) milestone Feb 25, 2019
@alexanderbez
Copy link
Contributor Author

alexanderbez commented Feb 26, 2019

Started playing with keyring in the SDK -- seems very straightforward. One thing that came to my attention is we'll now probably need some sort of gaiacli keys init command functionality which sets up a keyring with a passphrase. Subsequent usage will now prompt users for both a keyring passphrase (unless saved) and their key passphrase (bcrypt encrypted) -- not sure this is the best UX.

Or were we thinking of another flow?

@cwgoes
Copy link
Contributor

cwgoes commented Feb 26, 2019

I think we can ditch bcrypt if we're using a keyring which is already encrypted.

This seems like a large-magnitude change for prelaunch though, for now I suggest just the permissions fix.

@zmanian
Copy link
Member

zmanian commented May 3, 2019

FYI Iqlusion/ @poldsam is working on adding keyring support for the client key storage

@alexanderbez
Copy link
Contributor Author

Cool! You mean to Keybase @zmanian? Is there any code you can share? Will a PR be made?

@zmanian
Copy link
Member

zmanian commented May 3, 2019

https://github.com/iqlusioninc/cosmos-sdk/tree/kristi/keyringKeybase

Here is the WIP branch. Yep there will be a PR

@alexanderbez
Copy link
Contributor Author

Awesome. Look forward to reviewing the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs S:proposed
Projects
None yet
Development

No branches or pull requests

4 participants