RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 856098 - service slapd start causes AVC message
Summary: service slapd start causes AVC message
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openldap
Version: 7.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Jan Synacek
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 859019
TreeView+ depends on / blocked
 
Reported: 2012-09-11 08:15 UTC by David Spurek
Modified: 2015-03-02 05:27 UTC (History)
4 users (show)

Fixed In Version: openldap-2.4.33-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 859019 (view as bug list)
Environment:
Last Closed: 2014-06-13 10:52:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description David Spurek 2012-09-11 08:15:26 UTC
Description of problem:
service slapd start cause avc message, slaptest fail to write. /usr/lib/systemd/system/slapd.service have in config ExecStartPre=/usr/libexec/openldap/check-config.sh which run slaptest

type=AVC msg=audit(1347360019.846:833): avc:  denied  { write } for  pid=12425 comm="slaptest" path="/tmp/tmp.t4gJT7yp7p" dev="dm-2" ino=654207 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file

Version-Release number of selected component (if applicable):
selinux-policy-3.11.1-11.el7
openldap-2.4.32-2.el7

How reproducible:
always

Comment 1 Milos Malik 2012-09-11 08:33:30 UTC
Following AVCs appeared in enforcing mode:
----
time->Tue Sep 11 10:27:23 2012
type=PATH msg=audit(1347352043.811:10189): item=1 name=(null) inode=3670626 dev=08:04 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0
type=PATH msg=audit(1347352043.811:10189): item=0 name="/usr/sbin/slaptest" inode=3678745 dev=08:04 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:slapd_exec_t:s0
type=CWD msg=audit(1347352043.811:10189):  cwd="/"
type=EXECVE msg=audit(1347352043.811:10189): argc=2 a0="/usr/sbin/slaptest" a1="-u"
type=SYSCALL msg=audit(1347352043.811:10189): arch=c000003e syscall=59 success=yes exit=0 a0=1fa9e50 a1=1fa9420 a2=1fa8f90 a3=18 items=2 ppid=31277 pid=31278 auid=4294967295 uid=55 gid=55 euid=55 suid=55 fsuid=55 egid=55 sgid=55 fsgid=55 tty=(none) ses=4294967295 comm="slaptest" exe="/usr/sbin/slapd" subj=system_u:system_r:slapd_t:s0 key=(null)
type=AVC msg=audit(1347352043.811:10189): avc:  denied  { write } for  pid=31278 comm="slaptest" path="/tmp/tmp.ERiA2LfAdC" dev="tmpfs" ino=320241 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
type=AVC msg=audit(1347352043.811:10189): avc:  denied  { write } for  pid=31278 comm="slaptest" path="/tmp/tmp.ERiA2LfAdC" dev="tmpfs" ino=320241 scontext=system_u:system_r:slapd_t:s0 tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
----

Comment 2 Daniel Walsh 2012-09-11 11:54:53 UTC
Does slaptest do something like

command < _EOF
line1
line2
_EOF

BTW is this a real test or just some testing code you guys are doing?

Comment 3 Milos Malik 2012-09-11 12:10:49 UTC
slaptest is a part of openldap-servers package and it's executed from slapd.service file.

Comment 4 Milos Malik 2012-09-11 12:16:03 UTC
# rpm -ql openldap-servers | grep slaptest
/usr/sbin/slaptest
/usr/share/man/man8/slaptest.8.gz
# cat /usr/lib/systemd/system/slapd.service 
[Unit]
Description=OpenLDAP Server Daemon
After=syslog.target

[Service]
Type=forking
PIDFile=/var/run/openldap/slapd.pid
Environment="SLAPD_URLS=ldap:/// ldapi:///" "SLAPD_OPTIONS="
EnvironmentFile=/etc/sysconfig/slapd
ExecStartPre=/usr/libexec/openldap/check-config.sh
ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS

[Install]
WantedBy=multi-user.target
# head /usr/libexec/openldap/check-config.sh
#!/bin/sh
# Author: Jan Vcelak <jvcelak>

. /usr/libexec/openldap/functions

function check_config_syntax()
{
	retcode=0
	tmp_slaptest=`mktemp`
	run_as_ldap "/usr/sbin/slaptest $SLAPD_GLOBAL_OPTIONS -u" &>$tmp_slaptest
# ls -l /usr/sbin/slaptest 
lrwxrwxrwx. 1 root root 5 Aug 22 10:36 /usr/sbin/slaptest -> slapd
#

Comment 5 Daniel Walsh 2012-09-18 15:03:45 UTC
How about
	
	run_as_ldap "/usr/sbin/slaptest $SLAPD_GLOBAL_OPTIONS -u" &> /var/run/openldap/slaptest.log

Comment 6 Daniel Walsh 2012-09-18 15:04:06 UTC
Services should not be using /tmp.

Comment 8 Jan Vcelak 2012-10-11 14:32:34 UTC
Resolved in openldap-2.4.33-1.el7

Comment 11 Ludek Smid 2014-06-13 10:52:01 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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