Bug 2123169

Summary: fapolicyd ineffective with systemd DynamicUser=yes
Product: [Fedora] Fedora Reporter: François Rigault <frigo>
Component: fapolicydAssignee: Steve Grubb <sgrubb>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 38CC: rsroka, sgrubb
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2136802 (view as bug list) Environment:
Last Closed: 2024-05-21 14:16:07 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:
Bug Depends On:    
Bug Blocks: 2136802    

Description François Rigault 2022-08-31 20:35:36 UTC
Description of problem:
fapolicyd rules are not applied in systemd services running with dynamic user

Version-Release number of selected component (if applicable):
fapolicyd-1.1.4-4.fc38.x86_64
fapolicyd-selinux-1.1.4-4.fc38.noarch

How reproducible:
I only tried on Rawhide

Steps to Reproduce:
1. cp /usr/bin/id /usr/bin/id2
2. systemd-run --pipe -p User=haproxy    bash -c 'id ; id2'
3. systemd-run --pipe -p DynamicUser=yes bash -c 'id ; id2'

Actual results:
in 3.: 
# systemd-run --pipe -p DynamicUser=yes bash -c 'id ; id2'
Running as unit: run-u86.service
uid=62294(run-u86) gid=62294(run-u86) groups=62294(run-u86) context=system_u:system_r:initrc_t:s0
uid=62294(run-u86) gid=62294(run-u86) groups=62294(run-u86) context=system_u:system_r:initrc_t:s0

Expected results:
similar to 2., id2 should fail:

Running as unit: run-u81.service
uid=982(haproxy) gid=981(haproxy) groups=981(haproxy) context=system_u:system_r:initrc_t:s0
/usr/bin/bash: line 1: /usr/bin/id2: Operation not permitted


Additional info:

Comment 1 Steve Grubb 2022-08-31 21:04:36 UTC
For some reason, fanotify doesn't see the open/execute request at all. It sees systemd-run start and after that it goes dark.

Comment 4 Steve Grubb 2022-10-21 13:32:04 UTC
Thanks for pointing out this problem. Upstream has merged a patch that allows fapolicyd to see events on bind mount or overlayfs partitions. However, there are limitations on what can be controlled when containers are used. In any event, try the 1.1.7 version when it becomes available.

Comment 5 Ben Cotton 2023-02-07 15:13:29 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 6 Aoife Moloney 2024-05-07 15:48:18 UTC
This message is a reminder that Fedora Linux 38 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 38 on 2024-05-21.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '38'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 38 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 7 Aoife Moloney 2024-05-21 14:16:07 UTC
Fedora Linux 38 entered end-of-life (EOL) status on 2024-05-21.

Fedora Linux 38 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.