Bug 1307242 - SELinux prevents access to LDAP data base
SELinux prevents access to LDAP data base
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
23
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-13 09:03 EST by Thomas Köller
Modified: 2016-12-20 13:42 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-20 13:42:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Thomas Köller 2016-02-13 09:03:35 EST
Description of problem:

Upon creation of a new LDAP data base via ldapadd, I received the following SELinux alert:

SELinux is preventing /usr/sbin/slapd from rename access on the file __db.80000001.94287095.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow slapd to have rename access on the __db.80000001.94287095 file
Then you need to change the label on __db.80000001.94287095
Do
# semanage fcontext -a -t FILE_TYPE '__db.80000001.94287095'
where FILE_TYPE is one of the following: krb5_host_rcache_t, slapd_db_t, slapd_lock_t, slapd_log_t, slapd_replog_t, slapd_tmp_t, slapd_tmpfs_t, slapd_var_run_t. 
Then execute: 
restorecon -v '__db.80000001.94287095'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If you believe that slapd should be allowed rename access on the __db.80000001.94287095 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:
# grep slapd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:slapd_t:s0
Target Context                system_u:object_r:var_t:s0
Target Objects                __db.80000001.94287095 [ file ]
Source                        slapd
Source Path                   /usr/sbin/slapd
Port                          <Unknown>
Host                          sarkovy
Source RPM Packages           openldap-servers-2.4.40-14.fc23.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.4.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     sarkovy
Platform                      Linux sarkovy 4.3.5-300.fc23.x86_64 #1 SMP Mon Feb
                              1 03:18:41 UTC 2016 x86_64 x86_64
Alert Count                   1
First Seen                    2016-02-13 14:49:45 CET
Last Seen                     2016-02-13 14:49:45 CET
Local ID                      120b0bbd-62ce-412f-9f85-17618f7f6e6d

Raw Audit Messages
type=AVC msg=audit(1455371385.253:2859): avc:  denied  { rename } for  pid=21239 comm="slapd" name="__db.80000001.94287095" dev="dm-1" ino=929684 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file permissive=1


type=SYSCALL msg=audit(1455371385.253:2859): arch=x86_64 syscall=rename success=yes exit=0 a0=7f20b81c7120 a1=7f20b81c6fe0 a2=0 a3=63a items=0 ppid=1 pid=21239 auid=4294967295 uid=55 gid=55 euid=55 suid=55 fsuid=55 egid=55 sgid=55 fsgid=55 tty=(none) ses=4294967295 comm=slapd exe=/usr/sbin/slapd subj=system_u:system_r:slapd_t:s0 key=(null)

Hash: slapd,slapd_t,var_t,file,rename


Version-Release number of selected component (if applicable):
Comment 1 Lukas Vrabec 2016-02-15 07:40:24 EST
Hi, 
Where is "__db.80000001.94287095" file stored? 

Thank you.
Comment 2 Thomas Köller 2016-02-15 15:20:31 EST
That appears to be a temporary file that only exists under this name during the initialization of a new ldap data base. It is obviously renamed to a different name then (which is what triggered the error). It lives in the data base directory, which is run-time configurable, but is usually located somewhere underneath /var. In my case, it is '/var/openldap-data/koeller-hamburg.de', and its contents are as follows:

-rw-r--r--. 1 ldap ldap     2048 Feb 13 14:49 alock
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 cn.bdb
-rw-------. 1 ldap ldap   303104 Feb 14 10:49 __db.001
-rw-------. 1 ldap ldap    40960 Feb 15 16:49 __db.002
-rw-------. 1 ldap ldap   231624 Feb 14 10:49 __db.003
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 dn2id.bdb
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 gidNumber.bdb
-rw-------. 1 ldap ldap    32768 Feb 14 10:49 id2entry.bdb
-rw-------. 1 ldap ldap 10485760 Feb 14 10:49 log.0000000001
-rw-------. 1 ldap ldap     8192 Feb 13 15:24 memberUid.bdb
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 objectClass.bdb
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 sn.bdb
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 uid.bdb
-rw-------. 1 ldap ldap     8192 Feb 14 10:49 uidNumber.bdb
Comment 3 Thomas Köller 2016-02-28 08:18:45 EST
I just received a very similar report for a file in a directory containing another ldap data base. This happened after I relabelled all my file systems
using the 'fixfiles onboot' command.

---

SELinux is preventing /usr/sbin/slapd from 'read, write' accesses on the file /var/openldap-data/koeller.dyndns.org/uidNumber.bdb.

*****  Plugin catchall_labels (83.8 confidence) suggests   *******************

If you want to allow slapd to have read write access on the uidNumber.bdb file
Then you need to change the label on /var/openldap-data/koeller.dyndns.org/uidNumber.bdb
Do
# semanage fcontext -a -t FILE_TYPE '/var/openldap-data/koeller.dyndns.org/uidNumber.bdb'
where FILE_TYPE is one of the following: afs_cache_t, auth_cache_t, initrc_tmp_t, krb5_host_rcache_t, puppet_tmp_t, security_t, slapd_db_t, slapd_lock_t, slapd_log_t, slapd_replog_t, slapd_tmp_t, slapd_tmpfs_t, slapd_var_run_t, user_cron_spool_t. 
Then execute: 
restorecon -v '/var/openldap-data/koeller.dyndns.org/uidNumber.bdb'


*****  Plugin catchall (17.1 confidence) suggests   **************************

If you believe that slapd should be allowed read write access on the uidNumber.bdb 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:
# grep slapd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:slapd_t:s0
Target Context                system_u:object_r:var_t:s0
Target Objects                /var/openldap-
                              data/koeller.dyndns.org/uidNumber.bdb [ file ]
Source                        slapd
Source Path                   /usr/sbin/slapd
Port                          <Unknown>
Host                          sarkovy
Source RPM Packages           openldap-servers-2.4.40-14.fc23.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-158.7.fc23.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     sarkovy
Platform                      Linux sarkovy 4.3.5-300.fc23.x86_64 #1 SMP Mon Feb
                              1 03:18:41 UTC 2016 x86_64 x86_64
Alert Count                   26
First Seen                    2016-02-23 22:59:19 CET
Last Seen                     2016-02-28 14:10:02 CET
Local ID                      b690fa93-a004-4276-b263-c0bd691f6702

Raw Audit Messages
type=AVC msg=audit(1456665002.342:384): avc:  denied  { read write } for  pid=1551 comm="slapd" name="uidNumber.bdb" dev="dm-1" ino=275483 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file permissive=1


type=AVC msg=audit(1456665002.342:384): avc:  denied  { open } for  pid=1551 comm="slapd" path="/var/openldap-data/koeller.dyndns.org/uidNumber.bdb" dev="dm-1" ino=275483 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file permissive=1


type=SYSCALL msg=audit(1456665002.342:384): arch=x86_64 syscall=open success=yes exit=ESPIPE a0=7f3284093220 a1=2 a2=0 a3=7f32840009e0 items=0 ppid=1 pid=1551 auid=4294967295 uid=55 gid=55 euid=55 suid=55 fsuid=55 egid=55 sgid=55 fsgid=55 tty=(none) ses=4294967295 comm=slapd exe=/usr/sbin/slapd subj=system_u:system_r:slapd_t:s0 key=(null)

Hash: slapd,slapd_t,var_t,file,read,write
Comment 4 Fedora End Of Life 2016-11-24 10:33:27 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora End Of Life 2016-12-20 13:42:54 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

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