Bug 1861771

Summary: Cannot use the graphical user interface when pam_tty_audit.so is enabled
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 8.3CC: abuckner, fkrska, kmoriguc, leonfauster, lvrabec, mmalik, plautrba, sgadekar, ssekidde, zpytela
Target Milestone: rcKeywords: AutoVerified, Triaged, ZStream
Target Release: 8.4   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-67.el8 Doc Type: Bug Fix
Doc Text:
Cause: When the pam_tty_audit pam module is enabled for a user session, systemd needs the audit_control capability to be able to control kernel audit configuration and rules. This capability was not allowed, Consequence: The systemd user manager fails to start, errors are logged and AVC denials audited. Graphical display managers do not work any longer as they use a systemd user session to spawn the greeter. Fix: The capability was added to the policy conditionally: it is required to turn on the new init_audit_control boolean which is off by default. Result: Uses can use the graphical user interface.
Story Points: ---
Clone Of:
: 1938216 1962252 (view as bug list) Environment:
Last Closed: 2021-05-18 14:57:54 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: 1938216, 1962252    

Description Renaud Métrich 2020-07-29 14:07:11 UTC
Description of problem:

When enabling pam_tty_audit.so PAM plugin to /etc/pam.d/system-auth, it's not possible to use the Graphical User Interface anymore.

/etc/pam.d/system-auth:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[...]
session     required      pam_tty_audit.so enable=*
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

This is due to "systemd --user" process being spawned while creating the user session.
It processes /etc/pam.d/systemd-user which in turns includes /etc/pam.d/system-auth.

This is done while "systemd --user" process runs as "init_t" (context of main systemd) but "init_t" has no audit_config capability:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
6403  13:32:34.671661 execve("/usr/lib/systemd/systemd", ["/usr/lib/systemd/systemd", "--user"], ... <unfinished ...>
[...]
6403  13:32:34.608087 write(9</sys/fs/selinux/user>, "system_u:system_r:init_t:s0-s0:c0.c1023 unconfined_u", 52 <unfinished ...>

--> it is running as "init_t"

[...]
6403  13:32:34.658547 write(9</proc/6403/task/6403/attr/exec>, "unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023\0", 54) = 54 <0.000095>

--> it switches to "unconfined_t"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

The AVC popped while still being "init_t":
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# ausearch -m avc,user_avc -p 6403
----
time->Wed Jul 29 13:32:34 2020
type=AVC msg=audit(1596022354.666:200): avc:  denied  { audit_control } for  pid=6403 comm="(systemd)" capability=30  scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=capability permissive=1
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


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

selinux-policy-3.14.3-41.el8_2.5.noarch


How reproducible:

ALWAYS

Steps to Reproduce:
1. Configure "pam_tty_audit" in /etc/pam.d/system-auth on a system with GUI

/etc/pam.d/system-auth:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
[...]
session     required      pam_tty_audit.so enable=*
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Reboot


Actual results:

AVC and GUI not coming up


Expected results:

Works

Comment 3 Zdenek Pytela 2021-01-08 18:49:04 UTC
*** Bug 1912607 has been marked as a duplicate of this bug. ***

Comment 4 Zdenek Pytela 2021-01-22 20:05:51 UTC
*** Bug 1919402 has been marked as a duplicate of this bug. ***

Comment 5 Zdenek Pytela 2021-02-10 15:39:56 UTC
This bug has not been fully acknowledged by the subsystem to be resolved during the RHEL 8.4 development and testing phase, so it will be evaluated for inclusion into the next minor product update.

If you still want to pursue this issue further, please attach information regarding severity of the bugzilla.

Comment 18 Zdenek Pytela 2021-03-12 20:19:31 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/643

Comment 27 Zdenek Pytela 2021-03-26 07:49:21 UTC
*** Bug 1943477 has been marked as a duplicate of this bug. ***

Comment 29 errata-xmlrpc 2021-05-18 14:57:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (selinux-policy bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1639