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

@@ -35,6 +35,7 @@ services:
image: teslamate/teslamate:latest
restart: always
environment:
- ENCRYPTION_KEY=${TM_ENCRYPTION_KEY}
- DATABASE_USER=${TM_DB_USER}
- DATABASE_PASS=${TM_DB_PASS}
- DATABASE_NAME=${TM_DB_NAME}
@@ -101,6 +102,7 @@ volumes:
This file should reside in the same folder as the docker-compose.yml file.
```plaintext title=".env"
TM_ENCRYPTION_KEY= #your secure key to encrypt your Tesla API tokens
TM_DB_USER=teslamate
TM_DB_PASS= #your secure password!
TM_DB_NAME=teslamate