From owner-freebsd-arch@freebsd.org Fri Sep 9 20:04:43 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37ABABD4FBA; Fri, 9 Sep 2016 20:04:43 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC23DC86; Fri, 9 Sep 2016 20:04:42 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.15.2/8.15.2) with ESMTP id u89K4e1H048508; Fri, 9 Sep 2016 16:04:40 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.15.2/8.14.4/Submit) id u89K4eDu048507; Fri, 9 Sep 2016 16:04:40 -0400 (EDT) (envelope-from wollman) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <22483.5592.653250.726711@hergotha.csail.mit.edu> Date: Fri, 9 Sep 2016 16:04:40 -0400 From: Garrett Wollman To: freebsd-arch@freebsd.org, freebsd-security@freebsd.org Subject: Trying to think out a hack for NSS and pw(8) X-Mailer: VM 8.2.0b under 24.5.1 (amd64-portbld-freebsd10.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (hergotha.csail.mit.edu [127.0.0.1]); Fri, 09 Sep 2016 16:04:40 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, HEADER_FROM_DIFFERENT_DOMAINS autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hergotha.csail.mit.edu X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 20:04:43 -0000 Presently, we have a bunch of machines under configuration management (using Puppet, but that's not really relevant here). I'm hoping to implement LDAP via nsswitch on these machines, but I've run into an issue: the standard getpw*(3) mechanisms can't tell the difference between users or groups in the local databases and those in the remote LDAP database. We need Puppet to manage entries for users and groups in the local database, without respect to what entries might be imported from LDAP (because they are supposed to override the data returned by LDAP). Puppet invokes pw(8) to actually perform the modifications, but I suspect it also uses native code from the Ruby standard library to actually do pre-modification lookups. Looking at the code in both nss-pam-ldapd and libc, it seems like the only plausible way to fix this is to add functionality to nsswitch which would allow it to use different configurations depending on the identity of the process invoking getpwnam(3) or getgrnam(3). Does anyone have opinions on how this ought to be implemented, or indeed how it could be implemented securely? (As a side issue, the net/nss-pam-ldapd port completely ignores account expiration dates. This bug is due to the fact that Linux has this ships-in-the-night "shadow" mechanism, getspent(3), rather than having it integrated in getpwent(3) like it should be, but the ultimate upshot is that if you're using nss-pam-ldapd you can't rely on shadowExpire attributes in the directory actually have an effect on FreeBSD. I'll open a bugzilla issue about this.) -GAWollman From owner-freebsd-arch@freebsd.org Fri Sep 9 20:18:30 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54522BD2476; Fri, 9 Sep 2016 20:18:30 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 21141399; Fri, 9 Sep 2016 20:18:29 +0000 (UTC) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id DDD80273D6; Fri, 9 Sep 2016 20:13:04 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTP id u89KD2bK067594; Fri, 9 Sep 2016 20:13:03 GMT (envelope-from phk@phk.freebsd.dk) To: Garrett Wollman cc: freebsd-arch@freebsd.org, freebsd-security@freebsd.org Subject: Re: Trying to think out a hack for NSS and pw(8) In-reply-to: <22483.5592.653250.726711@hergotha.csail.mit.edu> From: "Poul-Henning Kamp" References: <22483.5592.653250.726711@hergotha.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <67592.1473451982.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Fri, 09 Sep 2016 20:13:02 +0000 Message-ID: <67593.1473451982@critter.freebsd.dk> X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 20:18:30 -0000 -------- In message <22483.5592.653250.726711@hergotha.csail.mit.edu>, Garrett Woll= man w rites: > Puppet invokes pw(8) to actually perform the >modifications, but I suspect it also uses native code from the Ruby >standard library to actually do pre-modification lookups. >[...] >Looking at the code in both nss-pam-ldapd and libc, it seems like the >only plausible way to fix this is to add functionality to nsswitch >which would allow it to use different configurations depending on the >identity of the process invoking getpwnam(3) or getgrnam(3). You want to add a futher layer of complications to the the already far too complicated user/group/authentication code in FreeBSD, just because you don't want to look at Puppets Ruby code ? Really ? -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-freebsd-arch@freebsd.org Fri Sep 9 21:07:21 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7EEFBD40DC for ; Fri, 9 Sep 2016 21:07:21 +0000 (UTC) (envelope-from pioto@pioto.org) Received: from mail-ua0-x22a.google.com (mail-ua0-x22a.google.com [IPv6:2607:f8b0:400c:c08::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C84F99 for ; Fri, 9 Sep 2016 21:07:21 +0000 (UTC) (envelope-from pioto@pioto.org) Received: by mail-ua0-x22a.google.com with SMTP id u68so78565252uau.1 for ; Fri, 09 Sep 2016 14:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pioto-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=DlX2UyuyLpPEyQVThK+KU3EAR7e4hjv3As8/IxqclHM=; b=WdsJhLGfs/LkJQr5qFfWq9kJMeh0uvQsarA4JYM7ehnSPvrSwWcKNZ3/DluYbnxqJn kYfkYRTvLohc9G6lwHdz2lAjb1rh72Gcr5ZJ1/8F1VwosbQlkGOrmoKsZWmvhn2Un++U IOTTj1jpEYgn2OBAqWDx5fpjqnlQzCyoQvklt03seqxXes8eUfrn7jCYEuPxUvHBA3fJ KnWa+KXQ/5yRzqDghsaX9UiX0GXAEJ4HowkyL2KGdJctqzsB1zPLJYkFD+qH4MIa9jU+ ZXS8V5DwdUePWX3K/wf7iqgEHuJ7Z4gNKeA+V3PXCBdKJLa6CNrEVrcl2ED8VOVndM2T uEPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=DlX2UyuyLpPEyQVThK+KU3EAR7e4hjv3As8/IxqclHM=; b=OAcl1NFpxy6gfPe+jAWugDO+Aqt/8y9qUZEPLtswtSe0Xsk1wV+UXRmvrmZ2NpKohA pSx3SawE+x6kY69ELm45xQsOAupUuS7Wdf5FuIK7NT7yTqbvGPowP6b1IgBYWbndlyIJ 1xeNSQzXeUTuHLNsfY8Y2OGGqGH773hMJPuaM0S1IbmxQ0ePiq9OmuOr1+NFQQnjTjoE J4+IcnYhGI6A9ZHx+ukQUaTHppn0d4LKT7t2sENpc+044xj8XyR5MLCcroh/zjeDjH6P GG6H2xmlXKWnfkNuN6ZyACsOXgzMb5A+UMF3UdDFSaZPJrC9QNCpHEkiToaVeBg9+YSd eDKw== X-Gm-Message-State: AE9vXwP+9sHKr0AMfaG6F5/9zFZJwbG7Iw80lmXCU6Auro8FUnuM84LOmMEZbcCSbyaEm8L91HjbQw6CJFmsVQ== X-Received: by 10.176.65.34 with SMTP id j31mr3505623uad.139.1473455240448; Fri, 09 Sep 2016 14:07:20 -0700 (PDT) MIME-Version: 1.0 References: <22483.5592.653250.726711@hergotha.csail.mit.edu> In-Reply-To: <22483.5592.653250.726711@hergotha.csail.mit.edu> From: Mike Kelly Date: Fri, 09 Sep 2016 21:07:10 +0000 Message-ID: Subject: Re: Trying to think out a hack for NSS and pw(8) To: Garrett Wollman , freebsd-arch@freebsd.org, freebsd-security@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 21:07:21 -0000 You may find that the best way to handle this is to disable enumeration of your LDAP users in NSS. For example, if you're using sssd for your LDAP NSS & PAM provider, it is, in fact, disabled by default. This means that calls to getpwent(3) will only end up enumerating the users in your local files, and not those in LDAP. But, calls to getpwnam(3), getpwuid(3), etc will return the details of a specific username or user id, even if it's only present in LDAP. On Fri, Sep 9, 2016 at 4:11 PM Garrett Wollman wrote: > Presently, we have a bunch of machines under configuration management > (using Puppet, but that's not really relevant here). I'm hoping to > implement LDAP via nsswitch on these machines, but I've run into an > issue: the standard getpw*(3) mechanisms can't tell the difference > between users or groups in the local databases and those in the remote > LDAP database. We need Puppet to manage entries for users and groups > in the local database, without respect to what entries might be > imported from LDAP (because they are supposed to override the data > returned by LDAP). Puppet invokes pw(8) to actually perform the > modifications, but I suspect it also uses native code from the Ruby > standard library to actually do pre-modification lookups. > > Looking at the code in both nss-pam-ldapd and libc, it seems like the > only plausible way to fix this is to add functionality to nsswitch > which would allow it to use different configurations depending on the > identity of the process invoking getpwnam(3) or getgrnam(3). Does > anyone have opinions on how this ought to be implemented, or indeed > how it could be implemented securely? > > (As a side issue, the net/nss-pam-ldapd port completely ignores > account expiration dates. This bug is due to the fact that Linux has > this ships-in-the-night "shadow" mechanism, getspent(3), rather than > having it integrated in getpwent(3) like it should be, but the > ultimate upshot is that if you're using nss-pam-ldapd you can't rely > on shadowExpire attributes in the directory actually have an effect on > FreeBSD. I'll open a bugzilla issue about this.) > > -GAWollman > > _______________________________________________ > freebsd-security@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-security > To unsubscribe, send any mail to "freebsd-security-unsubscribe@freebsd.org > " > -- Mike Kelly From owner-freebsd-arch@freebsd.org Sat Sep 10 03:28:46 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17418BD4CE5; Sat, 10 Sep 2016 03:28:46 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1E25637; Sat, 10 Sep 2016 03:28:45 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.15.2/8.15.2) with ESMTP id u8A3ShIM053044; Fri, 9 Sep 2016 23:28:43 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.15.2/8.14.4/Submit) id u8A3Sgc7053042; Fri, 9 Sep 2016 23:28:42 -0400 (EDT) (envelope-from wollman) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <22483.32234.747577.586530@hergotha.csail.mit.edu> Date: Fri, 9 Sep 2016 23:28:42 -0400 From: Garrett Wollman To: "Poul-Henning Kamp" Cc: freebsd-security@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Trying to think out a hack for NSS and pw(8) In-Reply-To: <67593.1473451982@critter.freebsd.dk> References: <22483.5592.653250.726711@hergotha.csail.mit.edu> <67593.1473451982@critter.freebsd.dk> X-Mailer: VM 8.2.0b under 24.5.1 (amd64-portbld-freebsd10.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (hergotha.csail.mit.edu [127.0.0.1]); Fri, 09 Sep 2016 23:28:43 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED, HEADER_FROM_DIFFERENT_DOMAINS autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hergotha.csail.mit.edu X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2016 03:28:46 -0000 < said: > You want to add a futher layer of complications to the the already > far too complicated user/group/authentication code in FreeBSD, > just because you don't want to look at Puppets Ruby code ? Um, no, that's not remotely what I wrote. I've spent far more time than is useful looking at Puppet's Ruby code, TYVM. What I don't want to do is rewrite pw(8) *and* the Ruby standard library to have their own passwd(5) implementations to be used just for managing the sysadmin accounts on a server. I could tolerate changing pw(8) to give it a "local" flag that means only look at/manipulate the local files -- except that the C library doesn't provide any sort of hook for that (yet). I'm proposing to implement that hook. That would at least get me 70% of the way there. -GAWollman From owner-freebsd-arch@freebsd.org Sat Sep 10 06:01:49 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19711BD2A38; Sat, 10 Sep 2016 06:01:49 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu [18.9.25.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5EA0C68; Sat, 10 Sep 2016 06:01:47 +0000 (UTC) (envelope-from kaduk@mit.edu) X-AuditID: 1209190f-f0fff70000003e0f-39-57d3a096e235 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id B3.68.15887.690A3D75; Sat, 10 Sep 2016 01:56:38 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id u8A5ub3B004390; Sat, 10 Sep 2016 01:56:37 -0400 Received: from multics.mit.edu (system-low-sipb.mit.edu [18.187.2.37]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id u8A5uYdh005897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 10 Sep 2016 01:56:36 -0400 Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id u8A5uXrW029071; Sat, 10 Sep 2016 01:56:33 -0400 (EDT) Date: Sat, 10 Sep 2016 01:56:33 -0400 (EDT) From: Benjamin Kaduk To: Garrett Wollman cc: freebsd-arch@freebsd.org, freebsd-security@freebsd.org Subject: Re: Trying to think out a hack for NSS and pw(8) In-Reply-To: <22483.5592.653250.726711@hergotha.csail.mit.edu> Message-ID: References: <22483.5592.653250.726711@hergotha.csail.mit.edu> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsUixG6nrjttweVwgxMHJC1mT5/GZNGz6Qmb xY5Pd9kdmD0uTb3N6jHj03yWAKYoLpuU1JzMstQifbsErowJ+04zFqzjqVi1rZ+pgfEfZxcj J4eEgInEurVtbF2MXBxCAm1MEt2HbzJBOBsZJRo6l7NDOIeYJI51nGcBaRESaGCUeP8tFMRm EdCW2LbnNDOIzSagIjHzzUagURwcIgI6EkuX8YCEmQWsJE6+WMYKYgsLWEq0/rzBBmJzCthJ /JzwgB3E5hVwkHi66TYLSKuQgK3EtA0mIGFRoCmr909hgSgRlDg58wkLxEgtieXTt7FMYBSY hSQ1C0lqASPTKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0TvdzMEr3UlNJNjKDA5JTk38E4p8H7 EKMAB6MSD++G3ZfChVgTy4orcw8xSnIwKYnyXtO7HC7El5SfUpmRWJwRX1Sak1p8iFGCg1lJ hHfuDKAcb0piZVVqUT5MSpqDRUmct2vGgXAhgfTEktTs1NSC1CKYrAwHh5IE77n5QI2CRanp qRVpmTklCGkmDk6Q4TxAw3tAaniLCxJzizPTIfKnGBWlxHkZQBICIImM0jy4XnDi2M2k+opR HOgVYd6lIFU8wKQD1/0KaDAT0GChU+dBBpckIqSkGhhbf8zKuui8yslsl2Xr1tl7mZa5v1ub KW+aY3E50vvwM4t3sUkzrqRIXlO1bGh9sIF9nuCciF/hbzNXCaXxKPKEp7Du45F7UbIs/Zd+ nqfI0hsXJi/q1zcWCTG3dyyTEfl0X5Xh0VzZ2Gsb1dtN2HoFbu9qlD6wQ2h/7DqGZcLBwXru Ihe2P1FiKc5INNRiLipOBAAGbO9I9wIAAA== X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2016 06:01:49 -0000 On Fri, 9 Sep 2016, Garrett Wollman wrote: > Presently, we have a bunch of machines under configuration management > (using Puppet, but that's not really relevant here). I'm hoping to > implement LDAP via nsswitch on these machines, but I've run into an > issue: the standard getpw*(3) mechanisms can't tell the difference > between users or groups in the local databases and those in the remote > LDAP database. We need Puppet to manage entries for users and groups > in the local database, without respect to what entries might be > imported from LDAP (because they are supposed to override the data > returned by LDAP). Puppet invokes pw(8) to actually perform the > modifications, but I suspect it also uses native code from the Ruby > standard library to actually do pre-modification lookups. > > Looking at the code in both nss-pam-ldapd and libc, it seems like the > only plausible way to fix this is to add functionality to nsswitch > which would allow it to use different configurations depending on the > identity of the process invoking getpwnam(3) or getgrnam(3). Does > anyone have opinions on how this ought to be implemented, or indeed > how it could be implemented securely? It's a bit late here, but it sounds kind of like you want to be able to set NSS_NONLOCAL_IGNORE [and have it do something useful]? (https://debathena.mit.edu/nss_nonlocal/) Unfortunately, I never got far enough in trying to port Athena to FreeBSD to have looked at how portable nss_nonlocal is. But it is probably worth looking at, for your case. -Ben From owner-freebsd-arch@freebsd.org Sat Sep 10 07:37:46 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62D50BD4F9C for ; Sat, 10 Sep 2016 07:37:46 +0000 (UTC) (envelope-from janm@transactionware.com) Received: from mail3.transactionware.com (mail.transactionware.com [203.14.245.7]) by mx1.freebsd.org (Postfix) with SMTP id DD59B83A for ; Sat, 10 Sep 2016 07:37:44 +0000 (UTC) (envelope-from janm@transactionware.com) Received: (qmail 36997 invoked by uid 907); 10 Sep 2016 07:31:01 -0000 Received: from eth222.nsw.adsl.internode.on.net (HELO [192.168.1.101]) (150.101.196.221) (smtp-auth username janm, mechanism plain) by mail3.transactionware.com (qpsmtpd/0.84) with (ECDHE-RSA-AES256-SHA encrypted) ESMTPSA; Sat, 10 Sep 2016 17:31:01 +1000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Trying to think out a hack for NSS and pw(8) From: Jan Mikkelsen In-Reply-To: <22483.5592.653250.726711@hergotha.csail.mit.edu> Date: Sat, 10 Sep 2016 17:31:02 +1000 Cc: freebsd-arch@freebsd.org, freebsd-security@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <22483.5592.653250.726711@hergotha.csail.mit.edu> To: Garrett Wollman X-Mailer: Apple Mail (2.3124) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2016 07:37:46 -0000 Hi, We have system images under version control with password databases as = part of the system image which get merged with system-specific password = databases. Not exactly the same requirement but similar. We manage the two separate databases using the -V option to pw, and then = have a script to merge the two databases into the standard local = database. This runs on boot to bring in changes from the system image = build, and after a local system change to apply the change. The problem = with your environment is probably that you=E2=80=99re calling getpwnam, = etc., where you can=E2=80=99t specify which password database you want = to use. If you changed the code that should only view local changes to use =E2=80=9C= pw -V /path/to/local usershow=E2=80=9D instead of calling getpw*(), a = similar approach might be possible. Regards, Jan. > On 10 Sep 2016, at 06:04, Garrett Wollman = wrote: >=20 > Presently, we have a bunch of machines under configuration management > (using Puppet, but that's not really relevant here). I'm hoping to > implement LDAP via nsswitch on these machines, but I've run into an > issue: the standard getpw*(3) mechanisms can't tell the difference > between users or groups in the local databases and those in the remote > LDAP database. We need Puppet to manage entries for users and groups > in the local database, without respect to what entries might be > imported from LDAP (because they are supposed to override the data > returned by LDAP). Puppet invokes pw(8) to actually perform the > modifications, but I suspect it also uses native code from the Ruby > standard library to actually do pre-modification lookups. >=20 > Looking at the code in both nss-pam-ldapd and libc, it seems like the > only plausible way to fix this is to add functionality to nsswitch > which would allow it to use different configurations depending on the > identity of the process invoking getpwnam(3) or getgrnam(3). Does > anyone have opinions on how this ought to be implemented, or indeed > how it could be implemented securely? >=20 > (As a side issue, the net/nss-pam-ldapd port completely ignores > account expiration dates. This bug is due to the fact that Linux has > this ships-in-the-night "shadow" mechanism, getspent(3), rather than > having it integrated in getpwent(3) like it should be, but the > ultimate upshot is that if you're using nss-pam-ldapd you can't rely > on shadowExpire attributes in the directory actually have an effect on > FreeBSD. I'll open a bugzilla issue about this.) >=20 > -GAWollman >=20 > _______________________________________________ > freebsd-arch@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to = "freebsd-arch-unsubscribe@freebsd.org"