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: Reinit server with token on demand, enable reusing exisitng configuration in all modes, update error output #210

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vonjackets
Copy link

This fix is tied to the issue I opened (#209), below is a review of what I aim to solve here.
Please let me know if this belongs in a renovate/ branch!

Problem Analysis

Panic when running in other modes without configuration

I noticed this when playing with attic, trying to run in api-server mode with no config panicked every time.

  • Scenario: Running atticd --api-server without a pre-existing configuration file causes a panic.
  • Root Cause: The run_oobe function, responsible for generating default configurations and tokens, is bypassed when the server is executed in API Server mode, leaving the server in an undefined state.
  • Impact: This prevents the server from starting properly in a default configuration, blocking administrators from easily deploying the API Server.

Missing Root Token in Monolithic Mode with Pre-Existing Configuration

  • Scenario: When the server is run in Monolithic Mode with a configuration file that includes an RS256 key, the run_oobe function is skipped. This prevents a root token from being generated.

  • Root Cause: The logic incorrectly assumes that the presence of a configuration file implies a fully initialized server, bypassing critical token generation steps.

  • Impact:

    1. Authentication Failure: Administrators cannot authenticate to the server because no root token is created.
    2. Operational Failure: atticadm generates "do-nothing" tokens, effectively rendering it non-functional.
    3. Deployment Inconsistency: The behavior creates discrepancies between first-run and subsequent runs of the server.

    So far, my testing has consisted of trying to work through my desired use case of using this for ci/cd builds. I intend to try deploying this fix within a container and running it there with a sqlite db.

    I have also ran the nix build . command from the root to ensure the entire project can be recreated. Please let me know if there's other work/testing output you'd like to see!

@vonjackets vonjackets marked this pull request as ready for review November 30, 2024 18:40
@vonjackets vonjackets changed the title Hotfix: Reinit server with token on demand, enable reusing exisitng configuration in all modes, update error output feat: Reinit server with token on demand, enable reusing exisitng configuration in all modes, update error output Dec 4, 2024
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.

1 participant