Repository navigation
Closed
Description
Blocker: no. Ship this in the same release as the monitoring agent (v0.2.0).
Part of the monitoring agent. It comes after #10 in the same stack.
Defect
- The agent changes its binary only when the control plane sends
agent.update, or when a person runsfly update. - Nothing examines the releases on a schedule. A server stays on its version until an admin sends an update batch.
- The checksum file comes from the same release as the binary. It shows that a download is complete. It does not show who made the release.
Cost
- A fix reaches a server only when a person does an action.
- A server that the control plane cannot update (for example, an agent that is too old for a new contract) stays old.
- If the agent installs each GitHub release without a second check, each person who can push a tag on
maincan put code on all servers.
Benefit of the fix
- Each server installs a new release by itself, one time each day, at its own time.
- The agent installs only a release that has a signature from a key outside GitHub. The signature is the approval step.
- The command path stays. It is the path for a fast update, and the recovery path if the key is lost or stolen.
Fix
- Add a signature file
checksums.txt.sigto each release. It has the key id, the tag, the time of the signature and an ed25519 signature. The signature covers these lines and the bytes ofchecksums.txt. - Add a tool that makes a key pair and signs a release. Add
make sign-release. The maintainer signs on their own computer. Do not put the private key in GitHub. - Put the public key in the binary.
- Each day, at the server slot (
server_id % 1440minutes after 00:00 UTC), get the latest release. - If the release is not newer, stop. The agent never goes back to an older version.
- Examine the signature. If there is no signature, or the signature is not correct, stop and write a log line.
- If the signature is less than 24 hours old, stop. In this time, the maintainer can mark a bad release as a pre-release.
- Install the release with the update code of enhancement: Run
agent.updateandagent.restartone time only #29, then exit. systemd starts the new binary. - Add the optional key
FLY_AGENT_AUTO_UPDATEin/etc/fly/agent.env. The valueoffstops the check on that server.
Caution
- Keep the private key in a password manager, with a copy offline. If you lose it, send a binary with a new key through
agent.update. - The control plane must update only the agents that are older than its target. Make this change before you sign the first release after v0.2.0.
Completion checks
- A release without a signature does not install by itself.
- A signature for a different tag, or with a different
checksums.txt, is refused. - A signed release installs only after 24 hours, at the server slot.
- The agent examines the releases one time each day, also when the report interval is long.
-
FLY_AGENT_AUTO_UPDATE=offstops the check. -
agent.updateoperates as before.
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(release): name the release key with a comment
fix(release): accept ~/ in the key path of release-key and sign-release
feat(release): trust the server-cli release key for flywp
feat(agent): conform to contract v0.3.0, with null for unknown update…
feat(agent): install signed releases by itself, one time each day (#40)
[-]Let the agent install signed releases on its own[/-][+]feature: Let the agent install signed releases on its own[/+]