From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8IjcDqiv2GFhhQEAgWs5BA (envelope-from ) for ; Fri, 07 Jan 2022 22:24:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kEmTC6iv2GGtNwAAauVa8A (envelope-from ) for ; Fri, 07 Jan 2022 22:24:56 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CADEE2AAD4 for ; Fri, 7 Jan 2022 22:24:55 +0100 (CET) Received: from localhost ([::1]:37208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n5wjG-0003pr-M4 for larch@yhetil.org; Fri, 07 Jan 2022 16:24:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wij-0003ph-Er for guix-devel@gnu.org; Fri, 07 Jan 2022 16:24:21 -0500 Received: from leibniz.telenet-ops.be ([195.130.137.77]:35418) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5wig-0006dY-8v for guix-devel@gnu.org; Fri, 07 Jan 2022 16:24:21 -0500 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by leibniz.telenet-ops.be (Postfix) with ESMTPS id 4JVx6z17tMzMrB3D for ; Fri, 7 Jan 2022 22:24:11 +0100 (CET) Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by baptiste.telenet-ops.be with bizsmtp id fxQ62600L4UW6Th01xQ7N6; Fri, 07 Jan 2022 22:24:07 +0100 Message-ID: <8dc3fb16db64df6fd71b7ab059c517aa3e779c2b.camel@telenet.be> Subject: Public key pinning in guix? From: Maxime Devos To: guix-devel@gnu.org Date: Fri, 07 Jan 2022 21:24:02 +0000 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-vObmz8H3nHXkkKWfQ2UG" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1641590647; bh=trdcTtzB1UTu/LyIVzH1GcmMzon8G7AfBwyvuxMTjp0=; h=Subject:From:To:Date; b=hofwtQswzBAmuGYclY2LyrpJNIYtW0kenal7kVy1FLZpDyDQ6LDi43CUn2tZeOirU jPLPltLNMlciF16FA4PzPzMZdsEvcUcqS7e5kIGsNSKtDxfZSMbwObfaELRBvkgC5C MhdjZTHTJT6pAyUmlcq1WxTkWd3Ioo8UoKGxGmPwyDHqrYk1VecHvyy/+F+X9pA+98 xAo0cI/aFkTC8c/Tw2v6ZXi9MBgeLBmkMfPsmG9PhlNEA9Vx97879mZPF55dF+5Cwg PuQfit77OfmS+qcLvCqhfoh9POuoMbeY3QxVoOmHJOC+X9ExqDAwvUY4GDhUjAO2ov UR12euayjxA3A== Received-SPF: pass client-ip=195.130.137.77; envelope-from=maximedevos@telenet.be; helo=leibniz.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641590695; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=trdcTtzB1UTu/LyIVzH1GcmMzon8G7AfBwyvuxMTjp0=; b=P5oKbOGMIE6vP4dApFl3ozEcu5JNzeShMY4e8qRHY4yHiOoM8slkdhIYWciqVjkYRnaFmY jfOxpRDVM4pW14AKRmgOREQ8ht8e+EKTxbjEYfm3MTWKgnHlkVcULs1xY74EdH9euz4xye Ye27skp1Ot5NDowG43kjP/Fu7YzeekKScOK1c/8tWWig33Pb+ouj+tOfhPMAzayAEVN8by unQJ/+DXIdDhxkgRizEb8+BJ4sS5J4UW9dBe39t767EJFICGVd+bZciHZV+yA96FsW2P1J bUhedxuxXbk5EVoHgKNXL3Va0B2AHIjBaAx230rVaii5teHcditRdYV8YYoYhQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641590695; a=rsa-sha256; cv=none; b=fxmuRvb7bffhmmnmYtJ6laR2NYiWsnWLhEbzI7TjyrsMTKLkXasffbmyQXSrSJeacH+d+V wLaQIqgg9o9aQBMlYDODCwlViQfqKbr0sgvubypXIvLd2aLX9Oj5b/0JFGB3NadrEjaJRg GReORCxZ2mBNHzkoJbfbZOoZA16ZKfsyZK7sFzKNx0CS3LvQS6/bX8F6zrVebd74Jl7Hs3 tQA4pvxRZ3ki8stFlr0jJaqzhxYhV4Lp9An3iEOfV9ld77lpVxrdxkaekzm9uM5u/S29SR NhJ5XzU35kYmnio1+QKrnnHDw6uDvLGN3DDB9DO91fUpwD22WWJubtGJqXvOmg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r22 header.b=hofwtQsw; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -6.60 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r22 header.b=hofwtQsw; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: CADEE2AAD4 X-Spam-Score: -6.60 X-Migadu-Scanner: scn1.migadu.com X-TUID: g5t3sdJrmI82 --=-vObmz8H3nHXkkKWfQ2UG Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi guix-devel, I coded up the following recently: [start snip] ;; TODO does this check all the right fields? (define %pinned-public-keys '(("content.minetest.net" . #u8(188 216 200 89 188 149 240 145 93 189 114 207 239 50 157 141 57 196 11 102)) ("ftp.gnu.org" . #u8(100 133 126 118 117 115 141 72 253 200 108 158 64 47 85 199 90 0 253 179 181)) ("www.stackage.org" . #u8(101 7 34 114 166 42 66 55 116 60 42 253 85 30 134 236 217 108 67 119)) ("hackage.haskell.org" . #u8(80 123 226 229 92 27 203 99 130 198 72 113 250 28 247 58 254 19 104 79)) ("fastapi.metacpan.org" . #u8(86 7 157 232 133 127 13 58 144 86 37 162 91 239 203 138 150 84 56 67)) ("cran.r-project.org" . #u8(60 80 123 29 14 43 131 116 105 126 126 58 154 231 6 150 216 158 70 213)) ("web.cvs.savannah.gnu.org" . #u8(66 134 131 20 232 136 162 102 201 229 202 93 21 161 26 192 176 3 61 38)))) (use-modules (gnutls) (rnrs bytevectors)) (define old (@@ (gnutls) x509-certificate-matches-hostname?)) (set! (@@ (gnutls) x509-certificate-matches-hostname?) (lambda (certificate domain) (and (old certificate domain) ;; If the domain name is known to Guix, verify the public key ;; -- the CA could be corrupt or compromised! (let ((pinned-key (assoc-ref %pinned-public-keys domain))) (or (pk 'd domain pinned-key (not pinned-key)) (bytevector=3D? pinned-key (x509-certificate-key-id certificate))))))) [end snip] I put it in (guix import minetest); it should probably be integrated into (guix build download) instead. The purpose is to resist a compromise of the CA system. More concretely, if you now do "guix refresh -u minetest-moreores" then a MITM that compromised a CA cannot secretly replace minetest-moreores with a mod that mines bitcoin for the MITM, or something. Possibly also useful for "guix download", "guix import", "guix lint", "guix build --with-latest=3D...". A downside is that whenever content.minetest.net changes public keys, the pinned public key in Guix needs to be updated. How often does this happen? I wouldn't now. This could be partially automated with a "./pre-inst-env guix update-the-pinned-keys" script, and there could be an "GUIX_IGNORE_KEY_PINNING=3Dyes" environment variable as escape hatch. WDYT, worth the trouble or not? --=-vObmz8H3nHXkkKWfQ2UG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYdivchccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ui/AP4xJ2sqUrpM6RKEb39anI5tK4wE FoDin4A9Jx8VrGURHgD9FI3YFc8DeJ9sYYQmjjBywQANVYHdYwO2r/2VaSoESgo= =dd1v -----END PGP SIGNATURE----- --=-vObmz8H3nHXkkKWfQ2UG--