Bug 2213995

Summary: boothd_etc_t is not defined
Product: [Fedora] Fedora Reporter: David Juran <djuran>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 38CC: dwalsh, lvrabec, mmalik, nknazeko, omosnacek, pkoncity, vmojzis, zpytela
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-06-28 17:51:59 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 David Juran 2023-06-10 21:18:24 UTC
Persisting an selinux boolean fails:

[david@juran ~]$ sudo setsebool -P httpd_can_network_connect 1
[sudo] password for david: 
libsepol.context_from_record: type boothd_etc_t is not defined
libsepol.context_from_record: could not create context structure
libsepol.context_from_string: could not create context structure
libsepol.sepol_context_to_sid: could not convert system_u:object_r:boothd_etc_t:s0 to sid
invalid context system_u:object_r:boothd_etc_t:s0
Failed to commit changes to booleans: Success

The boolean get set but is not persisted and is again reset after reboot

[david@juran ~]$ rpm -q policycoreutils selinux-policy-targeted
policycoreutils-3.5-1.fc38.x86_64
selinux-policy-targeted-38.15-1.fc38.noarch



Reproducible: Always

Comment 1 Zdenek Pytela 2023-06-12 10:47:09 UTC
David,

The type was added in selinux-policy-targeted-38.14-1, but no error like this is expected to appear. Have you have made any related changes?

semanage export
semodule -lfull | grep boothd
semodule -lfull | grep -v ^100

Comment 2 Zdenek Pytela 2023-06-19 14:33:39 UTC
I still cannot reproduce it, the type always exists:

# seinfo -xt boothd_etc_t

Types: 1
   type boothd_etc_t, configfile, file_type, non_auth_file_type, non_security_file_type;
# setsebool -P httpd_can_network_connect 1
<>
# rpm -q selinux-policy
selinux-policy-38.17-1.fc39.noarch

If triggering conditions are not found, I will proceed and close this bz.

Comment 3 Zdenek Pytela 2023-06-27 17:12:45 UTC
As no new information appeared during the past 2 weeks, we are going to close this bug. If you need to pursue this matter further, feel free to reopen this bug and attach the needed information.

Comment 4 David Juran 2023-06-27 19:03:28 UTC
Terribly sorry for late reply, been out traveling the past two weeks.

[root@juran ~]# semanage export
boolean -D
login -D
interface -D
user -D
port -D
node -D
fcontext -D
module -D
ibendport -D
ibpkey -D
permissive -D
boolean -m -0 httpd_can_network_connect
boolean -m -1 httpd_can_sendmail
boolean -m -1 httpd_unified
boolean -m -1 named_write_master_zones
boolean -m -0 nis_enabled
boolean -m -1 spamassassin_can_network
boolean -m -1 use_nfs_home_dirs
boolean -m -1 virt_sandbox_use_all_caps
boolean -m -0 virt_use_nfs
[root@juran ~]# 



[root@juran ~]# semodule -lfull | grep boothd
100 boothd            pp          




[root@juran ~]# semodule -lfull | grep -v ^100
200 flatpak           pp          



[root@juran ~]# seinfo -xt boothd_etc_t

Types: 1
   type boothd_etc_t, configfile, file_type, non_auth_file_type, non_security_file_type;



[root@juran ~]#  rpm -q selinux-policy
selinux-policy-38.15-1.fc38.noarch



[root@juran ~]# setsebool -P httpd_can_network_connect 1
libsepol.context_from_record: type boothd_etc_t is not defined
libsepol.context_from_record: could not create context structure
libsepol.context_from_string: could not create context structure
libsepol.sepol_context_to_sid: could not convert system_u:object_r:boothd_etc_t:s0 to sid
invalid context system_u:object_r:boothd_etc_t:s0
Failed to commit changes to booleans: Success

The boolean is actually set:
[root@juran ~]# getsebool httpd_can_network_connect
httpd_can_network_connect --> on


But it is not persisted, none of the booleans in /etc/selinux/targeted/modules/active/booleans.local is loaded on startup.

Comment 5 Zdenek Pytela 2023-06-27 19:44:37 UTC
Can you try reinstalling all policies?

dnf reinstall selinux-policy selinux-policy-targeted flatpak-selinux

Comment 6 David Juran 2023-06-28 17:51:59 UTC
I don't pretend to understand why this solved the issue, but it did!
Thanks for the help :-)