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

klishd: drop privileges in client connection #71

Closed
wants to merge 1 commit into from

Conversation

troglobit
Copy link
Contributor

When a client connects over the AF_UNIX socket we should drop privileges to match the uid and gid of that user. The '%u' translation done by the klish_prompt() function needs the USER env. variable to be set, so we do that too here.

When a client connects over the AF_UNIX socket we should drop privileges
to match the uid and gid of that user.  The '%u' translation done by the
klish_prompt() function needs the USER env. variable to be set, so we do
that too here.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@troglobit troglobit added this to the Infix v23.07 milestone Jul 6, 2023
@troglobit troglobit added the enhancement New feature or request label Jul 6, 2023
@troglobit
Copy link
Contributor Author

This was a good idea. Letting the forked-off child process of klishd drop its privileges so it connects as, e.g., the admin user. Unfortunately it does not work.

Later revisions of the klish project add their own UID tracking, but the daemon still runs and operates as root when connecting to sysrepo.

In PR #90 I explored this further and found several possible reasons for the problems I saw. These are documented in the patch on our kkit branch of klish, which we switch to in PR #90. Since that supersedes this PR, I suggest we close this one instead.

@troglobit troglobit marked this pull request as draft July 24, 2023 04:29
@troglobit troglobit added question Further information is requested and removed enhancement New feature or request labels Jul 24, 2023
@troglobit troglobit removed this from the Infix v23.07 milestone Jul 24, 2023
@wkz
Copy link
Contributor

wkz commented Aug 8, 2023

Continuing this discussion in #90.

@wkz wkz closed this Aug 8, 2023
@troglobit troglobit deleted the klish-drop-privs branch August 31, 2023 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants