gnu: mumi: Update to 0.0.0-12.bb2fe92.
[jackhill/guix/guix.git] / gnu / packages / openldap.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Lars-Dominik Braun <ldb@leibniz-psychology.org>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages openldap)
25 #:use-module (gnu packages autotools)
26 #:use-module (gnu packages check)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages cyrus-sasl)
29 #:use-module (gnu packages dbm)
30 #:use-module (gnu packages documentation)
31 #:use-module (gnu packages gettext)
32 #:use-module (gnu packages gnupg)
33 #:use-module (gnu packages groff)
34 #:use-module (gnu packages icu4c)
35 #:use-module (gnu packages kerberos)
36 #:use-module (gnu packages libevent)
37 #:use-module (gnu packages linux)
38 #:use-module (gnu packages networking)
39 #:use-module (gnu packages nss)
40 #:use-module (gnu packages password-utils)
41 #:use-module (gnu packages pcre)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages python)
45 #:use-module (gnu packages python-xyz)
46 #:use-module (gnu packages rsync)
47 #:use-module (gnu packages selinux)
48 #:use-module (gnu packages time)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web)
51 #:use-module (gnu packages)
52 #:use-module ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl expat))
53 #:use-module (guix packages)
54 #:use-module (guix download)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system python))
57
58 (define-public openldap
59 (package
60 (name "openldap")
61 (version "2.4.47")
62 (source (origin
63 (method url-fetch)
64
65 ;; See <http://www.openldap.org/software/download/> for a list of
66 ;; mirrors.
67 (uri (list (string-append
68 "ftp://mirror.switch.ch/mirror/OpenLDAP/"
69 "openldap-release/openldap-" version ".tgz")
70 (string-append
71 "https://www.openldap.org/software/download/OpenLDAP/"
72 "openldap-release/openldap-" version ".tgz")
73 (string-append
74 "ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/"
75 "openldap-release/openldap-" version ".tgz")))
76 (sha256
77 (base32
78 "02sj0p1pq12hqq29b22m3f5zs2rykgvc0q3wlynxjcsjhrvmhk7m"))))
79 (build-system gnu-build-system)
80 (inputs `(("bdb" ,bdb-5.3)
81 ("cyrus-sasl" ,cyrus-sasl)
82 ("gnutls" ,gnutls)
83 ("groff" ,groff)
84 ("icu4c" ,icu4c)
85 ("libgcrypt" ,libgcrypt)
86 ("zlib" ,zlib)))
87 (native-inputs `(("libtool" ,libtool)))
88 (arguments
89 `(#:tests? #f
90 #:configure-flags '("--disable-static")
91 #:phases
92 (modify-phases %standard-phases
93 (add-after 'install 'patch-sasl-path
94 ;; Give -L arguments for cyrus-sasl to avoid propagation.
95 (lambda* (#:key inputs outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out"))
97 (krb5 (assoc-ref inputs "mit-krb5"))) ;propagated from cyrus-sasl
98
99 ;; The ancient Libtool bundled with OpenLDAP copies the linker flags
100 ;; from Cyrus-SASL and embeds them into its own .la files. Add an
101 ;; absolute reference to Kerberos so it does not have to be propagated.
102 (substitute* (map (lambda (f) (string-append out "/" f))
103 '("lib/libldap.la" "lib/libldap_r.la"))
104 (("-lkrb5" lib)
105 (string-append "-L" krb5 "/lib " lib)))
106 #t))))))
107 (synopsis "Implementation of the Lightweight Directory Access Protocol")
108 (description
109 "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.")
110 (license openldap2.8)
111 (home-page "https://www.openldap.org/")))
112
113 (define-public nss-pam-ldapd
114 (package
115 (name "nss-pam-ldapd")
116 (version "0.9.11")
117 (source (origin
118 (method url-fetch)
119 (uri (string-append "https://arthurdejong.org/nss-pam-ldapd/"
120 "nss-pam-ldapd-" version ".tar.gz"))
121 (sha256
122 (base32
123 "1dna3r0q6sjhhlkhcp8x2zkslrd4y7701kk6fl5r940sdph1pmyh"))))
124 (build-system gnu-build-system)
125 (arguments
126 `(#:configure-flags
127 (list (string-append "--with-pam-seclib-dir="
128 (assoc-ref %outputs "out") "/lib/security/")
129 ;; nslcd cannot be convinced to look at run-time for its
130 ;; configuration file at a location that differs from the
131 ;; configured location.
132 "--with-ldap-conf-file=/etc/nslcd.conf")
133 #:phases
134 (modify-phases %standard-phases
135 ;; This is necessary because we tell nslcd with configure flags that
136 ;; it should look for its configuration file at /etc/nslcd.conf. The
137 ;; build system tries to install a default configuration to that very
138 ;; location.
139 (add-after 'unpack 'override-nslcd.conf-install-path
140 (lambda* (#:key outputs #:allow-other-keys)
141 (substitute* "Makefile.in"
142 (("\\$\\(DESTDIR\\)\\$\\(NSLCD_CONF_PATH\\)")
143 (string-append (assoc-ref outputs "out")
144 "/etc/nslcd.conf.example")))
145 #t)))))
146 (inputs
147 `(("linux-pam" ,linux-pam)
148 ("openldap" ,openldap)
149 ("mit-krb5" ,mit-krb5)
150 ("python" ,python)))
151 (home-page "https://arthurdejong.org/nss-pam-ldapd")
152 (synopsis "NSS and PAM modules for LDAP")
153 (description "nss-pam-ldapd provides a @dfn{Name Service Switch} (NSS)
154 module that allows your LDAP server to provide user account, group, host name,
155 alias, netgroup, and basically any other information that you would normally
156 get from @file{/etc} flat files or NIS. It also provides a @dfn{Pluggable
157 Authentication Module} (PAM) to do identity and authentication management with
158 an LDAP server.")
159 (license lgpl2.1+)))
160
161 (define-public python-ldap
162 (package
163 (name "python-ldap")
164 (version "3.1.0")
165 (source
166 (origin
167 (method url-fetch)
168 (uri (pypi-uri "python-ldap" version))
169 (sha256
170 (base32
171 "1i97nwfnraylyn0myxlf3vciicrf5h6fymrcff9c00k581wmx5s1"))))
172 (build-system python-build-system)
173 (arguments
174 `(#:phases
175 (modify-phases %standard-phases
176 (add-after 'unpack 'configure-openldap-locations
177 (lambda* (#:key inputs #:allow-other-keys)
178 (let ((openldap (assoc-ref inputs "openldap")))
179 (setenv "SLAPD"
180 (string-append openldap
181 "/libexec/slapd"))
182 (setenv "SCHEMA"
183 (string-append openldap
184 "/etc/openldap/schema/")))
185 #t)))))
186 (inputs
187 `(("openldap" ,openldap)
188 ("cyrus-sasl" ,cyrus-sasl)
189 ("mit-krb5" ,mit-krb5)))
190 (propagated-inputs
191 `(("python-pyasn1" ,python-pyasn1)
192 ("python-pyasn1-modules" ,python-pyasn1-modules)))
193 (home-page "https://www.python-ldap.org/")
194 (synopsis "Python modules for implementing LDAP clients")
195 (description
196 "This package provides an object-oriented API to access LDAP directory
197 servers from Python programs.")
198 (license psfl)))
199
200 (define-public 389-ds-base
201 (package
202 (name "389-ds-base")
203 (version "1.4.0.21")
204 (source (origin
205 (method url-fetch)
206 (uri (string-append "https://releases.pagure.org/389-ds-base/"
207 "389-ds-base-" version ".tar.bz2"))
208 (sha256
209 (base32
210 "1qd1ap5d5nxyiq0d19czfwc3h7iwl9lmr5sy7d7xmpr2by59aysr"))))
211 (build-system gnu-build-system)
212 (arguments
213 `(#:modules ((srfi srfi-1)
214 (guix build gnu-build-system)
215 ((guix build python-build-system)
216 #:select (python-version))
217 (guix build utils))
218 #:imported-modules ((guix build python-build-system)
219 ,@%gnu-build-system-modules)
220 #:configure-flags
221 (list (string-append "--with-db="
222 (assoc-ref %build-inputs "bdb"))
223 (string-append "--with-sasl="
224 (assoc-ref %build-inputs "cyrus-sasl"))
225 (string-append "--with-netsnmp="
226 (assoc-ref %build-inputs "net-snmp"))
227 (string-append "--with-pcre="
228 (assoc-ref %build-inputs "pcre"))
229 (string-append "--with-selinux="
230 (assoc-ref %build-inputs "libselinux"))
231 "--localstatedir=/var"
232 "--with-instconfigdir=/etc/dirsrv"
233 ;; The Perl scripts are being removed in the 1.4.0 release.
234 ;; Building them would require packaging of the outdated Mozilla
235 ;; LDAP SDK (instead of OpenLDAP) and PerLDAP.
236 "--disable-perl")
237 #:phases
238 (modify-phases %standard-phases
239 (add-after 'unpack 'fix-references
240 (lambda _
241 (substitute* "include/ldaputil/certmap.h"
242 (("nss3/cert.h") "nss/cert.h"))
243 (substitute* "src/lib389/lib389/nss_ssl.py"
244 (("'/usr/bin/certutil'")
245 (string-append "'" (which "certutil") "'"))
246 (("'/usr/bin/c_rehash'")
247 (string-append "'" (which "perl") "', '" (which "c_rehash") "'")))
248 #t))
249 (add-after 'unpack 'overwrite-default-locations
250 (lambda* (#:key outputs #:allow-other-keys)
251 (let ((out (assoc-ref outputs "out")))
252 (substitute* "src/lib389/lib389/paths.py"
253 (("/usr/share/dirsrv/inf/defaults.inf")
254 (string-append out "/share/dirsrv/inf/defaults.inf")))
255 ;; This directory can only be specified relative to sysconfdir. This
256 ;; is used to determine where to look for installed directory
257 ;; servers, so in the absence of a search path it needs to be global.
258 (substitute* "ldap/admin/src/defaults.inf.in"
259 (("^initconfig_dir =.*")
260 "initconfig_dir = /etc/dirsrv/registry\n"))
261 ;; This is used to determine where to write certificate files
262 ;; when installing new directory server instances.
263 (substitute* '("src/lib389/lib389/instance/setup.py"
264 "src/lib389/lib389/instance/remove.py")
265 (("etc_dirsrv_path = .*")
266 "etc_dirsrv_path = '/etc/dirsrv/'\n"))
267 #t)))
268 (add-after 'unpack 'fix-install-location-of-python-tools
269 (lambda* (#:key inputs outputs #:allow-other-keys)
270 (let* ((out (assoc-ref outputs "out"))
271 (pythondir (string-append
272 out "/lib/python"
273 (python-version (assoc-ref inputs "python"))
274 "/site-packages/")))
275 ;; Install directory must be on PYTHONPATH.
276 (setenv "PYTHONPATH"
277 (string-append (getenv "PYTHONPATH")
278 ":" pythondir))
279 ;; Install directory must exist.
280 (mkdir-p pythondir)
281 (substitute* "src/lib389/setup.py"
282 (("/usr") out))
283 (substitute* "Makefile.am"
284 (("setup.py install --skip-build" m)
285 (string-append m " --prefix=" out
286 " --root=/ --single-version-externally-managed"))))
287 #t))
288 (add-after 'build 'build-python-tools
289 (lambda* (#:key make-flags #:allow-other-keys)
290 ;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc
291 ;; files.
292 (setenv "DETERMINISTIC_BUILD" "1")
293 ;; Use deterministic hashes for strings, bytes, and datetime
294 ;; objects.
295 (setenv "PYTHONHASHSEED" "0")
296 (apply invoke "make" "lib389" make-flags)
297 #t))
298 (add-after 'install 'install-python-tools
299 (lambda* (#:key make-flags #:allow-other-keys)
300 (apply invoke "make" "lib389-install" make-flags)
301 #t))
302 (add-after 'install-python-tools 'wrap-python-tools
303 (lambda* (#:key outputs #:allow-other-keys)
304 (let* ((out (assoc-ref outputs "out"))
305 (path (getenv "PYTHONPATH")))
306 (for-each (lambda (file)
307 (wrap-program (string-append out file)
308 `("PYTHONPATH" ":" prefix (,path))))
309 '("/sbin/dsconf"
310 "/sbin/dscreate"
311 "/sbin/dsctl"
312 "/sbin/dsidm"
313 "/bin/ds-logpipe.py"
314 "/bin/ds-replcheck"
315 "/bin/readnsstate")))
316 #t)))))
317 (inputs
318 `(("bdb" ,bdb)
319 ("cracklib" ,cracklib)
320 ("cyrus-sasl" ,cyrus-sasl)
321 ("gnutls" ,gnutls)
322 ("httpd" ,httpd)
323 ("icu4c" ,icu4c)
324 ("libevent" ,libevent)
325 ("libselinux" ,libselinux)
326 ("linux-pam" ,linux-pam)
327 ("mit-krb5" ,mit-krb5)
328 ("net-snmp" ,net-snmp)
329 ("nspr" ,nspr)
330 ("nss" ,nss)
331 ("nss:bin" ,nss "bin") ; for certutil
332 ("openldap" ,openldap)
333 ("openssl" ,openssl) ; #included by net-snmp
334 ("pcre" ,pcre)
335 ("perl" ,perl)
336 ("python" ,python)
337 ("python-pyasn1" ,python-pyasn1)
338 ("python-pyasn1-modules" ,python-pyasn1-modules)
339 ("python-pytest" ,python-pytest)
340 ("python-dateutil" ,python-dateutil)
341 ("python-six" ,python-six)
342 ("python-argcomplete" ,python-argcomplete)
343 ("python-argparse-manpage" ,python-argparse-manpage)
344 ("python-ldap" ,python-ldap)))
345 (native-inputs
346 `(("autoconf" ,autoconf)
347 ("automake" ,automake)
348 ("doxygen" ,doxygen)
349 ("gettext" ,gettext-minimal)
350 ("libtool" ,libtool)
351 ("rsync" ,rsync)
352 ("pkg-config" ,pkg-config)))
353 (home-page "https://directory.fedoraproject.org")
354 (synopsis "Enterprise-class LDAP server")
355 (description "389ds is an enterprise-class LDAP server. It is hardened by
356 real-world use, is full-featured, and supports multi-master replication.
357
358 Other features include:
359
360 @enumerate
361 @item Online, zero downtime, LDAP-based update of schema, configuration, and
362 management including @dfn{Access Control Information} (ACIs);
363 @item Asynchronous Multi-Master Replication, to provide fault tolerance and
364 high write performance;
365 @item Extensive documentation;
366 @item Secure authentication and transport (TLS, and SASL);
367 @item LDAPv3 compliant server.
368 @end enumerate\n")
369 ;; GPLv3+ with OpenSSL linking exception.
370 (license gpl3+)))
371
372 (define-public python-bonsai
373 (package
374 (name "python-bonsai")
375 (version "1.2.0")
376 (source
377 (origin
378 (method url-fetch)
379 (uri (pypi-uri "bonsai" version))
380 (sha256
381 (base32
382 "013bl6h1m3f7vg1lk89d4vi28wbf31zdcs4f9g8css7ngx63v6px"))))
383 (build-system python-build-system)
384 (inputs
385 `(("mit-krb5" ,mit-krb5)
386 ("cyrus-sasl" ,cyrus-sasl)
387 ("openldap" ,openldap)))
388 ;; disabling tests, since they require docker and extensive setup
389 (arguments `(#:tests? #f))
390 (home-page "https://github.com/noirello/bonsai")
391 (synopsis "Access LDAP directory servers from Python")
392 (description
393 "This is a module for handling LDAP operations in Python. LDAP entries
394 are mapped to a special Python case-insensitive dictionary, tracking the
395 changes of the dictionary to modify the entry on the server easily.")
396 (license expat)))
397