openldap.scm 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015 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 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. (define-module (gnu packages openldap)
  23. #:use-module (gnu packages autotools)
  24. #:use-module (gnu packages check)
  25. #:use-module (gnu packages compression)
  26. #:use-module (gnu packages cyrus-sasl)
  27. #:use-module (gnu packages dbm)
  28. #:use-module (gnu packages documentation)
  29. #:use-module (gnu packages gettext)
  30. #:use-module (gnu packages gnupg)
  31. #:use-module (gnu packages gnuzilla)
  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 pcre)
  39. #:use-module (gnu packages perl)
  40. #:use-module (gnu packages pkg-config)
  41. #:use-module (gnu packages python)
  42. #:use-module (gnu packages python-xyz)
  43. #:use-module (gnu packages rsync)
  44. #:use-module (gnu packages selinux)
  45. #:use-module (gnu packages time)
  46. #:use-module (gnu packages tls)
  47. #:use-module (gnu packages web)
  48. #:use-module (gnu packages)
  49. #:use-module ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl))
  50. #:use-module (guix packages)
  51. #:use-module (guix download)
  52. #:use-module (guix build-system gnu)
  53. #:use-module (guix build-system python))
  54. (define-public openldap
  55. (package
  56. (name "openldap")
  57. (version "2.4.46")
  58. (source (origin
  59. (method url-fetch)
  60. ;; See <http://www.openldap.org/software/download/> for a list of
  61. ;; mirrors.
  62. (uri (list (string-append
  63. "ftp://mirror.switch.ch/mirror/OpenLDAP/"
  64. "openldap-release/openldap-" version ".tgz")
  65. (string-append
  66. "https://www.openldap.org/software/download/OpenLDAP/"
  67. "openldap-release/openldap-" version ".tgz")
  68. (string-append
  69. "ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/"
  70. "openldap-release/openldap-" version ".tgz")))
  71. (sha256
  72. (base32
  73. "0bab1km8f2nan1x0zgwliknbxg0zlf2pafxrr867kblrdfwdr44s"))))
  74. (build-system gnu-build-system)
  75. (inputs `(("bdb" ,bdb-5.3)
  76. ("cyrus-sasl" ,cyrus-sasl)
  77. ("gnutls" ,gnutls)
  78. ("groff" ,groff)
  79. ("icu4c" ,icu4c)
  80. ("libgcrypt" ,libgcrypt)
  81. ("zlib" ,zlib)))
  82. (native-inputs `(("libtool" ,libtool)))
  83. (arguments
  84. `(#:tests? #f
  85. #:configure-flags '("--disable-static")
  86. #:phases
  87. (modify-phases %standard-phases
  88. (add-after 'install 'patch-sasl-path
  89. ;; Give -L arguments for cyrus-sasl to avoid propagation.
  90. (lambda* (#:key inputs outputs #:allow-other-keys)
  91. (let ((out (assoc-ref outputs "out"))
  92. (krb5 (assoc-ref inputs "mit-krb5"))) ;propagated from cyrus-sasl
  93. ;; The ancient Libtool bundled with OpenLDAP copies the linker flags
  94. ;; from Cyrus-SASL and embeds them into its own .la files. Add an
  95. ;; absolute reference to Kerberos so it does not have to be propagated.
  96. (substitute* (map (lambda (f) (string-append out "/" f))
  97. '("lib/libldap.la" "lib/libldap_r.la"))
  98. (("-lkrb5" lib)
  99. (string-append "-L" krb5 "/lib " lib)))
  100. #t))))))
  101. (synopsis "Implementation of the Lightweight Directory Access Protocol")
  102. (description
  103. "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.")
  104. (license openldap2.8)
  105. (home-page "https://www.openldap.org/")))
  106. (define-public nss-pam-ldapd
  107. (package
  108. (name "nss-pam-ldapd")
  109. (version "0.9.10")
  110. (source (origin
  111. (method url-fetch)
  112. (uri (string-append "https://arthurdejong.org/nss-pam-ldapd/"
  113. "nss-pam-ldapd-" version ".tar.gz"))
  114. (sha256
  115. (base32
  116. "1cqamcr6qpgwxijlr6kg7jspjamjra8w0haan0qssn0yxn95d7c0"))))
  117. (build-system gnu-build-system)
  118. (arguments
  119. `(#:configure-flags
  120. (list (string-append "--with-pam-seclib-dir="
  121. (assoc-ref %outputs "out") "/lib/security/")
  122. ;; nslcd cannot be convinced to look at run-time for its
  123. ;; configuration file at a location that differs from the
  124. ;; configured location.
  125. "--with-ldap-conf-file=/etc/nslcd.conf")
  126. #:phases
  127. (modify-phases %standard-phases
  128. ;; This is necessary because we tell nslcd with configure flags that
  129. ;; it should look for its configuration file at /etc/nslcd.conf. The
  130. ;; build system tries to install a default configuration to that very
  131. ;; location.
  132. (add-after 'unpack 'override-nslcd.conf-install-path
  133. (lambda* (#:key outputs #:allow-other-keys)
  134. (substitute* "Makefile.in"
  135. (("\\$\\(DESTDIR\\)\\$\\(NSLCD_CONF_PATH\\)")
  136. (string-append (assoc-ref outputs "out")
  137. "/etc/nslcd.conf.example")))
  138. #t)))))
  139. (inputs
  140. `(("linux-pam" ,linux-pam)
  141. ("openldap" ,openldap)
  142. ("mit-krb5" ,mit-krb5)
  143. ("python" ,python-2)))
  144. (home-page "https://arthurdejong.org/nss-pam-ldapd")
  145. (synopsis "NSS and PAM modules for LDAP")
  146. (description "nss-pam-ldapd provides a @dfn{Name Service Switch} (NSS)
  147. module that allows your LDAP server to provide user account, group, host name,
  148. alias, netgroup, and basically any other information that you would normally
  149. get from @file{/etc} flat files or NIS. It also provides a @dfn{Pluggable
  150. Authentication Module} (PAM) to do identity and authentication management with
  151. an LDAP server.")
  152. (license lgpl2.1+)))
  153. (define-public python-ldap
  154. (package
  155. (name "python-ldap")
  156. (version "3.1.0")
  157. (source
  158. (origin
  159. (method url-fetch)
  160. (uri (pypi-uri "python-ldap" version))
  161. (sha256
  162. (base32
  163. "1i97nwfnraylyn0myxlf3vciicrf5h6fymrcff9c00k581wmx5s1"))))
  164. (build-system python-build-system)
  165. (arguments
  166. `(#:phases
  167. (modify-phases %standard-phases
  168. (add-after 'unpack 'configure-openldap-locations
  169. (lambda* (#:key inputs #:allow-other-keys)
  170. (let ((openldap (assoc-ref inputs "openldap")))
  171. (setenv "SLAPD"
  172. (string-append openldap
  173. "/libexec/slapd"))
  174. (setenv "SCHEMA"
  175. (string-append openldap
  176. "/etc/openldap/schema/")))
  177. #t)))))
  178. (inputs
  179. `(("openldap" ,openldap)
  180. ("cyrus-sasl" ,cyrus-sasl)
  181. ("mit-krb5" ,mit-krb5)))
  182. (propagated-inputs
  183. `(("python-pyasn1" ,python-pyasn1)
  184. ("python-pyasn1-modules" ,python-pyasn1-modules)))
  185. (home-page "https://www.python-ldap.org/")
  186. (synopsis "Python modules for implementing LDAP clients")
  187. (description
  188. "This package provides an object-oriented API to access LDAP directory
  189. servers from Python programs.")
  190. (license psfl)))
  191. (define-public 389-ds-base
  192. (package
  193. (name "389-ds-base")
  194. (version "1.4.0.13")
  195. (source (origin
  196. (method url-fetch)
  197. (uri (string-append "https://releases.pagure.org/389-ds-base/"
  198. "389-ds-base-" version ".tar.bz2"))
  199. (sha256
  200. (base32
  201. "01dm3zq3w5ami9pwcjbjz8wfbx9krjxybjrgc4wyhrxlzd90ylzj"))))
  202. (build-system gnu-build-system)
  203. (arguments
  204. `(#:modules ((srfi srfi-1)
  205. (guix build gnu-build-system)
  206. (guix build utils))
  207. #:configure-flags
  208. (list (string-append "--with-db="
  209. (assoc-ref %build-inputs "bdb"))
  210. (string-append "--with-sasl="
  211. (assoc-ref %build-inputs "cyrus-sasl"))
  212. (string-append "--with-netsnmp="
  213. (assoc-ref %build-inputs "net-snmp"))
  214. (string-append "--with-pcre="
  215. (assoc-ref %build-inputs "pcre"))
  216. (string-append "--with-selinux="
  217. (assoc-ref %build-inputs "libselinux"))
  218. ;; The Perl scripts are being removed in the 1.4.0 release.
  219. ;; Building them would require packaging of the outdated Mozilla
  220. ;; LDAP SDK (instead of OpenLDAP) and PerLDAP.
  221. "--disable-perl")
  222. #:phases
  223. (modify-phases %standard-phases
  224. (add-after 'unpack 'fix-install-location-of-python-tools
  225. (lambda* (#:key inputs outputs #:allow-other-keys)
  226. (let* ((out (assoc-ref outputs "out"))
  227. (get-python-version
  228. ;; FIXME: copied from python-build-system
  229. (lambda (python)
  230. (let* ((version (last (string-split python #\-)))
  231. (components (string-split version #\.))
  232. (major+minor (take components 2)))
  233. (string-join major+minor "."))))
  234. (pythondir (string-append
  235. out "/lib/python"
  236. (get-python-version (assoc-ref inputs "python"))
  237. "/site-packages/")))
  238. ;; Install directory must be on PYTHONPATH.
  239. (setenv "PYTHONPATH"
  240. (string-append (getenv "PYTHONPATH")
  241. ":" pythondir))
  242. ;; Install directory must exist.
  243. (mkdir-p pythondir)
  244. (substitute* "src/lib389/setup.py"
  245. (("/usr") out))
  246. (substitute* "Makefile.am"
  247. (("setup.py install --skip-build" m)
  248. (string-append m " --prefix=" out
  249. " --root=/ --single-version-externally-managed"))))
  250. #t))
  251. (add-after 'build 'build-python-tools
  252. (lambda* (#:key make-flags #:allow-other-keys)
  253. ;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc
  254. ;; files.
  255. (setenv "DETERMINISTIC_BUILD" "1")
  256. ;; Use deterministic hashes for strings, bytes, and datetime
  257. ;; objects.
  258. (setenv "PYTHONHASHSEED" "0")
  259. (apply invoke "make" "lib389" make-flags)
  260. #t))
  261. (add-after 'install 'install-python-tools
  262. (lambda* (#:key make-flags #:allow-other-keys)
  263. (apply invoke "make" "lib389-install" make-flags)
  264. #t))
  265. (add-after 'install-python-tools 'wrap-python-tools
  266. (lambda* (#:key outputs #:allow-other-keys)
  267. (let* ((out (assoc-ref outputs "out"))
  268. (path (getenv "PYTHONPATH")))
  269. (for-each (lambda (file)
  270. (wrap-program (string-append out file)
  271. `("PYTHONPATH" ":" prefix (,path))))
  272. '("/sbin/dsconf"
  273. "/sbin/dscreate"
  274. "/sbin/dsctl"
  275. "/sbin/dsidm"
  276. "/bin/ds-logpipe.py"
  277. "/bin/ds-replcheck"
  278. "/bin/readnsstate")))
  279. #t)))))
  280. (inputs
  281. `(("bdb" ,bdb)
  282. ("cyrus-sasl" ,cyrus-sasl)
  283. ("gnutls" ,gnutls)
  284. ("httpd" ,httpd)
  285. ("icu4c" ,icu4c)
  286. ("libevent" ,libevent)
  287. ("libselinux" ,libselinux)
  288. ("linux-pam" ,linux-pam)
  289. ("mit-krb5" ,mit-krb5)
  290. ("net-snmp" ,net-snmp)
  291. ("nspr" ,nspr)
  292. ("nss" ,nss)
  293. ("openldap" ,openldap)
  294. ("openssl" ,openssl) ; #included by net-snmp
  295. ("pcre" ,pcre)
  296. ("perl" ,perl)
  297. ("python" ,python)
  298. ("python-pyasn1" ,python-pyasn1)
  299. ("python-pyasn1-modules" ,python-pyasn1-modules)
  300. ("python-pytest" ,python-pytest)
  301. ("python-dateutil" ,python-dateutil)
  302. ("python-six" ,python-six)
  303. ("python-argcomplete" ,python-argcomplete)
  304. ("python-argparse-manpage" ,python-argparse-manpage)
  305. ("python-ldap" ,python-ldap)))
  306. (native-inputs
  307. `(("autoconf" ,autoconf)
  308. ("automake" ,automake)
  309. ("doxygen" ,doxygen)
  310. ("gettext" ,gettext-minimal)
  311. ("libtool" ,libtool)
  312. ("rsync" ,rsync)
  313. ("pkg-config" ,pkg-config)))
  314. (home-page "https://directory.fedoraproject.org")
  315. (synopsis "Enterprise-class LDAP server")
  316. (description "389ds is an enterprise-class LDAP server. It is hardened by
  317. real-world use, is full-featured, and supports multi-master replication.
  318. Other features include:
  319. @enumerate
  320. @item Online, zero downtime, LDAP-based update of schema, configuration, and
  321. management including @dfn{Access Control Information} (ACIs);
  322. @item Asynchronous Multi-Master Replication, to provide fault tolerance and
  323. high write performance;
  324. @item Extensive documentation;
  325. @item Secure authentication and transport (TLS, and SASL);
  326. @item LDAPv3 compliant server.
  327. @end enumerate\n")
  328. ;; GPLv3+ with OpenSSL linking exception.
  329. (license gpl3+)))