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.go +20−13
| @@ -106,7 +106,7 @@ func harden(path string, dir bool) (bool, error) { | |||
| 106 | 106 | if err != nil { | |
| 107 | 107 | return false, fmt.Errorf("%s: %w", path, err) | |
| 108 | 108 | } | |
| 109 | if err := verifyACLFor(path, dir, t.all, t.user); err == nil { | ||
| 109 | if err := verifyACLFor(path, dir, t.all, []*windows.SID{t.user}); err == nil { | ||
| 110 | 110 | return false, nil | |
| 111 | 111 | } | |
| 112 | 112 | if err := setACLFor(path, dir, t.all); err != nil { | |
| @@ -115,7 +115,7 @@ func harden(path string, dir bool) (bool, error) { | |||
| 115 | 115 | // SetNamedSecurityInfo reports that the object stored a DACL, not that the | |
| 116 | 116 | // DACL is the one this package meant. An instance that cannot protect its | |
| 117 | 117 | // secrets must not go on to serve them, so the result is checked. | |
| 118 | if err := verifyACLFor(path, dir, t.all, t.user); err != nil { | ||
| 118 | if err := verifyACLFor(path, dir, t.all, []*windows.SID{t.user}); err != nil { | ||
| 119 | 119 | return false, fmt.Errorf("%s: access was rewritten but is still not restricted: %w", path, err) | |
| 120 | 120 | } | |
| 121 | 121 | return true, nil | |
| @@ -134,13 +134,17 @@ func HardenFor(path string, dir bool, sids []*windows.SID) error { | |||
| 134 | 134 | if len(sids) == 0 { | |
| 135 | 135 | return fmt.Errorf("%s: no account to grant access to", path) | |
| 136 | 136 | } | |
| 137 | if err := verifyACLFor(path, dir, sids, nil); err == nil { | ||
| 137 | // Every requested principal has to be present, not merely every present | ||
| 138 | // principal allowed: a list that already names SYSTEM and Administrators | ||
| 139 | // looks valid when the new account is simply missing, and the service then | ||
| 140 | // cannot read its own configuration. | ||
| 141 | if err := verifyACLFor(path, dir, sids, sids); err == nil { | ||
| 138 | 142 | return nil | |
| 139 | 143 | } | |
| 140 | 144 | if err := setACLFor(path, dir, sids); err != nil { | |
| 141 | 145 | return err | |
| 142 | 146 | } | |
| 143 | if err := verifyACLFor(path, dir, sids, nil); err != nil { | ||
| 147 | if err := verifyACLFor(path, dir, sids, sids); err != nil { | ||
| 144 | 148 | return fmt.Errorf("%s: access was rewritten but is still not restricted: %w", path, err) | |
| 145 | 149 | } | |
| 146 | 150 | return nil | |
| @@ -203,13 +207,14 @@ func VerifyACL(path string) error { | |||
| 203 | 207 | if err != nil { | |
| 204 | 208 | return err | |
| 205 | 209 | } | |
| 206 | return verifyACLFor(path, false, t.all, t.user) | ||
| 210 | return verifyACLFor(path, false, t.all, []*windows.SID{t.user}) | ||
| 207 | 211 | } | |
| 208 | 212 | ||
| 209 | 213 | // verifyACLFor is the check behind VerifyACL and HardenFor. requireProtected is | |
| 210 | // set for directories, and mustHave names a principal the list has to grant, or | ||
| 211 | // nil when the caller only cares that nothing untrusted is named. | ||
| 212 | func verifyACLFor(path string, requireProtected bool, allowed []*windows.SID, mustHave *windows.SID) error { | ||
| 214 | // set for directories; required names the principals the list has to grant, so | ||
| 215 | // an installer cannot mistake "nothing untrusted is named" for "the account that | ||
| 216 | // needs access has it". | ||
| 217 | func verifyACLFor(path string, requireProtected bool, allowed, required []*windows.SID) error { | ||
| 213 | 218 | sd, err := windows.GetNamedSecurityInfo(path, windows.SE_FILE_OBJECT, | |
| 214 | 219 | windows.OWNER_SECURITY_INFORMATION|windows.DACL_SECURITY_INFORMATION) | |
| 215 | 220 | if err != nil { | |
| @@ -238,7 +243,7 @@ func verifyACLFor(path string, requireProtected bool, allowed []*windows.SID, mu | |||
| 238 | 243 | if dacl == nil { | |
| 239 | 244 | return fmt.Errorf("%s has no access list, which grants everyone full control", path) | |
| 240 | 245 | } | |
| 241 | granted := mustHave == nil | ||
| 246 | var granted []*windows.SID | ||
| 242 | 247 | for i := 0; i < int(dacl.AceCount); i++ { | |
| 243 | 248 | var ace *windows.ACCESS_ALLOWED_ACE | |
| 244 | 249 | if err := windows.GetAce(dacl, uint32(i), &ace); err != nil { | |
| @@ -254,12 +259,14 @@ func verifyACLFor(path string, requireProtected bool, allowed []*windows.SID, mu | |||
| 254 | 259 | if mask := uint32(ace.Mask); mask&fileAllAccess != fileAllAccess { | |
| 255 | 260 | return fmt.Errorf("%s gives %s %#x, expected full control %#x", path, sidName(sid), mask, uint32(fileAllAccess)) | |
| 256 | 261 | } | |
| 257 | if mustHave != nil && mustHave.Equals(sid) { | ||
| 258 | granted = true | ||
| 262 | if includesSID(required, sid) { | ||
| 263 | granted = append(granted, sid) | ||
| 259 | 264 | } | |
| 260 | 265 | } | |
| 261 | if !granted { | ||
| 262 | return fmt.Errorf("%s does not grant %s access", path, sidName(mustHave)) | ||
| 266 | for _, sid := range required { | ||
| 267 | if !includesSID(granted, sid) { | ||
| 268 | return fmt.Errorf("%s does not grant %s access", path, sidName(sid)) | ||
| 269 | } | ||
| 263 | 270 | } | |
| 264 | 271 | return nil | |
| 265 | 272 | } | |