Bug 240033

Summary: openvpn is leaking open file descriptors.
Product: [Fedora] Fedora Reporter: Daniel Walsh <dwalsh>
Component: openvpnAssignee: Steven Pritchard <steve>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: triage
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-14 17:20:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Walsh 2007-05-14 15:50:09 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070417 Fedora/2.0.0.3-4.fc7 Firefox/2.0.0.3

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):
openvpn-2.1-0.19.rc4.fc7

How reproducible:
Didn't try


Steps to Reproduce:
1.
2.
3.

Actual Results:


Expected Results:


Additional info:

Comment 1 Steven Pritchard 2007-05-14 16:29:49 UTC
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 17:48:07 UTC
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-04 00:41:05 UTC
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:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

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-07 01:44:03 UTC
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:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

Comment 5 Daniel Walsh 2008-05-07 09:38:48 UTC
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-14 02:54:04 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 7 Bug Zapper 2009-06-09 22:36:25 UTC
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 8 Bug Zapper 2009-07-14 17:20:19 UTC
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.