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 1911854

Summary: Allow systemd labeled as init_t domain to create dirs labeled as user_home_dir_t
Product: Red Hat Enterprise Linux 8 Reporter: Ryan Howe <rhowe>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: jcrumple, lvrabec, mmalik, plautrba, ssekidde
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-28 15:41:01 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:

Description Ryan Howe 2020-12-31 21:15:13 UTC
Description of problem:
 
 Selinux blocks systemd from mounting a volume under /home with a mount.mount unit. 

Version-Release number of selected component (if applicable):

  selinux-policy-3.14.3-41.el8_2.8.noarch
  selinux-policy-targeted-3.14.3-41.el8_2.8.noarch
  systemd-239-31.el8_2.2.x86_64



How reproducible:
100%

Steps to Reproduce:
1. See Addition Info


Actual results:
  Fail

Expected results:
  Be able to mount filesystems anywhere on a host with systemd. 

Additional info:

----------------
Systemd mount units
----------------

# /etc/systemd/system/var-home-share1.mount
[Unit]
Description=Mount Share1
[Mount]
What=nfs.redhat.com:/nfsexport/share1 
Where=/var/home/share1
Type=nfs      
[Install]
WantedBy=multi-user.target    


# /etc/systemd/system/var-home-share1.automount
[Unit]
Description=Automount Share1
[Automount] 
Where=/var/home/share1
DirectoryMode=0755
[Install]
WantedBy=multi-user.target

----------------
Audit Log
----------------

# echo 'type=AVC msg=audit(1609446667.955:138): avc:  denied  { create } for  pid=1 comm="systemd" name="share1" scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir permissive=0' | audit2allow


#============= init_t ==============
allow init_t user_home_dir_t:dir create;

----------------
Error
----------------
● var-home-share1.automount - Automount Share1
   Loaded: loaded (/etc/systemd/system/var-home-share1.automount; enabled; vendor preset: disabled)
   Active: failed (Result: resources) since Thu 2020-12-31 20:30:40 UTC; 37min ago
    Where: /var/home/share1

systemd[1]: Set up automount Automount Share1.

systemd[1]: var-home-share1.automount: Failed to check directory /var/home/share1: No such file or directory

systemd[1]: var-home-share1.automount: Failed to initialize automounter: No such file or directory

systemd[1]: var-home-share1.automount: Failed with result 'resources'.

systemd[1]: Failed to set up automount Automount Share1.
----------------

Comment 1 Zdenek Pytela 2021-01-04 20:30:52 UTC
The permissions are allowed in selinux-policy since the version 3.14.3-45 in RHEL 8.3.

Comment 7 Milos Malik 2021-01-27 09:20:45 UTC
SELinux policy already contains the fix.

# rpm -qa selinux\*
selinux-policy-3.14.3-60.el8.noarch
selinux-policy-targeted-3.14.3-60.el8.noarch
# sesearch -s init_t -t user_home_dir_t -c dir -p create -A
allow init_t non_security_file_type:dir { create getattr }; [ init_create_dirs ]:True
#

Please notice that the init_create_dirs boolean needs to be enabled on customer machines.

Comment 8 Zdenek Pytela 2021-01-28 15:41:01 UTC
Closing this bz as a dup of bz#1832231 which was a part of the following erratum:
https://access.redhat.com/errata/RHBA-2020:4528

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