SSH certificates and git signing

⭐⭐⭐⭐ 4星 来源: codon.org.uk (Matthew Garrett) | 2026-03

摘要

Matthew Garrett (Google安全工程师) 详解如何使用SSH证书签署git提交,提供比传统PGP更安全的代码签名方案。

为什么需要SSH证书

SSH证书优势

本地配置

1. 设置git使用SSH签名

git config set gpg.format ssh

2. 设置签名密钥

两种方式:

作者提供了 find-ssh-certificate 工具。

3. 签名提交

git commit -S

验证签名

* cert-authority ssh-rsa AAAA...

匹配所有principals,验证证书是否由指定CA签名。

GitHub/GitLab目前不支持此验证方式,作者写了 validate-git-signatures 工具。

硬件安全

作者写了 attestation-tpm-agent 工具。

核心洞察:"SSH密钥的裸加密在隔离情况下没有太大帮助,需要某种方式来确定哪些密钥可信。"

← 返回索引