RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1296851 - Correct SELinux context for stunnel logging
Summary: Correct SELinux context for stunnel logging
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-08 09:26 UTC by Milos Malik
Modified: 2016-11-04 02:40 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.13.1-71.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1296238
Environment:
Last Closed: 2016-11-04 02:40:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2283 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2016-11-03 13:36:25 UTC

Description Milos Malik 2016-01-08 09:26:14 UTC
+++ This bug was initially created as a clone of Bug #1296238 +++

Description of problem:
The stunnel program cannot write to a logfile because of selinux context, any attempt ends with an avc denial.

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-60.el7.noarch
selinux-policy-targeted-3.13.1-60.el7.noarch
stunnel-4.56-4.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. Set "output = file" in stunnel.conf
2. Run stunnel

Actual results:
type=AVC msg=audit(1450711949.536:39519): avc:  denied  { search } for  pid=28935 comm="stunnel" name="log" dev=dm-0 ino=522773 scontext=system_u:system_r:stunnel_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
type=SYSCALL msg=audit(1450711949.536:39519): arch=c000003e syscall=2 success=no exit=-13 a0=7f802d1ec7e0 a1=441 a2=1a0 a3=4 items=0 ppid=1419 pid=28935 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="stunnel" exe="/usr/bin/stunnel" 
etc.
in /var/log/audit/audit/log

Expected results:
No AVC denials

Additional info:
Logging using syslog works fine. The stunnel(8) manual page describes logging to an output file option as well:

output = file
  append log messages to a file instead of using syslog
  /dev/stdout device can be used to redirect log messages to the standard
  output (for example to log them with daemontools splogger).

so that we can expect that it also works without issues.

According to the stunnel_selinux(8) manual page, currently there is no log-type context associated nor there is a boolean to handle log files correctly.

Following AVCs appeared in permissive mode:
----
type=PATH msg=audit(01/08/2016 09:53:49.083:654) : item=1 name=/var/log/stunnel.log inode=1321 dev=fc:03 mode=file,640 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_log_t:s0 nametype=CREATE 
type=PATH msg=audit(01/08/2016 09:53:49.083:654) : item=0 name=/var/log/ inode=495 dev=fc:03 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_log_t:s0 nametype=PARENT 
type=CWD msg=audit(01/08/2016 09:53:49.083:654) :  cwd=/root 
type=SYSCALL msg=audit(01/08/2016 09:53:49.083:654) : arch=x86_64 syscall=open success=yes exit=8 a0=0x7f75914b3b60 a1=O_WRONLY|O_CREAT|O_APPEND a2=0640 a3=0x4 items=2 ppid=8195 pid=5050 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=pts0 ses=9 comm=stunnel exe=/usr/bin/stunnel subj=system_u:system_r:stunnel_t:s0 key=(null) 
type=AVC msg=audit(01/08/2016 09:53:49.083:654) : avc:  denied  { append open } for  pid=5050 comm=stunnel name=stunnel.log dev=vda3 ino=1321 scontext=system_u:system_r:stunnel_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file 
type=AVC msg=audit(01/08/2016 09:53:49.083:654) : avc:  denied  { create } for  pid=5050 comm=stunnel name=stunnel.log scontext=system_u:system_r:stunnel_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=file 
type=AVC msg=audit(01/08/2016 09:53:49.083:654) : avc:  denied  { add_name } for  pid=5050 comm=stunnel name=stunnel.log scontext=system_u:system_r:stunnel_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir 
type=AVC msg=audit(01/08/2016 09:53:49.083:654) : avc:  denied  { write } for  pid=5050 comm=stunnel name=log dev=vda3 ino=495 scontext=system_u:system_r:stunnel_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir 
type=AVC msg=audit(01/08/2016 09:53:49.083:654) : avc:  denied  { search } for  pid=5050 comm=stunnel name=log dev=vda3 ino=495 scontext=system_u:system_r:stunnel_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir 
----

Comment 4 errata-xmlrpc 2016-11-04 02:40:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2283.html


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