Bug #3033
Using temporary files in /tmp to comunicate with child processes is problematic in SELinux
| Status: | Investigating | Start date: | 01/12/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | exec | |||
| Target version: | - | |||
| Affected Puppet version: | 0.25.2 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
The present approach is necessitated by the more common / severe locking and race conditions that arise when trying to implement a cross-platform solution based on pipes (see related tickets, below).
There are two possible solutions here, both should be explored:
Related issues
History
Updated by Todd Zullinger about 2 years ago
Markus, using another directory would indeed help ease SELinux concerns AFAIK. As Dan Walsh (the main selinux-policy maintainer for RHEL and Fedora noted in “Fedora bug #553565”:https://bugzilla.redhat.com/show_bug.cgi?id=553565:
Make it simple, if you are running a process as root, DONT write to a directory where processes running as NON ROOT can muck around. UNLESS it is APSOLUTELY Necessary.
Users are evil. :)
A similar bug is what prompted us to inquire about tightening the permissions on /var/run/puppet, which defaults to 1777. We now patch that in the packages for Fedora and EPEL, as we can ensure that the needed user/group exists.
If puppet were to use a dir that only the puppet user had write access to for such files, I believe that would allow selinux-policy to allow the actions it is now denying. If everything using files in /tmp used the Tempfile module, we could perhaps even just set the TMPDIR env variable and make it easily configurable for folks.
Updated by James Turnbull about 2 years ago
- Target version changed from 0.25.4 to 0.25.5
Updated by James Turnbull almost 2 years ago
- Target version changed from 0.25.5 to 49
Updated by Ricky Zhou over 1 year ago
Hi, sorry I stopped updating this for the past few months. I have more time to keep looking into it now. Here is the most recent patch that I have for this issue (it is basically a retyped copy of the latest patch we were discussing on ticket #3013).
I’m lost in all the tickets surrounding this issue right now – can anybody remember which test/use case this version fails? Looking at the code, there should only be one situation where it is possible for this code to hang forever after the child is finished executing—-if the program that is being executed forks and exits, and its forked child continues writing to stdout/stderr, the select will continue to succeed and cause output to continue to be read continuously. This is a pretty pathological (and hopefully rare) case though.
Updated by James Turnbull about 1 year ago
- Target version deleted (
49)