Repository navigation
Conversation
Platform-team finding #15. Under rootless, management, signal and relay containers now set readOnlyRootFilesystem: true through a new backendContainer kind in netbird.securityContext. Like container, it is exempt from the OpenShift UID stripping, which applies to pod contexts. What each backend writes with chart defaults: - management: its data directory (already a PVC or emptyDir) and os.TempDir() for the geolocation download (os.MkdirTemp), so rootless management gets an emptyDir on /tmp. - signal and relay: nothing. A log file or Let's Encrypt data directory set to a path needs a volume through volumes/volumeMounts. The dashboard stays writable: its image rewrites the nginx config and html at start-up. Setting container.securityContext.readOnlyRootFilesystem to null removes the default, as for every other rootless key.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Platform-team finding #15. With
rootless: true, the management, signal and relay containers now run withreadOnlyRootFilesystem: true.Change
netbird.securityContext: adds abackendContainerkind. It renders thecontainerrootless defaults plusreadOnlyRootFilesystem: true. Likecontainer, it skips the OpenShift UID stripping, which only applies to pod contexts. The management, signal and relay deployments use it./tmp: whenrootlessis on, management gets anemptyDiron/tmpfor the geolocation download. Withrootlessoff, nothing changes.container.securityContext.readOnlyRootFilesystem: nullremoves the default, the same as for every other rootless key.values.yamlcomments and the "Pod security" section ofdocs/configuration.md.tests/render.shchecks that the default render has neither the flag nor/tmp, that the rootless example has 3 read-only containers and exactly one/tmpmount, and that thenulloverride works.What each backend writes (0.82.0)
Checked in the source (filesystem calls in
management,signal,relay,shared,encryptionandutil, v0.77.0 vs v0.82.0: the same set, with only refactors inutil/file.go). Also checked withdocker run --read-only --user 65532:65532 --cap-drop ALL --security-opt no-new-privileges, anddocker diffon a writable run. This coverednetbirdio/{management,signal,relay}:0.82.0and the netbird-eeghcr.io/netbirdio/{management,signal}-cloud:0.82.0-enterprise.1images:idp.db, geolocation databases) and toos.TempDir(). The GeoLite download unpacks intoos.MkdirTemp("/tmp", "geolite*"). On first start/tmppeaks at about 460 MB and is emptied once the databases reach the data directory.EnsureEncryptionKeywrites the config file only whendataStoreEncryptionKeyis empty, and the chart always sets one.--read-onlywith no errors.Caveats
--log-fileor the signal/relay Let's Encrypt data directory points at a path, that path needs a volume throughvolumes/volumeMounts. The other option is to setreadOnlyRootFilesystem: null./tmpemptyDirhas nosizeLimit, and the geolocation download briefly uses about 460 MB of it. A managementephemeral-storagelimit below that gets the pod evicted on first start.Compatibility
The default render (
rootless: false) is unchanged. Rootless installs gainreadOnlyRootFilesystem: trueon the three backends and a/tmpemptyDiron management. No chart version bump.Tested
On this branch, merged with current main (0.82.0, #69 and #70):
charts/netbird/tests/render.sh: pass.helm lint --strict charts/netbird --values charts/netbird/tests/values/secret-refs.yaml: pass.charts/netbird-ee/tests/render.sh: pass. netbird-ee withrootlesson for every component renders 3 read-only backends and/tmpon management, and passes a server-side dry run. TheNETBIRD_ENCRYPTION_KEY ... is a tablewarning also appears on main.examples/*/values.yamlrenders.examples/rootlessis an overlay, so it renders together with the required secrets.NB_E2E_ROOTLESS=true task chart:e2e(Kind, namespace enforcingrestricted, backends 0.74.0 upgraded to 0.82.0): PASS in 458.5s. It covered the dashboard, API and IdP through the ingress, a direct connection, an upgrade that keeps the peers, a relayed connection, and management keeping its peers across a restart.helm templatewithout values fails because the relay auth secret is required. This also happens on main and is not changed here.