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 1651248

Summary: pam_systemd timeout when nrpe runs sudo
Product: Red Hat Enterprise Linux 7 Reporter: Rik Theys <rik.theys>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED DUPLICATE QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact:
Priority: low    
Version: 7.6CC: lvrabec, mgrepl, mmalik, plautrba, redhat, ssekidde, vladimir-csp, vmojzis, zpytela
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-16 21:09:49 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:

Description Rik Theys 2018-11-19 14:16:12 UTC
Description of problem:

NRPE runs commands using sudo to monitor our server health. After upgrading to 7.6, the following error is logged and the nrpe commands time out:

Nov 19 14:39:34 tamar sudo: pam_systemd(sudo:session): Failed to create session: Connection timed out

This seems to be caused by a missing selinux permission.


Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.13.1-229.el7.noarch
selinux-policy-3.13.1-229.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. Configure nrpe to run a command under sudo, and trigger the check
2.
3.

Actual results:
nrpe check times out and the following message is logged:

Nov 19 14:49:44 tamar.esat.kuleuven.be sudo[323848]:     nrpe : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/ipmitool sdr type Power Supply
Nov 19 14:50:09 tamar.esat.kuleuven.be sudo[323848]: pam_systemd(sudo:session): Failed to create session: Connection timed out
Nov 19 14:50:09 tamar.esat.kuleuven.be sudo[323848]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 19 14:50:10 tamar.esat.kuleuven.be sudo[323848]: pam_unix(sudo:session): session closed for user root


Expected results:
No error and no timeout.

Additional info:

I was able to fix this issue by create an selinux policy module with the following settings:

module dbus2nrpe 1.0;

require {
        type systemd_logind_t;
        type nagios_unconfined_plugin_t;
        class dbus send_msg;
}

#============= systemd_logind_t ==============
allow systemd_logind_t nagios_unconfined_plugin_t:dbus send_msg;

Comment 3 Lukas Vrabec 2018-12-16 21:09:49 UTC

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