From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 2GfBF+h/U2WRBgEAG6o9tA:P1 (envelope-from ) for ; Tue, 14 Nov 2023 15:10:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2GfBF+h/U2WRBgEAG6o9tA (envelope-from ) for ; Tue, 14 Nov 2023 15:10:48 +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 4CA2331EE8 for ; Tue, 14 Nov 2023 15:10:48 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GMaDrnkj; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1699971048; a=rsa-sha256; cv=none; b=ZOA7gzvNn+osrEvYx20vFW8ejEiBIK7EA73Z6relsB1aMTUUIel5w3c8bd36YQqqf39uxJ sSDklAncRXIB7hvCSo9+V4O+b+R1hQx3QJd/3uLwjiwhk2Glyes9S8VVUsY4nLRZfAwEv9 AgkRqQZD6FZQiQdSjxv5mJAO6ZZCbx4ItpOSzLst/Drpt8g2D0i+LdITWwzoI3mCqQFZtk UTnXaxCmFNMOU9sU0R0Uv+xtKBBaSbKeFnGxzmX2vseaQ2CFMVWFcA09W84uKxSK9EyzRJ BSTWzcPr520cKlSfrVabg5F64bwwGManGDA9p6NPhIPMnSSsY6N6DASzamlQ5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GMaDrnkj; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1699971048; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=fb+XjT86CGeA6T1dLr7Vjt+ceFNklNVlGFBxP45nCmg=; b=djR9NuMyHHjrlimFzM+hSQWa7TZ79vkJq/rJXm84tLSxLdtBF5oZ5XgGWnKXNLlHgWldfT NrCuqbiXYDtvFu4RGKGjZ5Nl25aJvGy03NFdykLR6T/Ana6T4nuil7KwdlGE1L+vz1IFPW 0leEQH+gcd+1v0FtPJIXSMlDzIqB1Y5FfpKalIuHFtlBVRBzO82UglkOZMIuPfWz2m8Jgz jsK9RAM8cxHFXIsLzEmGp9o8oNwMKdtml82N7AH0waRR07WcFPsNgN87au635lvqiVZGHD EEuYxlnyACKab2uQEklo0wxeZdX6KO1N4h+y9G+u6JWVkjk0ASH1Io9so8TxUQ== 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?Q?=E2=80=98least-authority-wrapper=E2=80=99.?= 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 4CA2331EE8 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.79 X-Spam-Score: -5.79 X-TUID: +PFdMsegW9dS * 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)))))) -- 2.41.0