~kennylevinsen/greetd#15: 
Allow setting PAM environment vars from greeter

Certain environments (Gnome...) really want their XDG_SESSION_TYPE to be right:

gnome-shell[2741]: Failed to create backend: Could not get session ID: Session '14' is not a graphical session (type: 'tty')

There are also things that require XDG_CURRENT_DESKTOP, and according to the freedesktop spec it is a responsibility of the login manager to define it.

While supporting those in greetd is definitely non-goal, it might be worthy to allow greeter to support whatever freedesktop specifications they want to support.

For security considerations, allowed vars could be filtered (^XDG_).

Status
REPORTED
Submitter
~alebastr
Assigned to
No-one
Submitted
4 years ago
Updated
4 years ago
Labels
No labels applied.

~kennylevinsen 4 years ago

There are also things that require XDG_CURRENT_DESKTOP

These do not need to be set before pam_open_session, so in the spirit of simplicity, these should be handled as arbitrary environment vars set by a wrapper script (or even just by doing e.g. XDG_CURRENT_DESKTOP=blah command).

The only real reason to provide env vars in the protocol is to affect the PAM env in modules during pam_open_session. And, to my knowledge, the only relevant parameter is XDG_SESSION_TYPE for pam_systemd.so.

... freedesktop specifications ...

Note that XDG_SESSION_TYPE and all other logind XDG_* vars are not related to freedesktop specifications, but are purely systemd-internal variables with very unfortunate names, and no intention from systemd to upstream it to freedesktop.

For security considerations, allowed vars could be filtered (^XDG_).

XDG_SEAT, XDG_VTNR and XDG_SESSION_CLASS aren't supposed to be set.


It's really nasty that we'd have to add a protocol feature (even if a simple one that have existed before) just for a single var so that a single broken compositor can abuse an API. :(

~alebastr 4 years ago

These do not need to be set before pam_open_session, so in the spirit of simplicity, these should be handled as arbitrary environment vars set by a wrapper script (or even just by doing e.g. XDG_CURRENT_DESKTOP=blah command).

While I have a preference towards things that work out of the box despite being minimalistic and customizable, I get your point. It's just that from a distribution maintainer's standpoint wrapper scripts are kind of... not the best possible solution :(

Note that XDG_SESSION_TYPE and all other logind XDG_* vars are not related to freedesktop specifications, but are purely systemd-internal variables with very unfortunate names, and no intention from systemd to upstream it to freedesktop.

XDG_CURRENT_DESKTOP is mentioned in fd.o specs though. Which makes even less sense for me as it makes fd.o specs depend on internal systemd/Gnome things and decisions. Nevertheless, let's forget about it.

In the end, I guess we don't really have to add a generic variable support. Having a way to set session type should be enough, which may or may not be implemented as an environment variable in the protocol.

~kennylevinsen 4 years ago

XDG_CURRENT_DESKTOP is mentioned in fd.o specs though

Yup, just highlighting that the others' aren't, despite their misleading names. This has also lead to some thinking that XDG_SESSION_TYPE is a valid thing to read from user-space for e.g. picking wayland vs. x11 client backends, although I think we finally got all that killed. :/


Note: I'm mostly just ranting over how broken this is.

While I prefer no code when it serves no sane purpose, I do prefer a generic usable interface over one customized specifically to misuse of a broken systemd feature. :)

Register here or Log in to comment, or comment via email.