Bug 2009769
| Summary: | DBus unable to send_msg to cloud-init when "sudo" or "su" is used in cloud-init "user-data" scripts | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Stepan Broz <sbroz> |
| Component: | selinux-policy | Assignee: | Zdenek Pytela <zpytela> |
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.4 | CC: | lvrabec, mmalik, pkoncity, ssekidde |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.6 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | selinux-policy-3.14.3-84.el8 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-05-10 15:15:05 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: | |||
Hi Stepan, please can you reproduce the scenario again and attach here full AVC's messages in permissive mode? Steps to enable full auditing and permissive SELinux mode: 1) Open the /etc/audit/rules.d/audit.rules file in an editor. 2) Remove the following line if it exists: -a task,never 3) Add the following line to the end of the file: -w /etc/shadow -p w 4) Restart the audit daemon: # service auditd restart 5) Open the /etc/selinux/config file in an editor. change line SELINUX=enforcing to SELINUX=permissive 6) Re-run your scenario 7) Collect AVC denials: # ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today Thank you, Patrik Unfortunately the reproducer uses a vanilla guest image, as taken from the customer portal, that I am unable to modify. (guestfish fails to mount the image read-write) cloud-init does not run the second time post-install, I believe. I cannot provide the data you requested. (In reply to Stepan Broz from comment #2) > Unfortunately the reproducer uses a vanilla guest image, as taken from the > customer portal, that I am unable to modify. (guestfish fails to mount the > image read-write) > cloud-init does not run the second time post-install, I believe. > > I cannot provide the data you requested. Stepane, The new policy build is on the way, we will however hardly be able to test a complex scenario similar enough to the customer's environment, so there is a risk the fix is not complete. Do you think they will be able to test the selinux-policy package? I will do my test and will follow-up with the customer, no worries! Just let me know when it's ready. 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-2022:1995 |
Description of problem: Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Download KVM Guest Image from: https://access.redhat.com/downloads/content/479/ver=/rhel---8/8.4/x86_64/product-software 2.Place it in "/var/lib/libvirt/images/rhel-guest-image-8.4-992.x86_64.qcow2" 3. Create cidata.iso using the steps below: # mkdir ci; cd ci # vi meta-data --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------ instance-id: foobar local-hostname: foobar.example.com --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------ # vi user-data --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------ #cloud-config password: redhat chpasswd: { expire: False } ssh_pwauth: True ssh_authorized_keys: - <place_your_SSH_pubkey_here> runcmd: - su - -c date >~/testfile --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------ # mkisofs -o /var/lib/libvirt/images/cidata.iso -J -R -V cidata . 4. Create a new VM using rhel-guest-image-8.4-992.x86_64.qcow2 as disk drive and cidata.iso as a CD-ROM, boot it. Actual results: Extra 25 seconds delay with SELinux enabled and enforcing, AVC denial in audit.log as follows: type=USER_AVC msg=audit(1633097673.446:66): pid=652 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc: denied { send_msg } for msgtype=method_return dest=:1.19 spid=723 tpid=1434 scontext=system_u:system_r:systemd_logind_t:s0 tcontext=system_u:system_r:cloud_init_t:s0 tclass=dbus permissive=0 exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'UID="dbus" AUID="unset" SAUID="dbus" Expected results: No AVC, no extra delay. Additional info: https://access.redhat.com/solutions/5692661 Suggests: --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------ policy_module(cloud_init_sudo, 1.0) gen_require(` type cloud_init_t; type systemd_logind_t; class dbus send_msg; ') allow systemd_logind_t cloud_init_t:dbus send_msg; allow cloud_init_t systemd_logind_t:dbus send_msg; --8<--------8<--------8<--------8<--------8<--------8<--------8<--------8<------