Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

#404

Build for Windows: cross-compile windows/amd64, and name the platform seams

closed · opened by keenan 2d ago

keenan opened this 2d ago

Build-only Windows port: cross-compile windows/amd64, and name the platform seams

What

vole serve runs on Linux and macOS. There is no Windows build: at d1c3b32, GOOS=windows GOARCH=amd64 go build ./... stops with five type errors in two files, and a handful of other call sites are unix-only but hidden behind the first failure. Nobody can answer “does the server work on Windows?” without a build to run.

This issue is the first milestone: make the tree build and type-check for windows/amd64, put every unix assumption behind a platform file, and fail loudly where a security control cannot yet be honoured. It does not claim the server runs on Windows.

Current state

Compile blockers, in dependency order:

Where What
internal/storage/storage.go:88,115 syscall.Stat_t for allocated-block accounting and hard-link dedupe
internal/storage/storage.go:150,151 syscall.Statfs_t, syscall.Statfs for disk totals
internal/audit/audit.go:193 syscall.Stat_t uid against os.Geteuid()
ci/agent/disk.go:18,19 syscall.Statfs for the runner’s free-space guard
ci/agent/gitcache.go:63,68,81,86 syscall.Flock/LOCK_* with no !unix fallback, unlike core/git and ci/cache
ci/agent/sandbox.go:155 syscall.Kill(pid, 0) liveness probe
ci/agent/agent.go:1807,1833 SysProcAttr{Setpgid:true} and syscall.Kill(-pid, SIGKILL) for the command process group
server/integration_test.go:3356 syscall.Kill(-pid, SIGKILL) in the runner test’s cleanup

Runtime assumptions that compile but do not hold:

  • internal/secure/secure.go is file modes as a security control: Chmod(0600) only toggles FILE_ATTRIBUTE_READONLY on Windows, and os.Stat reports 0666 for any writable file, so today’s HardenFile would both make secrets read-only and never verify anything.
  • internal/audit/audit.go requires the audit log to be owned by the process uid and mode 0600; Windows needs an owner SID and a DACL check instead.
  • cmd/vole/ssh.go:254 syscall.Exec exists on Windows but returns EWINDOWS, so vole ssh-shell — the sshd front-door forced command — cannot work there.
  • ci/agent kills a process group; Windows needs a Job Object to reach grandchildren.
  • internal/secure/umask_other.go, core/git/lock_other.go and ci/cache/lock_other.go already degrade on non-unix: no umask, and locks that serialize only inside one process. ci/agent/gitcache.go has no such fallback.
  • internal/sshdconfig and vole ssh-config --platform know linux and darwin only.

Verified with GOOS=windows GOARCH=amd64 go build ./..., go build -gcflags=-e per package, and a throwaway worktree that stubbed the two first failures: with those stubbed, the tree builds and go vet reports only the test cleanup.

Hosting note

DigitalOcean cannot test this: its public image catalog has no Windows entry at all (the API lists AlmaLinux, CentOS, Debian, Fedora, Rocky Linux and Ubuntu; no windows-* slug), and it offers no Windows licensing or cloudbase-init. Milestone 2 needs AWS, Azure, or a local QEMU/Hyper-V VM with an eval image. deploy/cloud-init/vole.yaml is Linux cloud-init and does not apply.

Scope of this issue

  1. Split each unix-only file into *_unix.go, *_windows.go, and — where a non-target platform should still build — a *_other.go fallback, matching the existing umask_* and lock_* pairs.
  2. Implement the Windows side where it is cheap and safe: disk totals through GetDiskFreeSpaceEx, hard-link identity through GetFileInformationByHandle, LockFileEx/UnlockFileEx for the runner cache locks, an OpenProcess+GetExitCodeProcess liveness probe, and free space for the runner’s guard.
  3. Return an explicit error from the Windows security paths (internal/secure tightening, internal/audit ownership) rather than skipping the check or silently applying unix mode bits. A Windows build must refuse to serve before it can weaken a control; ACL hardening is milestone 2.
  4. Replace the front door’s syscall.Exec with a platform helper so Windows reports that the forced-command path is unavailable instead of returning a bare EWINDOWS.
  5. Move the runner test’s process-tree cleanup behind a test helper.
  6. Gate it in CI: cross-compile windows/amd64 and run GOOS=windows go vet ./... (which type-checks test files) beside the existing macOS binaries step.

golang.org/x/sys moves from indirect to direct for the Windows files. It is already in the module graph at v0.49.0 and its BSD-3-Clause license is already listed in licenses.toml.

Acceptance criteria

  • GOOS=windows GOARCH=amd64 go build ./... and GOOS=windows GOARCH=amd64 go vet ./... pass, locally and in verify.
  • gofmt -l . is empty; go build ./..., go vet ./... and go test ./... are unchanged on linux/darwin.
  • No unix security behaviour changes: internal/secure and internal/audit keep their current checks, messages and tests.
  • Every unix-only site above is either implemented for Windows or answers with an error that says what is missing and why it is not silently skipped.
  • vole workflow check passes.

Out of scope

  • Running vole serve on Windows: ACL-backed internal/secure hardening, SID ownership in internal/audit, CreateProcess-based front-door handoff, Job Objects for runner commands, Windows OpenSSH drop-in in internal/sshdconfig.
  • Packaging, service management, and deployment: no MSI/zip, no Windows service unit, no cloud-init equivalent.
  • CI at all beyond type-checking: no Windows runner in the verify image.

Comments (1)

keenan 2d ago

Milestone 1 smoke test on real Windows, and one new finding

The guest is up: Windows Server 2022 Standard Evaluation, Server Core (installation type Server Core, 10.0.20348), running under Docker with KVM (dockur/windows), 3 GB RAM / 4 vCPU / 40 GB disk. It is a local, throwaway machine on the host’s loopback SSH port; evaluation limit is 180 days.

What it proved about the merged build (0.2.0-devel+215f8aebc38e):

  • vole.exe version and vole.exe help work from a cross-compiled windows/amd64 binary; no unix-only code was reached on the way in.
  • vole serve refuses at the guard this issue added, with the sentence it was written to say: data directory C:\Users\keenan\forge\data: cannot remove world access from a secret directory on windows: the permission check has no equivalent there yet.

New finding for milestone 2, found before the guard could run:

  • ssh_socket defaults to /run/vole/ssh.sock, and configuration validation requires an absolute path. On Windows the default fails as ssh_socket must be an absolute path, got "/run/vole/ssh.sock", so milestone 2 needs a per-platform default (%ProgramData%\vole\ssh.sock or a named pipe) and a decision on whether a unix-domain socket is used for the front door at all. Filesystem paths elsewhere in the configuration will want the same audit.

Milestone 2 work, in the order the guest will exercise it:

  1. internal/secure: ACL hardening. Remove inheritance and grant the current user (and SYSTEM/Administrators where the service runs as one) full control, nothing else, then verify the DACL on the next open. Until the verification exists, the refusal stays.
  2. internal/audit: owner SID against the process token, replacing the uid check, and an ACL check replacing the 0600 check.
  3. Paths and defaults: ssh_socket, the /var/lib/vole-shaped defaults, and any other POSIX absolute path in forge/config.
  4. CI runner: Job Objects for newProcessGroup/killProcessGroup, and Process.Signal(SIGTERM) returning EWINDOWS for graceful stop.
  5. internal/sshdconfig and vole ssh-config --platform: a Windows OpenSSH drop-in, if the front-door arrangement is wanted on Windows.