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

Encrypted configuration backend #295

Merged
merged 11 commits into from
May 1, 2020
Merged

Encrypted configuration backend #295

merged 11 commits into from
May 1, 2020

Conversation

rubiojr
Copy link
Collaborator

@rubiojr rubiojr commented Apr 14, 2020

AES configuration backend encrypts Beehive's configuration using symmetric encryption.

Example:

./beehive --config crypto://x:mysecret@/home/rubiojr/beehive.conf`

BEEHIVE_CONFIG_PASSWORD=mysecret ./beehive --config /path/to/encrypted/config

This will use the key mysecret to encrypt/decrypt the config file.

The encrypted configuration file includes a 12 bytes header (beehiveconf+) that makes it possible to identify the file as an encrypted configuration file:

head -c 12 beehive-encrypted.conf
beehiveconf+

Fixes #226

@rubiojr
Copy link
Collaborator Author

rubiojr commented Apr 14, 2020

@muesli crypto is not really my strength. Any opinions before I start adding tests here?

@rubiojr
Copy link
Collaborator Author

rubiojr commented Apr 14, 2020

The plan is to also load the password from the environment, to provide a safer alternative to the embedded string in the URL.

@rubiojr rubiojr changed the base branch from config-interface to master April 24, 2020 19:10
BEEHIVE_CONFIG_PASSWORD environment=secret ./beehive --config crypto:///path/to/config
can now decrypt an encrypted configuraiton also.
@rubiojr rubiojr changed the title [WiP] Encrypted configuration backend Encrypted configuration backend Apr 25, 2020
@rubiojr
Copy link
Collaborator Author

rubiojr commented Apr 25, 2020

This is ready for 👀

@rubiojr
Copy link
Collaborator Author

rubiojr commented Apr 25, 2020

Ended up adding an example wrapper to store and retrieve the configuration password from a desktop keyring.

@muesli
Copy link
Owner

muesli commented Apr 30, 2020

Looks good to me, nice work, once again!

The only remark I have so far: maybe we could drop the fake username (x in the example crypto URL) and instead allow for it to be set as the password, so the URL could look like:

crypto://mysecret@/home/rubiojr/beehive.conf

I know it's technically abusing the username as our password, but it gets rid of the redundant & confusing fake value in the URL, and looks a bit nicer (imo).

What do you think?

@rubiojr
Copy link
Collaborator Author

rubiojr commented May 1, 2020

What do you think?

I like the idea.

@rubiojr
Copy link
Collaborator Author

rubiojr commented May 1, 2020

I'm also adding a cli tool to decrypt/encrypt an existing config. I found that useful.

@rubiojr
Copy link
Collaborator Author

rubiojr commented May 1, 2020

The only remark I have so far: maybe we could drop the fake username (x in the example crypto URL) and instead allow for it to be set as the password, so the URL could look like:

Fixed in 8626f31

I'm also adding a cli tool to decrypt/encrypt an existing config. I found that useful.

On a second thought, I'll leave that for a new PR, to reduce the scope here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encryption for values in configuration file?
2 participants