Skip to content

The superuser creation via env variables skip the key setup on netbox v2 tokens #1647

@edudppaz

Description

@edudppaz

Desired Behavior

The purpose of the SKIP_SUPERUSER and SUPERUSER_API_TOKEN is to allow the container build/startup to create a known user and API token that can be used to testing/integrations/etc.
The introduction of the new version of tokens for netbox, a "key" variable is configured on the Token model that is needed in order to do API calls using the new header towards netbox. The key should be allowed to also be setup during build to get a fully known key.token string for the superuser

Contrast to Current Behavior

The current build process creates a Superuser and an API_TOKEN using tokens v2 if the SUPERUSER_API_TOKEN, but it does not specify the key, this makes netbox generate a random key, unknown to the operator (or needs to be read afterwards) and changes on each container build.

Required Changes

  • Add a new optional SUPERUSER_API_KEY environment variable that can be used to setup the token key
  • Update docker/super_user.py to use his new environment variable and configure it for the api token if using v2 of tokens

Discussion: Benefits and Drawbacks

Benefits:

  • A fully functional v2 nb_{key}.{token} to be used for development
  • An environment variable that can be changed for this purpose

Drawbacks:

  • Security considerations? This is supossed to be used only for testing/development purposes so i see no drawback with having this flexibility.

Im working on a PR for this, coming soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions