Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1533964 - sudo skips PAM account module in case NOPASSWD is used in sudoers
sudo skips PAM account module in case NOPASSWD is used in sudoers
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sudo (Show other bugs)
7.4
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Daniel Kopeček
Patrik Kis
Mirek Jahoda
: FutureFeature, Patch, Triaged
Depends On: 1547974
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-12 11:35 EST by Thorsten Scherf
Modified: 2018-10-30 07:09 EDT (History)
5 users (show)

See Also:
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:
Environment:
Last Closed: 2018-10-30 07:09:01 EDT
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 03:31 EST, 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 10:01 EDT, Daniel Kopeček
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3320531 None None None 2018-01-15 04:35 EST
Red Hat Product Errata RHEA-2018:3199 None None None 2018-10-30 07:09 EDT

  None (edit)
Description Thorsten Scherf 2018-01-12 11:35:02 EST
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 03:31 EST
Created attachment 1382271 [details]
proposed patch
Comment 12 Daniel Kopeček 2018-09-24 10:01 EDT
Created attachment 1486438 [details]
upstream fix of a regression related to NOPASSWD PAM stack handling
Comment 15 errata-xmlrpc 2018-10-30 07:09:01 EDT
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.