Cache the fernet key in the /config volume #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
When the fernet key is not provided in an environment variable, cache the generated key in
/config/fernet.key
. If this is a persistent volume, the key will be reused on container restarts.This change will also accept a fernet key with or w/o enclosing "b'" and "'". This avoids confusion as
/app/fernet-key.py
prints it with the byte-string quotes.Benefits of this PR and context:
This is an easier method to preserve the key to prevent issues when the container restarts. Even on occasional container restarts I was having problems getting the login page w/o clearing cookies.
How Has This Been Tested?
I've been running this change for several days in several docker compose container stacks on x86_64 with a
/config
volume mounted andFERNETKEY
not defined and a volume mounted. My gateway errors on the login page have gone away.I also switched between defining
FERNETKEY
(to one generated by and cached in/config
) and mounting the/config
volume to ensure that the same key was being used (by reloading the web page and watching for tracebacks in the container logs).Source / References: