Statistics
| Revision:

root / openldap-rpm / trunk / SPECS / openldap-ltb.spec

History | View | Annotate | Download (16.4 KB)

1
#=================================================
2
# Specification file for OpenLDAP
3
#
4
# Install OpenLDAP
5
# Install an init script in /etc/init.d
6
# Create user/group ldap
7
# Configure syslog and logrotate
8
# Install a pwdChecker module
9
#
10
# Copyright (C) 2008 Raphael OUAZANA
11
# Copyright (C) 2008 Clement OUDOT
12
# Copyright (C) 2008 LINAGORA
13
#
14
# Provided by LTB-project (http://www.ltb-project.org)
15
#=================================================
16
17
#=================================================
18
# Variables
19
#=================================================
20
%define real_name        openldap
21
%define real_version     2.4.35
22
%define release_version  1%{?dist}
23
24
%define bdbdir           /usr/local/berkeleydb
25
%define ldapdir          /usr/local/openldap
26
%define ldapserverdir    %{ldapdir}
27
%define ldapdatadir      %{ldapdir}/var/openldap-data
28
%define ldaplogsdir      %{bdbdir}/openldap-logs
29
%define ldapbackupdir    /var/backups/openldap
30
%define ldaplogfile      /var/log/openldap.log
31
32
%define ldapuser         ldap
33
%define ldapgroup        ldap
34
35
%define slapd_init_name             ltb-project-openldap-initscript
36
%define slapd_init_version          1.9
37
38
%define check_password_name         ltb-project-openldap-ppolicy-check-password
39
%define check_password_version      1.1
40
%define check_password_conf         %{ldapserverdir}/etc/openldap/check_password.conf
41
%define check_password_minPoints    3
42
%define check_password_useCracklib  0
43
%define check_password_minUpper     0
44
%define check_password_minLower     0
45
%define check_password_minDigit     0
46
%define check_password_minPunct     0
47
48
#=================================================
49
# Header
50
#=================================================
51
Summary: OpenLDAP server with addons from the LDAP Tool Box project
52
Name: %{real_name}-ltb
53
Version: %{real_version}
54
Release: %{release_version}
55
# http://www.openldap.org/software/release/license.html
56
License: OpenLDAP Public License
57
58
Group: Applications/System
59
URL: http://www.openldap.org/
60
61
# Source available on http://www.openldap.org
62
Source: %{real_name}-%{real_version}.tgz
63
# Sources available on http://www.ltb-project.org
64
Source1: %{slapd_init_name}-%{slapd_init_version}.tar.gz
65
# Sources available on http://www.ltb-project.org
66
Source2: %{check_password_name}-%{check_password_version}.tar.gz
67
Source3: openldap.sh
68
Source4: DB_CONFIG
69
Source5: openldap.logrotate
70
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
71
72
BuildRequires: gcc, make, groff
73
BuildRequires: openssl-devel, cyrus-sasl-devel, berkeleydb-ltb >= 4.6.21, libtool-ltdl-devel
74
BuildRequires: cracklib
75
Requires: gawk, libtool-ltdl
76
77
Requires(pre): /sbin/ldconfig, coreutils
78
79
%description
80
OpenLDAP is an open source suite of LDAP (Lightweight Directory Access
81
Protocol) applications and development tools. LDAP is a set of
82
protocols for accessing directory services (usually phone book style
83
information, but other information is possible) over the Internet,
84
similar to the way DNS (Domain Name System) information is propagated
85
over the Internet. 
86
87
This package contains all: server, clients, librairies and docs. It
88
can be installed with openldap and openldap-devel. It provides tools
89
from the LDAP Tool Box project:
90
o Start/stop script
91
o Logrotate script
92
93
#=================================================
94
# Subpackage check-password
95
#=================================================
96
%package check-password
97
Summary:        check_password module for password policy
98
Version:        %{check_password_version}
99
Release:        8%{?dist}
100
Group:          Applications/System
101
URL:		http://www.ltb-project.org
102
103
%if "%{?dist}" == ".el6"
104
BuildRequires:	cracklib-devel
105
%endif
106
107
Requires:	cracklib, cracklib-dicts, %{real_name}-ltb >= %{real_version}
108
109
%description check-password
110
check_password.c is an OpenLDAP pwdPolicyChecker module used to check the strength 
111
and quality of user-provided passwords. This module is used as an extension of the 
112
OpenLDAP password policy controls, see slapo-ppolicy(5) section pwdCheckModule. 
113
check_password.c will run a number of checks on the passwords to ensure minimum 
114
strength and quality requirements are met. Passwords that do not meet these 
115
requirements are rejected.
116
117
This is provided by LDAP Tool Box project: http://www.ltb-project.org 
118
119
#=================================================
120
# Subpackage contrib-overlays
121
#=================================================
122
%package contrib-overlays
123
Summary:        Overlays contributed to OpenLDAP
124
Version:        %{real_version}
125
Release:        %{release_version}
126
Group:          Applications/System
127
URL:		http://www.ltb-project.org
128
129
Requires:	%{real_name}-ltb >= %{real_version}
130
131
%description contrib-overlays
132
Some overlays are not included in the OpenLDAP main package but provided
133
as contributions. This package provide some of them.
134
135
This is provided by LDAP Tool Box project: http://www.ltb-project.org 
136
137
#=================================================
138
# Source preparation
139
#=================================================
140
%prep
141
%setup -n %{real_name}-%{real_version}
142
%setup -n %{real_name}-%{real_version} -T -D -a 1
143
%setup -n %{real_name}-%{real_version} -T -D -a 2
144
145
#=================================================
146
# Building
147
#=================================================
148
%build
149
# OpenLDAP
150
export CC="gcc"
151
export CFLAGS="-DOPENLDAP_FD_SETSIZE=4096 -O2 -g"
152
# Uncomment to enable config delete option
153
#export CFLAGS="-DOPENLDAP_FD_SETSIZE=4096 -O2 -g -DSLAP_CONFIG_DELETE"
154
export CPPFLAGS="-I%{bdbdir}/include -I/usr/kerberos/include"
155
export LDFLAGS="-L%{bdbdir}/%{_lib}"
156
./configure --enable-ldap --enable-debug --prefix=%{ldapserverdir} --libdir=%{ldapserverdir}/%{_lib} --with-tls --with-cyrus-sasl --enable-spasswd --enable-overlays --enable-modules --enable-slapi --enable-meta --enable-crypt
157
make depend
158
make %{?_smp_mflags}
159
# check_password
160
cd %{check_password_name}-%{check_password_version} 
161
make %{?_smp_mflags} "CONFIG=%{check_password_conf}" "LDAP_INC=-I../include -I../servers/slapd"
162
cd ..
163
# contrib-overlays
164
cd contrib/slapd-modules
165
## lastbind
166
cd lastbind
167
make %{?_smp_mflags} "prefix=%{ldapserverdir}"
168
cd ..
169
## smbk5pwd
170
cd smbk5pwd
171
make %{?_smp_mflags} "DEFS=-DDO_SAMBA -DDO_SHADOW" "LDAP_LIB=-L%{_builddir}/%{real_name}-%{real_version}/libraries/liblber/.libs/ -L%{_builddir}/%{real_name}-%{real_version}/libraries/libldap_r/.libs/ -lldap_r -llber" "prefix=%{ldapserverdir}"
172
cd ..
173
cd ../..
174
175
#=================================================
176
# Installation
177
#=================================================
178
%install
179
rm -rf %{buildroot}
180
make install DESTDIR=%{buildroot} STRIP=""
181
182
# Directories
183
mkdir -p %{buildroot}%{ldapdatadir}
184
mkdir -p %{buildroot}%{ldaplogsdir}
185
mkdir -p %{buildroot}%{ldapbackupdir}
186
187
# Init script
188
mkdir -p %{buildroot}/etc/init.d
189
mkdir -p %{buildroot}/etc/default
190
install -m 755 %{slapd_init_name}-%{slapd_init_version}/slapd %{buildroot}/etc/init.d/slapd
191
install -m 644 %{slapd_init_name}-%{slapd_init_version}/slapd.default %{buildroot}/etc/default/slapd
192
sed -i 's:^SLAPD_PATH.*:SLAPD_PATH="'%{ldapdir}'":' %{buildroot}/etc/default/slapd
193
sed -i 's:^SLAPD_USER.*:SLAPD_USER="'%{ldapuser}'":' %{buildroot}/etc/default/slapd
194
sed -i 's:^SLAPD_GROUP.*:SLAPD_GROUP="'%{ldapgroup}'":' %{buildroot}/etc/default/slapd
195
sed -i 's:^BDB_PATH.*:BDB_PATH="'%{bdbdir}'":' %{buildroot}/etc/default/slapd
196
sed -i 's:^BACKUP_PATH.*:BACKUP_PATH="'%{ldapbackupdir}'":' %{buildroot}/etc/default/slapd
197
198
# PATH modification
199
mkdir -p %{buildroot}/etc/profile.d
200
install -m 755 %{SOURCE3} %{buildroot}/etc/profile.d/openldap.sh
201
sed -i 's:^OL_BIN.*:OL_BIN='%{ldapdir}/bin':' %{buildroot}/etc/profile.d/openldap.sh
202
sed -i 's:^OL_SBIN.*:OL_SBIN='%{ldapdir}/sbin':' %{buildroot}/etc/profile.d/openldap.sh
203
204
# BDB configuration
205
install -m 644 %{SOURCE4} %{buildroot}%{ldapdatadir}
206
sed -i 's:^set_lg_dir.*:set_lg_dir\t'%{ldaplogsdir}':' %{buildroot}%{ldapdatadir}/DB_CONFIG
207
208
# Logrotate
209
mkdir -p %{buildroot}/etc/logrotate.d
210
install -m 644 %{SOURCE5} %{buildroot}/etc/logrotate.d/openldap
211
212
# Modify data directory in slapd.conf
213
sed -i 's:^directory.*:directory\t'%{ldapdatadir}':' %{buildroot}%{ldapserverdir}/etc/openldap/slapd.conf
214
215
# check_password
216
install -m 644 %{check_password_name}-%{check_password_version}/check_password.so %{buildroot}%{ldapserverdir}/%{_lib}
217
echo "minPoints %{check_password_minPoints}" > %{buildroot}%{check_password_conf}
218
echo "useCracklib %{check_password_useCracklib}" >> %{buildroot}%{check_password_conf}
219
echo "minUpper %{check_password_minUpper}" >> %{buildroot}%{check_password_conf}
220
echo "minLower %{check_password_minLower}" >> %{buildroot}%{check_password_conf}
221
echo "minDigit %{check_password_minDigit}" >> %{buildroot}%{check_password_conf}
222
echo "minPunct %{check_password_minPunct}" >> %{buildroot}%{check_password_conf}
223
224
# contrib-overlays
225
cd contrib/slapd-modules
226
cd lastbind
227
make install "prefix=%{buildroot}%{ldapserverdir}"
228
cd ..
229
cd smbk5pwd
230
make install "prefix=%{buildroot}%{ldapserverdir}"
231
cd ..
232
cd ../..
233
234
%pre -n openldap-ltb
235
#=================================================
236
# Pre Installation
237
#=================================================
238
239
# If upgrade stop slapd
240
if [ $1 -eq 2 ]
241
then
242
	/sbin/service slapd stop > /dev/null 2>&1
243
fi
244
245
%post -n openldap-ltb
246
#=================================================
247
# Post Installation
248
#=================================================
249
250
# Do this at first install
251
if [ $1 -eq 1 ]
252
then
253
	# Set slapd as service
254
	/sbin/chkconfig --add slapd
255
256
	# Create user and group
257
	/usr/sbin/groupadd %{ldapgroup}
258
	/usr/sbin/useradd %{ldapuser} -g %{ldapgroup}
259
260
	# Add syslog facility
261
%if "%{?dist}" == ".el6"
262
	echo "local4.*	-%{ldaplogfile}" >> /etc/rsyslog.conf
263
	/sbin/service rsyslog restart > /dev/null 2>&1
264
%else
265
	echo "local4.*	-%{ldaplogfile}" >> /etc/syslog.conf
266
	/sbin/service syslog restart > /dev/null 2>&1
267
%endif
268
269
        # Add OpenLDAP libraries to the system
270
        echo "%{ldapserverdir}/%{_lib}" >> /etc/ld.so.conf
271
        /sbin/ldconfig
272
fi
273
274
# Always do this
275
# Change owner
276
/bin/chown -R %{ldapuser}:%{ldapgroup} %{ldapserverdir}
277
/bin/chown -R %{ldapuser}:%{ldapgroup} %{ldapdatadir}
278
/bin/chown -R %{ldapuser}:%{ldapgroup} %{ldaplogsdir}
279
/bin/chown -R %{ldapuser}:%{ldapgroup} %{ldapbackupdir}
280
281
%post check-password
282
#=================================================
283
# Post Installation
284
#=================================================
285
286
# Change owner
287
/bin/chown -R %{ldapuser}:%{ldapgroup} %{ldapserverdir}/%{_lib}
288
289
%preun -n openldap-ltb
290
#=================================================
291
# Pre uninstallation
292
#=================================================
293
294
# Don't do this if newer version is installed
295
if [ $1 -eq 0 ]
296
then
297
	# Stop slapd
