Encrypt API tokens (#2360)

Store API tokens encrypted in the database.

During the database migration a randomly generated key will be used encrypt the tokens if no ENCRYPTION_KEY environment variable was provided.

If the application is started without the presence of an ENCRYPTION_KEY (or if the key failed to decrypt the existing tokens), the UI will display a warning with further instructions.
This commit is contained in:
Adrian Kumpf
2022-02-18 17:03:13 +01:00
committed by GitHub
parent d461292bc4
commit 0d6e288c70
37 changed files with 2629 additions and 1867 deletions

View File

@@ -212,6 +212,7 @@ You should at least substitute the following details:
- `TESLAMATEPATH` should be the path that you ran the `git clone` within.
```
export ENCRYPTION_KEY="your_secure_encryption_key_here"
export DATABASE_USER="teslamate"
export DATABASE_PASS="your_secure_password_here"
export DATABASE_HOST="127.0.0.1"
@@ -229,6 +230,7 @@ $TESLAMATEPATH/_build/prod/rel/teslamate/bin/teslamate start
The following command needs to be run once during the installation process in order to create the database schema for the TeslaMate installation:
```bash
export ENCRYPTION_KEY="your_secure_encryption_key_here"
export DATABASE_USER="teslamate"
export DATABASE_PASS="your_secure_password_here"
export DATABASE_HOST="127.0.0.1"