Bug 240033 - openvpn is leaking open file descriptors.
openvpn is leaking open file descriptors.
Product: Fedora
Classification: Fedora
Component: openvpn (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Steven Pritchard
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2007-05-14 11:50 EDT by Daniel Walsh
Modified: 2009-07-14 13:20 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-07-14 13:20:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Walsh 2007-05-14 11:50:09 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070417 Fedora/ Firefox/

Description of problem:
SELinux is reporting AVC messages against openvpn.

The avc would indicate 
allow ifconfig_t openvpn_etc_t:file { read write };
is required.  

May 10 21:11:23 marie kernel: audit(1178824283.947:1387): avc:  denied  { read write } for  pid=1927 comm="ip" name="ipp.txt" dev=hda1 ino=161417 scontext=root:system_r:ifconfig_t:s0 tcontext=root:object_r:openvpn_etc_t:s0 tclass=file

This indicates the ip command is getting read/write access to ipp.txt.  

I believe this is caused by openvpn opening ipp.txt r/w,  and then execing the ip command (Probably in a script).

You need to call fcntl(fd, F_SETFD, F_CLOEXEC) 
On all open file descritptors before fork/exec to prevent these leaked file descriptors.

Version-Release number of selected component (if applicable):

How reproducible:
Didn't try

Steps to Reproduce:

Actual Results:

Expected Results:

Additional info:
Comment 1 Steven Pritchard 2007-05-14 12:29:49 EDT
I'm guessing that this is coming from someone using
sample-config-files/server.conf more-or-less unmodified.  The fix is probably to
just change this line:

  ifconfig-pool-persist ipp.txt

to this:

  ifconfig-pool-persist /var/run/openvpn/ipp.txt

I have a bug open to review the sample config files and fix this sort of thing,
but I haven't had a chance to do that yet...
Comment 2 Daniel Walsh 2007-05-14 13:48:07 EDT
While that may be correct.  That will not fix the AVC reported above. 
That would just require

allow ifconfig_t openvpn_var_run_t:file { read write };

Which is not probably correct either.  I don't think the "ip" command needs to
read write that file.  This is being caused because when you open the file in
openvpn, you are not setting the close on exec flag.
Comment 3 Bug Zapper 2008-04-03 20:41:05 EDT
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.
Comment 4 Bug Zapper 2008-05-06 21:44:03 EDT
This bug has been in NEEDINFO for more than 30 days since feedback was
first requested. As a result we are closing it.

If you can reproduce this bug in the future against a maintained Fedora
version please feel free to reopen it against that version.

The process we're following is outlined here:
Comment 5 Daniel Walsh 2008-05-07 05:38:48 EDT
Not sure if this bug still exists, but all open file descriptors in openvpn
should be closed before execing ifconfig.

fcntl(fd, F_SETFD, F_CLOSEXEC)
Comment 6 Bug Zapper 2008-05-13 22:54:04 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
Comment 7 Bug Zapper 2009-06-09 18:36:25 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: 
Comment 8 Bug Zapper 2009-07-14 13:20:19 EDT
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 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.