From patchwork Thu May 16 21:01:45 2024 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: 27541 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 EB1CD27BBEA; Thu, 16 May 2024 22:03:09 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 DB9E527BBE2 for ; Thu, 16 May 2024 22:03:08 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7iFh-000525-O7; Thu, 16 May 2024 17:03:01 -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 1s7iFg-00051L-1h for guix-patches@gnu.org; Thu, 16 May 2024 17:03:00 -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 1s7iFf-0002Va-M6 for guix-patches@gnu.org; Thu, 16 May 2024 17:02:59 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s7iFi-00042D-1s for guix-patches@gnu.org; Thu, 16 May 2024 17:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70992] [PATCH] services: nscd: Enable =?utf-8?b?4oCYcGFzc3dk?= =?utf-8?b?4oCZ?= and =?utf-8?b?4oCYZ3JvdXDigJk=?= caches by default. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 May 2024 21:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70992 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70992@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171589334715481 (code B ref -1); Thu, 16 May 2024 21:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 16 May 2024 21:02:27 +0000 Received: from localhost ([127.0.0.1]:50988 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7iF8-00041d-QJ for submit@debbugs.gnu.org; Thu, 16 May 2024 17:02:27 -0400 Received: from lists.gnu.org ([209.51.188.17]:55710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s7iF6-00041R-OV for submit@debbugs.gnu.org; Thu, 16 May 2024 17:02:25 -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 1s7iF3-0004po-Qq for guix-patches@gnu.org; Thu, 16 May 2024 17:02:22 -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 1s7iF2-0002Lt-IQ; Thu, 16 May 2024 17:02:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=T5F33nfKtE6ebjq3kWuAql7F+XF6JQR0uBHUoLvlkn4=; b=WVKZJVg/MB08LS LyE8T72bJU6KVlXa+AfmDFvSb/UT0CIWNTeLd33Gz8s2o7zoeuZJXtCrpliEIChV6ByfQmGujryVW 7udEvTBuq2cKN+c7ab4anNS8uaDA+/K8qYUJACcr7GcmhBMsAszbyW5u1icAVgt2UvlHZlil+qgXE 3lzEmX92eCWbrkArx21Emq98Mi52etBBRfRvbYDENcRs8BDl/9kTeoRHagc8uhUZduUqISqgcXtWy i0CGkYIPQSbxD3N6dK+0RulV0A2aEoHQwEbVjGc8X2CBk6RP2mZN0qbpZwWvu1QeoVNczaUeXv0md hQxSvEXOKEpamr1NFOaQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 16 May 2024 23:01:45 +0200 Message-ID: <7942e1351315694f0c6675a702f4153fd83cadc3.1715893079.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 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 From: Ludovic Courtès This allows users to specify NSS plugins such as LDAP via the ‘name-services’ field of . Failing that, user code will dlopen whatever passwd/group plugins are listed in /etc/nsswitch.conf, which is likely to fail, typically because those are not in $LD_LIBRARY_PATH. * gnu/services/base.scm (%nscd-default-caches): Add ‘passwd’ and ‘group’ caches. Change-Id: I9c03346a1de2710685f7801eccd2e08007427f5d --- gnu/services/base.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) Hi! I realized by looking at ‘strace id’ that our nscd instance was replying negatively to passwd and group lookups (to my surprise). Turns out we need to explicitly enable caching of a database in nscd.conf if we want nscd to honor lookups for that database. We really need nscd to honor passwd/group lookups if we want to support NSS plugins like LDAP or sss. (Now I realize that this is something Jean-François et al. probably experienced with their OpenLDAP service at .) Thoughts? Ludo’. base-commit: 58be9a79e2862d5fa9842d73f498ce2e5442b9ce diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 85160bd3abb..15f3807efcc 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1340,7 +1340,22 @@ (define %nscd-default-caches (positive-time-to-live (* 3600 24)) (negative-time-to-live 3600) (check-files? #t) ;check /etc/services changes - (persistent? #t)))) + (persistent? #t)) + + ;; Enable minimal caching of the user databases, not so much for + ;; caching but rather to allow that uses of NSS plugins like LDAP + ;; don't lead user processes to dlopen them (which is likely to fail + ;; due to them not being found in $LD_LIBRARY_PATH). + (nscd-cache (database 'passwd) + (positive-time-to-live 600) + (negative-time-to-live 20) + (check-files? #t) ;check /etc/passwd changes + (persistent? #f)) + (nscd-cache (database 'group) + (positive-time-to-live 600) + (negative-time-to-live 20) + (check-files? #t) ;check /etc/group changes + (persistent? #f)))) (define-deprecated %nscd-default-configuration #f