From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id RMZnBXhAkV9WPQAA0tVLHw (envelope-from ) for ; Thu, 22 Oct 2020 08:19:04 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SA/SOndAkV84TgAAbx9fmQ (envelope-from ) for ; Thu, 22 Oct 2020 08:19:03 +0000 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 425F494021E for ; Thu, 22 Oct 2020 08:19:03 +0000 (UTC) Received: from localhost ([::1]:49674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVVoM-0001rO-8u for larch@yhetil.org; Thu, 22 Oct 2020 04:19:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVVMI-0008Hw-JR for bug-guix@gnu.org; Thu, 22 Oct 2020 03:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVVMI-0001Se-7p for bug-guix@gnu.org; Thu, 22 Oct 2020 03:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVVMI-0005Ic-6h for bug-guix@gnu.org; Thu, 22 Oct 2020 03:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#44104: [patch] guix publish: provide server's signing key. References: <86lfg0br4s.fsf@disroot.org> In-Reply-To: <86lfg0br4s.fsf@disroot.org> Resent-From: "Amar M. Singh" Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 22 Oct 2020 07:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44104 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 44104@debbugs.gnu.org Received: via spool by 44104-submit@debbugs.gnu.org id=B44104.160335294220273 (code B ref 44104); Thu, 22 Oct 2020 07:50:02 +0000 Received: (at 44104) by debbugs.gnu.org; 22 Oct 2020 07:49:02 +0000 Received: from localhost ([127.0.0.1]:51334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVVLJ-0005Gs-IV for submit@debbugs.gnu.org; Thu, 22 Oct 2020 03:49:01 -0400 Received: from knopi.disroot.org ([178.21.23.139]:55454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVVLH-0005Gc-0z for 44104@debbugs.gnu.org; Thu, 22 Oct 2020 03:49:00 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 26F9B535A7 for <44104@debbugs.gnu.org>; Thu, 22 Oct 2020 09:48:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HN1gqAYfo64D for <44104@debbugs.gnu.org>; Thu, 22 Oct 2020 09:48:55 +0200 (CEST) From: "Amar M. Singh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1603352935; bh=JMGWbt4YEy+lsWsP9axHsQvUChMfhULWlV6tmahgIzA=; h=From:To:Subject:Date; b=VlcGNT9HFLTdGzrtDm1n0h57btB3Ie7eLogccvnOs1LBcPklQXzntZSm4OQoPmxsD Bs8hjMNWFAlEE+EB0b3klmyKsym9/swRRDdzEu6q7r0fJ+PsoeF3P/llQiHlCEf8W9 /EsfT+tAGfwF1Z2uVqqacgaPwSH3IoE+qux7iRMzYUDtVXZZDQbFicjzGSkAq/O7O2 a5Zy0XvUY2ct4qEd+a8QOyA5v1e0g41HBJNkCXjrrVAyUPTvTAWQ3aU+9hrlsz2mS6 Uc0m2gOiB6imkYJzyclI435YPWV+xWd47t3xGhjvrHV8g8vGOHVG3ylecNPbK1Wecg 80Opqvmt/JW2g== Date: Thu, 22 Oct 2020 13:18:44 +0530 Message-ID: <86d01a3dlv.fsf@disroot.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-Mailman-Approved-At: Thu, 22 Oct 2020 04:18:54 -0400 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=disroot.org header.s=mail header.b=VlcGNT9H; dmarc=fail reason="SPF not aligned (relaxed)" header.from=disroot.org (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 2.09 X-TUID: lH/NknASr+Uf --=-=-= Content-Type: text/plain Thanks, Updated. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-guix-publish-Provide-server-s-signing-key.patch Content-Transfer-Encoding: quoted-printable Content-Description: =?utf-8?B?0YfQtdCz0L4=?= >From fe0098082289a2350002da4e2438c41f6385b3e2 Mon Sep 17 00:00:00 2001 From: Amar Singh Date: Wed, 21 Oct 2020 02:02:02 +0530 Subject: [PATCH] guix publish: Provide server's signing key. Published at $(guix-publish-uri)/signing-key.pub Knock yourselves out! Best in industry. Signed-off-by: Amar Singh --- guix/scripts/publish.scm | 18 +++++++++++++++++- tests/publish.scm | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index 4eaf961ab2..1741b93309 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2015 David Thompson +;;; Copyright =C2=A9 2020 by Amar M. Singh ;;; Copyright =C2=A9 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Court=C3= =A8s ;;; ;;; This file is part of GNU Guix. @@ -686,6 +687,13 @@ to compress or decompress the log file; just return it= as-is." (values (response-headers log) log) (not-found request)))) =20 +(define (render-signing-key) + "Render signing key." + (let ((file %public-key-file)) + (values `((content-type . (text/plain (charset . "UTF-8"))) + (x-raw-file . ,file)) + file))) + (define (render-home-page request) "Render the home page." (values `((content-type . (text/html (charset . "UTF-8")))) @@ -699,7 +707,12 @@ to compress or decompress the log file; just return it= as-is." (a (@ (href "https://guix.gnu.org/manual/en/html= _node/Invoking-guix-publish.html")) (tt "guix publish")) - " speaking. Welcome!"))) + " speaking. Welcome!") + (p "Here is the " + (a (@ (href + "signing-key.pub")) + (tt "signing key")) + " for this server. Knock yourselves out!"))) port))))) =20 (define (extract-narinfo-hash str) @@ -918,6 +931,9 @@ methods, return the applicable compression." ;; / ((or () ("index.html")) (render-home-page request)) + ;; guix signing-key + (("signing-key.pub") + (render-signing-key)) ;; /.narinfo (((=3D extract-narinfo-hash (? string? hash))) (if cache diff --git a/tests/publish.scm b/tests/publish.scm index 1c3b2785fb..13f667aa7e 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2015 David Thompson +;;; Copyright =C2=A9 2020 by Amar M. Singh ;;; Copyright =C2=A9 2016, 2017, 2018, 2019, 2020 Ludovic Court=C3=A8s ;;; ;;; This file is part of GNU Guix. @@ -613,6 +614,10 @@ References: ~%" (let ((uri (publish-uri "/log/does-not-exist"))) (response-code (http-get uri)))) =20 +(test-equal "/signing-key.pub" + 200 + (response-code (http-get (publish-uri "/signing-key.pub")))) + (test-equal "non-GET query" '(200 404) (let ((path (string-append "/" (store-path-hash-part %item) --=20 2.28.0 --=-=-=--