Let PAM to provision users on their first login
Nico Williams
nico at cryptonector.com
Fri Nov 20 08:43:17 AEDT 2026
On Thu, Nov 19, 2026 at 02:07:46PM -0600, Theo de Raadt wrote:
> Damien Miller <djm at mindrot.org> wrote:
>
> > I don't love this because it fairly significantly complicates
> > some of the most critical code in OpenSSH.
> >
> > If this were just reversing the order in which we call getpwnam() and
> > pam_start() then it wouldn't be so bad, but requiring sshd proceed with
> > an invalid account right up to the point of authentication success is
> > pretty scary.
> >
> > The "monitor: Receive PAM account requests only after authentication"
> > bit is good though and mirrors a hardening that I've wanted to do for
> > a while.
>
> I agree. The proposal is no longer compatible with Unix / POSIX
> properties, and sshd the very last place this kind of thing should
> occur.
>
> Outside of the sshd context, I think the Ubuntu design is extremely
> dangerous and in time there will be interesting consequences.
Certainly the login could not complete if getpwnam() does not resolve
the user to a UID (and other things) before the end of the login process
-- Unix/POSIX requires a UID and GID for the user's processes, a shell,
a home directory. Unix/POSIX does not require that PAM be or not be
given a chance to create the account first. PAM is not traditionally a
part of Unix, but then again it's been a part of life on Unix-ish
operating systems for almost 3 decades, and that's almost long enough to
consider it part of the Unix tradition.
I don't see why the getpwnam() call couldn't be delayed so as to give
PAM a chance to create the user account, but I do think it's a
reasonable policy position to have that that shouldn't be possible, at
least with PAM as it is, though it's not a position I take.
But PAM a) SUX, b) does need more ways to tell the modules how the user
was authenticated when the 'how' is "not with pam_authenticate()" (i.e.,
not keyboard-interactive, not password) so that PAM could make better
authorization decisions.
Nico
--
More information about the openssh-unix-dev
mailing list