Re: [ldapext] Using groupOfNames (or similar) for UNIX groups and netgroups (was Re: DBIS commentary)

Simo Sorce <simo@redhat.com> Wed, 02 December 2015 17:21 UTC

Return-Path: <simo@redhat.com>
X-Original-To: ldapext@ietfa.amsl.com
Delivered-To: ldapext@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 2B1501AC3BE for <ldapext@ietfa.amsl.com>; Wed, 2 Dec 2015 09:21:08 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.911
X-Spam-Level:
X-Spam-Status: No, score=-5.911 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, J_BACKHAIR_34=1, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HtmaYgq407m9 for <ldapext@ietfa.amsl.com>; Wed, 2 Dec 2015 09:21:04 -0800 (PST)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 30D7F1A90ED for <ldapext@ietf.org>; Wed, 2 Dec 2015 09:21:03 -0800 (PST)
Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 37E97C0CC62B; Wed, 2 Dec 2015 17:21:03 +0000 (UTC)
Received: from willson.usersys.redhat.com ([10.3.113.3]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tB2HL1NT002308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 2 Dec 2015 12:21:02 -0500
Message-ID: <1449076861.9040.56.camel@redhat.com>
From: Simo Sorce <simo@redhat.com>
To: Jordan Brown <Jordan.Brown@oracle.com>
Date: Wed, 02 Dec 2015 12:21:01 -0500
In-Reply-To: <565E55C3.9080404@oracle.com>
References: <5655E4F0.7030809@oracle.com> <814F4E458AA9FF4E89CF1A9EDA0DE2A932F618A3@OZWEX0209N1.msad.ms.com> <565CAC30.6010701@oracle.com> <814F4E458AA9FF4E89CF1A9EDA0DE2A932F8EAFD@OZWEX0209N2.msad.ms.com> <565DDE78.5030908@oracle.com> <1449019308.9040.38.camel@redhat.com> <565E55C3.9080404@oracle.com>
Organization: Red Hat, Inc.
Content-Type: text/plain; charset="UTF-8"
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27
Archived-At: <http://mailarchive.ietf.org/arch/msg/ldapext/STltmx5h-utrg5Rd9facVcHPNRg>
Cc: "'ldapext@ietf.org'" <ldapext@ietf.org>
Subject: Re: [ldapext] Using groupOfNames (or similar) for UNIX groups and netgroups (was Re: DBIS commentary)
X-BeenThere: ldapext@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: LDAP Extension Working Group <ldapext.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ldapext>, <mailto:ldapext-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ldapext/>
List-Post: <mailto:ldapext@ietf.org>
List-Help: <mailto:ldapext-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ldapext>, <mailto:ldapext-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 02 Dec 2015 17:21:08 -0000

On Tue, 2015-12-01 at 18:21 -0800, Jordan Brown wrote:
> [ Splitting off a subtopic as Michael requested. ]
> 
> On 12/1/2015 5:21 PM, Simo Sorce wrote:
> > On Tue, 2015-12-01 at 09:52 -0800, Jordan Brown wrote:
> >> There are two problems there:
> >>
> >> 1)  A group could contain anything, even when you want it to only
> >> contain one type. [...]
> > This is very true and there are products that can cope, there are also
> > mechanism to more efficiently (at least latency wise) if you use
> > controls like: https://tools.ietf.org/html/draft-masarati-ldap-deref-00
> >
> > Both OpenLDAP and 389ds (for FreeIPA) implement this control and we use
> > it in various clients.
> 
> That control is indeed very interesting.  I don't immediately see how it helps 
> with the type-safety problem, though.  Am I missing something?

The idea is that you can get all data up at once including objectclass
and then you can simply drop results that do not have the right
objectclass value.
It is a little more wasteful than being able to specify a secondary
filter (that would probably be a great addition to the draft), for the
search done on the attribute of the group entry, but it is still good
enough to efficiently get results as well as easily weed off unwanted
ones.

> >>   I think the truly right answer there is to add new APIs that don't
> >> retrieve the members, and even to redefine the existing APIs to not
> >> retrieve the members, because there are almost no cases where it
> >> actually makes sense to retrieve the list of members of a UNIX group.
> > It would be nice to have a new API, although Posix has some wiggle room
> > which we fully exploit in clients like Windbind and SSSD.
> >
> > Both clients simply do not return all members in the enumeration cases
> > (getgrent) but only in the explicit group retrieve case (getgrnam).
> > This is because Posix allows to omit results in the enumeration case
> > according to some interpretations.
> 
> Yes, and I infer that there's corresponding omissions in other parts of the 
> standard.  In the getgrent description, the standard describes omitting this 
> information on the basis of security restrictions. Omitting the data there would 
> not help security at all if you could immediately turn around and request it 
> through getgrname and getgrgid.  Meeting the security need would require having 
> the restrictions in both places.

True, but are not doing this for security reasons, we are just taking
the fact that omissions are permissible as a blanket permission to omit
results, and clients should be prepared to deal with that.

After all the texts are vague and you could think that the security
measure expressed here is about not revealing group names.

The fact you can easily scan the whole group ID space is just the
annoying consequence of the fact most systems do not have a randomized
ID assignment policy and have a pretty limited ID space at just 32bit of
size or less. But hey, that's not my fault! :-)

> > Indeed, some admins complain about this so switches are provided in the above 
> > mentioned clients to behave "the classic way". And surprisingly very few systems 
> > really have a big issue with this. Given that any application that depends on 
> > full group enumeration is already fully broken and a performance liability on 
> > any enterprise system that has accounts in the thousands. 
> 
> Right.  The old "walk through all of the groups and then through all of their 
> members" strategy is doubly wrong:  the number of groups can be very large, and 
> the number of members of each group can be very large.
> 
> Heck, even with RFC2307 memberUid groups, simply retrieving the group list can 
> easily involve moving half a megabyte of data. That's a lot of wasted processing 
> when all you really wanted was a gid<->name lookup.
> 
> >> As long as we're talking about flaws in groupOfNames:  there's also
> >> the problem that "member" is a MUST attribute, and that makes empty
> >> groups problematic.
> > This was, in fact, such a big problem that in the FreeIPA product we
> > decided to break with the standard and changed member to be MAY, never
> > looked back on this choice.
> 
> We could address it through introducing a new object class (and here I include 
> just grabbing "group" from AD or "groupOfNames" from RFC2307bis-02, not just 
> creating a wholly new one), or by changing the definition.  This is one of those 
> cases where I'd say that breaking formal compatibility might well be appropriate.

Yes, it would be nice to change the class, because it is forward safe to
do so, if you created objects when the MUST was in place, nothing breaks
if you relax the constraint to MAY, at least from the POV of data
consistency in the directory.

And I never found any software the specifically rely on the fact you
can't delete the last member attribute from a group for something.
Actually usually I saw software that had to use workarounds like adding
the group dn to itself (and concealing the self-reference in the UI)
when an admin wants to remove the last member but not remove the whole
group.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York