Bug 868567 - SELinux is preventing /usr/sbin/sshd from 'search' accesses on the directory /var/lib/pgsql.
SELinux is preventing /usr/sbin/sshd from 'search' accesses on the directory ...
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
17
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Grepl
Fedora Extras Quality Assurance
abrt_hash:325495f59c06c7a5a55bb42e23c...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-20 17:06 EDT by James Heather
Modified: 2013-01-06 23:00 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-06 23:00:00 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
File: type (9 bytes, text/plain)
2012-10-20 17:06 EDT, James Heather
no flags Details
File: hashmarkername (14 bytes, text/plain)
2012-10-20 17:06 EDT, James Heather
no flags Details

  None (edit)
Description James Heather 2012-10-20 17:06:40 EDT
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 17:06:42 EDT
Created attachment 630656 [details]
File: type
Comment 2 James Heather 2012-10-20 17:06:44 EDT
Created attachment 630658 [details]
File: hashmarkername
Comment 3 Miroslav Grepl 2012-10-22 03:08:48 EDT
Did you setup a ssh connection between a client and a PostgreSQL server?
Comment 4 James Heather 2012-10-22 03:45:47 EDT
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 15:44:50 EDT
Probably not, does posqresql have a homedir in /var/lib/pgsql?
Comment 6 Daniel Walsh 2012-10-24 15:45:44 EDT
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 10:56:25 EST
We have a fix in Fedora18. Backported.

commit b981ffd267bd981fd9ede1c6201eb2bb85e7bdd0
Author: Miroslav Grepl <mgrepl@redhat.com>
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 13:41:09 EST
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-17 21:36:36 EST
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 01:40:12 EST
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-06 23:00:02 EST
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.

Note You need to log in before you can comment on or make changes to this bug.