gnu: mrustc: Clean up.
[jackhill/guix/guix.git] / gnu / packages / openldap.scm
CommitLineData
2a75d4e6 1;;; GNU Guix --- Functional package management for GNU
aff0cce9 2;;; Copyright © 2013, 2014, 2015, 2019 Ludovic Courtès <ludo@gnu.org>
2a75d4e6 3;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
80c13759 4;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
cbc6a28b 5;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
590594a1 6;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
2a75d4e6
AE
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)
f51d8e4c 25 #:use-module (gnu packages check)
2a75d4e6
AE
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages cyrus-sasl)
255d1bbe 28 #:use-module (gnu packages dbm)
f51d8e4c
RW
29 #:use-module (gnu packages documentation)
30 #:use-module (gnu packages gettext)
2a75d4e6
AE
31 #:use-module (gnu packages gnupg)
32 #:use-module (gnu packages groff)
33 #:use-module (gnu packages icu4c)
fadae857 34 #:use-module (gnu packages kerberos)
f51d8e4c 35 #:use-module (gnu packages libevent)
f8fe0e9d 36 #:use-module (gnu packages linux)
f51d8e4c 37 #:use-module (gnu packages networking)
aff0cce9 38 #:use-module (gnu packages nss)
cbc6a28b 39 #:use-module (gnu packages password-utils)
f51d8e4c
RW
40 #:use-module (gnu packages pcre)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
f8fe0e9d 43 #:use-module (gnu packages python)
44d10b1f 44 #:use-module (gnu packages python-xyz)
f51d8e4c
RW
45 #:use-module (gnu packages rsync)
46 #:use-module (gnu packages selinux)
47 #:use-module (gnu packages time)
cc2b77df 48 #:use-module (gnu packages tls)
f51d8e4c 49 #:use-module (gnu packages web)
b0415c03 50 #:use-module (gnu packages)
f51d8e4c 51 #:use-module ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl))
2a75d4e6
AE
52 #:use-module (guix packages)
53 #:use-module (guix download)
8c0b8cce
RW
54 #:use-module (guix build-system gnu)
55 #:use-module (guix build-system python))
2a75d4e6
AE
56
57(define-public openldap
58 (package
59 (name "openldap")
cb2c6364 60 (version "2.4.47")
2a75d4e6
AE
61 (source (origin
62 (method url-fetch)
969ee403
LC
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
47415332 70 "https://www.openldap.org/software/download/OpenLDAP/"
969ee403
LC
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
cb2c6364 77 "02sj0p1pq12hqq29b22m3f5zs2rykgvc0q3wlynxjcsjhrvmhk7m"))))
2a75d4e6 78 (build-system gnu-build-system)
a0adbb04 79 (inputs `(("bdb" ,bdb-5.3)
2a75d4e6 80 ("cyrus-sasl" ,cyrus-sasl)
217f3fdf 81 ("gnutls" ,gnutls)
2a75d4e6
AE
82 ("groff" ,groff)
83 ("icu4c" ,icu4c)
84 ("libgcrypt" ,libgcrypt)
2a75d4e6 85 ("zlib" ,zlib)))
3246cc91 86 (native-inputs `(("libtool" ,libtool)))
2a75d4e6 87 (arguments
c3f97617 88 `(#:tests? #f
b148506d 89 #:configure-flags '("--disable-static")
2a75d4e6 90 #:phases
c9dba6c1 91 (modify-phases %standard-phases
4f493cba
LF
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"))
af0162bc
MB
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.
4f493cba
LF
101 (substitute* (map (lambda (f) (string-append out "/" f))
102 '("lib/libldap.la" "lib/libldap_r.la"))
af0162bc
MB
103 (("-lkrb5" lib)
104 (string-append "-L" krb5 "/lib " lib)))
4f493cba 105 #t))))))
d4bf49b1 106 (synopsis "Implementation of the Lightweight Directory Access Protocol")
2a75d4e6
AE
107 (description
108 "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.")
109 (license openldap2.8)
47415332 110 (home-page "https://www.openldap.org/")))
b0415c03 111
f8fe0e9d
RW
112(define-public nss-pam-ldapd
113 (package
114 (name "nss-pam-ldapd")
4722330d 115 (version "0.9.11")
f8fe0e9d
RW
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
4722330d 122 "1dna3r0q6sjhhlkhcp8x2zkslrd4y7701kk6fl5r940sdph1pmyh"))))
f8fe0e9d
RW
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/")
289a8980
RW
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)))))
f8fe0e9d
RW
145 (inputs
146 `(("linux-pam" ,linux-pam)
147 ("openldap" ,openldap)
fadae857 148 ("mit-krb5" ,mit-krb5)
4722330d 149 ("python" ,python)))
f8fe0e9d
RW
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)
153module that allows your LDAP server to provide user account, group, host name,
154alias, netgroup, and basically any other information that you would normally
155get from @file{/etc} flat files or NIS. It also provides a @dfn{Pluggable
156Authentication Module} (PAM) to do identity and authentication management with
157an LDAP server.")
158 (license lgpl2.1+)))
8c0b8cce
RW
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
196servers from Python programs.")
197 (license psfl)))
f51d8e4c
RW
198
199(define-public 389-ds-base
200 (package
201 (name "389-ds-base")
cbc6a28b 202 (version "1.4.0.21")
f51d8e4c
RW
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
cbc6a28b 209 "1qd1ap5d5nxyiq0d19czfwc3h7iwl9lmr5sy7d7xmpr2by59aysr"))))
f51d8e4c
RW
210 (build-system gnu-build-system)
211 (arguments
212 `(#:modules ((srfi srfi-1)
213 (guix build gnu-build-system)
9c2563a8
LC
214 ((guix build python-build-system)
215 #:select (python-version))
f51d8e4c 216 (guix build utils))
9c2563a8
LC
217 #:imported-modules ((guix build python-build-system)
218 ,@%gnu-build-system-modules)
f51d8e4c
RW
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"))
7627bad6 230 "--localstatedir=/var"
af184b68 231 "--with-instconfigdir=/etc/dirsrv"
f51d8e4c
RW
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
19a0a060 238 (add-after 'unpack 'fix-references
cbc6a28b
RW
239 (lambda _
240 (substitute* "include/ldaputil/certmap.h"
241 (("nss3/cert.h") "nss/cert.h"))
19a0a060
RW
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") "'")))
cbc6a28b 247 #t))
af184b68
RW
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)))
f51d8e4c
RW
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"))
f51d8e4c
RW
270 (pythondir (string-append
271 out "/lib/python"
9c2563a8 272 (python-version (assoc-ref inputs "python"))
f51d8e4c
RW
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)
cbc6a28b 318 ("cracklib" ,cracklib)
f51d8e4c
RW
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)
19a0a060 330 ("nss:bin" ,nss "bin") ; for certutil
f51d8e4c 331 ("openldap" ,openldap)
6d7ca74b 332 ("openssl" ,openssl) ; #included by net-snmp
f51d8e4c
RW
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
355real-world use, is full-featured, and supports multi-master replication.
356
357Other 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+)))