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

External encryption key for master key #27

Open
radumarias opened this issue May 4, 2024 · 0 comments
Open

External encryption key for master key #27

radumarias opened this issue May 4, 2024 · 0 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@radumarias
Copy link
Member

radumarias commented May 4, 2024

The idea is to provide an external key to encrypt the master key. That key will be encrypted with a key derived from the password to keep it safe.

This increases security because:

  • If we get access to the encrypted key which is encrypted with a key derived from the pass, we can brute-force the pass, which is less secure than a full random key
  • Not having access to the encrypted key leaves us with the sole option to generate all possible keys, which is a huge space than the possible values for password

Generate key

The key generate PATH command should require a pass, randomly generate an encryption key, and encrypt it with the key derived from the pass.

  • Then write it in a file at PATH
  • Also have a param like key generate --stdout to directly print the key to stdout, in case the user wants to use > file

Change password

key passwd PATH, which asks for old and new passes (with confirmation) and re-encrypts the external key.

Use key

Then, in the mount command, add a new param --key PATH and use pass to decrypt it.
Also, have a param --key-stdin if the user wants to use rencfs ... < key

In EncryptedFs and EncryptedFsFuse3

These should also accept an Option<SecretString> as the path to the external key alongside the password and use that to decrypt the master key.

Expire master key

Given we expire the master key from mem, we will save the external key path to OS's keyring so we can reload it again when we need to decrypt again the master key. It's safer than keeping it in memory as, in extreme situations, it's somehow not as complicated for an attacker to retrieve that from memory rather than from keyring.

When #261 is impl we should use the external key to encrypt KEK.

Warning

Update readme

@radumarias radumarias added this to rencfs May 4, 2024
@radumarias radumarias converted this from a draft issue May 4, 2024
@radumarias radumarias moved this from Todo to In Progress in rencfs Aug 4, 2024
@radumarias radumarias changed the title param for key path Param for key path Aug 4, 2024
@radumarias radumarias added this to the 1.0.0-rc.1 milestone Aug 18, 2024
@radumarias radumarias changed the title Param for key path CLI arg for key path Sep 1, 2024
@radumarias radumarias changed the title CLI arg for key path Ability to provide external master encryption key Sep 1, 2024
@cristiborta cristiborta self-assigned this Sep 12, 2024
@cristiborta cristiborta removed their assignment Dec 20, 2024
@radumarias radumarias changed the title Ability to provide external master encryption key External encryption key for master key Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants