Skip to content

awscli2: make the vendored botocore prefer the system CA bundle - #576582

Merged
nixpkgs-ci[bot] merged 1 commit into
NixOS:masterfrom
zimbatm:cacert-awscli2
Oct 21, 2026
Merged

nixpkgs-ci[bot] merged 1 commit into
NixOS:masterfrom
zimbatm:cacert-awscli2

Conversation

@zimbatm

@zimbatm zimbatm commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

awscli2 uses its own copy of botocore (awscli/botocore), not python3Packages.botocore. It copies the cacert bundle into awscli/botocore/cacert.pem at build time. It ignores NIX_SSL_CERT_FILE, SSL_CERT_FILE and the system store at run time.

Override where() in awscli/botocore/httpsession.py so that get_cert_path() returns NIX_SSL_CERT_FILE, SSL_CERT_FILE, /etc/ssl/certs/ca-certificates.crt or /etc/ssl/cert.pem when one exists. The previous behaviour stays as the fallback. AWS_CA_BUNDLE and the ca_bundle setting still take precedence.

The S3 CRT transfer client still uses DEFAULT_CA_BUNDLE (the cacert copy), because awscrt cannot read the "TRUSTED CERTIFICATE" blocks in ca-bundle.crt.

Tested on x86_64-linux with aws sts get-caller-identity --region us-east-1 and a boto3 script, using fake AKIA…EXAMPLE keys so the request reaches STS: with SSL_CERT_FILE (or NIX_SSL_CERT_FILE) holding one unrelated root, the old build still completes TLS and gets InvalidClientTokenId; the new build fails with CERTIFICATE_VERIFY_FAILED. With the system bundle, with no variable set (falls back to /etc/ssl), or with AWS_CA_BUNDLE, the new build gets InvalidClientTokenId as expected. nixpkgs already links the vendored cacert.pem to cacert at build time; the problem was that botocore never consulted the runtime CA variables. The S3 CRT client still reads the build-time copy, because awscrt cannot parse TRUSTED CERTIFICATE blocks.

Related to: #576485
Related to: #576541

Assisted-by: Claude Code (claude-opus-5)

Things done

awscli2 uses its own copy of botocore (awscli/botocore), not
python3Packages.botocore. It copies the cacert bundle into
awscli/botocore/cacert.pem at build time. It ignores
NIX_SSL_CERT_FILE, SSL_CERT_FILE and the system store at run time.

Override where() in awscli/botocore/httpsession.py so that
get_cert_path() returns NIX_SSL_CERT_FILE, SSL_CERT_FILE,
/etc/ssl/certs/ca-certificates.crt or /etc/ssl/cert.pem when one
exists. The previous behaviour stays as the fallback. AWS_CA_BUNDLE and
the ca_bundle setting still take precedence.

The S3 CRT transfer client still uses DEFAULT_CA_BUNDLE (the cacert
copy), because awscrt cannot read the "TRUSTED CERTIFICATE" blocks in
ca-bundle.crt.

Part of NixOS#576541.

Assisted-by: Claude Code (claude-opus-5)
@zimbatm zimbatm added the backport release-26.05 Backport PR automatically label Oct 20, 2026
@zimbatm zimbatm mentioned this pull request Oct 20, 2026
66 of 95 tasks
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". llm-assisted Contributions that include code generation with LLMs labels Oct 20, 2026
@devusb

devusb commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@NixOS/nixpkgs-merge-bot merge

@nixpkgs-ci
nixpkgs-ci Bot added this pull request to the merge queue Oct 21, 2026
@nixpkgs-ci

nixpkgs-ci Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

@devusb wants to merge this PR.

Requirements to merge this PR with @NixOS/nixpkgs-merge-bot merge:

✔️ Queued for merge (#306934)

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Oct 21, 2026
Merged via the queue into NixOS:master with commit 07d3633 Oct 21, 2026
36 checks passed
@nixpkgs-ci

nixpkgs-ci Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Backport failed for release-26.05, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-26.05
git worktree add -d .worktree/backport-576582-to-release-26.05 origin/release-26.05
cd .worktree/backport-576582-to-release-26.05
git switch --create backport-576582-to-release-26.05
git cherry-pick -x 23a59d049dd98b966f791d83e3b8fe1e0ac56352

@ethancedwards8

ethancedwards8 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

backport #580303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". 8.has: failed backport 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. backport release-26.05 Backport PR automatically llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants