Bug 841680

Summary: SELinux is preventing /usr/bin/systemd-tmpfiles from 'write' accesses on the directory 0E.
Product: [Fedora] Fedora Reporter: zic <zic-rhn>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:30d9ed2222f43d90ca6342087a90e41d171219f1dd46fb516faad9033616c3cd
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-01 18:21:04 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 zic 2012-07-19 20:29:25 UTC
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.4.4-5.fc17.x86_64
time:           Fri 20 Jul 2012 05:29:07 AM JST

description:
:SELinux is preventing /usr/bin/systemd-tmpfiles from 'write' accesses on the directory 0E.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that systemd-tmpfiles should be allowed write access on the 0E directory by default.
:Then you should report this as a bug.
:You can generate a local policy module to allow this access.
:Do
:allow this access for now by executing:
:# grep systemd-tmpfile /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:systemd_tmpfiles_t:s0
:Target Context                unconfined_u:object_r:squid_cache_t:s0
:Target Objects                0E [ dir ]
:Source                        systemd-tmpfile
:Source Path                   /usr/bin/systemd-tmpfiles
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           systemd-44-17.fc17.x86_64
:Target RPM Packages           
:Policy RPM                    selinux-policy-3.10.0-137.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed).Tahri 3.4.4-5.fc17.x86_64 #1 SMP Thu
:                              Jul 5 20:20:59 UTC 2012 x86_64 x86_64
:Alert Count                   449
:First Seen                    Mon 16 Jul 2012 09:19:55 PM JST
:Last Seen                     Thu 19 Jul 2012 09:16:25 PM JST
:Local ID                      3da108da-d9e7-45ef-a4d2-b9ff853916c4
:
:Raw Audit Messages
:type=AVC msg=audit(1342700185.672:205736): avc:  denied  { write } for  pid=22244 comm="systemd-tmpfile" name="0E" dev="md112" ino=1180270 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=unconfined_u:object_r:squid_cache_t:s0 tclass=dir
:
:
:type=SYSCALL msg=audit(1342700185.672:205736): arch=x86_64 syscall=unlinkat success=no exit=EACCES a0=6 a1=1c5da63 a2=200 a3=8028 items=0 ppid=1 pid=22244 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=systemd-tmpfile exe=/usr/bin/systemd-tmpfiles subj=system_u:system_r:systemd_tmpfiles_t:s0 key=(null)
:
:Hash: systemd-tmpfile,systemd_tmpfiles_t,squid_cache_t,dir,write
:
:audit2allowunable to open /sys/fs/selinux/policy:  Permission denied
:
:
:audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied
:
:

Comment 1 Miroslav Grepl 2012-07-19 22:02:10 UTC
Where is "0E" located?

Comment 2 zic 2012-07-21 09:29:13 UTC
It should be /var/spool/squid/0E or moved squid folder to /tmp.

I was/am not familier with SELinux, so I just followed the instruction of "SELinux Alert Browser" [Troubleshoot] button.

It just told me to file this report and issue workaround:

# grep systemd-tmpfile /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

But this wasn't help.

If the tool description told me I should issue:

# /sbin/restorecon -R -v /tmp
# /sbin/restorecon -R -v /var/spool/squid

I didn't file this record.

I've already modified my /etc/selinux/config from SELINUX=enforcing to SELINUX=permissive, so I have no issues right now.

The reason I had to issue restorecon was, I created those new partitions /tmp, /var/spool/squid after I installed F17 and copied the contents.

I didn't know nothing about restorecon commands or touch something under / and reboot to relabel everything.

So I think issues on my side is not valid any more.

But probably, the "SELinux Alert Browser" message should be improve for a user to know about restorecon command.

Comment 3 Daniel Walsh 2012-07-23 14:42:54 UTC
Ok mv squid content back to /var/spool/squid and run restorecon, you do not want this content in /tmp.

Comment 4 zic 2012-07-23 18:13:12 UTC
When do such a thing, i.e. isolate a folder tree into a new partition, copy over its contents to the new partition and move the original into /tmp and keep it for a while, a sort of backup.  And let tmpwatch? to remove it.  That's how it happened all about.

So from my side, this issue is solved.

Comment 5 Daniel Walsh 2012-07-23 20:15:25 UTC
Miroslav I guess it is time that we allowed systemd-tmpfiles to delete any non security file type.

Comment 6 Miroslav Grepl 2012-07-24 11:52:28 UTC
I fixed files_delete_all_non_security_files() interface.

Comment 7 Fedora Update System 2012-07-27 15:33:54 UTC
selinux-policy-3.10.0-142.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-142.fc17

Comment 8 Fedora Update System 2012-07-28 01:23:40 UTC
Package selinux-policy-3.10.0-142.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.10.0-142.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-11215/selinux-policy-3.10.0-142.fc17
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2012-08-01 18:21:04 UTC
selinux-policy-3.10.0-142.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.