Let PAM to provision users on their first login
Nico Williams
nico at cryptonector.com
Tue Nov 24 04:51:34 AEDT 2026
Maybe it's time to design a replacement for PAM.
I've done some of this before, but back then GSS-API sounded pretty
good, and now it doesn't, and yet something like it is still needed for
anything much more complicated than JWTs and pubkey userauth because
things like Kerberos, though they are dying, are not dead.
If I had to build such a thing now I'd distinguish interactive
authentication (password, keyboard-interactive) from cryptographic
protocols, and I'd probably want to support captive browser login pages,
not just the text-only keyboard-interactive (but this would be well
outside the scope of SSH) so that one could experiment with that as a
graphical login screen.
I'd give it the prefix npa_ for new pluggable auth.
npa_authenticate_interactive_text() would be the equivalent of
pam_authenticate().
npa_authenticate_protocol() would allow for simple protocols like pubkey
userauth and also complex protocols like GSS-API, with a protocol type
designator (NPA_PROTO_SSHv2_PUBKEY_USERAUTH, NPA_PROTO_GSS,
NPA_PROTO_JWT, ...).
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.
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.
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.
Nico
--
More information about the openssh-unix-dev
mailing list