From patchwork Thu Jul 15 16:46:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: phodina X-Patchwork-Id: 31435 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 0E7FF27BC82; Thu, 15 Jul 2021 17:47:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C224C27BC6B for ; Thu, 15 Jul 2021 17:47:19 +0100 (BST) Received: from localhost ([::1]:41034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m44W6-0000vt-Om for patchwork@mira.cbaines.net; Thu, 15 Jul 2021 12:47:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m44Vv-0000t2-Sx for guix-patches@gnu.org; Thu, 15 Jul 2021 12:47:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m44Vq-0006El-4L for guix-patches@gnu.org; Thu, 15 Jul 2021 12:47:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m44Vq-00052H-1R for guix-patches@gnu.org; Thu, 15 Jul 2021 12:47:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49578] [PATCH] Add bolt Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Jul 2021 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49578@debbugs.gnu.org X-Debbugs-Original-To: "guix-patches@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.162636757319296 (code B ref -1); Thu, 15 Jul 2021 16:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jul 2021 16:46:13 +0000 Received: from localhost ([127.0.0.1]:49573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m44V2-00051A-T9 for submit@debbugs.gnu.org; Thu, 15 Jul 2021 12:46:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:55806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m44V0-000512-Dy for submit@debbugs.gnu.org; Thu, 15 Jul 2021 12:46:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m44Uz-00006x-Rn for guix-patches@gnu.org; Thu, 15 Jul 2021 12:46:10 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:38147) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m44Ux-0005aW-77 for guix-patches@gnu.org; Thu, 15 Jul 2021 12:46:09 -0400 Date: Thu, 15 Jul 2021 16:46:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1626367563; bh=VPlR1mh65XfbwPZ/EUEAYwEUbyjgYfBe4wZ25pB1MD0=; h=Date:To:From:Reply-To:Subject:From; b=KYylTmXxkmncIluOWLIuqNKTouV4TfFwo04vADoo6JZgN2SvTi0jNNgqybTzhOpwE YVHZjI/carLdnh5+gdscTEFznS7K/PstpeHmVZP+Gl/V/+KvGI3Zu2ojvbaJ9YBUNZ EY/HWdi1vhlK7LhxUDlgGldkNs/l61Y+tzVvHc18= Message-ID: MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.43.16; envelope-from=phodina@protonmail.com; helo=mail-4316.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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" Reply-to: phodina X-ACL-Warn: , phodina via Guix-patches X-Patchwork-Original-From: phodina via Guix-patches via From: phodina X-getmail-retrieved-from-mailbox: Patches --- index 4b57bc1f24..d07ee33a7e 100644 --- 2.31.1 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -123,6 +123,7 @@ #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages polkit) #:use-module (gnu packages readline) #:use-module (gnu packages rrdtool) #:use-module (gnu packages samba) @@ -2479,6 +2480,52 @@ IPv6 packet filter. Both commands are targeted at system administrators.") (license license:gpl2+))) +(define-public bolt + (package + (name "bolt") + (version "0.9.1") + (source (origin + (method git-fetch) + (uri + (git-reference + (url "https://gitlab.freedesktop.org/bolt/bolt") + (commit version))) + (sha256 + (base32 + "1phgp8fs0dlj74kbkqlvfniwc32daz47b3pvsxlfxqzyrp77xrfm")))) + (build-system meson-build-system) + (arguments + `(#:configure-flags (list (string-append "--localstatedir=" (assoc-ref %outputs "out") "/var")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-udev-rules-directory + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (mkdir-p (string-append out "/lib/udev/rules.d")) + (substitute* "meson.build" + (("udev.get_pkgconfig_variable..udevdir..") + (string-append "'" out "/lib'")))#t))) + (add-before 'install 'no-polkit-magic + (lambda* (#:key outputs #:allow-other-keys) + ;; Meson ‘magically’ invokes pkexec, which fails (not setuid). + (setenv "PKEXEC_UID" "something") + #t))))) + (native-inputs `(("pkg-config" ,pkg-config) ("dbus" ,dbus) ("asciidoc" ,asciidoc) ("umockdev" ,umockdev))) + (inputs `(("glib:bin" ,glib "bin") ("eudev" ,eudev) ("polkit" ,polkit))) + (synopsis "Userspace system daemon to enable security levels for Thunderbolt™ +on GNU/Linux®.") + (description "Thunderbolt™ is the brand name of a hardware interface developed by +Intel® that allows the connection of external peripherals to a +computer. +Devices connected via Thunderbolt can be DMA masters and thus read +system memory without interference of the operating system (or even +the CPU). Version 3 of the interface introduced 5 different security +levels, in order to mitigate the aforementioned security risk that +connected devices pose to the system. The security level is set by the +system firmware.") + (home-page "https://gitlab.freedesktop.org/bolt/bolt") + (license license:gpl2+))) + (define-public jitterentropy-rngd (package (name "jitterentropy-rngd") From patchwork Sat Sep 18 11:21:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: phodina X-Patchwork-Id: 33115 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 6526F27BBE1; Sat, 18 Sep 2021 12:22:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 909DB27BBE3 for ; Sat, 18 Sep 2021 12:22:19 +0100 (BST) Received: from localhost ([::1]:54758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRYQE-0001zp-O5 for patchwork@mira.cbaines.net; Sat, 18 Sep 2021 07:22:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRYPy-0001zh-OL for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50408) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRYPy-0007aa-DE for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mRYPy-0002GW-7G for guix-patches@gnu.org; Sat, 18 Sep 2021 07:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49578] [PATCH v3 2/2] services: Add a service for bolt. References: In-Reply-To: Resent-From: phodina Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Sep 2021 11:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Sarah Morgensen Cc: 49578@debbugs.gnu.org Received: via spool by 49578-submit@debbugs.gnu.org id=B49578.16319641108686 (code B ref 49578); Sat, 18 Sep 2021 11:22:02 +0000 Received: (at 49578) by debbugs.gnu.org; 18 Sep 2021 11:21:50 +0000 Received: from localhost ([127.0.0.1]:33721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRYPm-0002G2-3V for submit@debbugs.gnu.org; Sat, 18 Sep 2021 07:21:50 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:24888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mRYPi-0002Fn-Oo for 49578@debbugs.gnu.org; Sat, 18 Sep 2021 07:21:48 -0400 Date: Sat, 18 Sep 2021 11:21:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1631964096; bh=oE0vEhHG58+QeC/+X28zaw2nVFzLSeU+kI4vldvyXfg=; h=Date:To:From:Cc:Reply-To:Subject:From; b=rx6r3negT5aaYkv/0uDSVtzkf2NSXuzKECUK3tkHQ381JCYTNEQa0VZ0E1xPDOkjS +nM+1JF04NBgFAdGJgZ8LHu6qFWlfoa9sgq5RvNZHxqYFY/QWVzWD/9R4Enk1t9SFI j3ZN2AYdb2lBF96vkI8rYx8GER6aSKrUbFADUJQc= Message-ID: <7hJPvaldH4Bh7rtXByW9GPmxh-s8a1TCz9icV0mkcF6MLy5zRWlgrcruWWbl2KcenTOrIsL89cDh36eBRLrjKa6y53p8a8weWTQpSenjCHE=@protonmail.com> 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" Reply-to: phodina X-ACL-Warn: , phodina via Guix-patches X-Patchwork-Original-From: phodina via Guix-patches via From: phodina X-getmail-retrieved-from-mailbox: Patches * gnu/services/linux.scm (bolt-service-type) (bolt-shepherd-service, bolt-dbus-service) (bolt-configuration, bolt-configuration?): New procedures. ;;; ;;; Early OOM daemon. --- 2.32.0 diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 2eb02ac5a3..dc26f285bf 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2020 Efraim Flashner ;;; Copyright © 2021 raid5atemyhomework ;;; Copyright © 2021 B. Wilson +;;; Copyright © 2021 Petr Hodina ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,7 +25,9 @@ #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) + #:use-module (gnu system shadow) #:use-module (gnu services) + #:use-module (gnu services dbus) #:use-module (gnu services base) #:use-module (gnu services shepherd) #:use-module (gnu packages linux) @@ -33,7 +36,11 @@ #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (ice-9 match) - #:export (earlyoom-configuration + #:export (bolt-configuration + bolt-configuration? + bolt-service-type + + earlyoom-configuration earlyoom-configuration? earlyoom-configuration-earlyoom earlyoom-configuration-minimum-available-memory @@ -61,6 +68,76 @@ zram-device-configuration-priority zram-device-service-type)) + +;;; +;;; Thunderbolt daemon. +;;; + +(define-record-type* + bolt-configuration make-bolt-configuration bolt-configuration? + (package bolt-configuration-package ; package + (default bolt))) + +(define bolt-shepherd-service + (match-lambda + (($ package) + (with-imported-modules (source-module-closure + '((gnu build shepherd))) + (shepherd-service + (documentation "Thunderbolt daemon") + (provision '(thunderbolt)) + (requirement '(networking)) + (modules '((gnu build shepherd))) + (start #~(make-forkexec-constructor/container + (list #$(file-append package "/libexec/boltd")) + )) + (stop #~(make-kill-destructor))))))) + +(define %bolt-activation + #~(begin + (use-modules (guix build utils)) + (mkdir-p "/var/lib/boltd"))) + +(define (bolt-dbus-service config) + (list (wrapped-dbus-service (bolt-configuration-bolt config) + "libexec/boltd" + `(("BOLT_CONF_FILE_NAME" + '("share/dbus-1/interfaces/org.freedesktop.bolt.xml")))))) + +(define %bolt-accounts + (list (user-group (name "boltd") (system? #t)) + (user-account + (name "boltd") + (group "boltd") + (system? #t) + (comment "Boltd daemon user") + (home-directory "/var/empty") + (shell "/run/current-system/profile/sbin/nologin")))) + +(define bolt-udev-rule + (match-lambda + (($ package) + (file->udev-rule "90-bolt.rules" (file-append package "/lib/udev/rules.d/90-bolt.rules"))))) + +(define bolt-service-type + (service-type + (name 'boltd) + (description + "Thunderbolt daemon") + (extensions + (list (service-extension udev-service-type + (compose list bolt-udev-rule)) + (service-extension activation-service-type + (const %bolt-activation)) + (service-extension dbus-root-service-type + (compose list bolt-configuration-package)) + ; bolt-dbus-service) + (service-extension account-service-type + (const %bolt-accounts)) + (service-extension shepherd-root-service-type + (compose list bolt-shepherd-service)))) + (default-value (bolt-configuration)))) +