Skip to content

website: AUTHENTIK_SECRET_KEY has a newline character #9552

@thiagola92

Description

@thiagola92

Describe the bug
In Preparation, mentions:

echo "PG_PASS=$(openssl rand -base64 36)" >> .env
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60)" >> .env

But command openssl rand generates a newline each X bytes. This generate secrets like:

AUTHENTIK_SECRET_KEY=6UWXLq1/iznyqf0lniVUsseD5XPtpOFi7Bz7fNPOnEIqQbT8mOcGYwVUmF7DYm+W
8Kx/yO69QOPvuts3

Anything after newline will not be contained in the AUTHENTIK_SECRET_KEY.
In this example it will even show a message error because / is not valid in variable name:

$ sudo docker compose pull
[sudo] password for user: 
failed to read /home/user/Downloads/.env: line 3: unexpected character "/" in variable name "8Kx/yO69QOPvuts3"

To Reproduce
Steps to reproduce the behavior:

  1. Run openssl rand -base64 60 and check if there is a newline
  2. Make sure that second line has a character that is not valid in variable name but valid variable value
  3. docker compose pull
  4. Docker compose will warn you that variable name is not valid

Expected behavior
AUTHENTIK_SECRET_KEY being an one-line value.

Screenshots
None

Logs
None

Version and Deployment (please complete the following information):

  • authentik version: 2024.4.1
  • Deployment: docker-compose

Additional context
I thought about quoting but this would make newline being include and I'm not sure if this is desired. Maybe is better to do:

AUTHENTIK_SECRET_KEY=$(openssl rand -base64 60 | tr -d \n)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions