您可以在 git 2.8(2016 年 3 月)中找到实现新 curl 选项的另一个示例:
请参阅Christoph Egger ( )的提交 aeff8a6(2016 年 2 月 15 日) 。(由Junio C Hamano 合并 -- --在提交 e79112d中,2016 年 2 月 24 日)siccegge
gitster
http
: 实现公钥固定
添加http.pinnedpubkey
公钥固定的配置选项。libcurl
它允许任何由--base64(sha256(pubkey))
或filename
完整公钥支持的字符串。
如果 cURL 不支持固定(太旧),则向用户输出警告。
git config
手册页提到:
http.pinnedpubkey:
https 服务的公钥。
它可以是 PEM 或 DER 编码的公钥文件的文件名,也可以是以 ' sha256//
' 开头的字符串,后跟公钥的 base64 编码 sha256 哈希。另请参见libcurl 'CURLOPT_PINNEDPUBLICKEY'。
如果设置了此选项但 cURL 不支持,git 将退出并出现错误。
使用 Git 2.34(2021 年第四季度),在 SSL 证书固定时更新了 HTTPS 错误处理:
请参阅Ævar Arnfjörð Bjarmason ( ) 的提交 3e8084f(2021 年 9 月 24 日)。(由Junio C Hamano 合并 -- --在提交 97492aa中,2021 年 10 月 11 日)avar
gitster
http
: 检查CURLE_SSL_PINNEDPUBKEYNOTMATCH
何时发出错误
签字人:Ævar Arnfjörð Bjarmason
http.pinnedPubKey
将 a不匹配时显示的错误更改为指向aeff8a6http.pinnedPubKey
中添加的变量(“ :实施公钥固定”,2016-02-15,Git v2.8.0-rc0 --批次 #8中列出的合并),例如:http
git -c http.pinnedPubKey=sha256/someNonMatchingKey ls-remote https://github.com/git/git.git
fatal: unable to access 'https://github.com/git/git.git/' with http.pinnedPubkey configuration: SSL: public key does not match pinned public key!
在此之前,我们会在没有“”的情况下发出完全相同的内容with http.pinnedPubkey configuration
。
这样做的好处是我们将得到一个翻译的消息(“ :
”之后的所有内容都用英文硬编码在 中libcurl
),并且我们得到了对git-specific
导致错误的配置变量的引用。
不幸的是,我们不能轻易地测试它,因为https://
测试套件中没有需要的测试,t/lib-httpd.sh
也不知道如何设置这样的测试。
请参阅此线程以开始讨论如何进行不同的“ t/lib-httpd/apache.conf
”测试设置。