Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1296238 - Correct selinux context for stunnel logging
Summary: Correct selinux context for stunnel logging
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.7
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 1297325 1333033
TreeView+ depends on / blocked
 
Reported: 2016-01-06 16:40 UTC by Zdenek Pytela
Modified: 2019-10-10 10:49 UTC (History)
9 users (show)

Fixed In Version: selinux-policy-3.7.19-288.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1296851 1297325 (view as bug list)
Environment:
Last Closed: 2016-05-10 20:04:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0763 0 normal SHIPPED_LIVE selinux-policy bug fix update 2016-05-10 22:33:46 UTC

Description Zdenek Pytela 2016-01-06 16:40:43 UTC
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):
stunnel-4.29-3.el6_6.1.x86_64
selinux-policy-3.7.19-279.el6_7.8.noarch


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.

Comment 2 Miroslav Grepl 2016-01-07 09:44:47 UTC
Ok we can provide a new type - stunnel_log_t for these cases.

Comment 3 Milos Malik 2016-01-08 08:55:24 UTC
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 Milos Malik 2016-01-08 08:56:52 UTC
selinux-policy in RHEL-7 does not define any type for stunnel log files either.

Comment 12 errata-xmlrpc 2016-05-10 20:04:20 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-0763.html


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