Wire API_TOKEN_PEPPERS into NetBox config #346
Reference in New Issue
Block a user
Delete Branch "benvin/netbox-token-peppers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
NetBox 4.6.5 refuses to save v2 API tokens without
API_TOKEN_PEPPERS("Unable to save v2 tokens: API_TOKEN_PEPPERS is not defined"), which blocks creating the superuser token the NetBox Vault engine needs (it defaults to v2 tokens). The chart only auto-generates a pepper when it creates the config secret itself; it does not do that whileexistingSecret(netbox-secret-key) is set, so the config secret carries noapi_token_pepperskey.Changes
api_token_pepperson thenetbox-secret-keyVaultStaticSecret: a JSON pepper map{"1": "<random>"}seeded once into Vault alongsidesecret_key. VSO syncs every key at the path into the config secret, which the chart already mounts as an optional file intoAPI_TOKEN_PEPPERS.commonAnnotationsso thenetboxandnetbox-workerDeployments roll whennetbox-secret-keychanges, picking up the seeded pepper (and any rotatedsecret_key) without a manual restart.Follow-up (out of band)
Ben seeds the pepper once (rotating it invalidates existing v2 tokens):
NetBox 4.6.5 refuses to save v2 API tokens without API_TOKEN_PEPPERS ("Unable to save v2 tokens: API_TOKEN_PEPPERS is not defined"), blocking creation of the superuser token the NetBox Vault engine needs. The chart only auto-generates a pepper when it creates the config secret itself, which it does not do while existingSecret (netbox-secret-key) is set, so the config secret carries no api_token_peppers key. - Document api_token_peppers on the netbox-secret-key VaultStaticSecret: a JSON pepper map {"1": "<random>"} seeded once into Vault alongside secret_key; VSO syncs it into the config secret the chart already mounts. - Add a reloader annotation (commonAnnotations) so the web and worker Deployments roll when netbox-secret-key changes, picking up the seeded pepper without a manual restart.