apparmor stops /var/run/ldapi from being read causing ldap to fail
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | openldap (Ubuntu) |
Undecided
|
Ryan Tandy | ||
| | Utopic |
Undecided
|
Unassigned | ||
| | Vivid |
Undecided
|
Unassigned | ||
Bug Description
[Impact]
* Changes to AppArmor's unix socket mediation in utopic and later require servers to have 'rw' file permissions on socket paths, compared to just 'w' previously.
* This bug breaks any application that tries to communicate with slapd via the ldapi:// scheme, for example heimdal-kdc.
* The recommended way to configure slapd in Ubuntu is to authenticate via SASL EXTERNAL over the ldapi socket. This bug prevents online configuration of slapd (via ldapmodify) in the default setup.
[Test Case]
apt-get install slapd
ldapwhoami -H ldapi:// -QY EXTERNAL
Expected result:
dn:gidNumber=
Actual result:
ldap_sasl_
[Regression Potential]
* Extremely low potential for regression. No code changes, only granting an additional permission on contents of two directories. The worst possible regression is that slapd might be permitted to read some files it shouldn't, but having such files in /run/{slapd,nslcd} seems unlikely.
[Other Info]
Test packages can be found in ppa:rtandy/
| Jayesh Bhoot (bhoot-jayesh) wrote : | #2 |
I confirm that the bug is present on Kubuntu 14.10 as well.
When installing a clean ubuntu 14.10 server and installing slapd with :
apt-get install slapd ldap-utils
configure it with :
dpkg-reconfigure slapd
with ldap address of ldapi://xxx.xxx.xxx
the following command :
ldapsearch -Q -LLL -Y EXTERNAL -H ldapi:/// -b cn=config
gives the following error:
ldap_sasl_
Also, the provided solution of modifying apparmor config for slapd worked.
| Mats Luspa (matsl) wrote : | #3 |
This bug can also be found in Ubuntu 15.04 vivid. The workaround of modifying apparmor works.
| tags: | added: apparmor |
| Changed in openldap (Ubuntu): | |
| assignee: | nobody → Ryan Tandy (rtandy) |
| status: | Confirmed → In Progress |
| Ryan Tandy (rtandy) wrote : | #4 |
Based on reading apparmor code and changes, it sounds like changing 'w' to 'rw' actually is the correct fix (f.ex. [1]). My proposed merge (bug 1395098) includes that change.
This should probably be SRUed to U and V after getting fixed in the development release. Considering that ldapi is our default and recommended way of doing config changes, this is certainly a grave bug.
| Launchpad Janitor (janitor) wrote : | #5 |
This bug was fixed in the package openldap - 2.4.40+
---------------
openldap (2.4.40+
* Merge from Debian testing (LP: #1395098, LP: #1316124). Remaining changes:
- Enable AppArmor support:
- d/apparmor-profile: add AppArmor profile
- d/rules: use dh_apparmor
- d/control: Build-Depends on dh-apparmor
- d/slapd.
- Enable GSSAPI support:
- d/patches/
- Add --with-gssapi support
- Make guess_service_
principal
- d/configure.
- d/control: Added heimdal-dev as a build depend
- Enable ufw support:
- d/control: suggest ufw.
- d/rules: install ufw profile.
- d/slapd.
- Enable nss overlay:
- d/{patches/
nss overlay.
- d/{rules,slapd.py}: Add apport hook.
- d/slapd.init.ldif: don't set olcRootDN since it's not defined in
either the default DIT nor via an Authn mapping.
- d/slapd.
- add slapcat_opts to local variables.
- Remove unused variable new_conf.
- Fix backup directory naming for multiple reconfiguration.
- d/{slapd.
- d/rules: Enable -DLDAP_
in the openldap library, as required by Likewise-Open
- Show distribution in version:
- d/control: added lsb-release
- d/patches/
* Drop patches included upstream:
- d/patches/
- d/patches/
- d/patches/
* Drop hardening-wrapper as Debian now sets PIE and bindnow flags.
* debian/
* debian/
- Change 'r' to 'rw' for ldapi and nslcd sockets, required for apparmor
kernel ABI v7 (utopic and later). (LP: #1392018)
- Reduce permissions on /run/nslcd to just the nslcd socket.
* Enable the mdb backend again on ppc64el, fixed upstream in ITS#7713.
(LP: #1293250)
openldap (2.4.40+dfsg-1) unstable; urgency=medium
* Remove inetorgperson.
copy stripped of RFC text. (Closes: #780283)
* Adjust debian/watch for +dfsg versioning.
* debian/
patch to fix scope=onelevel searches wrongly including the search base in
results under the MDB backend. (ITS#7975) (Closes: #782212)
openldap (2.4.40-4) unstable; urgency=medium
* debian/
patch to fix a crash when a search includes the Deref control with an
empty attribute list. (ITS#8027) (CVE-2015-1545, Closes: #776988)
* debian/
patch to fix a double free triggered by...
| Changed in openldap (Ubuntu): | |
| status: | In Progress → Fix Released |
| Ryan Tandy (rtandy) wrote : | #7 |
| Massé (davon24) wrote : | #8 |
Hello! I have a problem with the vivid patch
sudo patch -p1 < ../openldap_
bash: ../openldap_
| Ryan Tandy (rtandy) wrote : Re: [Bug 1392018] Re: apparmor stops /var/run/ldapi from being read causing ldap to fail | #9 |
On Tue, Jun 02, 2015 at 01:36:04AM -0000, Massé wrote:
>Hello! I have a problem with the vivid patch
>
>sudo patch -p1 < ../openldap_
>bash: ../openldap_
That's not a problem with the patch. That's bash telling you it can't
find the patch in the place you told it to look :)
| Moritz (morrez) wrote : | #10 |
I try to apply the vivid patch, but don't seem to have openldap installed, only slapd – is that the same?
apt-get install openldap -> Unable to locate package
If slapd is correct, what is the proper patch location? slapd is located as follows:
/etc/init.d/slapd
/etc/ufw/
/etc/default/slapd
/run/slapd
/usr/share/
/usr/share/slapd
/usr/share/
/usr/sbin/slapd
/var/lib/slapd
| Ryan Tandy (rtandy) wrote : | #11 |
On Wed, Jun 17, 2015 at 07:28:44AM -0000, Moritz wrote:
>I try to apply the vivid patch, but don't seem to have openldap
>installed, only slapd – is that the same?
openldap is the source package. slapd is one of the binary packages
built from it.
http://
https:/
The patch applies to the source package.
>If slapd is correct, what is the proper patch location?
The patch changes one file: /etc/apparmor.
| Marc Deslauriers (mdeslaur) wrote : | #12 |
The actual fix that went into wily is:
# pid files and sockets
/{,var/}run/slapd/* w,
/{,var/
/{,var/
Ryan, could you please update your proposed debdiffs to reflect the actual changes that went into the development release?
Thanks!
| Ryan Tandy (rtandy) wrote : | #13 |
Apologies for the inconvenience. Attaching fixed (and tested) patches.
| Ryan Tandy (rtandy) wrote : | #14 |
| Marc Deslauriers (mdeslaur) wrote : | #15 |
ACK on the debdiffs, they look good. Thanks!
Uploaded for processing by the SRU team.
| Changed in openldap (Ubuntu Utopic): | |
| status: | New → In Progress |
| Changed in openldap (Ubuntu Vivid): | |
| status: | New → In Progress |
Hello Arjan.S, or anyone else affected,
Accepted openldap into vivid-proposed. The package will build now and be available at https:/
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in openldap (Ubuntu Vivid): | |
| status: | In Progress → Fix Committed |
| tags: | added: verification-needed |
| Changed in openldap (Ubuntu Utopic): | |
| status: | In Progress → Won't Fix |
| Ryan Tandy (rtandy) wrote : | #17 |
With slapd from vivid-updates:
# dpkg-query -W slapd
slapd 2.4.31-
# ldapwhoami -H ldapi:// -QY EXTERNAL
ldap_sasl_
With slapd from vivid-proposed:
# dpkg-query -W slapd
slapd 2.4.31-
# ldapwhoami -H ldapi:// -QY EXTERNAL
dn:gidNumber=
Marking verified.
| tags: |
added: verification-done removed: verification-needed |
| Launchpad Janitor (janitor) wrote : | #18 |
This bug was fixed in the package openldap - 2.4.31-
---------------
openldap (2.4.31-
* debian/
required for apparmor kernel ABI v7 (utopic and later). (LP: #1392018)
-- Ryan Tandy <email address hidden> Thu, 25 Jun 2015 09:40:29 -0700
| Changed in openldap (Ubuntu Vivid): | |
| status: | Fix Committed → Fix Released |
| Chris J Arges (arges) wrote : Update Released | #19 |
The verification of the Stable Release Update for openldap has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.
| David Bonner (thed-2011) wrote : | #20 |
This bug seems to still be be present in Ubuntu 16.04. How do i fix it so & can use ldap?
| Seth Arnold (seth-arnold) wrote : | #21 |
David, please file a new bug report and be sure to include any AppArmor DENIED messages from your logs.
Thanks


Status changed to 'Confirmed' because the bug affects multiple users.