Skip to content

fix(darwin): distrust the roots behind the compromised eMudhra intermediates - #274

Merged
furedea merged 1 commit into
mainfrom
fix/distrust-emudhra-roots
Oct 21, 2026
Merged

furedea merged 1 commit into
mainfrom
fix/distrust-emudhra-roots

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

概要

eMudhra(emSign)の中間 CA 8 枚は,公開証明書から秘密鍵を復元できる状態で発行されていた(advisory).ブラウザと OS は遮断済みだが,nix の CA ストアと,それを読む CLI(curl,git,Python など)はまだ信頼している.nixpkgs の cacert が対応するまで,nix-darwin の security.pki.caCertificateBlacklist で親の root 2 つを除く.

変更前 変更後
/etc/ssl/certs/ca-certificates.crt(NIX_SSL_CERT_FILE) 2 つの root を含む Comodo AAA Services root と emSign ECC Root CA - G3 を除く
SSL_CERT_FILE 未設定(uv の Python などは独自の既定を使い,侵害チェーンを信頼する) 上のファイルを指す
検査ホスト(dv-g3b-emudhra / dv-g3b-aaa-emudhra) 接続できる(200) 証明書エラーで拒否

受け入れ条件

  • darwinConfigurations.mbp.system がビルドできる
  • 生成された CA ファイルで,curl と uv の Python が両方の検査ホストを拒否し,api.github.com には接続できる
  • nixfmt のチェックが通る
  • switch 後,新しいシェルで curl https://dv-g3b-emudhra.we-have-a-problem.com/ が証明書エラーになる
補足と範囲外
  • Node.js は自前の CA を内蔵しているのでこの設定では塞がらない.修正版(22.23.4 / 24.22.1 / 26.12.1)が nixpkgs に入るまで残る(nixpkgs-unstable は 2026-10-22 時点で 24.21.0).
  • uv 本体の HTTPS も同梱の CA を使うので,修正版 0.13.4 が nixpkgs に入るまで残る(同時点で 0.13.1).
  • macOS のシステム証明書(/etc/ssl/cert.pem)は手動で同じ 2 つを除いた(バックアップは /etc/ssl/cert.pem.bak).
  • Comodo AAA Services root は Sectigo の広く使われる root なので,まれに接続できないサイトが出る可能性がある.nixpkgs の cacert が侵害された中間 CA だけを除いたら,この blacklist は外す.

🤖 Generated with Claude Code

