From 29697cec897e04e1ac066db2f3cf662f89d285a0 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Mon, 24 Jun 2024 21:58:42 +0200 Subject: [PATCH] provide sysusers file for ldap user and group creation and restore tmpfiles.d for /run [release 2.6.8-2mamba;Sun Jun 23 2024] --- openldap-initscript | 83 --------------------------------------------- openldap.spec | 29 ++++++++++------ openldap.sysusers | 3 ++ 3 files changed, 21 insertions(+), 94 deletions(-) delete mode 100644 openldap-initscript create mode 100644 openldap.sysusers diff --git a/openldap-initscript b/openldap-initscript deleted file mode 100644 index 5d999d3..0000000 --- a/openldap-initscript +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# -# ldap This shell script takes care of starting and stopping ldap server (slapd). -# -# chkconfig: 2345 35 65 -# description: LDAP stands for Lightweight Directory Access Protocol, used \ -# for implementing the industry standard directory services. -# processname: slapd -# config: /etc/openldap/slapd.conf -# pidfile: /var/run/slapd.pid - -# source function library -. /etc/init.d/functions - -[ -x /usr/bin/db_recover-51 ] && DB_RECOVER=db_recover-51 || DB_RECOVER=db_recover - -# source an auxiliary options file if we have one, and pick up OPTIONS, -# SLAPD_OPTIONS, and SLURPD_OPTIONS -[ -r /etc/sysconfig/ldap ] && . /etc/sysconfig/ldap - -slapd=/usr/sbin/slapd -[ -x ${slapd} ] || exit 0 - -RETVAL=0 - -function start() { - # fix bdb errors - [ -e "/var/lib/ldap/openldap-data/__db.001" ] && \ - $DB_RECOVER -h /var/lib/ldap/openldap-data - # start daemons - prog=`basename ${slapd}` - echo -n $"Starting $prog: " - if grep -q ^TLS /etc/openldap/slapd.conf; then - ${slapd} -u ldap -h "ldaps:/// ldap:///" $OPTIONS $SLAPD_OPTIONS - else - ${slapd} -u ldap $OPTIONS $SLAPD_OPTIONS - fi - evaluate_retval - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ldap - return $RETVAL -} - -function stop() { - # stop daemons - prog=`basename ${slapd}` - echo -n $"Stopping $prog: " - killproc ${slapd} - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && - rm -f /var/lock/subsys/ldap /var/run/ldap/slapd.args - return $RETVAL -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status ${slapd} - ;; - restart) - stop - start - ;; - condrestart) - if [ -f /var/lock/subsys/ldap ]; then - stop - start - fi - ;; - *) - echo $"Usage: $0 {start|stop|restart|status|condrestart}" - RETVAL=1 -esac - -exit $RETVAL - diff --git a/openldap.spec b/openldap.spec index fa748b5..3c66b24 100644 --- a/openldap.spec +++ b/openldap.spec @@ -1,6 +1,6 @@ Name: openldap -Version: 2.6.7 -Release: 1mamba +Version: 2.6.8 +Release: 2mamba Group: System/Servers Summary: An open source implementation of the Lightweight Directory Access Protocol Vendor: openmamba @@ -8,11 +8,11 @@ Distribution: openmamba Packager: Silvan Calarco URL: https://www.openldap.org Source0: ftp://ftp.openldap.org/pub/OpenLDAP/%{name}-release/%{name}-%{version}.tgz -Source1: %{name}-initscript Source2: %{name}-logrotate Source3: %{name}-2.2.15-conf Source4: openldap.service Source5: openldap.tmpfiles +Source6: openldap.sysusers # patch from Novell developers (evolution-exchange-2.4.0/docs/openldap-ntlm.diff) Patch0: %{name}-2.4.6-evolution-ntlm.patch Patch2: %{name}-2.4.24-default_config.patch @@ -24,7 +24,6 @@ BuildRequires: glibc-devel BuildRequires: libltdl-devel BuildRequires: libopenssl-devel BuildRequires: libsasl2-devel -BuildRequires: libsystemd-devel BuildRequires: libuuid-devel BuildRequires: libxcrypt-devel ## AUTOBUILDREQ-END @@ -107,8 +106,6 @@ This package contains static libraries and header files needed for development. %setup -q #-D -T #:<< _EOF -#cp %{SOURCE3} servers/slapd/slapd.conf -#%patch0 -p1 -b .ntlm %patch 2 -p1 %build @@ -142,12 +139,10 @@ This package contains static libraries and header files needed for development. chmod +x %{buildroot}%{_libdir}/lib*.so.* install -d %{buildroot}/var/lib/%{name}-data -install -d %{buildroot}/var/run/openldap/ -#install -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} install -D -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -#install -D -m 644 %{SOURCE4} %{buildroot}/lib/systemd/system/openldap.service -#install -D -m 644 %{SOURCE5} %{buildroot}%_tmpfilesdir/openldap.conf +install -D -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/openldap.conf +install -D -m0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/openldap.conf rm -f %{buildroot}%{_sysconfdir}/%{name}/*.default rm -f %{buildroot}%{_sysconfdir}/%{name}/schema/*.default @@ -180,6 +175,11 @@ rm -f %{buildroot}/var/openldap-data/DB_CONFIG.example %post -n lib%{name} -p /sbin/ldconfig %postun -n lib%{name} -p /sbin/ldconfig +%pre -n %{name}-server +%sysusers_create_package openldap %{SOURCE6} +%tmpfiles_create_package openldap %{SOURCE5} +: + %post -n %{name}-server %systemd_post slapd : @@ -255,13 +255,20 @@ rm -f %{buildroot}/var/openldap-data/DB_CONFIG.example %{_sbindir}/slapschema %{_sbindir}/slaptest %{_unitdir}/slapd.service -#%{_tmpfilesdir}/openldap.conf +%{_tmpfilesdir}/openldap.conf +%{_sysusersdir}/openldap.conf %dir %attr(700,ldap,ldap) /var/lib/openldap-data %config(noreplace) /var/lib/openldap-data/DB_CONFIG %{_mandir}/man3/* %{_mandir}/man8/* %changelog +* Sun Jun 23 2024 Silvan Calarco 2.6.8-2mamba +- provide sysusers file for ldap user and group creation and restore tmpfiles.d for /run + +* Tue Jun 04 2024 Automatic Build System 2.6.8-1mamba +- automatic version update by autodist + * Tue Jan 30 2024 Automatic Build System 2.6.7-1mamba - automatic version update by autodist diff --git a/openldap.sysusers b/openldap.sysusers new file mode 100644 index 0000000..5f666a1 --- /dev/null +++ b/openldap.sysusers @@ -0,0 +1,3 @@ +g ldap - +u ldap - "LDAP Server" /var/lib/openldap +m ldap ldap