Bug 964163

Summary: SELinux is preventing /usr/bin/ssh from 'append' accesses on the file /root/.ssh/known_hosts.
Product: [Fedora] Fedora Reporter: Markus Schulze <ms>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:35f0628e70fcfd726f302eb4f5f17cce48aad1f68fcc3854d9bb067a607ec12f
Fixed In Version: selinux-policy-3.11.1-96.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-23 12:27:18 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 Markus Schulze 2013-05-17 11:56:04 UTC
Description of problem:
SELinux is preventing /usr/bin/ssh from 'append' accesses on the file /root/.ssh/known_hosts.

*****  Plugin catchall (100. confidence) suggests  ***************************

If sie denken, dass es ssh standardmässig erlaubt sein sollte, append Zugriff auf known_hosts file zu erhalten.
Then sie sollten dies als Fehler melden.
Um diesen Zugriff zu erlauben, können Sie ein lokales Richtlinien-Modul erstellen.
Do
zugriff jetzt erlauben, indem Sie die nachfolgenden Befehle ausführen:
# grep ssh /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:mount_t:s0
Target Context                unconfined_u:object_r:ssh_home_t:s0
Target Objects                /root/.ssh/known_hosts [ file ]
Source                        ssh
Source Path                   /usr/bin/ssh
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           openssh-clients-6.1p1-8.fc18.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-92.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.8.11-200.fc18.x86_64 #1 SMP Wed
                              May 1 19:44:27 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-05-17 13:55:03 CEST
Last Seen                     2013-05-17 13:55:03 CEST
Local ID                      88f7a77a-e722-464c-bbaa-b41c453069c8

Raw Audit Messages
type=AVC msg=audit(1368791703.582:3069): avc:  denied  { append } for  pid=24962 comm="ssh" name="known_hosts" dev="sda4" ino=786593 scontext=system_u:system_r:mount_t:s0 tcontext=unconfined_u:object_r:ssh_home_t:s0 tclass=file


type=SYSCALL msg=audit(1368791703.582:3069): arch=x86_64 syscall=open success=no exit=EACCES a0=7fda64bac140 a1=441 a2=1b6 a3=238 items=0 ppid=1 pid=24962 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=ssh exe=/usr/bin/ssh subj=system_u:system_r:mount_t:s0 key=(null)

Hash: ssh,mount_t,ssh_home_t,file,append

audit2allow

#============= mount_t ==============
allow mount_t ssh_home_t:file append;

audit2allow -R
require {
	type mount_t;
}

#============= mount_t ==============
ssh_manage_home_files(mount_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.8.11-200.fc18.x86_64
type:           libreport

Comment 1 Daniel Walsh 2013-05-17 12:18:12 UTC
Were you mounting a sshfs file system?  Why would ssh be running as mount_t?

Comment 2 Markus Schulze 2013-05-17 12:22:34 UTC
I use autofs with fuse and sshfs to connect to another server. The automount process is running as root

Comment 3 Daniel Walsh 2013-05-17 14:36:18 UTC
d7900d40924d4874e999eaba96bd88378e5dce5e allows this in git.

Comment 4 Miroslav Grepl 2013-05-20 09:30:06 UTC
Back ported.

Comment 5 Fedora Update System 2013-05-20 13:41:02 UTC
selinux-policy-3.11.1-96.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-96.fc18

Comment 6 Fedora Update System 2013-05-21 08:43:36 UTC
Package selinux-policy-3.11.1-96.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.11.1-96.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-8730/selinux-policy-3.11.1-96.fc18
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-05-23 12:27:18 UTC
selinux-policy-3.11.1-96.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.