Bug 460039 - puppet is leaking open file descriptors
puppet is leaking open file descriptors
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: puppet (Show other bugs)
13
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeroen van Meeuwen
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-25 12:55 EDT by Daniel Walsh
Modified: 2011-06-27 09:59 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-27 09:59:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Daniel Walsh 2008-08-25 12:55:34 EDT
Description of problem:

When puppet is used in an SELinux environment and restarts confined domains the confined domains are trying to read/write puppet temp files.  This indicates a leaked file descriptor.

type=AVC msg=audit(1219670482.417:12047): avc:  denied  { read write } for  pid=30909 comm="snmpd" path="/tmp/puppet.2106.0" dev=dm-0 ino=786444 scontext=system_u:system_r:snmpd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file

The above avc indicates the snmpd daemon was trying to read/write /tmp/puppet.2106.0  Which is obviously incorrect.

All open file descriptors should be closed on exec

fcntl(fd, F_SETFD, FD_CLOEXEC)

I also see a lot of these avc's

type=AVC msg=audit(1218935273.281:5): avc:  denied  { read } for  pid=2689 comm="portmap" name="stat" dev=proc ino=4026531853 scontext=system_u:system_r:portmap_t:s0 tcontext=system_u:object_r:proc_t:s0 tclass=file


Does puppen open the /proc/stat file to reading and not close on exec the file descriptor?
Comment 1 David Lutterkort 2008-08-27 23:35:29 EDT
Not good .. is this with the latest version (0.24.5) ?

Would you mind opening a bug upstream (http://reductivelabs.com/redmine/projects/puppet/issues/new) ? Otherwise, I can do it.

Also, if you have a simple manifest that triggers that behavior, that would be quite helpful.
Comment 2 Till Maas 2008-12-08 10:16:36 EST
At least the tempfile from Tempfile.new in the function execute in util.rb creates a selinux denial, if puppet starts a service, e.g. this manifest creates a denial, if dovecot is not running. I renamed the basename of the tempfile to identify it in the audit.log.

 service { "dovecot":
           ensure => running
         }

It would probably easier to use some "exec" manifest using a confined command, but I did not test this.

I am not sure, whether this is really leakage, because puppet intentionally creates a tempfile and redirects the output of a fork to this file. I believe I have read something about selinux about restricting the redirection of output from confined commands.
Comment 3 Till Maas 2008-12-08 10:19:40 EST
sorry for the needinfo, don't know, how I set it. :-/
Comment 4 Daniel Walsh 2008-12-08 11:56:16 EST
Yes if puppet is creating a tmpfile with stdout redirected to it, and then executes 

service CONFINEDDOMAIN restart, it will generate an AVC message.

We can fix this problem by labeling the output file, and then allowing all confined domains to write to the output file.  I would prefer the output file to be in /var/run/puppet/ or /var/log/puppet/ rather then tmp though, since I believe system processes should not use /tmp since users can attack you.
Comment 5 Till Maas 2008-12-08 12:26:53 EST
puppet uses a ruby function to create the tempfile and I guess/hope, that it is done safely and there is no need to worry about any user being able to use this for an attack.
Comment 6 Daniel Walsh 2008-12-09 08:54:32 EST
If you are creating files for use by privledged processes in a directory where users have full read/write/delete privs, you are opening yourself to an unnecessary risk.  But I guess that is your choice.  The measures that tools like mktemp have had to go through to fight this risk prove the point.
Comment 7 Fedora Admin XMLRPC Client 2009-03-16 12:52:03 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 8 Till Maas 2009-05-27 11:07:58 EDT
(In reply to comment #4)

> We can fix this problem by labeling the output file, and then allowing all
> confined domains to write to the output file.  I would prefer the output file
> to be in /var/run/puppet/ or /var/log/puppet/ rather then tmp though, since I
> believe system processes should not use /tmp since users can attack you.  

/var/run/puppet/ is also world writeable btw.
Comment 9 Bug Zapper 2009-06-09 22:32:48 EDT
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Todd Zullinger 2009-06-09 23:30:10 EDT
FWIW, I talked with upstream about the permissions on /var/run/puppet.  We'll either get something workable for upstream or patch our packages to make /var/run/puppet have reasonable permissions (with upstream's blessing).
Comment 11 Jeroen van Meeuwen 2009-08-12 18:15:58 EDT
How, if at all, does this relate to https://bugzilla.redhat.com/show_bug.cgi?id=502881 ?
Comment 12 Daniel Walsh 2009-08-13 08:42:02 EDT
Can read that bugzilla.
Comment 15 Bug Zapper 2009-11-16 03:11:52 EST
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 16 Todd Zullinger 2009-11-21 13:52:20 EST
FWIW, we have gotten the permissions on tightened up.  They are now 0755 in our puppet packages.

Jeroen, bug 502881 appears to be inaccessible.  Could you summarize it if you think it's still potentially related?
Comment 17 Ricky Zhou 2009-12-21 15:24:19 EST
This is probably related to bug #546550 and http://projects.reductivelabs.com/issues/2731.  There's a patch on the ticket to get rid of the tempfile stuff that will hopefully get accepted after some testing.
Comment 18 Bug Zapper 2010-03-15 08:03:36 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle.
Changing version to '13'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 19 Bug Zapper 2011-06-02 14:28:43 EDT
This message is a reminder that Fedora 13 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 13.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '13'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 13's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 13 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 20 Bug Zapper 2011-06-27 09:59:48 EDT
Fedora 13 changed to end-of-life (EOL) status on 2011-06-25. Fedora 13 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.