From patchwork Tue Apr 23 16:12:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dale Mellor X-Patchwork-Id: 63321 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 03E3F27BBE2; Tue, 23 Apr 2024 17:15:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5A98527BBEA for ; Tue, 23 Apr 2024 17:15:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzInI-00035z-Ok; Tue, 23 Apr 2024 12:14:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rzInH-00035V-8m for guix-patches@gnu.org; Tue, 23 Apr 2024 12:14:55 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rzInG-000630-Us for guix-patches@gnu.org; Tue, 23 Apr 2024 12:14:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzInX-0001w8-CE for guix-patches@gnu.org; Tue, 23 Apr 2024 12:15:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#68621] [PATCH v2 3/4] services: knot-resolver: Use default DNSSEC trust anchors. Resent-From: Dale Mellor Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 23 Apr 2024 16:15:11 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68621 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68621@debbugs.gnu.org Cc: hello@lnikki.la X-Debbugs-Original-Cc: Leo =?utf-8?q?Nikkil=C3=A4?= , guix-patches@gnu.org Received: via spool by 68621-submit@debbugs.gnu.org id=B68621.17138888596813 (code B ref 68621); Tue, 23 Apr 2024 16:15:11 +0000 Received: (at 68621) by debbugs.gnu.org; 23 Apr 2024 16:14:19 +0000 Received: from localhost ([127.0.0.1]:53052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzImg-0001la-Bz for submit@debbugs.gnu.org; Tue, 23 Apr 2024 12:14:18 -0400 Received: from [195.15.247.228] (port=9898 helo=rdmp.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzImA-0001df-71 for 68621@debbugs.gnu.org; Tue, 23 Apr 2024 12:13:48 -0400 Received: from [127.0.0.1] (helo=localhost.localdomain) by rdmp.org with esmtp (Exim 4.96.1) (envelope-from ) id 1rzIln-00047D-2L; Tue, 23 Apr 2024 16:13:24 +0000 From: Dale Mellor Date: Tue, 23 Apr 2024 17:12:25 +0100 Message-ID: <20240423161226.973140-3-guix-devel-0brg6a@rdmp.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240120212542.17473-1-hello@lnikki.la> References: <20240120212542.17473-1-hello@lnikki.la> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Leo Nikkilä * gnu/services/dns.scm (%kresd.conf): Use default anchors. (knot-resolver-activation): Install default anchors when missing. --- gnu/services/dns.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 6608046909..f83c5b6594 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -655,7 +655,6 @@ (define-record-type* (define %kresd.conf (plain-file "kresd.conf" "-- -*- mode: lua -*- -trust_anchors.add_file('/var/cache/knot-resolver/root.keys') net = { '127.0.0.1', '::1' } user('knot-resolver', 'knot-resolver') modules = { 'hints > iterate', 'stats', 'predict' } @@ -676,10 +675,20 @@ (define %knot-resolver-accounts (define (knot-resolver-activation config) #~(begin (use-modules (guix build utils)) - (let ((rundir "/var/cache/knot-resolver") - (owner (getpwnam "knot-resolver"))) + (let* ((rundir "/var/cache/knot-resolver") + (keyfile (string-append rundir "/root.keys")) + (owner (getpwnam "knot-resolver"))) (mkdir-p rundir) - (chown rundir (passwd:uid owner) (passwd:gid owner))))) + (chown rundir (passwd:uid owner) (passwd:gid owner)) + + ;; Install initial trust anchors when missing. + (unless (file-exists? keyfile) + (copy-file #$(file-append (knot-resolver-configuration-package + config) + "/etc/knot-resolver/root.keys") + keyfile) + (chown keyfile (passwd:uid owner) (passwd:gid owner)) + (chmod keyfile #o755))))) (define knot-resolver-shepherd-services (match-lambda