Bug 2382114

Summary: SELinux is preventing /usr/libexec/openssh/sshd-session from 'getattr' accesses on the file /var/lib/lastlog/lastlog2.db.
Product: [Fedora] Fedora Reporter: Mikhail <mikhail.v.gavrilov>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dwalsh, lvrabec, mikhail.v.gavrilov, mmalik, omosnacek, pkoncity, vmojzis, zpytela
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:365e791797e4d0462ad041ae5924c0e644231ea8e99ba2c5d88fd22aebb4a85b;VARIANT_ID=workstation;
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-07-23 14:00:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: description
none
File: os_info none

Description Mikhail 2025-07-20 07:43:11 UTC
Description of problem:
SELinux is preventing /usr/libexec/openssh/sshd-session from 'getattr' accesses on the file /var/lib/lastlog/lastlog2.db.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/var/lib/lastlog/lastlog2.db default label should be var_lib_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /var/lib/lastlog/lastlog2.db

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that sshd-session should be allowed getattr access on the lastlog2.db file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'sshd-session' --raw | audit2allow -M my-sshdsession
# semodule -X 300 -i my-sshdsession.pp

Additional Information:
Source Context                system_u:system_r:sshd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:init_var_lib_t:s0
Target Objects                /var/lib/lastlog/lastlog2.db [ file ]
Source                        sshd-session
Source Path                   /usr/libexec/openssh/sshd-session
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openssh-server-10.0p1-4.fc43.x86_64
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-42.1-1.fc43.noarch
Local Policy RPM              selinux-policy-targeted-42.1-1.fc43.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 6.16.0-
                              0.rc6.250715g155a3c003e55.53.fc43.x86_64+debug #1
                              SMP PREEMPT_DYNAMIC Wed Jul 16 10:58:51 UTC 2025
                              x86_64
Alert Count                   3
First Seen                    2025-07-18 03:59:13 +05
Last Seen                     2025-07-20 12:40:37 +05
Local ID                      990dcfe5-a432-4591-9f77-49b063f36a1e

Raw Audit Messages
type=AVC msg=audit(1752997237.562:924): avc:  denied  { getattr } for  pid=201843 comm="sshd-session" path="/var/lib/lastlog/lastlog2.db" dev="nvme1n1p3" ino=158133466 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:init_var_lib_t:s0 tclass=file permissive=1


type=SYSCALL msg=audit(1752997237.562:924): arch=x86_64 syscall=newfstatat success=yes exit=0 a0=ffffff9c a1=556cfa221868 a2=7fff47a5b1b0 a3=100 items=1 ppid=1814 pid=201843 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=5 comm=sshd-session exe=/usr/libexec/openssh/sshd-session subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 key=(null)

type=CWD msg=audit(1752997237.562:924): cwd=/

type=PATH msg=audit(1752997237.562:924): item=0 name=/var/lib/lastlog/lastlog2.db inode=158133466 dev=00:23 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:init_var_lib_t:s0 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0

Hash: sshd-session,sshd_t,init_var_lib_t,file,getattr

Version-Release number of selected component:
selinux-policy-targeted-42.1-1.fc43.noarch

Additional info:
reporter:       libreport-2.17.15
reason:         SELinux is preventing /usr/libexec/openssh/sshd-session from 'getattr' accesses on the file /var/lib/lastlog/lastlog2.db.
package:        selinux-policy-targeted-42.1-1.fc43.noarch
component:      selinux-policy
hashmarkername: setroubleshoot
type:           libreport
kernel:         6.16.0-0.rc6.250715g155a3c003e55.53.fc43.x86_64+debug
component:      selinux-policy

Comment 1 Mikhail 2025-07-20 07:43:14 UTC
Created attachment 2097753 [details]
File: description

Comment 2 Mikhail 2025-07-20 07:43:15 UTC
Created attachment 2097754 [details]
File: os_info

Comment 3 Zdenek Pytela 2025-07-23 14:00:20 UTC

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