Commit | Line | Data |
---|---|---|
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") | |
590594a1 | 60 | (version "2.4.46") |
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 | |
590594a1 | 77 | "0bab1km8f2nan1x0zgwliknbxg0zlf2pafxrr867kblrdfwdr44s")))) |
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") | |
ca1dc4c7 | 115 | (version "0.9.10") |
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 | |
ca1dc4c7 | 122 | "1cqamcr6qpgwxijlr6kg7jspjamjra8w0haan0qssn0yxn95d7c0")))) |
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) |
f8fe0e9d RW |
149 | ("python" ,python-2))) |
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+))) | |
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 | |
196 | servers 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) | |
214 | (guix build utils)) | |
215 | #:configure-flags | |
216 | (list (string-append "--with-db=" | |
217 | (assoc-ref %build-inputs "bdb")) | |
218 | (string-append "--with-sasl=" | |
219 | (assoc-ref %build-inputs "cyrus-sasl")) | |
220 | (string-append "--with-netsnmp=" | |
221 | (assoc-ref %build-inputs "net-snmp")) | |
222 | (string-append "--with-pcre=" | |
223 | (assoc-ref %build-inputs "pcre")) | |
224 | (string-append "--with-selinux=" | |
225 | (assoc-ref %build-inputs "libselinux")) | |
7627bad6 | 226 | "--localstatedir=/var" |
af184b68 | 227 | "--with-instconfigdir=/etc/dirsrv" |
f51d8e4c RW |
228 | ;; The Perl scripts are being removed in the 1.4.0 release. |
229 | ;; Building them would require packaging of the outdated Mozilla | |
230 | ;; LDAP SDK (instead of OpenLDAP) and PerLDAP. | |
231 | "--disable-perl") | |
232 | #:phases | |
233 | (modify-phases %standard-phases | |
19a0a060 | 234 | (add-after 'unpack 'fix-references |
cbc6a28b RW |
235 | (lambda _ |
236 | (substitute* "include/ldaputil/certmap.h" | |
237 | (("nss3/cert.h") "nss/cert.h")) | |
19a0a060 RW |
238 | (substitute* "src/lib389/lib389/nss_ssl.py" |
239 | (("'/usr/bin/certutil'") | |
240 | (string-append "'" (which "certutil") "'")) | |
241 | (("'/usr/bin/c_rehash'") | |
242 | (string-append "'" (which "perl") "', '" (which "c_rehash") "'"))) | |
cbc6a28b | 243 | #t)) |
af184b68 RW |
244 | (add-after 'unpack 'overwrite-default-locations |
245 | (lambda* (#:key outputs #:allow-other-keys) | |
246 | (let ((out (assoc-ref outputs "out"))) | |
247 | (substitute* "src/lib389/lib389/paths.py" | |
248 | (("/usr/share/dirsrv/inf/defaults.inf") | |
249 | (string-append out "/share/dirsrv/inf/defaults.inf"))) | |
250 | ;; This directory can only be specified relative to sysconfdir. This | |
251 | ;; is used to determine where to look for installed directory | |
252 | ;; servers, so in the absence of a search path it needs to be global. | |
253 | (substitute* "ldap/admin/src/defaults.inf.in" | |
254 | (("^initconfig_dir =.*") | |
255 | "initconfig_dir = /etc/dirsrv/registry\n")) | |
256 | ;; This is used to determine where to write certificate files | |
257 | ;; when installing new directory server instances. | |
258 | (substitute* '("src/lib389/lib389/instance/setup.py" | |
259 | "src/lib389/lib389/instance/remove.py") | |
260 | (("etc_dirsrv_path = .*") | |
261 | "etc_dirsrv_path = '/etc/dirsrv/'\n")) | |
262 | #t))) | |
f51d8e4c RW |
263 | (add-after 'unpack 'fix-install-location-of-python-tools |
264 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
265 | (let* ((out (assoc-ref outputs "out")) | |
266 | (get-python-version | |
267 | ;; FIXME: copied from python-build-system | |
268 | (lambda (python) | |
269 | (let* ((version (last (string-split python #\-))) | |
270 | (components (string-split version #\.)) | |
271 | (major+minor (take components 2))) | |
272 | (string-join major+minor ".")))) | |
273 | (pythondir (string-append | |
274 | out "/lib/python" | |
275 | (get-python-version (assoc-ref inputs "python")) | |
276 | "/site-packages/"))) | |
277 | ;; Install directory must be on PYTHONPATH. | |
278 | (setenv "PYTHONPATH" | |
279 | (string-append (getenv "PYTHONPATH") | |
280 | ":" pythondir)) | |
281 | ;; Install directory must exist. | |
282 | (mkdir-p pythondir) | |
283 | (substitute* "src/lib389/setup.py" | |
284 | (("/usr") out)) | |
285 | (substitute* "Makefile.am" | |
286 | (("setup.py install --skip-build" m) | |
287 | (string-append m " --prefix=" out | |
288 | " --root=/ --single-version-externally-managed")))) | |
289 | #t)) | |
290 | (add-after 'build 'build-python-tools | |
291 | (lambda* (#:key make-flags #:allow-other-keys) | |
292 | ;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc | |
293 | ;; files. | |
294 | (setenv "DETERMINISTIC_BUILD" "1") | |
295 | ;; Use deterministic hashes for strings, bytes, and datetime | |
296 | ;; objects. | |
297 | (setenv "PYTHONHASHSEED" "0") | |
298 | (apply invoke "make" "lib389" make-flags) | |
299 | #t)) | |
300 | (add-after 'install 'install-python-tools | |
301 | (lambda* (#:key make-flags #:allow-other-keys) | |
302 | (apply invoke "make" "lib389-install" make-flags) | |
303 | #t)) | |
304 | (add-after 'install-python-tools 'wrap-python-tools | |
305 | (lambda* (#:key outputs #:allow-other-keys) | |
306 | (let* ((out (assoc-ref outputs "out")) | |
307 | (path (getenv "PYTHONPATH"))) | |
308 | (for-each (lambda (file) | |
309 | (wrap-program (string-append out file) | |
310 | `("PYTHONPATH" ":" prefix (,path)))) | |
311 | '("/sbin/dsconf" | |
312 | "/sbin/dscreate" | |
313 | "/sbin/dsctl" | |
314 | "/sbin/dsidm" | |
315 | "/bin/ds-logpipe.py" | |
316 | "/bin/ds-replcheck" | |
317 | "/bin/readnsstate"))) | |
318 | #t))))) | |
319 | (inputs | |
320 | `(("bdb" ,bdb) | |
cbc6a28b | 321 | ("cracklib" ,cracklib) |
f51d8e4c RW |
322 | ("cyrus-sasl" ,cyrus-sasl) |
323 | ("gnutls" ,gnutls) | |
324 | ("httpd" ,httpd) | |
325 | ("icu4c" ,icu4c) | |
326 | ("libevent" ,libevent) | |
327 | ("libselinux" ,libselinux) | |
328 | ("linux-pam" ,linux-pam) | |
329 | ("mit-krb5" ,mit-krb5) | |
330 | ("net-snmp" ,net-snmp) | |
331 | ("nspr" ,nspr) | |
332 | ("nss" ,nss) | |
19a0a060 | 333 | ("nss:bin" ,nss "bin") ; for certutil |
f51d8e4c | 334 | ("openldap" ,openldap) |
6d7ca74b | 335 | ("openssl" ,openssl) ; #included by net-snmp |
f51d8e4c RW |
336 | ("pcre" ,pcre) |
337 | ("perl" ,perl) | |
338 | ("python" ,python) | |
339 | ("python-pyasn1" ,python-pyasn1) | |
340 | ("python-pyasn1-modules" ,python-pyasn1-modules) | |
341 | ("python-pytest" ,python-pytest) | |
342 | ("python-dateutil" ,python-dateutil) | |
343 | ("python-six" ,python-six) | |
344 | ("python-argcomplete" ,python-argcomplete) | |
345 | ("python-argparse-manpage" ,python-argparse-manpage) | |
346 | ("python-ldap" ,python-ldap))) | |
347 | (native-inputs | |
348 | `(("autoconf" ,autoconf) | |
349 | ("automake" ,automake) | |
350 | ("doxygen" ,doxygen) | |
351 | ("gettext" ,gettext-minimal) | |
352 | ("libtool" ,libtool) | |
353 | ("rsync" ,rsync) | |
354 | ("pkg-config" ,pkg-config))) | |
355 | (home-page "https://directory.fedoraproject.org") | |
356 | (synopsis "Enterprise-class LDAP server") | |
357 | (description "389ds is an enterprise-class LDAP server. It is hardened by | |
358 | real-world use, is full-featured, and supports multi-master replication. | |
359 | ||
360 | Other features include: | |
361 | ||
362 | @enumerate | |
363 | @item Online, zero downtime, LDAP-based update of schema, configuration, and | |
364 | management including @dfn{Access Control Information} (ACIs); | |
365 | @item Asynchronous Multi-Master Replication, to provide fault tolerance and | |
366 | high write performance; | |
367 | @item Extensive documentation; | |
368 | @item Secure authentication and transport (TLS, and SASL); | |
369 | @item LDAPv3 compliant server. | |
370 | @end enumerate\n") | |
371 | ;; GPLv3+ with OpenSSL linking exception. | |
372 | (license gpl3+))) |