From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +KoGM2qcuWRTgwEASxT56A (envelope-from ) for ; Thu, 20 Jul 2023 22:43:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aKbhMmqcuWS7igAA9RJhRA (envelope-from ) for ; Thu, 20 Jul 2023 22:43:22 +0200 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 9D2DE3C1E5 for ; Thu, 20 Jul 2023 22:43:22 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b="G/qmkX6N"; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1689885802; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=fFenzCyWp34FYvC8s/VDuQRGKfgCWhC8SnolL/VRzVE=; b=swnkfZxIUxw7eQtnPVrBNsNF+1PHoYtIMUaAkgJAOtHo+qjYLQycgEY6ep7AeRS9HCU+CJ QCEJch6TQOPzvtFxkuDJI/XjseA5IgMXbFGWiHf0yUZ3rIE1KNPeJao27x3nb5JD0sxDgP tqkF0g5AbQQ6eirZEkQMtyXojEK4wpl0suTT/4EaQ4yw06OxM3o1AXAm12uNm3T/qpfOnN Dou8v0B5Ip066NOS3418eGT9lagig1JZ7wxp5n9qYvYg3t78AEqqgm/ArUJBXe4xTQNQ6M iIL87xBGQOS13WOMST5cteLEvF5u73SCSdvGUD1flGJ2yzQIJRl+LxyGN2cfeQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1689885802; a=rsa-sha256; cv=none; b=DXH4iwSGRbWNyYDbVovBC3enlmqzsJbdOm4R3W8+FvujGZGFklz6mm8yTRw+Qz7/UQsT1z YV8u+WkN2Fp3wyrknW9fjEoH4CeeIPqnDRtNHOeOjkfflFAoPzblQPvIPEkxglXaCC7fC3 iGa0WBNmL0rcAeB4EJVm58q7ASQwHrheFbNiUufWWkN4HT98nRPGTjfYYSsNyJGY0O0tqs VNd06QEaW14r/rK/5L55V45lLshwh2UwWJKsuFLpcJYbZqNIM0JkzwvXVrLMZc+Mjakx/7 vUMbOQQ6WJtiExBwLsNo/OBup6l1xYBdl+gxaCr+BD0OTaxhwj1rlR7Oza0tYA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b="G/qmkX6N"; 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"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMaUL-0007PS-9x; Thu, 20 Jul 2023 16:43:05 -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 1qMaUJ-0007OX-Sh for guix-patches@gnu.org; Thu, 20 Jul 2023 16:43:03 -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 1qMaUJ-0007DJ-Kd for guix-patches@gnu.org; Thu, 20 Jul 2023 16:43:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qMaUJ-0000Yo-E6 for guix-patches@gnu.org; Thu, 20 Jul 2023 16:43:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#61462] [PATCH v2 05/10] system: Add (gnu system privilege). Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jul 2023 20:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61462 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61462@debbugs.gnu.org Received: via spool by 61462-submit@debbugs.gnu.org id=B61462.16898857342017 (code B ref 61462); Thu, 20 Jul 2023 20:43:03 +0000 Received: (at 61462) by debbugs.gnu.org; 20 Jul 2023 20:42:14 +0000 Received: from localhost ([127.0.0.1]:60048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMaTW-0000WN-1f for submit@debbugs.gnu.org; Thu, 20 Jul 2023 16:42:14 -0400 Received: from tobias.gr ([80.241.217.52]:53738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qMaTP-0000VG-Fl for 61462@debbugs.gnu.org; Thu, 20 Jul 2023 16:42:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=fFenzCyWp34FY vC8s/VDuQRGKfgCWhC8SnolL/VRzVE=; h=references:in-reply-to:date: subject:to:from; d=tobias.gr; b=G/qmkX6NHtjyuZkTxBDo/JmxmMoeCQgBrm5kAx fc0x9LjQq7LoP1dgmvSbndSHPTYxc5G7t85lEXVhxdpZi7iiLnq70KL6+TKAXwSsJcsYUH Ff8CH/kVQzgihYGKsjBygWRAJBnwhXCDnbkefpsLmWw2kIoWzQ5+GJskGcyPB1r1y67/63 8G/BXsBHDcF2lG2GtAVg72pcjmZz31OUyg+Tf3+qmrV4i+vuCWbko3xqQ0dUl+xNnWcHll IQpArR+qVMwsU9hAjoOj4JlETrzqcYCOBog6PR7qppFqnzFt23ePVeVRUTB0xK0BuxMOKw 6a9HX7luxPPjHKrX5xjv7hxQ== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 295c9a2a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <61462@debbugs.gnu.org>; Thu, 20 Jul 2023 20:41:49 +0000 (UTC) Date: Sun, 16 Jul 2023 01:59:55 +0200 Message-ID: <05b635bc74e8f726f03242a05a3007336fb29522.1689465600.git.me@tobias.gr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <129e8d298556f6a159fcb704ed3df4bf0709ddd3.1689465600.git.me@tobias.gr> References: <129e8d298556f6a159fcb704ed3df4bf0709ddd3.1689465600.git.me@tobias.gr> 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: , Reply-to: Tobias Geerinckx-Rice X-ACL-Warn: , Tobias Geerinckx-Rice via Guix-patches From: Tobias Geerinckx-Rice via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.66 X-Spam-Score: -5.66 X-Migadu-Queue-Id: 9D2DE3C1E5 X-Migadu-Scanner: mx1.migadu.com X-TUID: /caGBYHMEzsV * gnu/system/privilege.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/local.mk | 1 + gnu/system/privilege.scm | 58 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 gnu/system/privilege.scm diff --git a/gnu/local.mk b/gnu/local.mk index f10713f126..49298ff0ad 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -733,6 +733,7 @@ GNU_SYSTEM_MODULES = \ %D%/system/mapped-devices.scm \ %D%/system/nss.scm \ %D%/system/pam.scm \ + %D%/system/privilege.scm \ %D%/system/setuid.scm \ %D%/system/shadow.scm \ %D%/system/uuid.scm \ diff --git a/gnu/system/privilege.scm b/gnu/system/privilege.scm new file mode 100644 index 0000000000..d89d5d5d1c --- /dev/null +++ b/gnu/system/privilege.scm @@ -0,0 +1,58 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2022 Tobias Geerinckx-Rice +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu system privilege) + #:use-module (guix records) + #:export (privileged-program + privileged-program? + privileged-program-program + privileged-program-setuid? + privileged-program-setgid? + privileged-program-user + privileged-program-group + privileged-program-capabilities)) + +;;; Commentary: +;;; +;;; Data structures representing privileged programs: binaries with additional +;;; permissions such as setuid/setgid, or POSIX capabilities. This is meant to +;;; be used both on the host side and at run time--e.g., in activation snippets. +;;; +;;; Code: + +(define-record-type* + privileged-program make-privileged-program + privileged-program? + ;; File name of the program to assign elevated privileges. + (program privileged-program-program) ;file-like + ;; Whether to set the setuid (‘set user ID’) bit. + (setuid? privileged-program-setuid? ;boolean + (default #f)) + ;; Whether to set the setgid (‘set group ID’) bit. + (setgid? privileged-program-setgid? ;boolean + (default #f)) + ;; The user name or ID this should be set to (defaults to root's). + (user privileged-program-user ;integer or string + (default 0)) + ;; The group name or ID we want to set this to (defaults to root's). + (group privileged-program-group ;integer or string + (default 0)) + ;; POSIX capabilities in cap_from_text(3) form (defaults to #f: none). + (capabilities privileged-program-capabilities ;string or #f + (default #f))) -- 2.41.0