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

session: No tty for pam, but session class and type. #1808

Closed
wants to merge 1 commit into from

Conversation

mvollmer
Copy link
Member

Systemd-logind expects a real tty and we should set the session class
and type explicitly.

https://bugs.freedesktop.org/show_bug.cgi?id=89024#c1

@mvollmer
Copy link
Member Author

Let's hear from Lennart whether this is ok.

I didn't touch the utmp code, but maybe we should avoid our fake tty there as well.

return res;
}
setenv ("XDG_SESSION_CLASS", "user", 1);
setenv ("XDG_SESSION_TYPE", "web", 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be pam_setenv()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, I don't know what I am doing...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, pam_putenv works.

@stefwalter
Copy link
Contributor

Fixes #1098

@mvollmer mvollmer force-pushed the no-pam-tty branch 2 times, most recently from bb83de0 to c9a48f1 Compare February 12, 2015 10:04
@poettering
Copy link

Looks good to me. The "web" session type is only available in really new versions of systemd (>= v216). Not sure what kind of error you will get if you try this on older versions (or whether you get one at all...) If you need compat with pre-v216 versions you'd have to test this I fear...

@mvollmer
Copy link
Member Author

Not sure what kind of error you will get if you try this on older versions (or whether you get one at all...) If you need compat with pre-v216 versions you'd have to test this I fear...

With 216 and a invalid session type "webx", the login succeeds but logind will not create a session. This in turn will break polkit for us since we hook the agent to the session. I guess systemd < 216 will behave the same.

@stefwalter
Copy link
Contributor

With 216 and a invalid session type "webx", the login succeeds but logind will not create a session. This in turn will break polkit for us since we hook the agent to the session. I guess systemd < 216 will behave the same.

Setting the session type in the pam config file is probably best then. That allows people who want to backport to pre-216 systemd to get Cockpit running.

@mvollmer
Copy link
Member Author

Removed XDG_SESSION_TYPE=web.

@poettering
Copy link

Stef, by "config file" you mean PAM snippet? sounds good to me then.

@mvollmer
Copy link
Member Author

Setting the session type in the pam config file is probably best then.

On Fedora at least, our invocation of pam_systemd is in the password-auth snippet, which is included into pam.d/cockpit...

@stefwalter
Copy link
Contributor

Stef, by "config file" you mean PAM snippet? sounds good to me then.

Yup.

Systemd-logind expects a real tty and we should set the session class
explicitly.

https://bugs.freedesktop.org/show_bug.cgi?id=89024#c1
@mvollmer
Copy link
Member Author

Corrected commit message re not setting XDG_SESSION_TYPE.

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

Successfully merging this pull request may close these issues.

None yet

3 participants