[GH-ISSUE #5257] configure.sh script is not idempotent #10203

Open
opened 2026-08-05 01:24:59 -04:00 by saavagebueno · 0 comments
Owner

Originally created by @CodingTil on GitHub (Feb 4, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5257

Describe the problem

The configure.sh script is not idempotent, i.e., without changing the environment variables in setup.env, running configure.sh overwrites and clears some values from the generated files.

This script should be idempotent. Assume, one has to rotate their IDP client secret. After changing that value in the setup.env, the intuitive next thing to do would be to run ./configure.sh. This, however, overwrites at least one critical value, namely DataStoreEncryptionKey.

To Reproduce

Steps to reproduce the behavior:

  1. go to infrastructure_files/
  2. create a minimal setup.env:
NETBIRD_DOMAIN="localhost"
NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://example.eu.auth0.com/.well-known/openid-configuration"
  1. Run ./configure.sh
  2. Start netbird, which will set some more values:
    1. go to artifacts/
    2. docker compose pull
    3. docker compose up -d --force-recreate
  3. Run ./configure.sh again
diff artifacts/docker-compose.yml artifacts/docker-compose.yml.bkp.1770237762
69c69
<     - NB_AUTH_SECRET=xR+upqMh77bN4W6O22Okm23T1HDOPAaRfgo5FGGgW6k
---
>     - NB_AUTH_SECRET=y32F6NVQus3KY4Sj5H61mtX7xHXWZtwcBerN96J1UYU
diff artifacts/management.json artifacts/management.json.bkp.1770237762
2,17c2,8
<   "Stuns": [
<     {
<       "Proto": "udp",
<       "URI": "stun:localhost:3478",
<       "Username": "",
<       "Password": null
<     }
<   ],
<   "TURNConfig": {
<     "Turns": [
<       {
<         "Proto": "udp",
<         "URI": "turn:localhost:3478",
<         "Username": "self",
<         "Password": "TolswrQufqvcKlo7mlwyyZvqNwkJ0YkwfBEEKNMTseY"
<       }
---
>     "Stuns": [
>         {
>             "Proto": "udp",
>             "URI": "stun:localhost:3478",
>             "Username": "",
>             "Password": ""
>         }
19,107c10,113
<     "CredentialsTTL": "12h",
<     "Secret": "secret",
<     "TimeBasedCredentials": false
<   },
<   "Relay": {
<     "Addresses": [
<       "rel://localhost:33080"
<     ],
<     "CredentialsTTL": "24h",
<     "Secret": "xR+upqMh77bN4W6O22Okm23T1HDOPAaRfgo5FGGgW6k"
<   },
<   "Signal": {
<     "Proto": "http",
<     "URI": "localhost:10000",
<     "Username": "",
<     "Password": null
<   },
<   "ReverseProxy": {
<     "TrustedHTTPProxies": [],
<     "TrustedHTTPProxiesCount": 0,
<     "TrustedPeers": [
<       "0.0.0.0/0"
<     ]
<   },
<   "DisableDefaultPolicy": false,
<   "Datadir": "",
<   "DataStoreEncryptionKey": "",
<   "StoreConfig": {
<     "Engine": "sqlite"
<   },
<   "HttpConfig": {
<     "Address": "0.0.0.0:33073",
<     "AuthIssuer": "https://example.eu.auth0.com/",
<     "AuthAudience": "",
<     "AuthKeysLocation": "https://example.eu.auth0.com/.well-known/jwks.json",
<     "AuthUserIDClaim": "",
<     "CertFile": "",
<     "CertKey": "",
<     "IdpSignKeyRefreshEnabled": false,
<     "OIDCConfigEndpoint": "https://example.eu.auth0.com/.well-known/openid-configuration"
<   },
<   "IdpManagerConfig": {
<     "ManagerType": "",
<     "ClientConfig": {
<       "Issuer": "https://example.eu.auth0.com/",
<       "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
<       "ClientID": "",
<       "ClientSecret": "",
<       "GrantType": "client_credentials"
<     },
<     "ExtraConfig": {},
<     "Auth0ClientCredentials": null,
<     "AzureClientCredentials": null,
<     "KeycloakClientCredentials": null,
<     "ZitadelClientCredentials": null
<   },
<   "DeviceAuthorizationFlow": {
<     "Provider": "none",
<     "ProviderConfig": {
<       "Audience": "",
<       "AuthorizationEndpoint": "",
<       "Domain": "",
<       "ClientID": "",
<       "ClientSecret": "",
<       "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
<       "DeviceAuthEndpoint": "https://example.eu.auth0.com/oauth/device/code",
<       "Scope": "openid",
<       "UseIDToken": false,
<       "RedirectURLs": null
<     }
<   },
<   "PKCEAuthorizationFlow": {
<     "ProviderConfig": {
<       "Audience": "",
<       "ClientID": "",
<       "ClientSecret": "",
<       "Domain": "",
<       "AuthorizationEndpoint": "https://example.eu.auth0.com/authorize",
<       "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
<       "Scope": "",
<       "RedirectURLs": [
<         "http://localhost:53000"
<       ],
<       "UseIDToken": false,
<       "DisablePromptLogin": false,
<       "LoginFlag": 0
<     }
<   }
< }
---
>     "TURNConfig": {
>         "TimeBasedCredentials": false,
>         "CredentialsTTL": "12h0m0s",
>         "Secret": "secret",
>         "Turns": [
>             {
>                 "Proto": "udp",
>                 "URI": "turn:localhost:3478",
>                 "Username": "self",
>                 "Password": "yT+WHDTsGJA3E+8kxV8nAPMR4CFiFqMY+yvo2W2Ypds"
>             }
>         ]
>     },
>     "Relay": {
>         "Addresses": [
>             "rel://localhost:33080"
>         ],
>         "CredentialsTTL": "24h0m0s",
>         "Secret": "y32F6NVQus3KY4Sj5H61mtX7xHXWZtwcBerN96J1UYU"
>     },
>     "Signal": {
>         "Proto": "http",
>         "URI": "localhost:10000",
>         "Username": "",
>         "Password": ""
>     },
>     "Datadir": "/var/lib/netbird/",
>     "DataStoreEncryptionKey": "ap/DyOX/Vw5IzrqUnTB0vCSY8bZhKeY9KC2Nl683hlo=",
>     "HttpConfig": {
>         "LetsEncryptDomain": "",
>         "CertFile": "",
>         "CertKey": "",
>         "AuthAudience": "",
>         "CLIAuthAudience": "",
>         "AuthIssuer": "https://example.eu.auth0.com/",
>         "AuthUserIDClaim": "",
>         "AuthKeysLocation": "https://example.eu.auth0.com/.well-known/jwks.json",
>         "OIDCConfigEndpoint": "https://example.eu.auth0.com/.well-known/openid-configuration",
>         "IdpSignKeyRefreshEnabled": false,
>         "ExtraAuthAudience": ""
>     },
>     "IdpManagerConfig": {
>         "ManagerType": "",
>         "ClientConfig": {
>             "Issuer": "https://example.eu.auth0.com/",
>             "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
>             "ClientID": "",
>             "ClientSecret": "",
>             "GrantType": "client_credentials"
>         },
>         "ExtraConfig": {},
>         "Auth0ClientCredentials": null,
>         "AzureClientCredentials": null,
>         "KeycloakClientCredentials": null,
>         "ZitadelClientCredentials": null
>     },
>     "DeviceAuthorizationFlow": {
>         "Provider": "none",
>         "ProviderConfig": {
>             "ClientID": "",
>             "ClientSecret": "",
>             "Domain": "",
>             "Audience": "",
>             "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
>             "DeviceAuthEndpoint": "https://example.eu.auth0.com/oauth/device/code",
>             "AuthorizationEndpoint": "",
>             "Scope": "openid",
>             "UseIDToken": false,
>             "RedirectURLs": null,
>             "DisablePromptLogin": false,
>             "LoginFlag": 0
>         }
>     },
>     "PKCEAuthorizationFlow": {
>         "ProviderConfig": {
>             "ClientID": "",
>             "ClientSecret": "",
>             "Domain": "",
>             "Audience": "",
>             "TokenEndpoint": "https://example.eu.auth0.com/oauth/token",
>             "DeviceAuthEndpoint": "",
>             "AuthorizationEndpoint": "https://example.eu.auth0.com/authorize",
>             "Scope": "",
>             "UseIDToken": false,
>             "RedirectURLs": [
>                 "http://localhost:53000"
>             ],
>             "DisablePromptLogin": false,
>             "LoginFlag": 0
>         }
>     },
>     "StoreConfig": {
>         "Engine": "sqlite"
>     },
>     "ReverseProxy": {
>         "TrustedHTTPProxies": [],
>         "TrustedHTTPProxiesCount": 0,
>         "TrustedPeers": [
>             "0.0.0.0/0"
>         ]
>     },
>     "DisableDefaultPolicy": false,
>     "EmbeddedIdP": null
> }
diff artifacts/turnserver.conf artifacts/turnserver.conf.bkp.1770237762
253c253
< user=self:TolswrQufqvcKlo7mlwyyZvqNwkJ0YkwfBEEKNMTseY
---
> user=self:yT+WHDTsGJA3E+8kxV8nAPMR4CFiFqMY+yvo2W2Ypds

Expected behavior

A clear and concise description of what you expected to happen.

Are you using NetBird Cloud?

Self-Hosted

NetBird version

v0.64.5

Is any other VPN software installed?

No.

Debug output

Not relevant.

Screenshots

Not relevant.

Additional context

Add any other context about the problem here.

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings
Originally created by @CodingTil on GitHub (Feb 4, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5257 **Describe the problem** The `configure.sh` script is not idempotent, i.e., without changing the environment variables in `setup.env`, running `configure.sh` overwrites and clears some values from the generated files. This script should be idempotent. Assume, one has to rotate their IDP client secret. After changing that value in the `setup.env`, the intuitive next thing to do would be to run `./configure.sh`. This, however, overwrites at least one critical value, namely `DataStoreEncryptionKey`. **To Reproduce** Steps to reproduce the behavior: 1. go to `infrastructure_files/` 2. create a minimal `setup.env`: ``` NETBIRD_DOMAIN="localhost" NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://example.eu.auth0.com/.well-known/openid-configuration" ``` 3. Run `./configure.sh` 4. Start netbird, which will set some more values: 1. go to `artifacts/` 2. `docker compose pull` 3. `docker compose up -d --force-recreate` 6. Run `./configure.sh` again ``` diff artifacts/docker-compose.yml artifacts/docker-compose.yml.bkp.1770237762 69c69 < - NB_AUTH_SECRET=xR+upqMh77bN4W6O22Okm23T1HDOPAaRfgo5FGGgW6k --- > - NB_AUTH_SECRET=y32F6NVQus3KY4Sj5H61mtX7xHXWZtwcBerN96J1UYU ``` ``` diff artifacts/management.json artifacts/management.json.bkp.1770237762 2,17c2,8 < "Stuns": [ < { < "Proto": "udp", < "URI": "stun:localhost:3478", < "Username": "", < "Password": null < } < ], < "TURNConfig": { < "Turns": [ < { < "Proto": "udp", < "URI": "turn:localhost:3478", < "Username": "self", < "Password": "TolswrQufqvcKlo7mlwyyZvqNwkJ0YkwfBEEKNMTseY" < } --- > "Stuns": [ > { > "Proto": "udp", > "URI": "stun:localhost:3478", > "Username": "", > "Password": "" > } 19,107c10,113 < "CredentialsTTL": "12h", < "Secret": "secret", < "TimeBasedCredentials": false < }, < "Relay": { < "Addresses": [ < "rel://localhost:33080" < ], < "CredentialsTTL": "24h", < "Secret": "xR+upqMh77bN4W6O22Okm23T1HDOPAaRfgo5FGGgW6k" < }, < "Signal": { < "Proto": "http", < "URI": "localhost:10000", < "Username": "", < "Password": null < }, < "ReverseProxy": { < "TrustedHTTPProxies": [], < "TrustedHTTPProxiesCount": 0, < "TrustedPeers": [ < "0.0.0.0/0" < ] < }, < "DisableDefaultPolicy": false, < "Datadir": "", < "DataStoreEncryptionKey": "", < "StoreConfig": { < "Engine": "sqlite" < }, < "HttpConfig": { < "Address": "0.0.0.0:33073", < "AuthIssuer": "https://example.eu.auth0.com/", < "AuthAudience": "", < "AuthKeysLocation": "https://example.eu.auth0.com/.well-known/jwks.json", < "AuthUserIDClaim": "", < "CertFile": "", < "CertKey": "", < "IdpSignKeyRefreshEnabled": false, < "OIDCConfigEndpoint": "https://example.eu.auth0.com/.well-known/openid-configuration" < }, < "IdpManagerConfig": { < "ManagerType": "", < "ClientConfig": { < "Issuer": "https://example.eu.auth0.com/", < "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", < "ClientID": "", < "ClientSecret": "", < "GrantType": "client_credentials" < }, < "ExtraConfig": {}, < "Auth0ClientCredentials": null, < "AzureClientCredentials": null, < "KeycloakClientCredentials": null, < "ZitadelClientCredentials": null < }, < "DeviceAuthorizationFlow": { < "Provider": "none", < "ProviderConfig": { < "Audience": "", < "AuthorizationEndpoint": "", < "Domain": "", < "ClientID": "", < "ClientSecret": "", < "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", < "DeviceAuthEndpoint": "https://example.eu.auth0.com/oauth/device/code", < "Scope": "openid", < "UseIDToken": false, < "RedirectURLs": null < } < }, < "PKCEAuthorizationFlow": { < "ProviderConfig": { < "Audience": "", < "ClientID": "", < "ClientSecret": "", < "Domain": "", < "AuthorizationEndpoint": "https://example.eu.auth0.com/authorize", < "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", < "Scope": "", < "RedirectURLs": [ < "http://localhost:53000" < ], < "UseIDToken": false, < "DisablePromptLogin": false, < "LoginFlag": 0 < } < } < } --- > "TURNConfig": { > "TimeBasedCredentials": false, > "CredentialsTTL": "12h0m0s", > "Secret": "secret", > "Turns": [ > { > "Proto": "udp", > "URI": "turn:localhost:3478", > "Username": "self", > "Password": "yT+WHDTsGJA3E+8kxV8nAPMR4CFiFqMY+yvo2W2Ypds" > } > ] > }, > "Relay": { > "Addresses": [ > "rel://localhost:33080" > ], > "CredentialsTTL": "24h0m0s", > "Secret": "y32F6NVQus3KY4Sj5H61mtX7xHXWZtwcBerN96J1UYU" > }, > "Signal": { > "Proto": "http", > "URI": "localhost:10000", > "Username": "", > "Password": "" > }, > "Datadir": "/var/lib/netbird/", > "DataStoreEncryptionKey": "ap/DyOX/Vw5IzrqUnTB0vCSY8bZhKeY9KC2Nl683hlo=", > "HttpConfig": { > "LetsEncryptDomain": "", > "CertFile": "", > "CertKey": "", > "AuthAudience": "", > "CLIAuthAudience": "", > "AuthIssuer": "https://example.eu.auth0.com/", > "AuthUserIDClaim": "", > "AuthKeysLocation": "https://example.eu.auth0.com/.well-known/jwks.json", > "OIDCConfigEndpoint": "https://example.eu.auth0.com/.well-known/openid-configuration", > "IdpSignKeyRefreshEnabled": false, > "ExtraAuthAudience": "" > }, > "IdpManagerConfig": { > "ManagerType": "", > "ClientConfig": { > "Issuer": "https://example.eu.auth0.com/", > "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", > "ClientID": "", > "ClientSecret": "", > "GrantType": "client_credentials" > }, > "ExtraConfig": {}, > "Auth0ClientCredentials": null, > "AzureClientCredentials": null, > "KeycloakClientCredentials": null, > "ZitadelClientCredentials": null > }, > "DeviceAuthorizationFlow": { > "Provider": "none", > "ProviderConfig": { > "ClientID": "", > "ClientSecret": "", > "Domain": "", > "Audience": "", > "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", > "DeviceAuthEndpoint": "https://example.eu.auth0.com/oauth/device/code", > "AuthorizationEndpoint": "", > "Scope": "openid", > "UseIDToken": false, > "RedirectURLs": null, > "DisablePromptLogin": false, > "LoginFlag": 0 > } > }, > "PKCEAuthorizationFlow": { > "ProviderConfig": { > "ClientID": "", > "ClientSecret": "", > "Domain": "", > "Audience": "", > "TokenEndpoint": "https://example.eu.auth0.com/oauth/token", > "DeviceAuthEndpoint": "", > "AuthorizationEndpoint": "https://example.eu.auth0.com/authorize", > "Scope": "", > "UseIDToken": false, > "RedirectURLs": [ > "http://localhost:53000" > ], > "DisablePromptLogin": false, > "LoginFlag": 0 > } > }, > "StoreConfig": { > "Engine": "sqlite" > }, > "ReverseProxy": { > "TrustedHTTPProxies": [], > "TrustedHTTPProxiesCount": 0, > "TrustedPeers": [ > "0.0.0.0/0" > ] > }, > "DisableDefaultPolicy": false, > "EmbeddedIdP": null > } ``` ``` diff artifacts/turnserver.conf artifacts/turnserver.conf.bkp.1770237762 253c253 < user=self:TolswrQufqvcKlo7mlwyyZvqNwkJ0YkwfBEEKNMTseY --- > user=self:yT+WHDTsGJA3E+8kxV8nAPMR4CFiFqMY+yvo2W2Ypds ``` **Expected behavior** A clear and concise description of what you expected to happen. **Are you using NetBird Cloud?** Self-Hosted **NetBird version** `v0.64.5` **Is any other VPN software installed?** No. **Debug output** Not relevant. **Screenshots** Not relevant. **Additional context** Add any other context about the problem here. **Have you tried these troubleshooting steps?** - [X] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [X] Checked for newer NetBird versions - [X] Searched for similar issues on GitHub (including closed ones) - [X] Restarted the NetBird client - [X] Disabled other VPN software - [X] Checked firewall settings
saavagebueno added the triage-needed label 2026-08-05 01:24:59 -04:00
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10203