File nss-pam-ldapd.spec of Package nss-pam-ldapd

# spec file for package nss-pam-ldapd
# Copyright (c) 2021 SUSE LLC
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%{!?_pam_moduledir: %define _pam_moduledir /%{_lib}/security}

Name:           nss-pam-ldapd
Version:        0.9.12
Release:        0
Summary:        NSS module and daemon for using LDAP as a naming service
License:        LGPL-2.1-or-later
Group:          Productivity/Networking/LDAP/Clients
Source1:        baselibs.conf
Source2:        nslcd.service
Source100:      nss-pam-ldapd-rpmlintrc
BuildRequires:  automake
BuildRequires:  krb5-devel
BuildRequires:  openldap2-devel
BuildRequires:  pam-devel
BuildRequires:  systemd-rpm-macros
Requires(pre):  shadow
Conflicts:      nss_ldap
Conflicts:      pam_ldap
Obsoletes:      nss-ldapd < %{version}-%{release}
Provides:       nss-ldapd = %{version}-%{release}

This is nss-pam-ldapd which provides a Name Service Switch (NSS)
module that allows your LDAP server to provide user account, group,
host name, alias, netgroup, and basically any other information that
you would normally get from %{_sysconfdir} flat files or NIS. It also provides a
Pluggable Authentication Module (PAM) to do authentication to an LDAP

This is implemented using thin NSS and PAM modules which delegate to a
dedicated service (nslcd) that queries the LDAP server with persistent
connections, authentication, attribute translation, etc.

%setup -q

export CPPFLAGS="-I/usr/include/sasl"
%configure --libdir=/%{_lib} \
	    --with-pam-seclib-dir=%{_pam_moduledir} \
make %{?_smp_mflags}

make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}/%{_unitdir}/
install -p -m644 %{SOURCE2} %{buildroot}/%{_unitdir}/
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcnslcd

# creating groupd and user nslcd
%{_bindir}/getent group nslcd >/dev/null || %{_sbindir}/groupadd -r nslcd
%{_bindir}/getent passwd nslcd >/dev/null || \
  %{_sbindir}/useradd -r -g nslcd -d / -s /sbin/nologin \
  -c "nslcd ldap user" nslcd
%service_add_pre nslcd.service

%service_add_post nslcd.service

%service_del_preun nslcd.service

%service_del_postun nslcd.service

%license COPYING
%config(noreplace) %attr(640,root,root) %{_sysconfdir}/nslcd.conf

openSUSE Build Service is sponsored by