From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id uBtQDv6aWWRV3gAASxT56A (envelope-from ) for ; Tue, 09 May 2023 02:59:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EAdeDf6aWWSXGgAAG6o9tA (envelope-from ) for ; Tue, 09 May 2023 02:59:42 +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 EB3B22E57A for ; Tue, 9 May 2023 02:59:41 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwBh3-0004ec-HM; Mon, 08 May 2023 20:59: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 1pwBh0-0004e0-Pu for guix-patches@gnu.org; Mon, 08 May 2023 20:59:03 -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 1pwBh0-0002KI-HO for guix-patches@gnu.org; Mon, 08 May 2023 20:59:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwBh0-00065T-Cs for guix-patches@gnu.org; Mon, 08 May 2023 20:59:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63383] [PATCH 2/4] Drop limits.conf from /etc/security; use directly in pam-limits-service-type. Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 May 2023 00:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63383 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63383@debbugs.gnu.org Cc: Felix Lechner Received: via spool by 63383-submit@debbugs.gnu.org id=B63383.168359390223307 (code B ref 63383); Tue, 09 May 2023 00:59:02 +0000 Received: (at 63383) by debbugs.gnu.org; 9 May 2023 00:58:22 +0000 Received: from localhost ([127.0.0.1]:41964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwBgL-00063q-Or for submit@debbugs.gnu.org; Mon, 08 May 2023 20:58:22 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]:34338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwBgJ-00063S-LX for 63383@debbugs.gnu.org; Mon, 08 May 2023 20:58:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=cX9d0wMejgWBq2w lnxu8JRYxnDXwoWc1jZF+JmagTuI=; h=references:in-reply-to:date:subject: cc:to:from; d=lease-up.com; b=X+TEpieMyp4NdMLbpZQ76tuuXJ/20U8P/rTw7e6x PVmfpLozVp/KL+KljhWllQenaZY4xGVH/dzkBEih2OyUKn1p2MJFcoWQ26KdHFLY1hnw4u 2mcR1vjMEqETLxBBT4W/suKhDG4+paCs9HN5bWEgtmeAevdbEfNRodPCMbJEY= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id e545b596 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Tue, 9 May 2023 00:58:18 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 1957fc71; Tue, 9 May 2023 00:58:18 +0000 (UTC) Date: Mon, 8 May 2023 17:58:07 -0700 Message-Id: <02c2307e7a2d256b6d2da12a8c3ac4a9bfa390b0.1683593547.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 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: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches From: Felix Lechner 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683593982; a=rsa-sha256; cv=none; b=ZEsigjNdS0qS8PN+stwcDxcF7NrNfYVFQlhlvus0CC8yRUa5S5cm+cJYt7xAHy3+rLHV8e l3fCnKOLorteVvtKd3kqx6cXo2Ze+TUHBE4nwyv0jZ3hntZJcE/FMHYaoZyW75eW+ByjAt QbYbT5lWmcKdevWDq0l7P68Oybkg+t/c0JAOIf7A34ypldc8NhrA7EovSVLBsB2+FGW21s +cH1leLD8x5BXMj9x9uUGTixCN3FPXyoWqo/IJ9pbQAXe2lO7mkmCrMZD3U002gjWUVdBs BRsWl7hh/DKS0f5lpBHisI7zknXJsFMG2R3AyV8qeD0l4F3kLNK2xufzQRohCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=X+TEpieM; 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=1683593982; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=M9BTpkTzO/z0lMVGPYLe/TmgVW56AA9XsQewZ2JgWVk=; b=rldEdYdhMJka/7ZLZhlQyWDJM7lSmOuXiAdgurFmV1Cueqp9lqQBAfzdSCLYXBFbFeKxSb IlqCTnfeao1RhUdmL+YbdvkYLBfuCkWrlQiw81+CUAP9pP9wrwsK1FpJAVGT5hv/YEAdIl 7dQAIfdwmus2ABNMZ3DRdRcsmSu3sDEBCLre2IVA9bO2o9m2khRnE99AQywPCGCfWZicoO iiCsrIynaQNqhr6lFxq+vBijwj/VudTTi0018RKJ9oMZDxbcsHL15mEG9S/xM6XsaH9XFi 4Y03roxRThnCJS5RcD8+868+n1rwl4i0NelxNIRIpPSQ1ekWXLMIdmcZeqXzyA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lease-up.com header.s=2017 header.b=X+TEpieM; 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" X-Migadu-Spam-Score: -1.69 X-Spam-Score: -1.69 X-Migadu-Queue-Id: EB3B22E57A X-TUID: 8NNpo9TI68jG This commit was tested and is already deployed in production. * gnu/services/base.scm: Drop config file limits.conf from /etc; use absolute path in store instead. --- gnu/services/base.scm | 59 ++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 4adb551796..16dcc55483 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1608,36 +1608,34 @@ (define-deprecated (syslog-service #:optional (config (syslog-configuration))) (define pam-limits-service-type (let ((pam-extension - (lambda (pam) - (let ((pam-limits (pam-entry - (control "required") - (module "pam_limits.so") - (arguments - '("conf=/etc/security/limits.conf"))))) - (if (member (pam-service-name pam) - '("login" "greetd" "su" "slim" "gdm-password" "sddm" - "sudo" "sshd")) - (pam-service - (inherit pam) - (session (cons pam-limits - (pam-service-session pam)))) - pam)))) - - ;; XXX: Using file-like objects is deprecated, use lists instead. - ;; This is to be reduced into the list? case when the deprecated - ;; code gets removed. - ;; Create /etc/security containing the provided "limits.conf" file. - (security-limits + (lambda (limits-file) + (lambda (pam) + (let ((pam-limits (pam-entry + (control "required") + (module "pam_limits.so") + (arguments + (list #~(string-append "conf=" #$limits-file)))))) + (if (member (pam-service-name pam) + '("login" "greetd" "su" "slim" "gdm-password" "sddm" + "sudo" "sshd")) + (pam-service + (inherit pam) + (session (cons pam-limits + (pam-service-session pam)))) + pam))))) + (make-limits-file (match-lambda + ;; XXX: Using file-like objects is deprecated, use lists instead. + ;; This is to be reduced into the list? case when the deprecated + ;; code gets removed. ((? file-like? obj) (warning (G_ "Using file-like value for \ 'pam-limits-service-type' is deprecated~%")) - `(("security/limits.conf" ,obj))) + obj) ((? list? lst) - `(("security/limits.conf" - ,(plain-file "limits.conf" - (string-join (map pam-limits-entry->string lst) - "\n" 'suffix))))) + (plain-file "limits.conf" + (string-join (map pam-limits-entry->string lst) + "\n" 'suffix))) (_ (raise (formatted-message (G_ "invalid input for 'pam-limits-service-type'~%"))))))) @@ -1645,13 +1643,12 @@ (module "pam_limits.so") (service-type (name 'limits) (extensions - (list (service-extension etc-service-type security-limits) - (service-extension pam-root-service-type - (lambda _ (list pam-extension))))) + (list (service-extension pam-root-service-type + (lambda (config) + (list (pam-extension (make-limits-file config))))))) (description - "Install the specified resource usage limits by populating -@file{/etc/security/limits.conf} and using the @code{pam_limits} -authentication module.") + "Use the @code{pam_limits} authentication module to set the specified +resource usage limits.") (default-value '())))) (define-deprecated (pam-limits-service #:optional (limits '())) -- 2.39.2