From patchwork Thu Mar 30 12:52:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6752 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PnNcW0985z3x2l for ; Thu, 30 Mar 2023 12:52:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PnNcV1mHVzc6; Thu, 30 Mar 2023 12:52:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PnNcV0rFZz2xSf; Thu, 30 Mar 2023 12:52:42 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PnNcS1YRMz2xnV for ; Thu, 30 Mar 2023 12:52:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4PnNcR3bqvzc6; Thu, 30 Mar 2023 12:52:39 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1680180759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9cVxIebG6aOHur1lgkohzBMmw1Q6kJ57p2GU0rIGQmk=; b=M1/7EmuVk/xJJOJ+3Skqm1AmN6F6swveFLxKQM0K8a+f2bAsgQgmVTozY7SXLAiZptXRi9 9An6I1ky83mCNgAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1680180759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=9cVxIebG6aOHur1lgkohzBMmw1Q6kJ57p2GU0rIGQmk=; b=U1y7afdoDPpXT7LnQFURjbe5nKRzGBHzulW2Nfu1tr+6dzkG791eyozXD78zLc6wV3cKq4 SkHp1yLgCewyYIT6JtpItrXop9yqK/ggWzOQ9D820KdZUpWIELmmhGSvC7Szgl1hPfPpRo WthRDh/s4q4NCxtmceiwCzWgY1R1UoRVRpmmge98g8yPWmZAZP4QpP89rnTcibGna5L2HD n7xmvsrlW3cmCpJ5jbo9Du3vjDg2peIetYn33AUB/sDsI4OxSjj2zDnfO4Lb4QC5qM0u1y xnm4aXDIRSz7KA18ADvwlHD+kFMlfCNC/ndCGjmwVXlJv6gXYySCWZWOIqFOXg== From: Stefan Schantl To: pakfire@lists.ipfire.org Subject: [PATCH 1/2] macros: Add macro to automatically install all systemd sysusers files Date: Thu, 30 Mar 2023 14:52:29 +0200 Message-Id: <20230330125230.11184-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: pakfire@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Mailinglist for the Pakfire Build System." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pakfire-bounces@lists.ipfire.org Sender: "Pakfire" This macros works very similar than the tmpfiles one but handles sysusers files. Signed-off-by: Stefan Schantl --- macros/systemd.macro | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/macros/systemd.macro b/macros/systemd.macro index 9dc74ff0..1453db95 100644 --- a/macros/systemd.macro +++ b/macros/systemd.macro @@ -1,5 +1,6 @@ SYSTEMD_TMPFILES_DIR = /usr/lib/tmpfiles.d +SYSTEMD_SYSUSERS_DIR = /usr/lib/sysusers.d MACRO_INSTALL_SYSTEMD_FILES for file in %{DIR_SOURCE}/systemd/*; do @@ -19,3 +20,12 @@ MACRO_INSTALL_SYSTEMD_TMPFILES done unset file end + +MACRO_INSTALL_SYSTEMD_SYSUSERS + for file in %{DIR_SOURCE}/*.sysusers; do + [ -e "${file}" ] || continue + mkdir -p %{BUILDROOT}/%{SYSTEMD_SYSUSERS_DIR} + cp -vf ${file} %{BUILDROOT}/%{SYSTEMD_SYSUSERS_DIR}/$(basename ${file%*.sysusers}).conf + done + unset file +end From patchwork Thu Mar 30 12:52:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6753 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4PnNcW15b5z3xDG for ; Thu, 30 Mar 2023 12:52:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4PnNcV3FSfzv6; Thu, 30 Mar 2023 12:52:42 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4PnNcV15Qmz30Gq; Thu, 30 Mar 2023 12:52:42 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4PnNcS4FMrz2xnV for ; Thu, 30 Mar 2023 12:52:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4PnNcS1qzgzcL; Thu, 30 Mar 2023 12:52:40 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1680180760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+jCFnaf7zncIJlMdIDBLTlJRnWK1/Hqh7zXvZmtUXeY=; b=Z8k7tow0Q6YulRuXpICwfqLt+E7WvxF6KEES/OxGkaKKbsagv8+97JiesUX6Ggt67gXtb7 1MCW/9UreZ2ooyBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1680180760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+jCFnaf7zncIJlMdIDBLTlJRnWK1/Hqh7zXvZmtUXeY=; b=bjbToMCjDgASgd70A8yht8uT85D8BSz9S724ukIc/HQIBwO2kntkiPl3J0LrmnOCLztvN5 i2HPOo2OzU5m15lZsub8wIWUCzcSoWn6mzfplCc3i0CzhoweZ6PXNnQbqfGltEiXnkU2Sv KhRxJc6U8W/ZHbkgTJHLEHuZhfIZZpjijUcH1zbZfZ5WndwyDo2ymNy1k0LKoc9+wOMX1q OLs9p5Rg45Lblo3pa4aL9n7dNk8okUbwM8obGtiwvWQajdxuEi4gMiDePqJslIUq1iJd8C G/pRnHUzaMQ4jTt5SbsjWFCFQxecdvfUy+Izyh5NUTM3Nmac5KYWIlK0TBZ1hA== From: Stefan Schantl To: pakfire@lists.ipfire.org Subject: [PATCH 2/2] macros: Add macro to apply sysusers based users/groups inside the jail Date: Thu, 30 Mar 2023 14:52:30 +0200 Message-Id: <20230330125230.11184-2-stefan.schantl@ipfire.org> In-Reply-To: <20230330125230.11184-1-stefan.schantl@ipfire.org> References: <20230330125230.11184-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: pakfire@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Mailinglist for the Pakfire Build System." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: pakfire-bounces@lists.ipfire.org Sender: "Pakfire" This macro can be called inside a build file and easily allows to apply any kind of users/groups specified in a sysusers file. Signed-off-by: Stefan Schantl --- macros/systemd.macro | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/macros/systemd.macro b/macros/systemd.macro index 1453db95..27231094 100644 --- a/macros/systemd.macro +++ b/macros/systemd.macro @@ -2,6 +2,17 @@ SYSTEMD_TMPFILES_DIR = /usr/lib/tmpfiles.d SYSTEMD_SYSUSERS_DIR = /usr/lib/sysusers.d +MACRO_APPLY_SYSTEMD_SYSUSERS + mkdir -pv %{SYSTEMD_SYSUSERS_DIR} + + for file in %{DIR_SOURCE}/*.sysusers; do + [ -e "${file}" ] || continue + cat ${file} | \ + systemd-sysusers --replace=%{SYSTEMD_SYSUSERS_DIR}/$(basename ${file%*.sysusers}).conf - + done + unset file +end + MACRO_INSTALL_SYSTEMD_FILES for file in %{DIR_SOURCE}/systemd/*; do [ -e "${file}" ] || continue