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 2003153

Summary: Confined sysadm users cannot execute postfix administration commands
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: lvrabec, mmalik, ssekidde
Target Milestone: rcKeywords: Triaged
Target Release: 8.6Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-21 18:43:36 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: 1778780    

Description Renaud Métrich 2021-09-10 13:18:21 UTC
Description of problem:

When a user is confined to sysadm_u and sudo'es, he still cannot execute administrative postfix commands such as the ones below:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# id -Z
sysadm_u:sysadm_r:sysadm_t:s0-s0:c0.c1023

# /sbin/postsuper
-bash: /sbin/postsuper: Permission denied

# /usr/bin/newaliases
postalias: fatal: open database /etc/aliases.db: Permission denied
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

For `postsuper`, it's due to not having a rule to execute "postfix_master_exec_t" file.

For `newaliases`, it's due to not having a rule to be able to create the file in `/etc` when file doesn't exist.


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

selinux-policy-3.14.3-67.el8_4.1.noarch


How reproducible:

Always, see above.

Additional info:

This is problematic when root has been disabled. Since it's not possible to transition to "unconfined_r" role, no sysadm_u user can execute such commands.

Comment 1 Zdenek Pytela 2021-12-21 18:43:36 UTC
rhel8# rpm -q selinux-policy
selinux-policy-3.14.3-85.el8.noarch
rhel8# /sbin/postsuper
rhel8# touch /etc/aliases
rhel8# /usr/bin/newaliases
rhel8#

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

Comment 2 Renaud Métrich 2022-05-05 10:06:01 UTC
Hi Zdenek,

I don't understand why you closed this as a dup of some unrelated BZ (the other BZ is on sosreport).
Do you plan to fix this in that BZ instead?

Just FYI the solution here is to allow user_mail_t to manage etc_aliases_t:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
policy_module(user_mail_allow_creating_etc_aliases, 1.0)

gen_require(`
	type user_mail_t;
	type etc_aliases_t;
')

manage_files_pattern(user_mail_t, etc_aliases_t, etc_aliases_t)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------