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

feat: Ability to create root user via environment variables #4847

Merged
merged 11 commits into from
Jan 16, 2025

Conversation

peaklabs-dev
Copy link
Member

@peaklabs-dev peaklabs-dev commented Jan 16, 2025

Changes

  • feat: Ability to set the initial root user (instance admin user) of Coolify in the .env file via environment variables:

    • ROOT_USERNAME=
    • ROOT_USER_EMAIL=
    • ROOT_USER_PASSWORD=
  • feat: Registration is automatically disabled if you set up a root user via the .env file

  • feat: Logic, error handling and clean log output for each scenario:

    • Environment variables do not pass validation rules
    • Root user created successfully
    • Root user already exists, skipping creation
  • Security fix: After initial installation, the Registration page is exposed with the registration form. This is usually not an issue as one installs and registers within seconds/minutes after the URL becomes publicly accessible. However, if you leave the registration page too long without registering a user, a malicious actor can potentially register and compromise your system.

-> The new way of setting your root user in the .env file can prevent the registration page from ever being accessible to the internet.

Note

  • At the moment, the registration page is only inaccessible (all the time) if you use manual installation because the automated script downloads the .env file during installation, and then the user has to fill in the values in the .env file after Coolify is already installed and then run the script again (registration page will be live for a few seconds like this). In the future, we can make the script more interactive and ask for a username, email, and password.
  • For security purposes, the env values only take effect if the root user does not yet exist, so you cannot override the existing root user with these env values.

Issues

@peaklabs-dev peaklabs-dev changed the base branch from main to next January 16, 2025 16:40
@peaklabs-dev peaklabs-dev added the 🏔️ Peaklabs A label for PRs from Peaklabs. label Jan 16, 2025
@peaklabs-dev peaklabs-dev marked this pull request as ready for review January 16, 2025 19:20
@andrasbacsai
Copy link
Member

andrasbacsai commented Jan 16, 2025

Thank you for the PR! We need to document it as well!

@peaklabs-dev
Copy link
Member Author

I will add docs for this tomorrow morning.

@andrasbacsai andrasbacsai merged commit 8f32c32 into next Jan 16, 2025
3 checks passed
@github-actions github-actions bot removed the 🏔️ Peaklabs A label for PRs from Peaklabs. label Jan 16, 2025
@peaklabs-dev peaklabs-dev deleted the feat-create-initial-user-via-env branch January 16, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants