Bug 1741609

Summary: SELinux is preventing bacula-fd from using the 'dac_override' capabilities.
Product: [Fedora] Fedora Reporter: jan.vesely
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 30CC: andreas, dwalsh, grepl.miroslav, jpkorva, jridky, lvrabec, mgrepl, negativo17, phracek, plautrba, rvokal, vdolezal, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:2f1ecfb848afaddddfa6bafb2ada18cd71628970a7895c94f331ce714a80ea0a;VARIANT_ID=workstation;
Fixed In Version: selinux-policy-3.14.3-57.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-05 03:54:50 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 jan.vesely 2019-08-15 14:46:39 UTC
Description of problem:
SELinux is preventing bacula-fd from using the 'dac_override' capabilities.

*****  Plugin dac_override (91.4 confidence) suggests   **********************

If you want to help identify if domain needs this access or you have a file with the wrong permissions on your system
Then turn on full auditing to get path information about the offending file and generate the error again.
Do

Turn on full auditing
# auditctl -w /etc/shadow -p w
Try to recreate AVC. Then execute
# ausearch -m avc -ts recent
If you see PATH record check ownership/permissions on file, and fix it,
otherwise report as a bugzilla.

*****  Plugin catchall (9.59 confidence) suggests   **************************

If you believe that bacula-fd should have the dac_override capability 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:
# ausearch -c 'bacula-fd' --raw | audit2allow -M my-baculafd
# semodule -X 300 -i my-baculafd.pp

Additional Information:
Source Context                system_u:system_r:bacula_t:s0
Target Context                system_u:system_r:bacula_t:s0
Target Objects                Unknown [ capability ]
Source                        bacula-fd
Source Path                   bacula-fd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.3-43.fc30.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 5.2.7-200.fc30.x86_64 #1 SMP Thu
                              Aug 8 05:35:29 UTC 2019 x86_64 x86_64
Alert Count                   6
First Seen                    2019-08-06 23:36:36 EDT
Last Seen                     2019-08-14 23:48:05 EDT
Local ID                      01eb4f68-ca4b-4140-9ed3-5fff9e51adde

Raw Audit Messages
type=AVC msg=audit(1565840885.804:2326): avc:  denied  { dac_override } for  pid=1414 comm="bacula-fd" capability=1  scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:system_r:bacula_t:s0 tclass=capability permissive=0


Hash: bacula-fd,bacula_t,bacula_t,capability,dac_override

Version-Release number of selected component:
selinux-policy-3.14.3-43.fc30.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.10.1
hashmarkername: setroubleshoot
kernel:         5.2.7-200.fc30.x86_64
type:           libreport

Comment 1 Lukas Vrabec 2019-08-19 14:01:43 UTC
Hi Bacula devs, 

Does Bacula require to bypass DAC permissions also for writing on filesystem or search/read is enough? I assume for creating backup reasing the whole filesystem should be enough.

Thanks,
Lukas.

Comment 2 jan.vesely 2019-08-29 18:11:25 UTC
*** Bug 1747133 has been marked as a duplicate of this bug. ***

Comment 3 Zdenek Pytela 2019-11-13 16:23:06 UTC
*** Bug 1771634 has been marked as a duplicate of this bug. ***

Comment 4 Zdenek Pytela 2019-11-13 16:28:31 UTC
Simone and bacula folks,

bacula-fd requested the dac_override capability which is not allowed for the bacula_t domain. However, there already is dac_read_search granted: Is it sufficient for having bacula working?

Comment 5 Simone Caronni 2019-11-18 05:53:43 UTC
I will make some tests.

Comment 6 Jari Korva 2020-02-06 08:04:39 UTC
I got "dac_override" error while restoring folder structure to /var/tmp/bacula-restores on CentOS 8.1. At a quick glance it seems that I can't restore subfolders owned by regular users (non-root).

Comment 7 Zdenek Pytela 2020-02-10 13:40:32 UTC
I've submitted a PR to address the issue:
https://github.com/fedora-selinux/selinux-policy-contrib/pull/204

Comment 8 Lukas Vrabec 2020-02-10 15:36:34 UTC
commit 7c4e8a4167103ac7bca5c46c1625906f6bdc4608 (HEAD -> rawhide, origin/rawhide, origin/HEAD)
Author: Zdenek Pytela <zpytela>
Date:   Mon Feb 10 14:38:16 2020 +0100

    Allow bacula dac_override capability
    
    The dac_override capability is needed to restore permissions and ownership.
    Resolves: rhbz#1741609

Comment 9 Fedora Update System 2020-03-20 08:00:21 UTC
FEDORA-2020-cde9529d3d has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2020-cde9529d3d

Comment 10 Fedora Update System 2020-03-21 01:22:25 UTC
selinux-policy-3.14.3-57.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-cde9529d3d

Comment 11 Fedora Update System 2020-04-05 03:54:50 UTC
FEDORA-2020-cde9529d3d has been pushed to the Fedora 30 stable repository.
If problem still persists, please make note of it in this bug report.