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.
To backport:
commit 901ac5314982f5600ef11691969b9af89aeba772
Author: Zdenek Pytela <zpytela>
Date: Mon Dec 20 14:21:33 2021 +0100
Allow userdomains use pam_ssh_agent_auth for passwordless sudo
The pam_ssh_agent_auth module can be used for granting permissions based
on SSH agent requests. When configured for using in the sudo pam module,
it requires permissions for sudodomain to use the user socket file and
stream connect to its corresponding userdomain.
Resolves: rhbz#1917879
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: After configuring pam_ssh_agent_auth to provide passwordless sudo through ssh agent, AVCs are preventing "sudo" from working: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- allow staff_sudo_t staff_t:unix_stream_socket connectto; allow staff_sudo_t user_tmp_t:sock_file { getattr write }; allow sysadm_sudo_t sysadm_t:unix_stream_socket connectto; allow sysadm_sudo_t user_tmp_t:sock_file write; -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- More generally, what is missing are these rules: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- allow staff_sudo_t staff_t:unix_stream_socket connectto; allow sysadm_sudo_t sysadm_t:unix_stream_socket connectto; allow auditadm_sudo_t auditadm_t:unix_stream_socket connectto; allow dbadm_sudo_t dbadm_t:unix_stream_socket connectto; allow secadm_sudo_t secadm_t:unix_stream_socket connectto; allow sudodomain user_tmp_t:sock_file { getattr write }; -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Version-Release number of selected component (if applicable): selinux-policy-3.14.3-54.el8.noarch How reproducible: Always Steps to Reproduce: 1. Install pam_ssh_agent_auth -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # yum -y install pam_ssh_agent_auth -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 2. Configure passwordless sudo through ssh agent /etc/pam.d/sudo: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- auth sufficient pam_ssh_agent_auth.so file=~/.ssh/authorized_keys ... -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- /etc/sudoers: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Defaults env_keep += "SSH_AUTH_SOCK" -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 3. Create "staff" and "sysadm" users -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # useradd -Z staff_u -G wheel staff # echo "pass" | passwd --stdin staff # useradd -Z sysadm_u -G wheel sysadm # echo "pass" | passwd --stdin sysadm -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 4. Generate ssh key and install it -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # ssh-keygen # ssh-copy-id staff@localhost # ssh-copy-id sysadm@localhost # semanage boolean -m ssh_sysadm_login --on -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- 5. Finally start ssh-agent, ssh and sudo from the account -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # ssh-agent; ssh-add # ssh -A staff@localhost $ sudo -i -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Actual results: [sudo] password for staff: Expected results: Password-less sudo