0.9.27 — rootless: per-user lease file path#185
Merged
Conversation
Twenty-eighth 0.9.x release. IP-lease file
(network-leases.txt) moves from single shared
/var/run/crate/ to per-user /var/run/crate/<uid>/ subtree
when crated's privops socket is detected.
lib/network_lease.cpp::effectivePath() — lazily resolves
the path on first use:
- g_pathOverridden (setPathForTesting): honour override
- privops socket detected: per-user
/var/run/crate/<uid>/network-leases.txt
- else: legacy /var/run/crate/network-leases.txt
All 7 call sites (openLocked, readAll, writeAllAtomic,
leasePath) replaced g_path with effectivePath(). Same path
cached for process lifetime.
Combined with 0.9.10 sub-CIDR allocator, alice's crate run
never reads or writes bob's leases. Two operators can both
run a jail named "web" simultaneously without IP collision.
Trade-offs:
- Path locked in at process start (cached after first
call). Acceptable for short-lived crate run.
- No auto-migration of existing legacy leases — operator
runs crate clean + crate run to rebuild per-user.
Suite: 1301 (unchanged — existing tests use setPathForTesting
override path).
Remaining: RCTL umbrella (0.9.28), default flip (0.9.29),
setuid removed (1.0.0).
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.
Summary
Twenty-eighth 0.9.x release. IP-lease file (
network-leases.txt) moves from a single shared/var/run/crate/location to a per-user/var/run/crate/<uid>/subtree when crated's privops socket is detected.What lands
lib/network_lease.cpp::effectivePath()— lazily resolves the path on first use:All 7 call sites (
openLocked,readAll,writeAllAtomic,leasePath) replacedg_pathreferences witheffectivePath(). Path cached for process lifetime.Behavior
/var/run/crate/network-leases.txt/var/run/crate/<uid>/network-leases.txtsetPathForTesting-supplied pathCombined with 0.9.10's sub-CIDR allocator, alice's
crate runnever reads or writes bob's leases. Two operators can run a jail namedwebsimultaneously without IP collision.Trade-offs
crate run.crate clean+crate runto rebuild per-user.Test plan
setPathForTestingoverride path)lib/network_lease.cppcompiles cleanlyNo new tests — the runtime path-detection is non-deterministic (depends on whether socket exists at test time); existing test infrastructure deliberately overrides via
setPathForTesting.Series state
CLI call-sites wired (12 in total):
crate retune,crate stop, fullcrate runchain (createJail / removeJail / ZFS attach+detach / nullfs mounts / vnet moveToVnet / setUp / disableOffload / bridge add+del / setInetAddr / createEpair)crate runlease file path → per-user under/var/run/crate/<uid>/← this PRRemaining:
loginclass:crate-<uid>:KEY:deny=...rules at jail-create time)rootless_per_user: truebecomes default incrated.conf.sample)Makefile installFiles
lib/network_lease.cpp—effectivePath()+ 7 call-site updatescli/args.cpp—crate 0.9.27CHANGELOG.md— entryGenerated by Claude Code