mirror of
https://github.com/jmcorgan/fips.git
synced 2026-10-05 11:08:25 +00:00
install-service.ps1 created C:\ProgramData\fips without setting an ACL, so it inherited C:\ProgramData's access: any local user could read the node's identity key there, and could create a fips.yaml, fips.key, hosts, peers.allow or peers.deny in the directory before one existed, for the service, running as LocalSystem, to read. The service log is written there too. The installer now builds an ACL that grants only SYSTEM and Administrators and does not inherit, and creates a new directory with that ACL already applied, using the .NET call each PowerShell edition provides. Created first and restricted afterwards, the empty directory would carry C:\ProgramData's access in between, and any local user could turn it into a junction in that time with no privilege and without changing its owner. An existing directory is refused if it is a link or junction or is owned by an account other than SYSTEM, Administrators or the installing administrator, since a user who created it could swap it for a link to another directory. Otherwise the installer makes Administrators the owner, refuses the directory if it has since become a link and any link or folder inside it, applies the ACL, and resets the owner and ACL of each existing file. That check runs before the ACL is applied, because applying it rewrites the inherited entries of everything below the directory, and runs again after it and after the reset. Every icacls call acts on a link rather than its target and has its exit code checked. Files created in the directory later, by the service or fipsctl keygen, take the same ACL. Well-known SIDs are used so the step works on non-English Windows. A user who created the directory keeps full control of it through the entry C:\ProgramData's CREATOR OWNER grant leaves for their account, and taking ownership changes only the owner. So each refusal tells the operator to copy out anything needed and delete the directory, taking ownership only if that is what it takes to delete it, and an icacls failure says to delete the directory or the file, or simply retry if the file has gone. Packaging tests check the order of these steps and that they come before any path inside the directory is touched; that the ACL is built with both SIDs and both inheritance flags and passed to the directory's creation; the refusal conditions themselves (the owner test, the directory link test at the start and in each recheck, and a link or folder entry each refused on its own); that every icacls call acts on links and is checked; and that takeown is never offered as the recovery. The README and the fips reference say that reading the directory now needs an elevated prompt (an unelevated foreground run may skip the config there or fail with an access error), that the installer should run before fipsctl keygen, and that it should run again after files are moved into the directory, since a moved file keeps its old permissions.
Reference
Information-oriented technical descriptions for lookup on demand. Reference content describes what is: wire formats, configuration keys, command-line flags, control-socket commands, default values, file paths, exit codes. It is consulted, not read end-to-end.
Reference is austere by design: minimal narrative, no opinions, no guidance on when to use a feature. The "why" lives in design/; the "how do I accomplish X" lives in how-to/.
Available Reference
| Document | Scope |
|---|---|
| wire-formats.md | All FMP and FSP message byte layouts, encapsulation walkthrough |
| configuration.md | Full YAML configuration reference for the daemon and gateway |
| security.md | nftables baseline, peer ACL, cryptographic primitives, rekey defaults, threat-resistance matrix |
| nostr-events.md | Kind 37195 advert, Kind 21059 traversal signaling, Kind 10050 inbox relays |
| transports.md | Per-transport statistics counter inventory |
| control-socket.md | Line-delimited JSON control protocol for the daemon and gateway |
| native-api.md | Native datagram API: the Rust surface, addressing and ports, errno table, ceilings, line protocol, command reference |
| cli-fips.md | fips daemon CLI: options, exit codes, environment, files |
| cli-fipsctl.md | fipsctl control-client: subcommands, options, exit codes |
| cli-fipstop.md | fipstop live-status TUI: tabs, keybindings |
| cli-fips-gateway.md | fips-gateway service CLI: options, exit codes, files |