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