298
	/sbin/service slapd stop > /dev/null 2>&1
299
300
	# Delete service
301
	/sbin/chkconfig --del slapd
302
303
        # Remove syslog facility
304
%if "%{?dist}" == ".el6"
305
	sed -i '/local4\..*/d' /etc/rsyslog.conf
306
	/sbin/service rsyslog restart
307
%else
308
	sed -i '/local4\..*/d' /etc/syslog.conf
309
	/sbin/service syslog restart
310
%endif
311
312
        # Remove OpenLDAP libraries from the system
313
        sed -i '\:'%{ldapserverdir}/%{_lib}':d' /etc/ld.so.conf
314
        /sbin/ldconfig
315
fi
316
317
#=================================================
318
# Cleaning
319
#=================================================
320
%clean
321
rm -rf %{buildroot}
322
323
#=================================================
324
# Files
325
#=================================================
326
%files -n openldap-ltb
327
%defattr(-, root, root, 0755)
328
%{ldapdir}
329
%config(noreplace) %{ldapserverdir}/etc/openldap/slapd.conf
330
%config(noreplace) %{ldapserverdir}/etc/openldap/ldap.conf
331
/etc/init.d/slapd
332
%config(noreplace) /etc/default/slapd
333
/etc/profile.d/openldap.sh
334
%{ldaplogsdir}
335
%config(noreplace) /etc/logrotate.d/openldap
336
%{ldapbackupdir}
337
%exclude %{check_password_conf}
338
%exclude %{ldapserverdir}/%{_lib}/check_password.so
339
%exclude %{ldapserverdir}/libexec/openldap
340
%config(noreplace) %{ldapdatadir}/DB_CONFIG
341
342
%files check-password
343
%config(noreplace) %{check_password_conf}
344
%{ldapserverdir}/%{_lib}/check_password.so
345
346
%files contrib-overlays
347
%{ldapserverdir}/libexec/openldap
348
349
#=================================================
350
# Changelog
351
#=================================================
352
%changelog
353
* Wed Apr 02 2013 - Clement Oudot <clem@ltb-project.org> - 2.4.35-1 / 1.1-8
354
- Upgrade to OpenLDAP 2.4.35
355
- Remove dependency to Berkeley DB (#585)
356
- Make DB_CONFIG a config file (#588)
357
* Thu Mar 12 2013 - Clement Oudot <clem@ltb-project.org> - 2.4.34-1 / 1.1-8
358
- Upgrade to OpenLDAP 2.4.34
359
- Upgrade to init script 1.9
360
* Thu Oct 11 2012 - Clement Oudot <clem@ltb-project.org> - 2.4.33-1 / 1.1-8
361
- Upgrade to OpenLDAP 2.4.33
362
- Upgrade to init script 1.8
363
* Thu Aug 23 2012 - Clement Oudot <clem@ltb-project.org> - 2.4.32-1 / 1.1-8
364
- Upgrade to OpenLDAP 2.4.32
365
- Upgrade to init script 1.7
366
- Comment to enable config delete option (#476)
367
- Use rsyslog on EL6 (#480)
368
* Thu Apr 24 2012 - Clement Oudot <clem@ltb-project.org> - 2.4.31-1 / 1.1-8
369
- Upgrade to OpenLDAP 2.4.31
370
- Upgrade to init script 1.6
371
- Add OpenLDAP libraries to the system (#411)
372
* Fri Mar 09 2012 - Clement Oudot <clem@ltb-project.org> - 2.4.30-1 / 1.1-8
373
- Upgrade to OpenLDAP 2.4.30
374
- Upgrade to init script 1.5
375
* Thu Jan 05 2012 - Clement Oudot <clem@ltb-project.org> - 2.4.28-2 / 1.1-8
376
- Upgrade to init script 1.4
377
- Remove circular build dependency
378
* Wed Nov 30 2011 - Clement Oudot <clem@ltb-project.org> - 2.4.28-1 / 1.1-8
379
- Upgrade to OpenLDAP 2.4.28
380
- Create package contrib-overlays
381
* Fri Nov 25 2011 - Clement Oudot <clem@ltb-project.org> - 2.4.27-1 / 1.1-8
382
- Upgrade to OpenLDAP 2.4.27
383
- Upgrade to init script 1.3
384
- Remove OpenLDAP restart on log rotation
385
* Fri Jul 08 2011 - Clement Oudot <clem@ltb-project.org> - 2.4.26-1 / 1.1-7
386
- Upgrade to OpenLDAP 2.4.26
387
* Tue May 03 2011 - Clement Oudot <clem@ltb-project.org> - 2.4.25-1 / 1.1-6
388
- Upgrade to OpenLDAP 2.4.25
389
- Enable SLAPI
390
* Thu Mar 24 2011 - Clement Oudot <clem@ltb-project.org> - 2.4.24-1 / 1.1-5
391
- Upgrade to OpenLDAP 2.4.24
392
- Upgrade to init script 1.2
393
* Wed Jul 21 2010 - Clement Oudot <clem@ltb-project.org> - 2.4.23-1 / 1.1-4
394
- Upgrade to OpenLDAP 2.4.23
395
- Upgrade to init script 1.1
396
* Mon May 10 2010 - Clement Oudot <clem@ltb-project.org> - 2.4.22-1 / 1.1-3
397
- Upgrade to OpenLDAP 2.4.22
398
- Upgrade to init script 1.0
399
* Fri Feb 19 2010 - Clement Oudot <clem@ltb-project.org> - 2.4.21-1 / 1.1-2
400
- Upgrade to OpenLDAP 2.4.21
401
* Sat Oct 31 2009 - Clement Oudot <clem@ltb-project.org> - 2.4.19-1 / 1.1-1
402
- Upgrade to OpenLDAP 2.4.19 (#135)
403
- Upgrade to init script 0.9
404
- Upgrade to check_password 1.1
405
- Disable strip to provide debuginfo package (#117)
406
- Use %config(noreplace)
407
- Start slapd before upgrade, and start after upgrade
408
* Fri Jul 3 2009 - Clement Oudot <clem@ltb-project.org> - 2.4.16-2 / 1.0.3-4
409
- Upgrade to init script 0.8
410
* Tue Apr 29 2009 - Clement Oudot <clem@ltb-project.org> - 2.4.16-1 / 1.0.3-4
411
- Upgrade to OpenLDAP 2.4.16
412
* Mon Mar 2 2009 - Clement Oudot <clem@ltb-project.org> - 2.4.15-1 / 1.0.3-3
413
- This package is now maintened in LTB project
414
- Upgrade to OpenLDAP 2.4.15
415
- Upgrade to init script 0.7
416
* Fri Feb 6 2009 - Clement Oudot <clement.oudot@linagora.com> - 2.4.13-2
417
- Upgrade check_password to 1.0.3 (useCracklib parameter support)
418
* Fri Jan 15 2009 - Clement Oudot <clement.oudot@linagora.com> - 2.4.13-1
419
- remove checkLdapPwdExpiration script with cron configuration (provided by linagora-ldap-tools)
420
- add pwdModuleChecker check_password-1.0.2  from Calivia
421
- enable modules to support external password checking module
422
* Fri Oct 24 2008 - Clement Oudot <clement.oudot@linagora.com> - 2.4.12-1.2
423
- install in /opt
424
- remove slurpd references
425
- set OpenLDAP and BerkelyDB dirs in all scripts
426
* Mon Oct 20 2008 - Clement Oudot <clement.oudot@linagora.com> - 2.4.12-1.1
427
- new version 2.4.12
428
- use BerkeleyDB 4.6.21
429
- use SASL and all overlays
430
- use init script 0.6.5
431
- configure syslog and logrotate
432
- add checkLdapPwdExpiration script with cron configuration
433
* Fri Sep 29 2006 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.3.27-1.1
434
- Add Berkeley DB logs directory
435
* Fri Sep 29 2006 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.3.27-1.0
436
- New version
437
* Fri Nov 25 2005 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.3.12-1.0
438
- New version
439
* Mon Oct 6 2005 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.2.28-4.2
440
- Another fix for init level
441
* Mon Oct 6 2005 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.2.28-4
442
- Fix typo in CFLAGS
443
- Fix init level in init script (v0.4)
444
* Mon Oct 3 2005 - Clement Oudot <clement.oudot@linagora.com> - 2.2.28-3
445
- Update init script version from 0.2 to 0.3
446
* Fri Sep 30 2005 - Raphael Ouazana <raphael.ouazana@linagora.com> - 2.2.28-2
447
- add patch because getaddrinfo is thread-safe on Linux
448
* Thu Aug 30 2005 - Clement Oudot <clement.oudot@linagora.com> - 2.2.28-1
449
- package for RHEL3 ES UP5