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

Allow pkexec outside of /usr/bin #3502

Open
jtojnar opened this issue Jul 23, 2020 · 1 comment
Open

Allow pkexec outside of /usr/bin #3502

jtojnar opened this issue Jul 23, 2020 · 1 comment

Comments

@jtojnar
Copy link

jtojnar commented Jul 23, 2020

Problem description

Sublime Text hardcodes /usr/bin/pkexec, which does not exist on NixOS, so we have to replace it with /run/wrappers/bin/pkexec using a LD_PRELOAD hack. But since it is an environment variable, it gets passed to child programs, not all tolerating such interference.

(On NixOS, there is not really /usr directory. We symlink directory trees of globally installed packages into /run/current-system/sw, and /run/current-system/sw/bin directory is added to PATH environment variable, but packages cannot contain setuid binaries for security reasons – unprivileged users can build and install packages. Those are placed in /run/wrappers/bin, which is also added to PATH.)

Preferred solution

It would be nice if pkexec could be picked up from PATH.

Alternatives

  • For software that has source code available, we just patch it but that is not an option here.
  • The path in the source code could be padded from right with \0 so that we could patch the executable with a longer path. For us, nine extra characters should be enough but perhaps add few more to be safe.
  • Define the path in Default.sublime-package. Since it would be defined in Python code, we can patch it easily.
@jtojnar
Copy link
Author

jtojnar commented Apr 28, 2023

Looks like run_admin_process now calls file_exists so replacing /usr/bin/pkexec for pkexec\x00\x00\x00\x00\x00\x00\x00\x00\x00 as we were doing and relying on PATH no longer works.

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

No branches or pull requests

2 participants