Repository navigation
fix: spored installs and runs on EL8 and SELinux-enforcing AMIs (#1052, #1056) - #1174
Merged
Merged
Conversation
#1056) EL8 (#1056): the shared installer used curl --retry-all-errors (curl 7.71+); EL8's curl 7.61.1 exits 2 on it, every download "failed", and the bootstrap aborted with no spored, so no TTL or cost limit. Retries now go through a portable spore_curl_retry loop with the same semantics (#462), which stops on a usage error and shows curl's stderr on the final attempt. SELinux (#1052): spored was renamed into place from /tmp, keeping cloud-init's cloud_init_tmp_t label, which systemd cannot exec on an enforcing host. The installer now runs restorecon on the binary after the rename, and every script that writes the spored unit, plus the upgrade rollback, relabels too. It is a no-op without SELinux. Gates: internal/curlcompat parses curl 7.61.1's real --help (captured from rockylinux:8). Every curl command in the module's Go source and in every rendered Linux script is checked against it. The installer runs under a fake 7.61.1 curl, survives empty-reply drops on every fetch, and is checked for the relabel with a fake restorecon. Each gate was watched failing against a compiling revert. Fixes #1052 Fixes #1056
scttfrdmn
force-pushed
the
fix/1052-1056-spored-install-el
branch
from
October 19, 2026 04:39
889f755 to
0b8cf18
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs that stopped spored from starting on Enterprise Linux. Each one left the instance running with no TTL, no cost limit and no
--on-complete, so it billed until someone terminated it by hand.Fixes #1052
Fixes #1056
#1056: EL8 (Rocky/RHEL 8), curl 7.61.1
Cause. All four downloads in the shared installer (
pkg/sporedinstall) usedcurl ... --retry-all-errors. That flag was added in curl 7.71 (#462 added it so that a transientEmpty reply from serverwould be retried). EL8 ships curl 7.61.1, which exits 2 on the unknown option. The installer hid curl's stderr, so every source was reported asFailed to download ... from any source, and the bootstrap aborted.Fix. A
spore_curl_retry <retries> <delay> <curl args...>shell function now does the retrying. It makes up to retries+1 attempts, sleeps a fixed delay between them, and retries on any error, which is the semantics of--retry N --retry-delay D --retry-all-errors. The call sites keep the same numbers as before: 3/1 for the.sigHEAD probe, 5/2 for the binary,.sha256and.sig. Two changes:Plain
curl --retrywithout--retry-all-errorswas not an option. It does not retry exit 52, and the new transient-failure test fails against it (see below).#1052: SELinux enforcing (Rocky 9)
Cause. The binary is downloaded to
mktemp /tmp/spored.XXXXXX, which cloud-init labelscloud_init_tmp_t, and thenmv'd into/usr/local/bin.mvkeeps the source's label, and systemd (init_t) cannot exec acloud_init_tmp_tfile. The result wasstatus=203/EXECon every restart.Fix. A
spore_selinux_relabel <path...>function runsrestorecon -Fvwhenrestoreconexists andselinuxenableddoes not say no. It warns rather than failing, because the binary is already verified and in place. It is called:/usr/local/bin/spored;/etc/systemd/system/spored.service, beforesystemctl start: the boot bootstrap and both app user-data cores;spawn upgrade-sporedrollback, which also renames a/tmpbackup into place.The install still uses rename + relabel rather than
install -m 0755. The rename is atomic, so it cannot hit ETXTBSY (#27) and there is never a moment with no binary, or a partial one, at the destination. GNUinstallunlinks the old file and then writes the new one in place.Hosts without
restorecon(Ubuntu), or with SELinux disabled, are unaffected. On AL2023 (SELinux permissive) restorecon runs and sets the defaultbin_tlabel, which does no harm.Gates
Per CLAUDE.md "Writing a gate". Each one was watched failing against a revert that compiles.
internal/curlcompat(new)curl --helpofrockylinux:8(committed, embedded), not written from memory. A test pins known members and known newer options so a broken parse can't pass vacuously.cmd/TestNoCurlOptionNewerThanEL8.gofile in the module, nestedlambda/modules included, found by walking the tree, and (b) all 7 rendered Linux scripts uses only 7.61.1 options. Fails if it finds fewer than 20 invocations, or any rendered script has none.curl ... --retry-all-errorsline restored: fails in the source sweep and in all 7 rendered scripts.--retry-all-errorspassed through the wrapper (only visible after Sprintf): fails in the rendered sweep.pkg/sporedinstall/TestInstallsWithEL8CurlTestEL8CurlShimRejectsANewerOptionchecks that the fake actually rejects a newer option.pkg/sporedinstall/TestRetriesATransientEmptyReplyOnEveryFetch.sha256,.sigHEAD and.sigGET; the install must still succeed (#462 kept).curl --retry N --retry-delay Dwithout--retry-all-errors: fails, so plain--retrydoes not cover this.pkg/sporedinstall/TestRelabelsTheInstalledBinaryForSELinuxrestoreconrecords its arguments and whether the target was already installed. Four cases: enforcing (-Fv <dest>after install), SELinux disabled (not called), restorecon failing (install exit 0 with a WARNING), no restorecon (no-op).cmd/TestEveryScriptRelabelsSporedForSELinuxspore_selinux_relabel /etc/systemd/system/spored.serviceafter the heredoc and beforesystemctl start spored. The upgrade rollback line relabels.systemctl start; rollback relabel removed. Each fails.pkg/launcher's existing #462 retry assertions now match the wrapper calls instead of the flag string.Validation
rockylinux:8(curl 7.61.1, openssl installed for the signature step) androckylinux:9(curl 7.76.1), usingfile://sources and a throwaway P-256 key. On both: a missing source is skipped, the checksum and signature are verified, the binary is installed and runs. On EL8,spore_curl_retry 3 1 --retry-all-errors ...printscurl: option --retry-all-errors: is unknownand returns 2, which shows the final-attempt stderr is visible. Onrockylinux:9with policycoreutils installed,selinuxenabledreturns 1 inside the container and the install is the expected no-op.-S warning): clean on all 7 rendered scripts. The standalone installer is clean at every severity.restorecon -Fgivesbin_t) come from the issue's on-instance evidence and the sclero workaround, which uses the same command.Found while doing this and filed as #1173: the pipeline-orchestrator Lambda installs spored with its own inline curl, sha256 only, and the verified-installer gate does not walk
lambda/.