Bug 1866866
| Summary: | PAM can't identify the user when running via gnome-terminal in an X session | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Akshay Sakure <asakure> | 
| Component: | pam | Assignee: | Iker Pedrosa <ipedrosa> | 
| Status: | CLOSED ERRATA | QA Contact: | shridhar <sgadekar> | 
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.2 | CC: | dapospis, dlavu, pbrezina, sgadekar | 
| Target Milestone: | rc | Flags: | pm-rhel:
                mirror+
                 | 
  
| Target Release: | 8.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | sync-to-jira | ||
| Fixed In Version: | pam-1.3.1-13.el8 | Doc Type: | If docs needed, set a value | 
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-18 14:59:51 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
        
        
          Akshay Sakure
        
        
        
        
        
          2020-08-06 16:12:15 UTC
        
       
      
      
      
    It is a side effect of the terminal windows not having a login session in /var/run/utmp anymore. Perhaps a fallback to PAM_RUSER could be done. And if that does not work the thing that is done for use_uid could be done as well with the exception if getuid() returns 0 as that would be suspicious. master:
    6bf9b454eb971083f0cce49faa2aa1cde329ff5d - pam_wheel: improve coding style
    9091ea1d81e85f49a221b0325d27b22ce69e444a - pam_wheel: if getlogin fails fallback to PAM_RUSER
    a3a5cbf86083c43026b558e2023f597530626267 - pam_wheel: clarify use_uid option in man page
    tested against:
[testuser@localhost ~]$ rpm -q pam
pam-1.3.1-14.el8.x86_64
Logged in as testuser via Gnome.
[testuser@localhost ~]$ sudo -l
Matching Defaults entries for testuser on localhost:
    !visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin,
    env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS",
    env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE",
    env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES",
    env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE",
    env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin
User testuser may run the following commands on localhost:
    (ALL) NOPASSWD: ALL
[testuser@localhost ~]$ 
from /var/log/messages
Dec  3 05:42:57 localhost gdm-password][4687]: pam_unix(gdm-password:session): session closed for user testuser
Dec  3 05:42:57 localhost polkitd[885]: Unregistered Authentication Agent for unix-session:5 (system bus name :1.648, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Dec  3 05:43:01 localhost systemd[35180]: pam_unix(systemd-user:session): session opened for user testuser by (uid=0)
Dec  3 05:43:01 localhost gdm-password][35171]: pam_unix(gdm-password:session): session opened for user testuser by (uid=0)
Dec  3 05:43:03 localhost polkitd[885]: Registered Authentication Agent for unix-session:7 (system bus name :1.979 [/usr/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Dec  3 05:43:22 localhost sudo[35832]: pam_wheel(sudo:account): Access granted to 'testuser' for 'testuser'
Dec  3 05:43:22 localhost sudo[35832]: testuser : TTY=pts/0 ; PWD=/home/testuser ; USER=root ; COMMAND=list
Dec  3 05:44:19 localhost su[35873]: pam_systemd(su-l:session): Cannot create session: Already running in a session or user slice
Dec  3 05:44:19 localhost su[35873]: pam_unix(su-l:session): session opened for user root by (uid=1001)
user is able to run the sudo command after logging in via GUI.
    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 (pam 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-2021:1649  |