Bug 2050140

Summary: unexpected selinux changes during installation to image
Product: Red Hat Enterprise Linux 8 Reporter: Zdenek Veleba <zveleba>
Component: anacondaAssignee: Anaconda Maintenance Team <anaconda-maint-list>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact: Sagar Dubewar <sdubewar>
Priority: unspecified    
Version: 8.6CC: gfialova, jkonecny, jstodola, lmanasko, sdubewar, vslavik
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
.Unexpected SELinux policies on systems where Anaconda is running as an application When Anaconda is running as an application on an already installed system (for example to perform another installation to an image file using the `–image` anaconda option), the system is not prohibited to modify the SELinux types and attributes during installation. As a consequence, certain elements of SELinux policy might change on the system where Anaconda is running. To work around this problem, do not run Anaconda on the production system. Instead, run Anaconda in a temporary virtual machine to keep the SELinux policy unchanged on a production system. Running anaconda as part of the system installation process such as installing from `boot.iso` or `dvd.iso` is not affected by this issue.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-22 15:36:26 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: 2026666    

Description Zdenek Veleba 2022-02-03 10:51:12 UTC
Description of problem:
Some selinux types and attributes were changed during the installation to image.

Version-Release number of selected component (if applicable):
RHEL-8.6.0-20220201.1
anaconda-33.16.6.5-1.el8

How reproducible:
Always

Steps to Reproduce:
1. seinfo --all > seinfo_all_before.out
2. Create disk image `fallocate -l 9G /root/disk.img`
2. Start installation `anaconda --image=/root/disk.img --repo=<url>`
3. Perform minimal installation
3. seinfo --all > seinfo_all_after.out

Actual results:
Full seinfo diff, before and after installation to image:
diff seinfo_all_before.out seinfo_all_after.out 
7c7
<   Types:              4946    Attributes:          252
---
>   Types:              4943    Attributes:          254
10,12c10,12
<   Allow:            110798    Neverallow:            0
<   Auditallow:          163    Dontaudit:         10258
<   Type_trans:       243938    Type_change:          87
---
>   Allow:            110675    Neverallow:            0
>   Auditallow:          161    Dontaudit:         10310
>   Type_trans:       241546    Type_change:          87
2547c2547
< Types: 4946
---
> Types: 4943
3772,3773d3771
<    flatpak_helper_exec_t
<    flatpak_helper_t
6142a6141
>    sandbox_t
6631,6632d6629
<    swtpm_exec_t
<    swtpm_t
7495c7492
< Type Attributes: 252
---
> Type Attributes: 254
7656a7654
>    sandbox_domain
7658a7657
>    sandbox_typeattr_1

Expected results:
No changes on the "host" system.

Additional info:
It seems that the differences depend on what environment you have and what you are installing to the image.

Comment 6 Jiri Konecny 2022-04-01 10:39:51 UTC
Hi Vlada, could you please take a look on this if it is SELinux or us?

Comment 7 Vladimír Slávik 2022-04-12 17:29:17 UTC
I did not find anything that would explicitly change such things, so I think this effect is indirect and likely not our bug.

In my limited understanding, a system's policy can consist of many files installed by many packages, and this command's output only dumps the sum of all the types from all the files. With that hypothesis, the differences in seinfo output according to installed packages make sense. And changes to the output on host instead of target feel like something is leaking while installing things. It might be useful to see if the same changes occur to installation environment.

Better ask somebody who knows what they are doing...