@furedea
furedea merged commit c68c9aa into main Oct 21, 2026
11 checks passed
@furedea
furedea deleted the fix/distrust-emudhra-roots branch October 21, 2026 16:12
furedea added a commit that referenced this pull request Oct 21, 2026
…lds (#275)

## 概要

Node.js と uv は自前の CA を内蔵しているので,#274 の CA ストアの修正では侵害された eMudhra 中間 CA
を拒否できない.修正版(Node.js 24.22.1,uv 0.13.4)は nixpkgs ではまだ staging/master
にしかないため,nixpkgs が追いつくまで公式のビルド済みバイナリを使う.

| | 変更前 | 変更後 |
|---|---|---|
| Node.js | `unstable.nodejs_24`(24.18.1) | 公式 macOS ビルド
24.22.1(`nix/packages/nodejs_bin.nix`) |
| uv | `pkgs.uv`(0.11.21) | 公式 macOS ビルド
0.13.4(`nix/packages/uv_bin.nix`) |
| 検査ホストへの接続(`dv-g3b-emudhra` / `dv-g3b-aaa-emudhra`) | Node も uv も接続できる
| Node は `CERT_REVOKED`,uv は接続エラーで拒否 |

## 受け入れ条件

- [x] 取得物の hash が公式の値と一致する(Node は `SHASUMS256.txt`,uv は GitHub release の
digest)
- [x] `nix flake check` が通る
- [x] ビルドした Node と uv が両方の検査ホストを拒否し,Node は `api.github.com` に接続できる
- [ ] `switch` 後,`node --version` が v24.22.1,`uv --version` が 0.13.4 になる

<details>
<summary>補足と戻し方</summary>

- nixpkgs の状況(2026-10-22):Node.js 24.22.1 は staging のみ(unstable と master
は 24.21.0),uv 0.13.4 は master と staging(unstable は 0.13.1,stable 26.05 は
0.11.21).
- 戻し方:nixpkgs-unstable が Node.js 24.22.1 以上になったら `nodejsPackage` を
`unstable.nodejs_24` に,使う nixpkgs が uv 0.13.4 以上になったら `uvPackage` を `uv`
に戻し,2 つのファイルを消す.各ファイルの冒頭にも同じ条件を書いた.
- 公式バイナリは aarch64-darwin 向けのみ.ホストはすべて aarch64-darwin.
- 参考:[Node.js 2026-10-21 security
releases](https://nodejs.org/en/blog/vulnerability/october-2026-security-releases),[uv
GHSA-hq85-5cpj-mr62](https://github.com/astral-sh/uv/security/advisories/GHSA-hq85-5cpj-mr62),[eMudhra
advisory](https://emudhra.we-have-a-problem.com/)

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea added a commit that referenced this pull request Oct 21, 2026
## 概要

Python の requests は `SSL_CERT_FILE` を読まず,各 venv の certifi を使う.手元の venv の
certifi はすべて修正版(2026.10.19)より古く(2026.2.25〜2026.7.22),侵害された eMudhra 中間 CA
を信頼する.`REQUESTS_CA_BUNDLE` を #274 で除外した CA ストアに向ける.

| クライアント(swe-conform の venv で確認) | 変更前 | 変更後 |
|---|---|---|
| requests 2.34.2 | 検査ホストに接続できる(200) | `SSLError` で拒否 |
| httpx 0.28.1 | #274 の `SSL_CERT_FILE` で既に拒否 | 変わらない |

## 受け入れ条件

- [x] `REQUESTS_CA_BUNDLE` が `/etc/ssl/certs/ca-certificates.crt` になる
- [x] 同じ値を渡した requests が検査ホストを拒否する
- [ ] `switch` 後の新しいシェルで,venv の requests が検査ホストを拒否する

<details>
<summary>補足</summary>

- certifi 自体の更新は,各リポジトリの `exclude-newer = "1 week"` により 2026-10-26 以降に
Renovate が行う.この変数はそれまでのつなぎで,#276 の戻し対象に加える.
- 対象
lock:FIRE-Bench(2026.4.22),k8s-guideline-bench(2026.2.25),swe-bench-trial(2026.2.25),swe-conform(2026.7.22).

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea added a commit that referenced this pull request Oct 21, 2026
…#282)

## 概要

#274 の `security.pki.caCertificateBlacklist` は,除外した root を消さず,「拒否」印付きの
OpenSSL `TRUSTED CERTIFICATE` 形式で `/etc/ssl/certs/ca-certificates.crt`
に残していた.OpenSSL を使う curl・Python・Node
は印を守るが,codex(rustls)はこの形式を通常の証明書に変換して信頼してしまい,`SSL_CERT_FILE`
を渡しても侵害チェーンの検査ホストに接続できた(`status=200`).root を含まない
`ca-no-trust-rules-bundle.crt` から CA ストアを作る.

| | 変更前 | 変更後 |
|---|---|---|
| CA ストアの元 | `ca-bundle.crt`(通常 120 件+`TRUSTED CERTIFICATE` 172 件.除外した
root も拒否印付きで残る) | `ca-no-trust-rules-bundle.crt`(通常 120 件のみ.除外した root
は含まない) |
| curl で検査ホスト | `certificate rejected` | `unable to get local issuer
certificate`(root がない) |
| codex(`SSL_CERT_FILE` あり)で検査ホスト | 200 で接続 | 拒否される見込み(下の受け入れ条件で確認) |

## 受け入れ条件

- [x] 生成される CA ストアに `TRUSTED CERTIFICATE` 形式がなく,除外した root の PEM がない
- [x] curl が両方の検査ホストを拒否し,`api.github.com` には接続できる
- [x] `nix flake check` が通る
- [ ] `switch` 後,`SSL_CERT_FILE` を設定した codex が検査ホストに接続できない

<details>
<summary>補足</summary>

- `ca-no-trust-rules-bundle.crt` の通常の証明書 120 件は,`ca-bundle.crt`
のサーバー認証用の 120 件と同じ集合.
- `SSL_CERT_FILE`,`REQUESTS_CA_BUNDLE`,`NIX_SSL_CERT_FILE` はどれも同じ
`/etc/ssl/certs/ca-certificates.crt` を指すので,変数の変更はない.
- nixpkgs の cacert が侵害された中間 CA を拒否したら,この上書きも blacklist と一緒に外す(#276).
- 注意:`/etc/zshenv` は親プロセスが環境を読み込み済みだと読み直さないため,`switch` 後は Ghostty と
herdr を一度終了して起動し直さないと,新しい環境変数がペインに入らない.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant