From patchwork Thu May 11 11:15:42 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: 49934 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 B232327BBF0; Thu, 11 May 2023 12:16:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 630E727BBED for ; Thu, 11 May 2023 12:16:18 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1px4HH-0000Iz-6C; Thu, 11 May 2023 07:16:07 -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 1px4HC-0000IG-US for guix-patches@gnu.org; Thu, 11 May 2023 07:16:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1px4HC-0008Dq-Ks for guix-patches@gnu.org; Thu, 11 May 2023 07:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1px4HC-0007md-Gd for guix-patches@gnu.org; Thu, 11 May 2023 07:16:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63314] [PATCH v2 1/2] system: pam: Let PAM extensions add shepherd requirements. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 May 2023 11:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63314 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Josselin Poiret Cc: 63314@debbugs.gnu.org Received: via spool by 63314-submit@debbugs.gnu.org id=B63314.168380375429898 (code B ref 63314); Thu, 11 May 2023 11:16:02 +0000 Received: (at 63314) by debbugs.gnu.org; 11 May 2023 11:15:54 +0000 Received: from localhost ([127.0.0.1]:49867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px4H4-0007m9-8S for submit@debbugs.gnu.org; Thu, 11 May 2023 07:15:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34014) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1px4H2-0007ls-GA for 63314@debbugs.gnu.org; Thu, 11 May 2023 07:15:52 -0400 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 1px4Gw-00087Z-VA; Thu, 11 May 2023 07:15:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=FtC54X3BQTOUWYJJ2+XwGCozTbIUTOGn9PMcvuurEDY=; b=GfxE0YVyXhz/HTgDeMOl SvgEQc1P1EWe+aGa+X1fr20ozhotKXxENXyn0ivMyKY5CgmaksBhCDKeh354h1MGe2zWuZVNDOQdg GH7kE7Ek+SXocYcnqtTvokwuuH7zrB8/c2kX+TGGaOaOzQKKbx3gapQelYmw1SvmMj0QUbPR3AMI/ eeHXFnzFQ7cFHynrGbFUS9u4+1bqIIl5KbzH+McVOKmzUgt3MJ2DjcPY6M4neje8P1UFhKLanSfUS mlOI8p+ir+mpX/nBwkUIikNS4ovlJ3IqZ2BKJ0YKitoOJKY0A+yROuYeaNcU1fRCzFFPsCWEhGQtn iJiJyNw+Qf9BWw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1px4Gu-0001xU-84; Thu, 11 May 2023 07:15:46 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= References: <9371fcad4037f991a3c003f550c8c080f15271f6.1683650554.git.dev@jpoiret.xyz> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 22 =?utf-8?q?Flor=C3=A9al?= an 231 de la =?utf-8?b?UsOpdm9sdXRpb24s?= jour de la Fritillaire X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 11 May 2023 13:15:42 +0200 In-Reply-To: <9371fcad4037f991a3c003f550c8c080f15271f6.1683650554.git.dev@jpoiret.xyz> (Josselin Poiret's message of "Tue, 9 May 2023 18:45:07 +0200") Message-ID: <8735435db5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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 Hi, Josselin Poiret skribis: > From: Josselin Poiret > > * gnu/system/pam.scm (): New record type. > (pam-shepherd-service): Add Shepherd synchronization point. > > * gnu/services/mail.scm (dovecot-shepherd-service) > * gnu/services/lightdm.scm (lightdm-shepherd-service) > * gnu/services/mail.scm (opensmtpd-shepherd-service) > * gnu/services/sddm.scm (sddm-shepherd-service) > * gnu/services/ssh.scm (lsh-shepherd-service, openssh-shepherd-service) > * gnu/services/xorg.scm (slim-shepherd-service, gdm-shepherd-service) > * gnu/services/base.scm (greetd-shepherd-services): Add PAM requirement. > > * gnu/system/pam.scm (/etc-entry, extend-configuration, > pam-root-service-type, pam-root-service) > * gnu/services/authentication.scm (pam-ldap-pam-service) > * gnu/services/base.scm (pam-limits-service-type) > (greetd-pam-service) > * gnu/services/desktop.scm (pam-gnome-keyring) > * gnu/services/kerberos.scm (pam-krb5-pam-service) > * gnu/services/pam-mount.scm (pam-mount-pam-service): Adapt to use > pam-extension. Excellent! I committed with the cosmetic changes below: Ludo’. diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm index f624064999..adc40c975f 100644 --- a/gnu/system/pam.scm +++ b/gnu/system/pam.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013-2017, 2019-2021 Ludovic Courtès +;;; Copyright © 2023 Josselin Poiret ;;; ;;; This file is part of GNU Guix. ;;; @@ -354,9 +355,9 @@ (define (session-environment-service vars) ;;; PAM root service. ;;; -;; A PAM transformer consists of a procedure acting on each PAM entry, with an -;; additional list of shepherd-requirements that the meta PAM shepherd service -;; will depend on. +;; Extension of the PAM configuration. A PAM transformer consists of a +;; procedure acting on each PAM entry; 'shepherd-requirements' lists services +;; that the meta 'pam' Shepherd service will depend on. (define-record-type* pam-extension make-pam-extension pam-extension? (transformer pam-extension-transformer) @@ -380,12 +381,8 @@ (define (/etc-entry config) "Return the /etc/pam.d entry corresponding to CONFIG." (match config (($ services transformers shepherd-requirements) - (let ((services - (map - ;; XXX We need to add identity because compose expects at least - ;; one argument for some reason. - (apply compose (cons identity transformers)) - services))) + (let ((services (map (apply compose identity transformers) + services))) `(("pam.d" ,(pam-services->directory services))))))) (define (pam-shepherd-service config) @@ -404,16 +401,15 @@ (define (extend-configuration initial extensions) "Extend INITIAL with NEW." ;; TODO: Remove deprecation shim. (define cleaned-extensions - (map - (lambda (ext) - (cond - ((procedure? ext) - (begin - (warning (G_ "pam-root-service-type transformer extensions should\ -now use the record.")) - (pam-extension (transformer ext)))) - (#t ext))) - extensions)) + (map (lambda (ext) + (if (procedure? ext) + (begin + (warning (G_ "'pam-root-service-type' extensions should \ +now use the record~%")) + (pam-extension (transformer ext))) + ext)) + extensions)) + (let-values (((services pam-extensions) (partition pam-service? cleaned-extensions))) (pam-configuration