Let PAM to provision users on their first login
Marco Trevisan
marco at ubuntu.com
Tue Nov 24 05:30:38 AEDT 2026
On 23 nov 2026 at 11:51, Nico Williams wrote:
> Maybe it's time to design a replacement for PAM.
Yeah, I'd be open to that... And it's something I've been thinking on
too.
We had lots of discussion with systemd folks that lead to starting
drafting https://github.com/systemd/systemd/pull/39855
Where PAM is still used as is for supporting legacy setups, but
exposed differently at least.
> The equivalent of pam_acc_mgmt() should output a JSON text
> representing
> all the metadata about the user that is needed to complete the logon:
> UID, GID, supplementary GIDs, SIDs even, home directory, shell, some
> sort of access profile maybe, etc. No need for getpwnam(), though
> preferably getpwnam() and getpwuid() should work after the session is
> open.
Well it basically should support what systemd-userdb already allows.
> I'd make the library for this use IPC (instead of dlopen()) to 'load'
> and run its plugins so the library itself is as simple as possible and
> so as to make it possible to write plugins in other languages, isolate
> them, run them with least privilege, etc. All the library would do is
> load its configuration, vfork/exec its plugins, and shuttle text and
> binary tokens to and fro with the absolute bare minimum of an encoding
> for the IPC protocol.
Yeah, I do agree with this and I also have drafted something that does
it
already for current PAM though, as IMHO this part could be already
improved
for the current PAM.
> The configuration should probably be in the form of a simple
> programming
> language since PAM configuration basically became that, but a terrible
> one at that. Or maybe not: if you want to customize things a lot
> maybe
> you build your own plugin that invokes other plugins and implements
> your
> 'business logic' as you wish and in whatever programming language you
> want.
>
> This thing should be as utterly simple as possible.
Yeah, true... But you know, if you go through supporting APIs through
IPC
you'd end up still making things more complex once you need to support
new
things.
But indeed the basic API should be very simple, leading to
implementations
to go through details.
However, this is something that is very far from our radars, and while
PAM
is not perfect it still the current standard.
Even if we end up designing something simpler and better than PAM, the
main
topic here would likely stay: Can we delay the user check to the point
the
authentication has been fully completed?
Using whenever backend we rely on for it.
More information about the openssh-unix-dev
mailing list