Bug 1301329

Summary: SELinux is preventing snapperd from 'create' accesses on the directory 1.
Product: [Fedora] Fedora Reporter: abyss.7
Component: snapperAssignee: LVM and device-mapper development team <lvm-team>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: agk, dominick.grift, dwalsh, kakoskin, lvm-team, lvrabec, mgrepl, msnitzer, okozina, plautrba
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:0cad605768e8bf62f8ded27a5aed48e41701b7fcab58d53a534a187e89fdf444;VARIANT_ID=workstation;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-03 12:02: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 abyss.7 2016-01-24 09:47:37 UTC
Description of problem:
I have installed dnf plugin for snapper - to automatically store snapshots. After installing a single package an error occured. Looks like the problem is about '/.snapshots/1'
SELinux is preventing snapperd from 'create' accesses on the directory 1.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow snapperd to have create access on the 1 directory
Then you need to change the label on 1
Do
# semanage fcontext -a -t FILE_TYPE '1'
where FILE_TYPE is one of the following: snapperd_conf_t, snapperd_data_t. 
Then execute: 
restorecon -v '1'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If you believe that snapperd should be allowed create access on the 1 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 snapperd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:snapperd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:unlabeled_t:s0
Target Objects                1 [ dir ]
Source                        snapperd
Source Path                   snapperd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.2.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.3.3-300.fc23.x86_64 #1 SMP Tue
                              Jan 5 23:31:01 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-01-24 12:42:03 MSK
Last Seen                     2016-01-24 12:42:03 MSK
Local ID                      5a31c0bb-85a6-4018-a17c-01e324ee3b52

Raw Audit Messages
type=AVC msg=audit(1453628523.365:3603): avc:  denied  { create } for  pid=15394 comm="snapperd" name="1" scontext=system_u:system_r:snapperd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=dir permissive=0


Hash: snapperd,snapperd_t,unlabeled_t,dir,create

Version-Release number of selected component:
selinux-policy-3.13.1-158.2.fc23.noarch

Additional info:
reporter:       libreport-2.6.3
hashmarkername: setroubleshoot
kernel:         4.3.3-300.fc23.x86_64
type:           libreport

Comment 1 kakoskin 2016-03-03 11:04:17 UTC
Description of problem:
Install Fedora with btrfs file system and install snapper.

Create Snapper configuration for root subvolume:
# snapper -c -root create-config /

Make  a snapshot 
# snapper -c root create 

Note that Snapper managed to create the directory /.snapshots/ but actual snapshot creation fails. 


Version-Release number of selected component:
selinux-policy-3.13.1-158.9.fc23.noarch

Additional info:
reporter:       libreport-2.6.4
hashmarkername: setroubleshoot
kernel:         4.4.3-300.fc23.x86_64
type:           libreport

Comment 2 Ondrej Kozina 2016-03-03 12:02:04 UTC
Yes, it's a known problem. snapper (with btrfs backend only) snapshots directories have invalid selinux type set for subtree after ioctl call.

*** This bug has been marked as a duplicate of bug 1247530 ***