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.

Package Windows: an MSI built with wixl, and install.ps1

31560d91c4e27f3fdee2652aa3b4b12b8343903d · Keenan Nemetz · 2d ago · parent 9cbfa891

Package Windows: an MSI built with wixl, and install.ps1

The Windows server installs from an MSI now, with install.ps1 on the channel as
the one-command path, the same shape as the Linux installer.

The MSI is built by wixl (msitools), not the WiX toolset. WiX v5 and v6 refuse to
build outside Windows: every relative path is canonicalized against a hardcoded
C:\ and the first Directory is rejected, so it cannot run in the release image. I
tested both before choosing; wixl 0.101 is what Debian bookworm ships and it
produces a package that installs, upgrades, and uninstalls on the Server Core
guest. Its limits shaped the design and are recorded in the .wxs header: it
silently drops Component/@Permanent and @NeverOverwrite, cannot edit PATH, and
cannot schedule rollback actions, so the configuration and the data directory
belong to `vole service install` and not to the package.

That moved two things into the CLI. `service install` now writes a documented
default configuration to %ProgramData%\Vole\vole.toml when it is given none, and
initializes the instance database and repository like the Linux post-install
step, so the package's only action is the binary registering itself. The same
command serves a hand install and a pre-release, which has no MSI.

The MSI's upgrade table is written by hand because wixl's MajorUpgrade schedules
RemoveExistingProducts in the window Windows Installer rejects (error 2613).
RemoveExistingProducts is placed at 1501, the service's stop-and-remove at 3400,
and install-and-start after InstallFiles, so an upgrade removes the old product
before the new files land and the running executable is never locked.

Fixed along the way, found by installing the MSI: secure.HardenFor accepted an
access list that was a subset of what it was asked to grant, so a configuration
written by SYSTEM looked correct and never got the service account's entry; the
service then could not read it and failed to start. HardenFor now requires every
requested principal to be present, with a Windows test for the subset case.

Release and verify wiring: both images gain wixl and msitools, verify builds the
MSI and reads its tables back (wixl exits 0 when a source is missing), and the
release builds the Windows binary and, for a stable tag, the MSI, and publishes
install.ps1 beside install.sh. A pre-release tag has no MSI: ProductVersion
cannot carry a pre-release suffix and wixl cannot express the same-version
upgrade, so those releases ship the binary and install.ps1 says so.

Docs: install.md gains the Windows method, packaging.md the Windows package and
its limits, deploying windows.md the packaged flow (install, configure, first
admin, firewall, upgrade, binary fallback, troubleshooting), and RELEASING.md
the Windows sign-off a Linux runner cannot perform.

Verified on the Server Core 2022 guest: MSI install starts the service and serves
HTTP 200, with the config created at the documented default and the data kept;
0.2.1 upgrades over 0.2.0 with one Programs-and-Features entry and the service
running; uninstall removes the service and the binary and leaves the config,
data, and a marker file; install.ps1 installs from a local mirror after checking
SHA256SUMS; reinstall and uninstall are repeatable. Windows unit tests pass
there, and `vole workflow run verify` passes locally including the new package
step.

Part of 01M8SE6GWX1DGYPY6H9YC142C2.

internal/secure/acl_windows_test.go +36−1

@@ -111,7 +111,7 @@ func TestHardenDirProtectsFilesCreatedInside(t *testing.T) {
111 111 if err != nil {
112 112 t.Fatal(err)
113 113 }
114 if err := verifyACLFor(dir, true, trusted.all, trusted.user); err != nil {
114 if err := verifyACLFor(dir, true, trusted.all, []*windows.SID{trusted.user}); err != nil {
115 115 t.Fatalf("the directory still inherits: %v", err)
116 116 }
117 117
@@ -130,6 +130,41 @@ func TestHardenDirProtectsFilesCreatedInside(t *testing.T) {
130 130 }
131 131 }
132 132
133 // TestHardenForAddsEveryRequestedPrincipal is the case that caught a real bug:
134 // a list naming SYSTEM and Administrators is a subset of the list the installer
135 // wants, so a "nothing untrusted" check passed while the account that had to read
136 // the file was missing from it.
137 func TestHardenForAddsEveryRequestedPrincipal(t *testing.T) {
138 path := filepath.Join(t.TempDir(), "vole.toml")
139 if err := os.WriteFile(path, []byte("data_dir = 'C:\\data'\n"), 0o600); err != nil {
140 t.Fatal(err)
141 }
142 system, err := windows.CreateWellKnownSid(windows.WinLocalSystemSid)
143 if err != nil {
144 t.Fatal(err)
145 }
146 administrators, err := windows.CreateWellKnownSid(windows.WinBuiltinAdministratorsSid)
147 if err != nil {
148 t.Fatal(err)
149 }
150 users, err := windows.CreateWellKnownSid(windows.WinBuiltinUsersSid)
151 if err != nil {
152 t.Fatal(err)
153 }
154
155 // Start from the half the package installer would write first.
156 if err := HardenFor(path, false, []*windows.SID{system, administrators}); err != nil {
157 t.Fatal(err)
158 }
159 // Then ask for one more principal, as a service install does for its account.
160 if err := HardenFor(path, false, []*windows.SID{system, administrators, users}); err != nil {
161 t.Fatal(err)
162 }
163 if err := verifyACLFor(path, false, []*windows.SID{system, administrators, users}, []*windows.SID{users}); err != nil {
164 t.Fatalf("the requested principal was not added: %v", err)
165 }
166 }
167
133 168 // TestVerifyACLRejectsAnotherAccount checks the half a DACL rewrite cannot fix:
134 169 // a secret owned by an account that has no business holding one is refused rather
135 170 // than accepted as somebody else's problem.