File 389-ds.spec of Package 389-ds
448
1
#
2
# spec file for package 389-ds
3
#
4
# Copyright (c) 2020 SUSE LLC
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via https://bugs.opensuse.org/
16
#
17
18
19
# bcond is confusingly backwards to what you expect - without means
20
# to ENABLE the option, with means to DISABLE it.
21
%if (0%{?sle_version} > 150299) || (0%{?suse_version} > 1549)
22
%bcond_without rust
23
%else
24
%bcond_with rust
25
%endif
26
27
%define use_python python3
28
%define skip_python2 1
29
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
30
31
# Home directory
32
%global pkgname dirsrv
33
%global groupname %{pkgname}.target
34
35
%define homedir %{_localstatedir}/lib/dirsrv
36
%define logdir %{_localstatedir}/log/dirsrv
37
%define lockdir %{_localstatedir}/lock/dirsrv
38
# User and group name that own the home directory
39
%define user_group dirsrv
40
%ifnarch s390x s390 ppc64 ppc64le
41
%global use_tcmalloc 1
42
%else
43
%global use_tcmalloc 0
44
%endif
45
%define svrcorelib libsvrcore0
46
47
Name: 389-ds
48
Version: 1.4.4.14~git0.37dc95673
49
Release: 0
50
Summary: 389 Directory Server
51
License: GPL-3.0-or-later AND MPL-2.0
52
Group: Productivity/Networking/LDAP/Servers
53
URL: https://pagure.io/389-ds-base
54
Source: 389-ds-base-%{version}.tar.xz
55
Source1: extra-schema.tgz
56
Source2: LICENSE.openldap
57
%if %{with rust}
58
Source3: vendor.tar.xz
59
%endif
60
Source4: supportutils-plugin-dirsrv-.tar.xz
61
Source9: %{name}-rpmlintrc
62
Source10: %{user_group}-user.conf
63
# 389-ds does not support i686
64
ExcludeArch: %ix86
65
BuildRoot: %{_tmppath}/%{name}-%{version}-build
66
BuildRequires: autoconf
67
BuildRequires: automake
68
BuildRequires: cracklib-devel
69
BuildRequires: cyrus-sasl-devel
70
BuildRequires: db-devel >= 4.5
71
BuildRequires: doxygen
72
BuildRequires: gawk
73
BuildRequires: gcc-c++
74
BuildRequires: gdb
75
BuildRequires: krb5-devel
76
BuildRequires: libcmocka-devel
77
BuildRequires: libevent-devel
78
BuildRequires: libtalloc-devel
79
BuildRequires: libtevent-devel
80
BuildRequires: libtool
81
BuildRequires: sysuser-tools
82
# net-snmp-devel is needed to build the snmp ldap-agent
83
BuildRequires: net-snmp-devel >= 5.1.2
84
BuildRequires: openldap2-devel
85
# pam-devel is required by the pam passthru auth plug-in
86
BuildRequires: %{python_module devel}
87
BuildRequires: %{python_module setuptools}
88
BuildRequires: %{python_module argcomplete}
89
BuildRequires: %{python_module argparse-manpage}
90
BuildRequires: %{python_module ldap >= 3}
91
BuildRequires: %{python_module pyasn1-modules}
92
BuildRequires: %{python_module pyasn1}
93
BuildRequires: %{python_module python-dateutil}
94
BuildRequires: %{python_module six}
95
BuildRequires: pam-devel
96
BuildRequires: pkgconfig
97
BuildRequires: python-rpm-macros
98
BuildRequires: pkgconfig(icu-i18n)
99
BuildRequires: pkgconfig(icu-uc)
100
BuildRequires: pkgconfig(libcap)
101
BuildRequires: pkgconfig(libcrypto)
102
BuildRequires: pkgconfig(libpcre)
103
BuildRequires: pkgconfig(libssl)
104
BuildRequires: pkgconfig(libsystemd)
105
BuildRequires: pkgconfig(nspr)
106
BuildRequires: pkgconfig(nss)
107
BuildRequires: pkgconfig(systemd)
108
%if %{use_tcmalloc}
109
BuildRequires: pkgconfig(libtcmalloc)
110
%endif
111
BuildRequires: rsync
112
%if %{with rust}
113
BuildRequires: cargo
114
BuildRequires: rust
115
%endif
116
Requires: %{_sbindir}/service
117
Requires: acl
118
# This is a requirement as it's the only known "safe" method of
119
# plaintext password authentication to ldap, beside the use of
120
# ldaps.
121
Requires: cyrus-sasl-plain
122
Requires: db-utils
123
Requires: lib389 = %{version}
124
# Needed for creating the ccache and some GSSAPI steps in sasl
125
Requires: krb5
126
%sysusers_requires
127
# 389-ds does not directly require gssapi, but it is needed for
128
# ldap gssapi auth, so we recommend it.
129
# This used to be a requirement, but it's actually optional.
130
Recommends: cyrus-sasl-gssapi
131
# This is required by rfc2831, however it's also horribly insecure
132
# and requires insecure password storage. We really should remove
133
# it.
134
Recommends: cyrus-sasl-digestmd5
135
# Recommended to be installed to assist with debugging and problem
136
# solving.
137
Recommends: supportutils
138
139
Requires(post): fillup
140
Requires(pre): shadow
141
PreReq: permissions
142
Obsoletes: 389-ds-base < %{version}-%{release}
143
Provides: 389-ds-base = %{version}-%{release}
144
%{?systemd_ordering}
145
146
%description
147
389 Directory Server is a full-featured LDAPv3 compliant server. In
148
addition to the standard LDAPv3 operations, it supports multi-master
149
replication, fully online configuration and administration, chaining,
150
virtual attributes, access control directives in the data, Virtual
151
List View, server-side sorting, SASL, TLS/SSL, and many other
152
features. (The server started out as Netscape Directory Server.)
153
154
%package devel
155
Summary: Development files for the 389 Directory Server
156
License: GPL-3.0-or-later AND MPL-2.0
157
Group: Development/Libraries/C and C++
158
Provides: svrcore-devel = 4.1.4
159
Obsoletes: svrcore-devel < 4.1.4
160
Requires: %{name} = %{version}
161
Requires: %{svrcorelib} = %{version}
162
Requires: libevent-devel
163
Requires: openldap2-devel
164
Requires: pkgconfig
165
Requires: pkgconfig(nspr)
166
Requires: pkgconfig(nss)
167
Requires: pkgconfig(systemd)
168
169
%description devel
170
389 Directory Server is a full-featured LDAPv3 compliant server. In
171
addition to the standard LDAPv3 operations, it supports multi-master
172
replication, fully online configuration and administration, chaining,
173
virtual attributes, access control directives in the data, Virtual
174
List View, server-side sorting, SASL, TLS/SSL, and many other
175
features.
176
177
This package contains the development files for 389DS.
178
179
%package snmp
180
Summary: SNMP Agent for 389 Directory Server
181
License: GPL-3.0-or-later AND MPL-2.0
182
Group: System/Daemons
183
Requires: %{name} = %{version}
184
185
Obsoletes: %{name} <= 1.3.6.2
186
187
%description snmp
188
SNMP Agent for the 389 Directory Server base package.
189
190
%package -n lib389
191
Summary: 389 Directory Server administration tools and library
192
License: GPL-3.0-or-later AND MPL-2.0
193
Group: Development/Languages/Python
194
Requires: %{use_python}-argcomplete
195
Requires: %{use_python}-argparse-manpage
196
Requires: %{use_python}-distro
197
Requires: %{use_python}-ldap >= 3.0
198
Requires: %{use_python}-pyasn1
199
Requires: %{use_python}-pyasn1-modules
200
Requires: %{use_python}-python-dateutil
201
Requires: %{use_python}-six
202
Requires: krb5-client
203
Requires: mozilla-nss-tools
204
# We recommend this here as a supplementary tool for ldap
205
# server interaction, but it's in no way required.
206
Recommends: openldap2-client
207
# These are recommended if you have selinux on your system
208
# to allow some supplementary automated interactions during
209
# setup, but it's not required.
210
Recommends: python3-selinux
211
Recommends: python3-policycoreutils
212
213
Provides: python3-lib389 = %{version}-%{release}
214
Obsoletes: python-lib389 < %{version}-%{release}
215
Obsoletes: python3-lib389 < %{version}-%{release}
216
217
%description -n lib389
218
Python library for interacting with and administering 389
219
Directory Server instances locally or remotely.
220
221
%package -n %{svrcorelib}
222
Summary: Secure PIN handling using NSS crypto
223
License: MPL-2.0
224
Group: System/Libraries
225
226
%description -n %{svrcorelib}
227
svrcore provides applications with several ways to handle secure PIN storage
228
e.g. in an application that must be restarted, but needs the PIN to unlock
229
the private key and other crypto material, without user intervention. svrcore
230
uses the facilities provided by NSS.
231
232
%prep
233
# Extract the 389-ds sources.
234
%setup -q -a 1 -n %{name}-base-%{version}
235
236
# Extract the vendor.tar.gz. The -D -T here prevents removal of the sources
237
# from the previous setup step.
238
%if %{with rust}
239
%setup -q -n %{name}-base-%{version} -D -T -a 3
240
%endif
241
%setup -q -n %{name}-base-%{version} -D -T -a 4
242
243
%build
244
%sysusers_generate_pre %{SOURCE10} %{user_group}
245
# Make sure python3 is used in shebangs
246
# FIX ME!! This should be fixed in the source code !!!
247
sed -r -i '1s|^#!\s*%{_bindir}.*python.*|#!%{_bindir}/%{use_python}|' ldap/admin/src/scripts/{*.py,ds-replcheck} src/lib389/cli/ds*
248
249
touch docs/custom.css
250
autoreconf -fi
251
export CFLAGS="%{optflags}"
252
export XCFLAGS="$CFLAGS"
253
254
%configure \
255
%if 0%{?suse_version} >= 1330
256
--enable-gcc-security \
257
%endif
258
--enable-autobind \
259
--enable-auto-dn-suffix \
260
--with-openldap \
261
--enable-cmocka \
262
%if %{use_tcmalloc}
263
--enable-tcmalloc \
264
%endif
265
--with-selinux \
266
%if %{with rust}
267
--enable-rust-offline \
268
%endif
269
--disable-perl \
270
--libexecdir=%{_prefix}/lib/dirsrv/ \
271
--with-pythonexec="%{_bindir}/%{use_python}" \
272
--with-systemd \
273
--with-systemdgroupname=%{groupname} \
274
--with-systemdsystemunitdir="%{_unitdir}" \
275
--with-systemdsystemconfdir="%{_sysconfdir}/systemd/system" \
276
--with-tmpfiles-d="%{_sysconfdir}/tmpfiles.d" \
277
--with-systemdgroupname=dirsrv.target \
278
279
make %{?_smp_mflags}
280
281
pushd src/lib389
282
%python_build
283
popd
284
285
%install
286
%make_install
287
pushd src/lib389
288
%python_install
289
mv %{buildroot}/usr/libexec/dirsrv/dscontainer %{buildroot}%{_prefix}/lib/dirsrv/
290
rmdir %{buildroot}/usr/libexec/dirsrv/
291
popd
292
293
cp -r man/man3 %{buildroot}%{_mandir}/man3
294
295
install -D -d -m 0750 %{buildroot}%{homedir}
296
mkdir -p %{buildroot}%{logdir}
297
mkdir -p %{buildroot}%{homedir}
298
mkdir -p %{buildroot}%{lockdir}
299
mkdir -p %{buildroot}%{_sysusersdir}
300
mkdir -p %{buildroot}/usr/lib/supportconfig/plugins/
301
302
#remove libtool archives and static libs
303
find %{buildroot} -type f -name "*.la" -delete -print
304
305
# install extra schema files
306
cp -R extra-schema "%{buildroot}/%{_datadir}/dirsrv/"
307
308
# Install the support utils plugin.
309
cp supportutils-plugin-dirsrv-/dirsrv "%{buildroot}/usr/lib/supportconfig/plugins/dirsrv"
310
311
# bring OpenLDAP copyright notice here because it is referenced by several extra schema files
312
cp %{SOURCE2} ./
313
314
rm -rv %{buildroot}/usr/share/cockpit/
315
rm -rv %{buildroot}/usr/share/metainfo/389-console/
316
mv src/svrcore/README{,.svrcore}
317
mv src/svrcore/LICENSE{,.svrcore}
318
install -m 0644 %{SOURCE10} %{buildroot}%{_sysusersdir}/
319
320
%pre -f %{user_group}.pre
321
322
%post
323
%fillup_only -n dirsrv
324
%set_permissions %{_sbindir}/ns-slapd
325
326
%verifyscript
327
%verify_permissions -e %{_sbindir}/ns-slapd
328
329
%postun
330
output=/dev/null
331
# reload to pick up any changes to systemd files
332
/bin/systemctl daemon-reload >$output 2>&1 || :
333
# reload to pick up any shared lib changes
334
%fillup_only -n dirsrv
335
%fillup_only -n dirsrv.systemd
336
exit 0
337
338
%preun
339
%service_del_preun %{pkgname}.target
340
341
%pre snmp
342
%service_add_pre dirsrv-snmp.service
343
344
%post snmp
345
%service_add_post %{pkgname}-snmp.service
346
347
%preun snmp
348
%service_del_preun %{pkgname}-snmp.service
349
350
%postun snmp
351
%service_del_postun %{pkgname}-snmp.service
352
353
%post -n %{svrcorelib} -p /sbin/ldconfig
354
355
%postun -n %{svrcorelib} -p /sbin/ldconfig
356
357
%files
358
%defattr(-,root,root)
359
%doc README*
360
%license LICENSE LICENSE.openldap
361
%{_sysusersdir}/%{user_group}-user.conf
362
%dir %attr(-,%{user_group},%{user_group}) %{homedir}
363
%dir %attr(-,%{user_group},%{user_group}) %{logdir}
364
%config(noreplace) %{_sysconfdir}/dirsrv/config/*
365
%config(noreplace) %{_sysconfdir}/dirsrv/schema/*
366
%{_datadir}/dirsrv
367
%dir %{_libdir}/dirsrv
368
%dir %{_libdir}/dirsrv/*
369
%dir %{_sysconfdir}/dirsrv
370
%dir %{_sysconfdir}/dirsrv/config
371
%dir %{_sysconfdir}/dirsrv/schema
372
%{_libdir}/dirsrv/libns-dshttpd-*.so
373
%{_libdir}/dirsrv/librewriters.so
374
%{_libdir}/dirsrv/plugins/*.so
375
%{_libdir}/dirsrv/python/*.py
376
%{_libdir}/dirsrv/*.so.*
377
%exclude %{_mandir}/man1/ldap-agent*
378
%{_mandir}/man1/*
379
%{_mandir}/man5/*
380
%{_mandir}/man8/ns-slapd.8.gz
381
%{_mandir}/man8/openldap_to_ds.8.gz
382
%{_bindir}/*
383
# TODO: audit bug running https://bugzilla.opensuse.org/show_bug.cgi?id=1111564
384
# This also needs a lot more work on the service file
385
#attr(750,root,dirsrv) #caps(CAP_NET_BIND_SERVICE=pe) #{_sbindir}/ns-slapd
386
%verify(not caps) %attr(755,root,root) %{_sbindir}/ns-slapd
387
%{_sbindir}/openldap_to_ds
388
%{_unitdir}/dirsrv@.service
389
%{_unitdir}/dirsrv.target
390
%exclude %{_unitdir}/dirsrv@.service.d/custom.conf
391
%{_prefix}/lib/dirsrv/ds_systemd_ask_password_acl
392
# This has to be hardcoded to /lib - $libdir changes between lib/lib64, but
393
# sysctl.d is always in /lib.
394
%{_prefix}/lib/sysctl.d/*
395
%dir %{_datadir}/gdb/auto-load/usr/sbin/
396
%{_datadir}/gdb/auto-load/usr/sbin/ns-slapd-gdb.py
397
%dir %{_prefix}/lib/supportconfig
398
%dir %{_prefix}/lib/supportconfig/plugins
399
%attr(750,root,root) %{_prefix}/lib/supportconfig/plugins/dirsrv
400
401
%files devel
402
%defattr(-,root,root)
403
%doc README*
404
%doc src/svrcore/README.svrcore
405
%license LICENSE
406
%license src/svrcore/LICENSE.svrcore
407
%{_mandir}/man3/*
408
%{_includedir}/dirsrv
409
%{_includedir}/svrcore.h
410
%{_libdir}/libsvrcore.so
411
%{_libdir}/dirsrv/libns-dshttpd.so
412
%{_libdir}/dirsrv/libslapd.so
413
%{_libdir}/dirsrv/libldaputil.so
414
%{_libdir}/pkgconfig/dirsrv.pc
415
%{_libdir}/pkgconfig/svrcore.pc
416
417
%files -n %{svrcorelib}
418
%defattr(-,root,root,-)
419
%license src/svrcore/LICENSE*
420
%{_libdir}/libsvrcore.so.*
421
422
%files snmp
423
%defattr(-,root,root,-)
424
%license LICENSE LICENSE.GPLv3+ LICENSE.openssl
425
# TODO: README.devel
426
%config(noreplace)%{_sysconfdir}/%{pkgname}/config/ldap-agent.conf
427
%{_sbindir}/ldap-agent*
428
%{_mandir}/man1/ldap-agent.1*
429
%{_unitdir}/%{pkgname}-snmp.service
430
431
%files -n lib389
432
%defattr(-,root,root,-)
433
%license src/lib389/LICENSE
434
%doc src/lib389/README*
435
%{_sbindir}/dsconf
436
%{_sbindir}/dscreate
437
%{_sbindir}/dsctl
438
%{_sbindir}/dsidm
439
%dir %{_prefix}/lib/dirsrv/
440
%{_prefix}/lib/dirsrv/dscontainer
441
%{_mandir}/man8/dsconf.8.gz
442
%{_mandir}/man8/dscreate.8.gz
443
%{_mandir}/man8/dsctl.8.gz
444
%{_mandir}/man8/dsidm.8.gz
445
/usr/lib/python*/site-packages/lib389*
446
447
%changelog
448