Skip to content

Share a host folder with a VM over NFS (key f); version 0.1.1 - #5

Merged
kasramp merged 25 commits into
mainfrom
folder-share
Nov 18, 2026
Merged

kasramp merged 25 commits into
mainfrom
folder-share

Conversation

@kasramp

@kasramp kasramp commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Share one host folder per VM over NFS, limited to that VM, kept correct across host reboots, with no doas on start/stop. Version 0.1.1.

What it does

  • Key f on a managed VM with Internet on: pick a folder (or Browse), Share / Stop sharing. The dialog shows the guest commands to mount it once or at every guest boot (Linux and OpenBSD).
  • Shared column (last, 30 wide, wraps) shows the shared folder.
  • One-time setup via doas, announced by a confirm that names every change: installs /etc/vmmanager/sync-exports (stdlib-only, root-owned), adds it to /etc/rc.local, enables portmap/mountd/nfsd and sets nfsd to -t -n 4 (TCP only). The daemons start after the first share has written its line (OpenBSD's rc.d refuses to start them while /etc/exports is empty).
  • Per-VM export: <folder> -mapall=<owner> 100.64.<id>.3 under a vmmanager marker. The sync script rewrites only vmmanager's marked lines, under a flock on /var/run/exports.lock shared with dockerctl, and runs at boot from rc.local because vmd re-assigns VM ids at boot.
  • pf: the vmmanager anchor blocks portmap and nfsd from anything outside 100.64.0.0/10, so the LAN can't reach the NFS services. Older installs are offered "Update the vmmanager pf rules?".
  • Health check: "Shared folders are out of date" with an "Update shares" fix (no root needed to detect).
  • Refuses /, empty input and characters that break exports(5) or the pasted guest commands.
  • Man page: new SHARED FOLDERS section (setup, guest mount one-off and permanent, boot window, the NFS limit below), FILES, HEALTH CHECK and UNINSTALL updated.

Known limit (documented, accepted)

The kernel exports a whole file system to an address, so root inside a guest could reach other files on the same file system with the owner's rights by crafting NFS file handles. Other VMs and the LAN still can't mount anything. The man page and the dialog say so and suggest a separate partition for untrusted VMs.

Testing

  • 219 unit tests, py_compile, mandoc -Tlint -Wwarning clean (run on OpenBSD 8.0).
  • Live on OpenBSD 8.0: setup, share with a Debian guest, one-off and @reboot mounts, host reboot (export follows the VM ids, daemons start, guest remounts), dockerctl's export and docker run -v unaffected, LAN ports 111/2049 closed, Stop sharing leaves only dockerctl's line.
  • Design: docs/superpowers/specs/2026-11-18-folder-share-design.md; plan: docs/superpowers/plans/2026-11-18-folder-share.md.

…stale per user; confirm texts; folder chars; man
@kasramp
kasramp merged commit 7d4e256 into main Nov 18, 2026
2 checks passed
@kasramp
kasramp deleted the folder-share branch November 18, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant