Bug 868567

Summary: SELinux is preventing /usr/sbin/sshd from 'search' accesses on the directory /var/lib/pgsql.
Product: [Fedora] Fedora Reporter: James Heather <drfudgeboy>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:325495f59c06c7a5a55bb42e23ca8e8f3adbd6c318cd181b2de81a2c5d5c8c73
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-07 04:00:00 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: type
none
File: hashmarkername none

Description James Heather 2012-10-20 21:06:40 UTC
Additional info:
libreport version: 2.0.14
kernel:         3.6.1-1.fc17.x86_64

description:
:SELinux is preventing /usr/sbin/sshd from 'search' accesses on the directory /var/lib/pgsql.
:
:*****  Plugin catchall (100. confidence) suggests  ***************************
:
:If you believe that sshd should be allowed search access on the pgsql directory 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:
:# grep sshd /var/log/audit/audit.log | audit2allow -M mypol
:# semodule -i mypol.pp
:
:Additional Information:
:Source Context                system_u:system_r:sshd_t:s0-s0:c0.c1023
:Target Context                system_u:object_r:postgresql_db_t:s0
:Target Objects                /var/lib/pgsql [ dir ]
:Source                        sshd
:Source Path                   /usr/sbin/sshd
:Port                          <Unknown>
:Host                          (removed)
:Source RPM Packages           openssh-server-5.9p1-26.fc17.x86_64
:Target RPM Packages           postgresql-server-9.1.6-1.fc17.x86_64
:Policy RPM                    selinux-policy-3.10.0-153.fc17.noarch
:Selinux Enabled               True
:Policy Type                   targeted
:Enforcing Mode                Enforcing
:Host Name                     (removed)
:Platform                      Linux (removed) 3.6.1-1.fc17.x86_64 #1 SMP Wed Oct
:                              10 12:13:05 UTC 2012 x86_64 x86_64
:Alert Count                   141
:First Seen                    2012-06-25 20:55:41 BST
:Last Seen                     2012-10-19 21:20:30 BST
:Local ID                      9154d521-f877-485a-9955-4e62e303e587
:
:Raw Audit Messages
:type=AVC msg=audit(1350678030.344:6400): avc:  denied  { search } for  pid=14552 comm="sshd" name="pgsql" dev="dm-5" ino=262426 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:postgresql_db_t:s0 tclass=dir
:
:
:type=SYSCALL msg=audit(1350678030.344:6400): arch=x86_64 syscall=stat success=no exit=EACCES a0=7f5da397c730 a1=7fff19253060 a2=7fff19253060 a3=6e6970706172772f items=0 ppid=1737 pid=14552 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=sshd exe=/usr/sbin/sshd subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 key=(null)
:
:Hash: sshd,sshd_t,postgresql_db_t,dir,search
:
:audit2allow
:
:#============= sshd_t ==============
:allow sshd_t postgresql_db_t:dir search;
:
:audit2allow -R
:
:#============= sshd_t ==============
:allow sshd_t postgresql_db_t:dir search;
:

Comment 1 James Heather 2012-10-20 21:06:42 UTC
Created attachment 630656 [details]
File: type

Comment 2 James Heather 2012-10-20 21:06:44 UTC
Created attachment 630658 [details]
File: hashmarkername

Comment 3 Miroslav Grepl 2012-10-22 07:08:48 UTC
Did you setup a ssh connection between a client and a PostgreSQL server?

Comment 4 James Heather 2012-10-22 07:45:47 UTC
No, I didn't. Or, at least, it's possible I connected to a uni ssh server that also runs PostgreSQL, but if I did, it certainly wasn't to do anything database-like. I'd just have been using it as a tunnel to another machine, which isn't running PostgreSQL.

Is this another incoming attack?

Comment 5 Daniel Walsh 2012-10-24 19:44:50 UTC
Probably not, does posqresql have a homedir in /var/lib/pgsql?

Comment 6 Daniel Walsh 2012-10-24 19:45:44 UTC
grep pgsql /etc/passwd
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash


I would bet sshd is just looking through homedirs as listed in /etc/passwd

Comment 7 Miroslav Grepl 2012-12-16 15:56:25 UTC
We have a fix in Fedora18. Backported.

commit b981ffd267bd981fd9ede1c6201eb2bb85e7bdd0
Author: Miroslav Grepl <mgrepl>
Date:   Mon Dec 10 11:16:29 2012 +0100

    Label /var/lib/pgsql/.ssh as ssh_home_t

Comment 8 Fedora Update System 2012-12-17 18:41:09 UTC
selinux-policy-3.10.0-165.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/selinux-policy-3.10.0-165.fc17

Comment 9 Fedora Update System 2012-12-18 02:36:36 UTC
Package selinux-policy-3.10.0-165.fc17:
* should fix your issue,
* was pushed to the Fedora 17 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.10.0-165.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-20544/selinux-policy-3.10.0-165.fc17
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-01-05 06:40:12 UTC
Package selinux-policy-3.10.0-166.fc17:
* should fix your issue,
* was pushed to the Fedora 17 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.10.0-166.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-20544/selinux-policy-3.10.0-166.fc17
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-01-07 04:00:02 UTC
selinux-policy-3.10.0-166.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.