public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Slapd calls nss_ldap before opening its ports
Date: Mon, 29 Oct 2007 06:03:41 -0700	[thread overview]
Message-ID: <20071029130341.GT22369@curie-int.orbis-terrarum.net> (raw)
In-Reply-To: <20071022195659.GB8767@bart.bs.l>

[-- Attachment #1: Type: text/plain, Size: 2577 bytes --]

On Mon, Oct 22, 2007 at 09:56:59PM +0200, Bertram Scharpf wrote:
> Hi,
> 
> Am Montag, 22. Okt 2007, 15:30:59 +0200 schrieb Michael Hanselmann:
> > On Mon, Oct 22, 2007 at 02:12:29PM +0200, Bertram Scharpf wrote:
> > > Therefore I suppose the slapd daemon tries to obtain passwd/shadow
> > > information for ldap via nss_ldap.
> > 
> > Yes, it does. Therefore, use something like the following line in
> > /etc/ldap.conf:
> > 
> >   nss_initgroups_ignoreusers root,ldap,cron,portage 
> 
> Ah, I did not know this yet. I see the problem in whole is
> more complicated.
> 
> Even though Alec enters caveats I will use the ignore
> solution for now. What was troubling me was that I didn't
> know what was going on at all.
I was busy with other things, so I didn't get to this.

It's not unique to Gentoo, but rather it is more apparent on Gentoo
because of how users do things. 

The RHEL documentation on LDAP server (mind you, I last read it before
they did their own Fedora Directory Server) had big warnings about not
using nss_ldap on the machine that housed your slapd.

Secondly, the glibc NSS lookup for a numeric UID has a nasty bit in it:
for S in NSS-sources:
	lookup for U in the numeric column
	if found, return.
	lookup for U in the key column (pw_name)
	if found, return.

Doing the U is member of groups lookup is even worse, since it doesn't
break out of the look as soon as possible (hence why the
initgroups_ignoreusers setting is important).

Now if you are doing a lookup for a non-existent numeric UID, this means
that you hit the files backend twice, and the LDAP backend twice.

If slapd is not available (either because it is local and not started
yet, OR because networking is not available yet), the LDAP lookups will
time out. The Gentoo stock /etc/ldap.conf that powers nss_ldap has
settings to try to minimize the cost of the timeouts, that uses a
timeout of 15 seconds per lookup.

I discussed this previously with Uberlord, I can't recall the bug #.
The net of it is that _every_ UID and GID used (and yes, even doing an
ls can hit them!) must be present in the core system data, or it the
timeout penalty must be paid for each lookup.

It's easy to fall foul of this. Somewhere around, there was a NSS module
that just logged every lookup instead of performing them, and it is
astounding how many lookups take place during boot.

-- 
Robin Hugh Johnson
Gentoo Linux Developer & Infra Guy
E-Mail     : robbat2@gentoo.org
GnuPG FP   : 11AC BA4F 4778 E3F6 E4ED  F38E B27B 944E 3488 4E85

[-- Attachment #2: Type: application/pgp-signature, Size: 321 bytes --]

  reply	other threads:[~2007-10-29 13:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 12:12 [gentoo-dev] Slapd calls nss_ldap before opening its ports Bertram Scharpf
2007-10-22 12:44 ` Benjamin Smee
2007-10-22 12:56   ` Bertram Scharpf
2007-10-22 15:48     ` Alec Warner
2007-10-22 19:50       ` Bertram Scharpf
2007-10-22 13:30 ` Michael Hanselmann
2007-10-22 15:47   ` Alec Warner
2007-10-22 19:56   ` Bertram Scharpf
2007-10-29 13:03     ` Robin H. Johnson [this message]
2007-10-29 11:45 ` Mike Frysinger
2007-10-29 12:15   ` Bertram Scharpf
2007-10-29 12:47     ` Mike Frysinger
2007-10-29 12:57       ` Bertram Scharpf
2007-10-29 16:41         ` Mike Frysinger
2007-10-29 17:39           ` Bertram Scharpf
2007-10-29 19:22             ` Chris Gianelloni
2007-10-29 20:41               ` Josh Saddler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071029130341.GT22369@curie-int.orbis-terrarum.net \
    --to=robbat2@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox