Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1154164

Summary: New SELinux policy for bacula doesn't allow writing backup files to NFS/CIFS share
Product: Red Hat Enterprise Linux 6 Reporter: Robert Scheck <redhat-bugzilla>
Component: selinux-policyAssignee: Simon Sekidde <ssekidde>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: high Docs Contact:
Priority: medium    
Version: 6.6CC: dwalsh, halgol60, lvrabec, mgrepl, michal.bruncko, mmalik, robert.scheck, ssekidde
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-263.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:09:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
custom policy module
none
Updated bacula policy package none

Description Robert Scheck 2014-10-17 17:25:58 UTC
Description of problem:
If you configure bacula that backup files get written to a NFS share (e.g.
provided by a NAS which is not capable to run bacula itself) this is going
to fail since RHEL 6.6 and the new SELinux policy for bacula.

Version-Release number of selected component (if applicable):
bacula-director-common-5.0.0-12.el6.x86_64
bacula-director-sqlite-5.0.0-12.el6.x86_64
selinux-policy-3.7.19-260.el6.noarch
selinux-policy-targeted-3.7.19-260.el6.noarch

How reproducible:
Everytime, see above.

Actual results:
New SELinux policy for bacula doesn't allow writing backup files to NFS share.

Expected results:
Allow writing backups to whatever location is needed for administrators.

Comment 1 Robert Scheck 2014-10-17 17:32:40 UTC
Cross-filed cases #01265653 (ourself), #01265658 (customer1), #01265660 
(customer2) on the Red Hat customer portal.

Comment 5 Miroslav Grepl 2014-10-20 05:38:37 UTC
Lukas,
could you please attach a local policy module with fixes for bacula? We need to allow to access NFS.

For now it could be allowed using

# semanage permissive -a bacula_t

Comment 6 Robert Scheck 2014-10-20 11:25:11 UTC
This affects CIFS as well (cifs_t). Maybe something like bacula_anon_write
as boolean (or similar) is needed?

Comment 7 Robert Scheck 2014-10-20 12:19:41 UTC
Single AVC denied example for CIFS from one of our productive systems:

type=AVC msg=audit(1413583503.159:3454): avc:  denied  { write } for  pid=10297 comm="bacula-sd" name="Incremental-0031" dev=cifs ino=9904194586646 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:cifs_t:s0 tclass=file
type=SYSCALL msg=audit(1413583503.159:3454): arch=x86_64 syscall=open success=yes exit=ENXIO a0=7fad7c014900 a1=2 a2=1a0 a3=8 items=0 ppid=1 pid=10297 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=bacula-sd exe=/usr/sbin/bacula-sd subj=system_u:system_r:bacula_t:s0 key=(null)

Comment 10 Robert Scheck 2014-10-21 09:28:03 UTC
AVC denied example from tonight for NFS from one of our productive systems:

type=AVC msg=audit(1413861044.129:28994): avc:  denied  { write } for  pid=24887 comm="bacula-sd" name="bacula" dev=0:1b ino=44840656 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=AVC msg=audit(1413861044.129:28994): avc:  denied  { add_name } for  pid=24887 comm="bacula-sd" name="Bacula-Full-0128" scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=AVC msg=audit(1413861044.129:28994): avc:  denied  { create } for  pid=24887 comm="bacula-sd" name="Bacula-Full-0128" scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:nfs_t:s0 tclass=file
type=SYSCALL msg=audit(1413861044.129:28994): arch=x86_64 syscall=open success=yes exit=ENXIO a0=7f108c0252e0 a1=42 a2=1a0 a3=10 items=0 ppid=1 pid=24887 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=bacula-sd exe=2F7573722F7362696E2F626163756C612D7364202864656C6574656429 subj=system_u:system_r:bacula_t:s0 key=(null)

Comment 11 Simon Sekidde 2014-12-27 00:46:03 UTC
Created attachment 973354 [details]
custom policy module

Robert, 

The objective is to address this with Bacula Booleans for NFS and CIFS. Can you install the attached local policy module and let us know if this fixes both use cases?

MD5 Checksum  9ca8c3c64d8226e143b1751016ea2c5c

Comment 13 Robert Scheck 2015-01-08 11:22:02 UTC
Simon, the mybacula.pp does not introduce any new booleans? Or is the policy
module meant to contain the changes that a boolean should bring? Testing the
policy is hard to impossible for me, because all our regular (productive!)
setups still fail due to unresolved bug #1154158 right now:

type=AVC msg=audit(1420715823.303:272904): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=19660874 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.303:272904): arch=c000003e syscall=21 success=no exit=-13 a0=30772761fc a1=7 a2=7eff76904a40 a3=8 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715823.303:272905): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=19660874 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.303:272905): arch=c000003e syscall=21 success=no exit=-13 a0=3077276205 a1=7 a2=7eff76904a40 a3=8 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715823.303:272906): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=25952257 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.303:272906): arch=c000003e syscall=21 success=no exit=-13 a0=3077276200 a1=7 a2=7eff76904a40 a3=8 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715823.315:272907): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=19660874 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.315:272907): arch=c000003e syscall=21 success=no exit=-13 a0=30772761fc a1=7 a2=7eff76904ad0 a3=7eff76904fb0 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715823.315:272908): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=19660874 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.315:272908): arch=c000003e syscall=21 success=no exit=-13 a0=3077276205 a1=7 a2=7eff76904ad0 a3=7eff76904fb0 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715823.315:272909): avc:  denied  { write } for  pid=19335 comm="bacula-dir" name="tmp" dev=sda1 ino=25952257 scontext=system_u:system_r:bacula_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=dir
type=SYSCALL msg=audit(1420715823.315:272909): arch=c000003e syscall=21 success=no exit=-13 a0=3077276200 a1=7 a2=7eff76904ad0 a3=7eff76904fb0 items=0 ppid=1 pid=19335 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=system_u:system_r:bacula_t:s0 key=(null)
type=AVC msg=audit(1420715865.966:272912): avc:  denied  { execute } for  pid=19590 comm="bacula-dir" name="bacula-mount.sh" dev=sda1 ino=3145799 scontext=unconfined_u:system_r:bacula_t:s0 tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file
type=SYSCALL msg=audit(1420715865.966:272912): arch=c000003e syscall=59 success=no exit=-13 a0=7fb31c0011f0 a1=7fb327237660 a2=7fff6a798ba8 a3=3075418240 items=0 ppid=19515 pid=19590 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=44261 comm="bacula-dir" exe="/usr/sbin/bacula-dir.sqlite" subj=unconfined_u:system_r:bacula_t:s0 key=(null)

Comment 14 Simon Sekidde 2015-01-27 20:29:40 UTC
(In reply to Robert Scheck from comment #13)
> Simon, the mybacula.pp does not introduce any new booleans? Or is the policy
> module meant to contain the changes that a boolean should bring? 

Includes changes that will be part of the boolean

Comment 15 Simon Sekidde 2015-01-27 20:31:12 UTC
Created attachment 984867 [details]
Updated bacula policy package


> Testing the policy is hard to impossible for me, because all our regular 
> (productive!) setups still fail due to unresolved bug #1154158 right now:
> 
> type=AVC msg=audit(1420715865.966:272912): avc:  denied  { execute } for 
> pid=19590 comm="bacula-dir" name="bacula-mount.sh" dev=sda1 ino=3145799
> scontext=unconfined_u:system_r:bacula_t:s0
> tcontext=unconfined_u:object_r:admin_home_t:s0 tclass=file
> type=SYSCALL msg=audit(1420715865.966:272912): arch=c000003e syscall=59
> success=no exit=-13 a0=7fb31c0011f0 a1=7fb327237660 a2=7fff6a798ba8
> a3=3075418240 items=0 ppid=19515 pid=19590 auid=0 uid=0 gid=0 euid=0 suid=0
> fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=44261 comm="bacula-dir"
> exe="/usr/sbin/bacula-dir.sqlite" subj=unconfined_u:system_r:bacula_t:s0
> key=(null)

Understood. I have attached a new policy file. 

 MD5 Checksum d606f73c68f84dbf074dc7bf71eaac12

If you label the bacula-mount.sh file as bacula_unconfined_script_exec_t and test with the new policy file can you share the AVCs?

Comment 16 Robert Scheck 2015-04-01 12:40:47 UTC
Sorry, I overlooked this comment. I tested the new policy file on a system
with CIFS a few minutes ago and it seems to work (no AVC so far).

Comment 19 errata-xmlrpc 2015-07-22 07:09: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-2015-1375.html