New functions/API for secure launching of external programs#1915
Draft
Explorer09 wants to merge 6 commits intohtop-dev:mainfrom
Draft
New functions/API for secure launching of external programs#1915Explorer09 wants to merge 6 commits intohtop-dev:mainfrom
Explorer09 wants to merge 6 commits intohtop-dev:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This feature branch implements an interface for checking an external program's permission and launching a program with dropped privileges when it's applicable.
I wrote this as a sepeate module, tentatively named ProgramLauncher (and I welcome suggestions for better names). It has these features:
o+x) bit is now respected only of the program is owned by root. (Theu+xandg+xbehaviors remain the same, but the code now checks for UID and GID explicitly so that root user won't bypass it.)PATHenvironment variable, the "ProgramLauncher" API can cache the result - keeping the full program path and the inode in the filesystem. If someone quietly swaps the program while an htop instance is running, that htop instance will stop trusting or running the external program (until htop restarts).Included in the branch are changes to lsof (OpenFileScreen), strace/truss (TraceScreen), systemctl (SystemdMeter) and rc-status (OpenRCMeter) to all launch using the new framework. These are examples of how the new module/APIs may be called.
Resolves #1844.
Note that this conflicts with #1893. I have no plans to change the
fork()andfexecve()calls to useposix_spawn()becauseposix_spawn()can't achieve the security I want (I needposix_fspawn()instead, but no libc had implemented such interface for me).