Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share the TTY device with systemd-logind #433

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thkukuk
Copy link

@thkukuk thkukuk commented Aug 30, 2023

When sshd creates a session via PAM, it does not know the TTY and sets a dummy one. As result, systemd-logind has to parse utmp and find the correct entry to get the TTY afterwards. Instead tell systemd-logind the TTY device after we know it.

utmp on 64bit bi-arch systems like x86-64 are, with glibc, not Y2038 ready and glibc maintainers want to drop it because of this and for many other reasons (https://www.thkukuk.de/blog/Y2038_glibc_utmp_64bit/). So going via utmp for the TTY will not work anymore in the near future.

@djmdjm
Copy link
Contributor

djmdjm commented Mar 30, 2024

Sorry, we are not willing to accept a dependency on libsystemd. If there is a way to communicate this information without taking the dependency (similar to what we're doing to avoid sd_notify()) then we'd consider it.

@bluca
Copy link

bluca commented Mar 31, 2024

This is a D-Bus API, so you don't need libsystemd, but you need a D-Bus client implementation to call the relevant method. It's not something that can be implemented in a few lines of code like the readiness protocol. From a C program, that pretty much means either libglib or libsystemd.

Would it be acceptable if it was dlopened instead of linked, and only if a disabled-by-default runtime config in sshd_config is set?

@djmdjm
Copy link
Contributor

djmdjm commented Apr 30, 2024

We probably wouldn't be interested in dlopen()ing anything into sshd's address space, because it carries identical risks to direct linking. Maybe in a fork+exec'd subprocess, but that's obviously significantly more hassle.

@bluca
Copy link

bluca commented Apr 30, 2024

Yes it pulls stuff in, however it is not identical: linking means it happens unconditionally on startup, while dlopen means it only happens on demand. If it is gated by a config option, it would only happen if the config is enabled, and it could also check whether systemd is running before doing it as well (trivial check if /run/systemd/system exists)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants