Bug 1533964 - sudo skips PAM account module in case NOPASSWD is used in sudoers
Summary: sudo skips PAM account module in case NOPASSWD is used in sudoers
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sudo   
(Show other bugs)
Version: 7.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Kopeček
QA Contact: Patrik Kis
Mirek Jahoda
URL:
Whiteboard:
Keywords: FutureFeature, Patch, Triaged
Depends On: 1547974
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-01-12 16:35 UTC by Thorsten Scherf
Modified: 2018-11-06 13:50 UTC (History)
5 users (show)

Fixed In Version: sudo-1.8.23-1.el7
Doc Type: Enhancement
Doc Text:
*sudo* now runs PAM stack even when no authentication is required With this update, the *sudo* utility runs Pluggable Authentication Module (PAM) account management modules even when the "NOPASSWD" option is configured in the policy. This enables checking for restrictions imposed by PAM modules outside of the authentication phase. As a result, PAM modules, such as `pam_time`, now work properly in the described scenario.
Story Points: ---
Clone Of:
: 1679209 (view as bug list)
Environment:
Last Closed: 2018-10-30 11:09:01 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
proposed patch (17.91 KB, patch)
2018-01-17 08:31 UTC, Daniel Kopeček
no flags Details | Diff
upstream fix of a regression related to NOPASSWD PAM stack handling (7.02 KB, patch)
2018-09-24 14:01 UTC, Daniel Kopeček
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3199 None None None 2018-10-30 11:09 UTC
Red Hat Knowledge Base (Solution) 3320531 None None None 2018-01-15 09:35 UTC
Red Hat Knowledge Base (Solution) 3679241 None None None 2018-11-06 13:50 UTC

Description Thorsten Scherf 2018-01-12 16:35:02 UTC
Description of problem:
sudo skips the PAM account phase and therefore also skips the pam_time module which results in failed time based account restriction.  

sudo should use 'pam_acct_mgmt()' in case no authentication is required. The function is fully independent of 'pam_authenticate()'.

http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_acct_mgmt

Version-Release number of selected component (if applicable):
all versions of sudo are affected.

How reproducible:

/etc/sudoers:
foobar	 ALL=(ALL)	NOPASSWD: ALL

/etc/pam.d/sudo:
account required pam_time.so

/etc/security/time.conf:
sudo;*;*;!Al0000-24000

sudo still works for the 'foobar' user. Expectation is that sudo is failing.

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 3 Daniel Kopeček 2018-01-17 08:31 UTC
Created attachment 1382271 [details]
proposed patch

Comment 12 Daniel Kopeček 2018-09-24 14:01 UTC
Created attachment 1486438 [details]
upstream fix of a regression related to NOPASSWD PAM stack handling

Comment 15 errata-xmlrpc 2018-10-30 11:09:01 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, 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/RHEA-2018:3199


Note You need to log in before you can comment on or make changes to this bug.