From 315bc2b4cfb0f1b34f96c97d42a02028abb99814 Mon Sep 17 00:00:00 2001 From: riccardom Date: Tue, 24 Nov 2026 09:14:28 +0100 Subject: [PATCH 1/2] [doc] Name peer auth required as an exception to the auth secret startup check The startup and backup guidance said the combined server never starts without server.authSecret, so an operator with peerAuth.required would add a secret the server then refuses. --- src/pages/selfhosted/maintenance/backup.mdx | 2 +- src/pages/selfhosted/maintenance/configuration-files.mdx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/selfhosted/maintenance/backup.mdx b/src/pages/selfhosted/maintenance/backup.mdx index d13483f2b..ae3eeb632 100644 --- a/src/pages/selfhosted/maintenance/backup.mdx +++ b/src/pages/selfhosted/maintenance/backup.mdx @@ -24,7 +24,7 @@ The steps below use `backup/` as the target directory and assume the default qui | `proxy.env`, `traefik-dynamic.yaml` | Install directory | [Reverse proxy](/manage/reverse-proxy) enabled | Proxy access token and the Traefik routing rules that pass TLS through to the proxy. | | `crowdsec/` directory | Install directory | [CrowdSec](/selfhosted/maintenance/crowdsec) enabled | CrowdSec configuration, mounted into the container at `/etc/crowdsec`. | | `nginx-netbird.conf`, `caddyfile-netbird.txt`, `npm-advanced-config.txt` | Install directory | External reverse proxy chosen during setup | Snippets for your own reverse proxy. Harmless to copy if present. | -| `.env`, or the secret store that sets `NB_AUTH_SECRET` or `NB_STORE_ENCRYPTION_KEY` | Install directory, or your secret store | Either variable set on `netbird-server` | The only copy of these secrets once they are removed from `config.yaml`. See [Keeping secrets out of the config file](/selfhosted/maintenance/configuration-files#keeping-secrets-out-of-the-config-file). Without the encryption key the restored database cannot be read, and without `server.authSecret` the server does not start (unless it uses external relays). **Required.** | +| `.env`, or the secret store that sets `NB_AUTH_SECRET` or `NB_STORE_ENCRYPTION_KEY` | Install directory, or your secret store | Either variable set on `netbird-server` | The only copy of these secrets once they are removed from `config.yaml`. See [Keeping secrets out of the config file](/selfhosted/maintenance/configuration-files#keeping-secrets-out-of-the-config-file). Without the encryption key the restored database cannot be read, and without `server.authSecret` the server does not start (unless it uses external relays or `server.peerAuth.required` is set). **Required.** | | `/var/lib/netbird` in `netbird-server` | Docker volume `netbird_data` | Always | Management database (SQLite by default), encryption keys and state. **Required.** | | `/var/lib/crowdsec/data` in `crowdsec` | Docker volume `crowdsec_db` | CrowdSec enabled | CrowdSec LAPI database, including the bouncer key that `proxy.env` references. Without it the restored proxy cannot authenticate to CrowdSec. | | `/certs` in `proxy` | Docker volume `netbird_proxy_certs` | Reverse proxy enabled | Certificates for proxied services. Optional: the proxy reissues them, but restoring avoids a burst of Let's Encrypt requests. | diff --git a/src/pages/selfhosted/maintenance/configuration-files.mdx b/src/pages/selfhosted/maintenance/configuration-files.mdx index 756a0c37f..9c6386a63 100644 --- a/src/pages/selfhosted/maintenance/configuration-files.mdx +++ b/src/pages/selfhosted/maintenance/configuration-files.mdx @@ -555,7 +555,7 @@ Two of the secrets in `config.yaml` can be moved out of it: `server.authSecret`, These variables require NetBird v0.83.0 or later. Earlier versions of the combined server ignore both. On them, a secret you remove from `config.yaml` is missing: without `server.authSecret` the server refuses to start (unless it uses external relays), and without `server.store.encryptionKey` it starts with a newly generated key and cannot read the data already in the database. -A variable that is set and not empty overrides the `config.yaml` field; an unset or empty one does not. If neither the variable nor `config.yaml` supplies a value, the server refuses to start without `server.authSecret` (unless `server.relays.addresses` points at external relays). Without an encryption key it generates a new one on every start, so data already in the database cannot be read. +A variable that is set and not empty overrides the `config.yaml` field; an unset or empty one does not. If neither the variable nor `config.yaml` supplies a value, the server refuses to start without `server.authSecret` (unless `server.relays.addresses` points at external relays or `server.peerAuth.required` is set). Without an encryption key it generates a new one on every start, so data already in the database cannot be read. Docker Compose reads a `.env` file next to `docker-compose.yml`, so the service can reference variables from it: @@ -566,7 +566,7 @@ netbird-server: - NB_STORE_ENCRYPTION_KEY=${NB_STORE_ENCRYPTION_KEY} ``` -If `.env` lacks an entry, the reference expands to an empty string and the server falls back to `config.yaml`. If you also removed the field from `config.yaml`, the server has no value: without the encryption key it starts with a newly generated key and cannot read the data already in the database, and without `server.authSecret` it refuses to start (unless it uses external relays). +If `.env` lacks an entry, the reference expands to an empty string and the server falls back to `config.yaml`. If you also removed the field from `config.yaml`, the server has no value: without the encryption key it starts with a newly generated key and cannot read the data already in the database, and without `server.authSecret` it refuses to start (unless it uses external relays or `server.peerAuth.required` is set). Add `.env` to your `.gitignore`. Once you remove the fields from `config.yaml`, `.env` is the only copy of these secrets, so include it in your [backups](/selfhosted/maintenance/backup). From d9fd6bd382e0c1af329fca590e7d06098e7c2c08 Mon Sep 17 00:00:00 2001 From: riccardom Date: Tue, 24 Nov 2026 14:05:01 +0100 Subject: [PATCH 2/2] Say peerAuth.required must be true, and that NB_AUTH_SECRET conflicts with it A false value also sets the field without lifting the secret check, and a non-empty NB_AUTH_SECRET makes a peerAuth.required built-in relay refuse to start. --- src/pages/selfhosted/maintenance/backup.mdx | 2 +- src/pages/selfhosted/maintenance/configuration-files.mdx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/selfhosted/maintenance/backup.mdx b/src/pages/selfhosted/maintenance/backup.mdx index ae3eeb632..8c5d994e1 100644 --- a/src/pages/selfhosted/maintenance/backup.mdx +++ b/src/pages/selfhosted/maintenance/backup.mdx @@ -24,7 +24,7 @@ The steps below use `backup/` as the target directory and assume the default qui | `proxy.env`, `traefik-dynamic.yaml` | Install directory | [Reverse proxy](/manage/reverse-proxy) enabled | Proxy access token and the Traefik routing rules that pass TLS through to the proxy. | | `crowdsec/` directory | Install directory | [CrowdSec](/selfhosted/maintenance/crowdsec) enabled | CrowdSec configuration, mounted into the container at `/etc/crowdsec`. | | `nginx-netbird.conf`, `caddyfile-netbird.txt`, `npm-advanced-config.txt` | Install directory | External reverse proxy chosen during setup | Snippets for your own reverse proxy. Harmless to copy if present. | -| `.env`, or the secret store that sets `NB_AUTH_SECRET` or `NB_STORE_ENCRYPTION_KEY` | Install directory, or your secret store | Either variable set on `netbird-server` | The only copy of these secrets once they are removed from `config.yaml`. See [Keeping secrets out of the config file](/selfhosted/maintenance/configuration-files#keeping-secrets-out-of-the-config-file). Without the encryption key the restored database cannot be read, and without `server.authSecret` the server does not start (unless it uses external relays or `server.peerAuth.required` is set). **Required.** | +| `.env`, or the secret store that sets `NB_AUTH_SECRET` or `NB_STORE_ENCRYPTION_KEY` | Install directory, or your secret store | Either variable set on `netbird-server` | The only copy of these secrets once they are removed from `config.yaml`. See [Keeping secrets out of the config file](/selfhosted/maintenance/configuration-files#keeping-secrets-out-of-the-config-file). Without the encryption key the restored database cannot be read, and without `server.authSecret` the server does not start (unless it uses external relays or `server.peerAuth.required` is `true`). **Required.** | | `/var/lib/netbird` in `netbird-server` | Docker volume `netbird_data` | Always | Management database (SQLite by default), encryption keys and state. **Required.** | | `/var/lib/crowdsec/data` in `crowdsec` | Docker volume `crowdsec_db` | CrowdSec enabled | CrowdSec LAPI database, including the bouncer key that `proxy.env` references. Without it the restored proxy cannot authenticate to CrowdSec. | | `/certs` in `proxy` | Docker volume `netbird_proxy_certs` | Reverse proxy enabled | Certificates for proxied services. Optional: the proxy reissues them, but restoring avoids a burst of Let's Encrypt requests. | diff --git a/src/pages/selfhosted/maintenance/configuration-files.mdx b/src/pages/selfhosted/maintenance/configuration-files.mdx index 9c6386a63..4e8b93bab 100644 --- a/src/pages/selfhosted/maintenance/configuration-files.mdx +++ b/src/pages/selfhosted/maintenance/configuration-files.mdx @@ -548,14 +548,14 @@ Two of the secrets in `config.yaml` can be moved out of it: `server.authSecret`, | Variable | Overrides | Notes | |---|---|---| -| `NB_AUTH_SECRET` | `server.authSecret` | External relays use it only when `server.relays.secret` is empty. See [External relays and self-hosted Enterprise](#external-relays-and-self-hosted-enterprise). | +| `NB_AUTH_SECRET` | `server.authSecret` | External relays use it only when `server.relays.secret` is empty. See [External relays and self-hosted Enterprise](#external-relays-and-self-hosted-enterprise). With the built-in relay, leave it unset or empty when `server.peerAuth.required` is `true`: with both, the server refuses to start. See [Refuse unauthenticated peers](/selfhosted/maintenance/peer-authentication#refuse-unauthenticated-peers). | | `NB_STORE_ENCRYPTION_KEY` | `server.store.encryptionKey` | On self-hosted Enterprise, also the key its integrations use. See [External relays and self-hosted Enterprise](#external-relays-and-self-hosted-enterprise). | These variables require NetBird v0.83.0 or later. Earlier versions of the combined server ignore both. On them, a secret you remove from `config.yaml` is missing: without `server.authSecret` the server refuses to start (unless it uses external relays), and without `server.store.encryptionKey` it starts with a newly generated key and cannot read the data already in the database. -A variable that is set and not empty overrides the `config.yaml` field; an unset or empty one does not. If neither the variable nor `config.yaml` supplies a value, the server refuses to start without `server.authSecret` (unless `server.relays.addresses` points at external relays or `server.peerAuth.required` is set). Without an encryption key it generates a new one on every start, so data already in the database cannot be read. +A variable that is set and not empty overrides the `config.yaml` field; an unset or empty one does not. If neither the variable nor `config.yaml` supplies a value, the server refuses to start without `server.authSecret` (unless `server.relays.addresses` points at external relays or `server.peerAuth.required` is `true`). Without an encryption key it generates a new one on every start, so data already in the database cannot be read. Docker Compose reads a `.env` file next to `docker-compose.yml`, so the service can reference variables from it: @@ -566,7 +566,7 @@ netbird-server: - NB_STORE_ENCRYPTION_KEY=${NB_STORE_ENCRYPTION_KEY} ``` -If `.env` lacks an entry, the reference expands to an empty string and the server falls back to `config.yaml`. If you also removed the field from `config.yaml`, the server has no value: without the encryption key it starts with a newly generated key and cannot read the data already in the database, and without `server.authSecret` it refuses to start (unless it uses external relays or `server.peerAuth.required` is set). +If `.env` lacks an entry, the reference expands to an empty string and the server falls back to `config.yaml`. If you also removed the field from `config.yaml`, the server has no value: without the encryption key it starts with a newly generated key and cannot read the data already in the database, and without `server.authSecret` it refuses to start (unless it uses external relays or `server.peerAuth.required` is `true`). Add `.env` to your `.gitignore`. Once you remove the fields from `config.yaml`, `.env` is the only copy of these secrets, so include it in your [backups](/selfhosted/maintenance/backup).