Bug 1583211 - nslcd, the local LDAP daemon, fails to start with SELINUX enabled
Summary: nslcd, the local LDAP daemon, fails to start with SELINUX enabled
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: nss-pam-ldapd
Version: 28
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Nalin Dahyabhai
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-28 13:17 UTC by Krzysztof Halasa
Modified: 2019-05-03 08:23 UTC (History)
4 users (show)

Fixed In Version: nss-pam-ldapd-0.8.14-13.fc28
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-03 08:23:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Krzysztof Halasa 2018-05-28 13:17:34 UTC
Description of problem:
nslcd is unable to create its PID file in /var/run/nslcd and fails to start.

The default /etc/nslcd.conf contains:
# The user and group nslcd should run as.
uid nslcd
gid ldap

However, the PID file is apparently written before setuid() etc. call (i.e., still with root privileges) and this conflicts with access rights to /var/run/nslcd (which is created by /usr/lib/tmpfiles.d/nss-pam-ldapd.conf):

# ls -dl /var/run/nslcd/
drwxr-xr-x. 2 nslcd root 80 May 28 13:10 /var/run/nslcd//
              ^^^^^

# cat /usr/lib/tmpfiles.d/nss-pam-ldapd.conf
# nslcd needs a directory in /var/run to store its pid file and socket
d /var/run/nslcd 0755 nslcd root

This problem only manifests itself with SELINUX in enforcing mode, since only then root cannot ignore directory rights.

Version-Release number of selected component (if applicable):
0.8.14-10.fc27 (current Fedora 28)

How reproducible:
Try to use it with SELINUX enabled and enforcing the policy.

Steps to Reproduce:
1. dnf install nss-pam-ldapd
2. Adjust /etc/nslcd.conf according to local requirements
3. systemctl start nslcd
4. systemctl status nslcd

Actual results:
systemd[1]: nslcd.service: Can't open PID file /var/run/nslcd/nslcd.pid (yet?) after start: No such file or directory

Expected results:
The nslcd should be running.

Comment 1 Lukas Slebodnik 2018-05-28 15:22:20 UTC
It failed in enforcing mode because nslcd_t does not have capability dac_override

sh# sesearch -A -s nslcd_t -c capability
allow nslcd_t nslcd_t:capability { chown dac_read_search setgid setuid sys_nice };

But +1 for fixing permissions rather then adding unnecessary capability

Comment 2 Lukas Slebodnik 2018-05-29 07:54:44 UTC
Could you test following scratch build?
https://koji.fedoraproject.org/koji/taskinfo?taskID=27274886

Comment 3 Krzysztof Halasa 2018-05-29 12:12:55 UTC
Just installed it: nss-pam-ldapd-0.8.14-12.fc28.x86_64.rpm and it works correctly. Thanks a lot.

Comment 4 Jakub Hrozek 2018-05-30 10:00:32 UTC
Thank you for fixing the bug, Lukas. I built the package with your fix but for some reason I'm not able to create an update, I'm getting:

You may not specify an empty list of builds.
ACL validation mechanism was unable to determine ACLs.

Through both the bodhi cli and the web UI..

Comment 5 Lukas Slebodnik 2018-05-30 11:34:04 UTC
Commit https://src.fedoraproject.org/rpms/nss-pam-ldapd/c/1ec06c959209d63b4758c85180cb9fe4e74e49b8?branch=master is not sufficient

I used a different one in scratch build.

I just forgot to create a PR in dist-git

https://src.fedoraproject.org/fork/lslebodn/rpms/nss-pam-ldapd/branch/master_1583211 (and also branch f28_1583211)

Comment 6 Lukas Slebodnik 2018-07-14 14:46:47 UTC
Would you mind to create bodhi update for this build?
https://koji.fedoraproject.org/koji/buildinfo?buildID=1087520

Comment 7 Jakub Hrozek 2018-07-15 13:34:12 UTC
(In reply to Lukas Slebodnik from comment #6)
> Would you mind to create bodhi update for this build?
> https://koji.fedoraproject.org/koji/buildinfo?buildID=1087520

Done:
https://bodhi.fedoraproject.org/updates/nss-pam-ldapd-0.8.14-13.fc28

Comment 8 Ben Cotton 2019-05-02 21:18:48 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. 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 '28'.

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 28 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.


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