后量子 GitHub SSH
Post-Quantum GitHub SSH

原始链接: https://bauer.codes/post/2026/12/post-quantum-github-ssh/

文章认为,近期 NSA 的后量子指南以及 Filippo Valsorda 的分析表明,即便没有迫在眉睫的紧急情况,现在就加固 GitHub SSH 也是明智之举。它关注通过 Git URL 重写以 SSH 方式访问 GitHub 的用户。 有两个方面很重要:密钥交换和身份验证。用户应检查 GitHub 是否协商使用 `mlkem768x25519-sha256` 或 `sntrup761x25519-sha512`;如果没有,应在 `~/.ssh/config` 中为 `github.com` 添加 `KexAlgorithms` 条目。由于 GitHub 没有纯 PQC 选项,混合 ML-KEM 是最佳可用选择。 对于身份验证,文章建议逐步弃用 Ed25519 和较弱的 RSA 密钥。生成 ECDSA P-384 密钥(或 RSA-3072),将其注册到 GitHub,并将 GitHub SSH 限制为使用该 `IdentityFile`。使用 SSH 验证提交的人还应将新密钥注册为签名密钥,并更新 `~/.gitconfig`。最后,清除现有的 SSH 控制连接,刷新 `ssh-agent` 中的密钥,并确认连接显示为混合 kex 以及 ECDSA-384 或 RSA-3072 身份验证。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 工作 | 提交 登录 后量子 GitHub SSH ( bauer.codes ) 7 分 由 embeng4096 发布 1 小时前 | 过往 | 收藏 | 1 条评论 帮助 rubyalgo89 9 分钟前 [–] 试过了,瓶颈在客户端;我们有一半的镜像仍搭载不带 ML-KEM 的 OpenSSH。 回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请加入 YC | 联系 搜索:
相关文章

原文
bauer.codes | Post-Quantum GitHub SSH

Menu

2026-12-04

Tech is in a tizzy over the NSA Post-Quantum Cryptography (PQC) advisory and Matthew “🤡” Prince’s now deleted vagueposting.
But there does seem to be something “there” there unlike the big fat nothing burger Anthropic blundered into literally earlier this week.

Given how frustratingly few details our betters deign to share with the rest of us, Filippo Valsorda has some analysis and details worth considering. Read it. The world probably isn’t ending tomorrow, but it’s worth getting off Ed25519 sooner rather than later.

If, like me, you have this bit in your ~/.gitconfig, you likely interact with GitHub’s git server exclusively via SSH.

[url "[email protected]:"]
    insteadOf = https://github.com/

This step-by-step guide helps you follow Filippo’s recommendations when interacting with GitHub SSH. There are two points of vulnerability here: key exchange and authentication.

vulnerability checks

If you don’t see mlkem… or sntrup…, see key exchange.

# key exchange check
ssh -v -o ControlPath=none -T [email protected] 2>&1 | grep "kex: algorithm"

If you see an Ed25519 key or an RSA key that is less than 3072, see authentication.

# auth check
ssh -v -o ControlPath=none -T [email protected] 2>&1 | grep "Server accepts key"

Alternatively, check your publicly registered keys: https://github.com/$GITHUB_USERNAME.keys

fixing

key exchange

Neither OpenSSH 10.6 nor GitHub offers purely PQC options (ML-KEM/FIPS 203). As of 2026-09-22, GitHub offers mlkem768x25519-sha256, so a hybrid PQC scheme is the best we can do for now — in line with the NSA advisory.

Some systems force potentially vulnerable defaults in /etc/ssh/crypto.conf. If you can’t modify that yourself on a managed laptop, put the following config in ~/.ssh/config.

Host github.com
    KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512

Yes, it’s KexAlgorithms as in “key exchange”.

authentication

As of 2026-12-04, GitHub still suggests Ed25519 when generating new auth keys. That’s probably no longer a good idea, and GitHub doesn’t offer anything PQC for auth. The best we can do for now is use RSA-3072 or P-384.

  1. Generate a new key

    export GH_KEY="$HOME/.ssh/id_ecdsa_github"
    ssh-keygen -t ecdsa -b 384 -f "${GH_KEY}"
    
    # copy to clipboard on mac
    pbcopy < "${GH_KEY}.pub"
    
  2. Register your new public key as an authentication key at https://github.com/settings/keys

  3. Either move your old Ed25519 keys out of ~/.ssh or add IdentityFile and IdentitiesOnly values to ~/.ssh/config for GitHub.

    Host github.com
        KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512
        IdentityFile ~/.ssh/id_ecdsa_github
        IdentitiesOnly yes
    

verified commits

If you use SSH verified commits:

  1. Register your new public key as a signing key at https://github.com/settings/keys

  2. Update your signing key in ~/.gitconfig

    [user]
        signingkey = ~/.ssh/id_ecdsa_github.pub
    [gpg]
        format = ssh
    [commit]
        gpgsign = true
    

validation

You’ll want to clean up any existing ControlPath connections and add your new key to your ssh agent for the new key to be effective for git operations.

export GH_KEY="$HOME/.ssh/id_ecdsa_github"
ssh -O exit [email protected] # if you are using ControlPersist like I do
ssh-add -D                 # if you are using an agent, drop old keys
ssh-add "${GH_KEY}"        # add new key

Then run:

ssh -v -o ControlPath=none -T [email protected] 2>&1 \
| tr -d '\r' \
| awk -v b="$(ssh-keygen -lf "${GH_KEY}.pub" | cut -d' ' -f1)" '
    /kex: algorithm:/ { k = $NF }
    /Server accepts key/ { t = $6 }
    END {
        ok = (k ~ /^(mlkem|sntrup)/ && ((t == "ECDSA" && b >= 384) || (t == "RSA" && b >= 3072)))
        print (ok ? "PASS" : "FAIL"), "kex=" k, "auth=" t "-" b
        exit !ok
    }'

… prints PASS kex=mlkem768x25519-sha256 auth=ECDSA-384 for me.

Related tags:

email comments to [email protected]

Back to top

联系我们 contact @ memedata.com