Let PAM to provision users on their first login
Marco Trevisan
marco at ubuntu.com
Fri Nov 20 14:45:48 AEDT 2026
Hi,
On 19 nov 2026 at 16:49, Damien Miller wrote:
>> Well this is quite untrue for many linux-glibc systems where openssh
>> runs
>> today that may rely on winbind, SSSD or systemd (via userdb or
>> dynamic users).
>
> So I think its worth separating nss, which from the applcation's
> perspective just works behind the scenes, and what you're asking for
> in this patch series.
>
> With NSS, a provider and offer whatever getpw* information it wants
> and
> applications like sshd just keep working.
Yes, there's only one problem... Such information may yet not be known
when sshd tries to get it.
> With this patch series, AIUI you're saying that NSS *can't* provide
> getpw* information and that sshd (and presumably every other app that
> processes logins) is required to continue with a non-existent user on
> the basis that it might be created at a very late stage in
> authentication. This is a very differnt thing to ask for and one that
> has much larger implications for application developers.
>
> I don't understand why you couldn't have gone with (say) a solution
> where NSS returns getpw* information for these accounts from the
> start.
This is something that we cannot provide, because such accounts (and
in some cases their UID/GID) aren't and won't be ever know until you
first complete an authentication process.
As these user are defined in some cloud that will only reveal their
existence whenever each user will be able to authenticate using one
or multiple factors.
As per this it's just not possible to make NSS return their information
ahead of time.
And returning just random information for them without being
authenticated it's not possible and it's only prone to DDoS.
> This would have worked AFAIK for all applications that process
> logins and wouldn't have require all of them to complicate themselves
> by having to deal with maybe-invalid-maybe-valid-later.
Well, a part that as said, unfortunately it seems that sshd is the only
login application we know of that is using this behavior, but even if
that wasn't the case, the fact here is that we don't have a reasonable
way to make getpw* to release information after going through an
authentication, without going through PAM - at least in the linux/glibc
world.
That said, I really would have liked to get this in the simplest way,
but given the way sshd is designed, this was the simplest and less
invasive way I found... But I would be happy to re-consider other
options if you were interested in having such logic to work and you
have better ideas.
More information about the openssh-unix-dev
mailing list