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

Linux sockets should maybe pass effective UID/GID #452

Open
kgaillot opened this issue Dec 7, 2021 · 4 comments
Open

Linux sockets should maybe pass effective UID/GID #452

kgaillot opened this issue Dec 7, 2021 · 4 comments

Comments

@kgaillot
Copy link
Contributor

kgaillot commented Dec 7, 2021

For non-Linux sockets, libqb appears to use the effective UID/GID as the socket credentials, and given the member naming in struct qb_ipcc_connection (i.e. euid/egid), it seems that was the original intent as well.

However, for Linux sockets, libqb enables SO_PASSCRED when connecting, and qb_ipc_auth_creds() pulls the other side's credentials from SCM_CREDENTIALS. I believe libqb on the other side lets the credentials default, which the kernel will set to the user's real UID/GID. I think only root can set SCM_CREDENTIALS when connecting, so it might not be helpful in all cases, but it would nice to use the effective UID/GID when possible.

For context, see this mailing list thread:
https://www.mail-archive.com/[email protected]/msg10681.html

@wferi
Copy link
Contributor

wferi commented Dec 8, 2021

According to https://man7.org/linux/man-pages/man2/setreuid.2.html even unprivileged processes can set their real user ID to their effective user ID. I think this would also solve the original problem.

@chrissie-c
Copy link
Contributor

@kgaillot While you are undoubtedly right, I worry what would break if we were to change it now.

@kgaillot
Copy link
Contributor Author

kgaillot commented Dec 8, 2021

@chrissie-c , @wferi 's comment gives me an alternative idea ... pacemaker's tools could make the effective ID the real ID before connecting.

@wferi
Copy link
Contributor

wferi commented Dec 8, 2021

@kgaillot I actually meant that the setuid wrapper written by the original poster could. I don't think the Pacemaker tools have any business manipulating these IDs.

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

No branches or pull requests

3 participants