Bug 408611

Summary: SSHD avc for /var/log/btmp
Product: [Fedora] Fedora Reporter: Paweł Hołuj <pholuj>
Component: selinux-policyAssignee: Daniel Walsh <dwalsh>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 8CC: pekkas
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-12-03 18:09:31 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:

Description Paweł Hołuj 2007-12-03 13:34:13 UTC
selinux-policy version: selinux-policy-3.0.8-58.fc8

Description of problem:
SSHD get access denied for file /var/log/btmp
Security context for /var/log/btmp:
system_u:object_r:var_log_t:s0
SSHD using system_u:system_r:sshd_t:s0-s0:c0.c1023

Steps to Reproduce:
1. Run sshd
2. From other machine connect to sshd.
3. Enter wrong user and password.
  
Actual results:
Access denied for sshd.

Expected results:
Access for writing.

Comment 1 Daniel Walsh 2007-12-03 18:09:31 UTC
Some how the file context on btmp got lost

restorecon /var/log/btmp should fix.

If you have any idea what removed and recreated this file, tell me.  This is not
a bug in selinux but in the package that removed and recreated the file.



Comment 2 Pekka Savola 2008-01-03 15:53:49 UTC
The same thing happened to me.

My guess is that logrotate did this.

[root@gap psavola]# restorecon -n -v /var/log/btmp-20080101 
[root@gap psavola]# restorecon -n -v /var/log/btmp
restorecon reset /var/log/btmp context
system_u:object_r:var_log_t:s0->system_u:object_r:faillog_t:s0

But I'm not sure if that's conclusive.

There seems to be another bug with logrotate-related selinux policies.  At F8,
by default the rotated files are no longer "name.[0-9]*" format but
"name-[date]" format, and the policy doesn't seem to reflect this (grep -r btmp
under /etc/selinux yield e.g., 'modules/active/file_contexts:/var/log/btmp.*').



Comment 3 Pekka Savola 2008-01-03 16:01:12 UTC
Oops, two similar looking SSHD AVCs, the symptoms are already described in
#427274.  Maybe that was also the cause for losing the context here..