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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
58 (define-public openldap
65 ;; See <http://www.openldap.org/software/download/> for a list of
67 (uri (list (string-append
68 "ftp://mirror.switch.ch/mirror/OpenLDAP/"
69 "openldap-release/openldap-" version ".tgz")
71 "https://www.openldap.org/software/download/OpenLDAP/"
72 "openldap-release/openldap-" version ".tgz")
74 "ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/"
75 "openldap-release/openldap-" version ".tgz")))
78 "02sj0p1pq12hqq29b22m3f5zs2rykgvc0q3wlynxjcsjhrvmhk7m"))))
79 (build-system gnu-build-system)
80 (inputs `(("bdb" ,bdb-5.3)
81 ("cyrus-sasl" ,cyrus-sasl)
85 ("libgcrypt" ,libgcrypt)
87 (native-inputs `(("libtool" ,libtool)))
90 #:configure-flags '("--disable-static")
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
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"))
105 (string-append "-L" krb5 "/lib " lib)))
107 (synopsis "Implementation of the Lightweight Directory Access Protocol")
109 "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.")
110 (license openldap2.8)
111 (home-page "https://www.openldap.org/")))
113 (define-public nss-pam-ldapd
115 (name "nss-pam-ldapd")
119 (uri (string-append "https://arthurdejong.org/nss-pam-ldapd/"
120 "nss-pam-ldapd-" version ".tar.gz"))
123 "1dna3r0q6sjhhlkhcp8x2zkslrd4y7701kk6fl5r940sdph1pmyh"))))
124 (build-system gnu-build-system)
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")
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
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")))
147 `(("linux-pam" ,linux-pam)
148 ("openldap" ,openldap)
149 ("mit-krb5" ,mit-krb5)
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
161 (define-public python-ldap
168 (uri (pypi-uri "python-ldap" version))
171 "1i97nwfnraylyn0myxlf3vciicrf5h6fymrcff9c00k581wmx5s1"))))
172 (build-system python-build-system)
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")))
180 (string-append openldap
183 (string-append openldap
184 "/etc/openldap/schema/")))
187 `(("openldap" ,openldap)
188 ("cyrus-sasl" ,cyrus-sasl)
189 ("mit-krb5" ,mit-krb5)))
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")
196 "This package provides an object-oriented API to access LDAP directory
197 servers from Python programs.")
200 (define-public 389-ds-base
206 (uri (string-append "https://releases.pagure.org/389-ds-base/"
207 "389-ds-base-" version ".tar.bz2"))
210 "1qd1ap5d5nxyiq0d19czfwc3h7iwl9lmr5sy7d7xmpr2by59aysr"))))
211 (build-system gnu-build-system)
213 `(#:modules ((srfi srfi-1)
214 (guix build gnu-build-system)
215 ((guix build python-build-system)
216 #:select (python-version))
218 #:imported-modules ((guix build python-build-system)
219 ,@%gnu-build-system-modules)
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.
238 (modify-phases %standard-phases
239 (add-after 'unpack 'fix-references
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") "'")))
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"))
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
273 (python-version (assoc-ref inputs "python"))
275 ;; Install directory must be on PYTHONPATH.
277 (string-append (getenv "PYTHONPATH")
279 ;; Install directory must exist.
281 (substitute* "src/lib389/setup.py"
283 (substitute* "Makefile.am"
284 (("setup.py install --skip-build" m)
285 (string-append m " --prefix=" out
286 " --root=/ --single-version-externally-managed"))))
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
292 (setenv "DETERMINISTIC_BUILD" "1")
293 ;; Use deterministic hashes for strings, bytes, and datetime
295 (setenv "PYTHONHASHSEED" "0")
296 (apply invoke "make" "lib389" make-flags)
298 (add-after 'install 'install-python-tools
299 (lambda* (#:key make-flags #:allow-other-keys)
300 (apply invoke "make" "lib389-install" make-flags)
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))))
315 "/bin/readnsstate")))
319 ("cracklib" ,cracklib)
320 ("cyrus-sasl" ,cyrus-sasl)
324 ("libevent" ,libevent)
325 ("libselinux" ,libselinux)
326 ("linux-pam" ,linux-pam)
327 ("mit-krb5" ,mit-krb5)
328 ("net-snmp" ,net-snmp)
331 ("nss:bin" ,nss "bin") ; for certutil
332 ("openldap" ,openldap)
333 ("openssl" ,openssl) ; #included by net-snmp
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)))
346 `(("autoconf" ,autoconf)
347 ("automake" ,automake)
349 ("gettext" ,gettext-minimal)
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.
358 Other features include:
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.
369 ;; GPLv3+ with OpenSSL linking exception.
372 (define-public python-bonsai
374 (name "python-bonsai")
379 (uri (pypi-uri "bonsai" version))
382 "013bl6h1m3f7vg1lk89d4vi28wbf31zdcs4f9g8css7ngx63v6px"))))
383 (build-system python-build-system)
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")
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.")