From patchwork Tue Nov 14 14:09:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 56455 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 33E1127BBEA; Tue, 14 Nov 2023 14:10:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 5CA2C27BBE2 for ; Tue, 14 Nov 2023 14:10:48 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2u7b-00008H-0C; Tue, 14 Nov 2023 09:10:31 -0500 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 1r2u7Q-0008Vi-25 for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10:20 -0500 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 1r2u7P-00027I-Pq for guix-patches@gnu.org; Tue, 14 Nov 2023 09:10:19 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r2u85-0005cp-Mc for guix-patches@gnu.org; Tue, 14 Nov 2023 09:11:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67175] [PATCH 1/9] services: pagekite: Use =?utf-8?b?4oCYbGVh?= =?utf-8?b?c3QtYXV0aG9yaXR5LXdyYXBwZXLigJku?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 Nov 2023 14:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67175 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67175@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 67175-submit@debbugs.gnu.org id=B67175.169997103721479 (code B ref 67175); Tue, 14 Nov 2023 14:11:01 +0000 Received: (at 67175) by debbugs.gnu.org; 14 Nov 2023 14:10:37 +0000 Received: from localhost ([127.0.0.1]:60568 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7g-0005aN-VG for submit@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r2u7f-0005a4-Qk for 67175@debbugs.gnu.org; Tue, 14 Nov 2023 09:10:36 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2u6t-0001r0-Qx; Tue, 14 Nov 2023 09:09:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=fb+XjT86CGeA6T1dLr7Vjt+ceFNklNVlGFBxP45nCmg=; b=GMaDrnkj6ysbNxXWSPyX WQK7OZk1padCbaumsaBN+c+f0ofKo5rIttUgod3oSTBTuoRnYYpTKiNF6clAm52RD9hh0IUkdUlwG gn29zV9B0IRJiGpNld+oUP2BNffaP9BSMdyNbVK0hqcRFwXHyjq91I32YbBH918O6VKWjGzNQuOgk g9Mxe0ComPe9uyZvTdTPsLpbBZQP71rIHXbz4SqMlg5c5gcMoctCYWt9vM+C6Rt9/0qCsGJhmdhS3 0ZsZtoG4l0p6rH9tNjaQCcfRDeuvo9tCgWLDQwl3zpeloVReFIFCFVQ5aan9c7FOk1C+10EBD2Bcn 3wVdTp3Y8upzyA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 14 Nov 2023 15:09:10 +0100 Message-ID: <52f588ecd8c438019142d9cb4766933407d42ee7.1699970930.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: 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 * gnu/services/networking.scm (pagekite-shepherd-service): Define ‘config-file’ and ‘mappings’; define ‘pagekite’ in terms of ‘least-authority-wrapper’. Remove now-unneeded ‘with-imported-modules’ form and ‘modules’ field. Use ‘make-forkexec-constructor’ instead of ‘make-forkexec-constructor/container’. Change-Id: I7c6c6266785f6a0f81a69d85f070779a0d6edd91 --- gnu/services/networking.scm | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 0508a4282c..d3376f9acb 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1918,29 +1918,34 @@ (define (pagekite-configuration-file config) (define (pagekite-shepherd-service config) (match-record config (package kitename kitesecret frontend kites extra-file) - (with-imported-modules (source-module-closure - '((gnu build shepherd) - (gnu system file-systems))) + (let* ((config-file (pagekite-configuration-file config)) + (mappings (cons (file-system-mapping + (source config-file) + (target source)) + (if extra-file + (list (file-system-mapping + (source extra-file) + (target source))) + '()))) + (pagekite (least-authority-wrapper + (file-append package "/bin/pagekite") + #:name "pagekite" + #:mappings mappings + ;; 'pagekite' changes user IDs to it needs to run in the + ;; global user namespace. + #:namespaces (fold delq %namespaces '(net user))))) (shepherd-service (documentation "Run the PageKite service.") (provision '(pagekite)) (requirement '(networking)) - (modules '((gnu build shepherd) - (gnu system file-systems))) - (start #~(make-forkexec-constructor/container - (list #$(file-append package "/bin/pagekite") + (start #~(make-forkexec-constructor + (list #$pagekite "--clean" "--nullui" "--nocrashreport" "--runas=pagekite:pagekite" - (string-append "--optfile=" - #$(pagekite-configuration-file config))) - #:log-file "/var/log/pagekite.log" - #:mappings #$(if extra-file - #~(list (file-system-mapping - (source #$extra-file) - (target source))) - #~'()))) + (string-append "--optfile=" #$config-file)) + #:log-file "/var/log/pagekite.log")) ;; SIGTERM doesn't always work for some reason. (stop #~(make-kill-destructor SIGINT))))))