Repository navigation
fix(mpi): --efa installs a pinned, sha256-checked EFA installer, signature-verified at pin time and release; refuses AL2 (#1505, #1504) - #1508
Merged
Conversation
Contributor
Author
|
Supply-chain pins independently verified (2026-11-02).
|
scttfrdmn
force-pushed
the
fix/1505-efa-installer-pin
branch
from
November 2, 2026 20:58
adb017b to
ef1ab65
Compare
Contributor
Author
Live re-test at
|
scttfrdmn
force-pushed
the
fix/1505-efa-installer-pin
branch
from
November 2, 2026 21:22
ef1ab65 to
37fbb13
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…er scripts/efapin, allowlist the EFA key fingerprint
GNU tar execs gzip for -z; the sandbox's restricted PATH had none, so the EFA sandbox tests failed on CI's Ubuntu runner while passing on macOS, whose bsdtar decompresses in-process.
scttfrdmn
force-pushed
the
fix/1505-efa-installer-pin
branch
from
November 2, 2026 21:47
af991ef to
01cdf44
Compare
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.
Fixes #1505
Fixes #1504
Stacked on #1506. This branch carries #1506's two commits, rebased onto main (
4cf785e6,a976d823). Both PRs change the same EFA block inpkg/userdata/mpi.go, and #1506's behaviour is kept: with--efathe job uses the installer's/opt/amazon/openmpi, and the run fails closed if that is missing. Merge #1506 first, then rebase this branch, which drops those two commits. Do not merge #1506 with--delete-branchwhile this PR targets main. It doesn't need to: it targets main.What
--efaused to downloadaws-efa-installer-latest.tar.gzand runefa_installer.shas root with no integrity check, and it left the tarball in/tmp. Now:Pin (
pkg/userdata/efa.go, the one Go source of truth).efaInstallerVersion = "1.51.0"(current latest;latesthas the same ETag) andefaInstallerSHA256 = "83993044…2465c".User data (the EFA block in
mpi.go)./etc/os-releaseID=amzn,VERSION_ID=2), refuse before downloading anything (--efa on an Amazon Linux 2 --ami fails: the EFA installer dropped AL2 in 1.50.0 and spawn fetches aws-efa-installer-latest #1504)./tmp/spawn-efa, tryhttps://spawn-binaries-<region>.s3.<region>.amazonaws.com/spawn/efa/aws-efa-installer-1.51.0.tar.gzfirst (only insporedinstall.PublishedRegions()), thenhttps://efa-installer.amazonaws.com/aws-efa-installer-1.51.0.tar.gz. Each source's bytes must have the pinned sha256 before anything is unpacked../efa_installer.sh -y -g.rm -rf /tmp/spawn-efa, whether the installer succeeds or fails.Every failure goes through the --mpi on an AL2 --ami dies at the jq hostfile step (jq not installed); no SPAWN_COMPLETE, so the cohort bills until TTL #1483 trap: an
mpi-bootstraprecord plus a reason in/var/log/spawn-command.log. No sha256 match at all givesspawn: no EFA installer 1.51.0 with the pinned sha256.Signature, at pin time and at release, never on the instance (as bootstrap: nothing moves the pinned AWS CLI version/sha256 the Linux bootstrap installs #1495/fix(bootstrap): install the pinned AWS CLI from the regional spawn-binaries mirror first (#1494) #1503 do for the AWS CLI).
scripts/efa-pin.shimportsscripts/efapin/aws-efa-installer.keyinto a throwaway GNUPGHOME. It requires exactly one primary key,4E9091BCBB97A96B26B15E59A05480B1DD2D3CCC, and fails if that key ever gets an expiry within 60 days. It downloads the tarball and its.sig, requires a gpgVALIDSIGwhose primary fingerprint is the pinned one, and only then hashes the tarball.verify: a new release step, "Verify the pinned EFA installer". It runs right after the release version guard, before any AWS credentials or GoReleaser, needs no credentials, and requires the pinned sha256.bump [--version V]: the newest1.N.Nin AWS's EFA release-notes table. It skips a version whose tarball is not published yet. Otherwise it rewrites the two constants via go/parser and adds a CHANGELOG entry.Bump automation.
.github/workflows/efa-pin.ymlis a weekly sibling ofawscli-pin.yml: GITHUB_TOKEN only,contents/pull-requests/issues: writeon its one job. It opens a PR, or, only on GitHub's "not permitted to create or approve pull requests", it opens or updates an issue "EFA installer pin bump available: → " with the compare link.Shared code.
scripts/internal/pinkitholds the go/parser const rewrite, the CHANGELOG Unreleased/Changed insertion, the PR-refusal match, and the PGP v4 fingerprint (pgp.gomoved fromscripts/awsclipin, unchanged).scripts/awsclipinnow calls it; its behaviour and its tests are unchanged and pass.Key
4E90 91BC BB97 A96B 26B1 5E59 A054 80B1 DD2D 3CCC, "Amazon EC2 EFA [email protected]", RSA 2048, created 2020-07-29, no expiry.facb124c…9d0f904d).VALIDSIGverified for 1.51.0 (signed 2026-10-22) and 1.49.0.scripts/efa-pin.sh verifypassed against the real origin. A realbumpfrom a temporary 1.49.0 pin moved it to 1.51.0 with the same sha256, and I reverted that edit..gitleaks.tomlallowlists the two fingerprint lines by exact line and value, as feat(ci): weekly workflow moves the bootstrap's pinned AWS CLI by PR (#1495) #1501 did. gitleaks finds 2 leaks without them and 0 with them.AL2 decision (#1504)
I chose to refuse, not pin 1.49.0 for AL2. One pin, one key, one bump. The installer itself already exits 1 on AL2, but only after a 591 MiB download, and its message lands only in cloud-init's log. The check runs at the instance because spawn does not know the OS of an arbitrary
--amiat launch. I checked the condition against the real/etc/os-releasein amazonlinux:2 (refused) and ubuntu:24.04 and 22.04 (allowed). AL2023'sVERSION_IDis2023.Mirror: instance side here, release publishing is follow-up #1507 (needs IAM)
The user data already tries
spawn/efa/first and sha-checks it. Nothing publishes it yet, so today that fetch fails fast (an anonymous GET of a missing key returns 403, and curl does not retry 4xx), and the origin serves the tarball.--no-public-ipwith--efatherefore still needs NAT, andnoPublicIPInternetNeedsis unchanged. Publishing needs a prefix the release role does not have, so I stopped there. The exact policy is in #1507:s3:PutObject,s3:DeleteObjectonarn:aws:s3:::spawn-binaries-*/spawn/efa/*s3:ListBucketonarn:aws:s3:::spawn-binaries-*withStringLikes3:prefixspawn/efa/*s3:GetObjectunderspawn/efa/in each bucket policy (not checked)It also builds on #1503 (still open). Cost: 591 MiB × 11 regions ≈ 6.5 GiB per version.
IAM in this PR: none. The verify step has no credentials, and the weekly workflow uses GITHUB_TOKEN only.
Sizes
--mpi-command,--efa: 9381 → 10200 bytes raw, 4074 → 4381 gzipped (+307).--efa: unchanged, 9210 / 3989.encodeUserData), so it stays well under 16 KiB.pkg/launcheris untouched, so the published bootstrap body does not change and no orchestrator redeploy is needed for this.Gates (every revert below kept
go vetclean, and the named gate ran and failed)TestEFAInstallerNotThePinnedOneIsNeverUnpackedOrRun(4 cases: tampered at both sources, tampered at origin with no mirror, truncated, served nowhere)an EFA installer ran from a tarball that is not the pinned one: "TAMPERED"TestEFAMirrorIsTriedFirstAndStillSHAChecked(mirror has it / lacks it / altered / unpublished region)fetched [origin], want [mirror …]TAMPEREDran;rank 0 exited 1TestEFAInstallerLeavesNothingInTmp(success, and an installer exiting 3)rm -rf /tmp/spawn-efadroppedleft under /tmp …: ["/tmp/spawn-efa" "/tmp/spawn-efa/aws-efa-installer"]TestEFARefusedOnAmazonLinux2if false && (…)rank 0 exited 0, want 1, fetched both URLs, the installer ranTestEFAPinIsTheGoSourceOfTruthcomparisons … = 0000…, want … 8399…-lateststill names … aws-efa-installer-latestTestVerifyRefusesAnythingButThePinnedSignedTarball(efa-pin.sh, real gpg, throwaway keys, file:// origin)verify exited 0, want success=falseverify exited 0verify exited 0(key file holds a second key)TestVerifyRequiresThePinnedSigner(rule 2: the key-count check is disabled in the sandbox copy)&& $NF == fprdroppeda tarball signed by a key other than the pinned one verifiedTestBumpPinsOnlyASignedNewerTarballbump succeeded,efapin set ran for a tarball that is not validly signedTestPinScriptPinsTheSameFingerprintEFA_KEY_FPRpins …3CCD, want … 3CCCTestCommittedKeyIsAWSsEFAInstallerKey(fingerprint computed from the key file, against the value written out from AWS's page)KeyFingerprintdigit changedKeyFingerprint = …3CCDTestPinConstantsExistInEFAGo/TestBumpCoversEveryEFAPin(discovers pins in pkg/userdata)no const efaInstallerSHA256/looks like an EFA installer pin the bump does not moveTestReleaseVerifiesThePinnedEFAInstallerFirstecho …)0 steps run scripts/efa-pin.sh verifycontinue-on-error: truemust always run and fail the releaseEFA verify is step 11, GoReleaser 10, and after the AWS credentials step 5TestEFAPinWorkflowRunsTheBumpWithOnlyPRPermissionspr-refusedopens an issue without first checking efapin pr-refusedactions: writepermissions = …, want exactly …The sandbox tests run the whole rendered member scripts, rank 0 plus 2 peers, with real
tarandsha256sumon real gzipped tarballs. Only curl's bytes are stand-ins, and the pinned sha is swapped for the stand-in's throughefaPinnedSHA256, whichTestEFAPinIsTheGoSourceOfTruthholds to the constant. #1506's three gates pass unchanged in intent; their stubs now serve a real tarball instead of fakingtar.Checks
These pass:
make check, from /private/tmp.make lint: 0 issues in all modules.semgrep scan --config=auto --error .: 0 findings.actionlint: only the existingci.yml:98SC2001, which is also on main.shellcheck scripts/efa-pin.shgo build .No help text changed. There were no AWS calls.
Live check (2-node EFA pair, branch-built CLI)
GOTOOLCHAIN=go1.27.3 go build -o ~/.xtmp/spawn-1505 .from this branch. A dev build inlines the bootstrap, so no published body is involved.--mpi --efacohort on an EFA-capable type (e.g.c5n.18xlarge/hpc7g), default AL2023 AMI, with a TTL and--on-complete terminate. Use--mpi-command 'fi_info -p efa && mpirun … hostname'or an osuosu_latencyif available./var/log/spawn-command.logand cloud-init output showInstalling EFA installer 1.51.0....us-east-1, the mirror fetch failed (403) and the origin served it. Expect nosha256 mismatchline for the origin.ls /tmp/spawn-efa /tmp/aws-efa-installer* 2>&1: absent./opt/amazon/openmpi/bin/mpirunexists and is the one on PATH (fix(mpi): --efa runs the EFA installer's Open MPI under /opt/amazon/openmpi (#1491) #1506).fi_info -p efalists the device.completedfrommpi.--amiwith--efashould install normally. An AL2--amiwith--efashould fail fast withspawn: --efa needs AL2023 or Ubuntu…and anmpi-bootstraprecord, with no download in the log.