kerberos.scm 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
  5. ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
  6. ;;; Copyright © 2012, 2013 Nikita Karetnikov <nikita@karetnikov.org>
  7. ;;; Copyright © 2012, 2017 Ludovic Courtès <ludo@gnu.org>
  8. ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
  9. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  10. ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
  11. ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  12. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  13. ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  14. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  15. ;;;
  16. ;;; This file is part of GNU Guix.
  17. ;;;
  18. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  19. ;;; under the terms of the GNU General Public License as published by
  20. ;;; the Free Software Foundation; either version 3 of the License, or (at
  21. ;;; your option) any later version.
  22. ;;;
  23. ;;; GNU Guix is distributed in the hope that it will be useful, but
  24. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  25. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. ;;; GNU General Public License for more details.
  27. ;;;
  28. ;;; You should have received a copy of the GNU General Public License
  29. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  30. (define-module (gnu packages kerberos)
  31. #:use-module (gnu packages)
  32. #:use-module (gnu packages autotools)
  33. #:use-module (gnu packages bash)
  34. #:use-module (gnu packages bison)
  35. #:use-module (gnu packages dbm)
  36. #:use-module (gnu packages perl)
  37. #:use-module (gnu packages gettext)
  38. #:use-module (gnu packages gnupg)
  39. #:use-module (gnu packages libidn)
  40. #:use-module (gnu packages hurd)
  41. #:use-module (gnu packages linux)
  42. #:use-module (gnu packages pkg-config)
  43. #:use-module (gnu packages compression)
  44. #:use-module (gnu packages readline)
  45. #:use-module (gnu packages sqlite)
  46. #:use-module (gnu packages tcl)
  47. #:use-module (gnu packages texinfo)
  48. #:use-module (gnu packages tls)
  49. #:use-module ((guix licenses) #:prefix license:)
  50. #:use-module (guix packages)
  51. #:use-module (guix download)
  52. #:use-module (guix gexp)
  53. #:use-module (guix utils)
  54. #:use-module (guix build-system gnu))
  55. (define-public mit-krb5
  56. (package
  57. (name "mit-krb5")
  58. (replacement mit-krb5-1.19.2)
  59. (version "1.19.1")
  60. (source (origin
  61. (method url-fetch)
  62. (uri (list
  63. (string-append "https://web.mit.edu/kerberos/dist/krb5/"
  64. (version-major+minor version)
  65. "/krb5-" version ".tar.gz")
  66. (string-append "https://kerberos.org/dist/krb5/"
  67. (version-major+minor version)
  68. "/krb5-" version ".tar.gz")))
  69. (patches (search-patches "mit-krb5-hurd.patch"))
  70. (sha256
  71. (base32
  72. "02xjpsfy84l6v7vjlxzhrl6mx2zrmxz0v01w2j33bv73nxzgh5ps"))))
  73. (build-system gnu-build-system)
  74. (native-inputs
  75. `(("bison" ,bison)
  76. ("perl" ,perl)
  77. ("tcl" ,tcl))) ;required for some tests
  78. (inputs
  79. `(("openssl" ,openssl)))
  80. (arguments
  81. `(;; XXX: On 32-bit systems, 'kdb5_util' hangs on an fcntl/F_SETLKW call
  82. ;; while running the tests in 'src/tests'. Also disable tests when
  83. ;; cross-compiling.
  84. #:tests? ,(and (not (%current-target-system))
  85. (string=? (%current-system) "x86_64-linux"))
  86. ,@(if (%current-target-system)
  87. '(#:configure-flags
  88. (list "--localstatedir=/var"
  89. "krb5_cv_attr_constructor_destructor=yes"
  90. "ac_cv_func_regcomp=yes"
  91. "ac_cv_printf_positional=yes"
  92. "ac_cv_file__etc_environment=yes"
  93. "ac_cv_file__etc_TIMEZONE=no")
  94. #:make-flags
  95. (list "CFLAGS+=-DDESTRUCTOR_ATTR_WORKS=1"))
  96. '(#:configure-flags
  97. (list "--localstatedir=/var")))
  98. #:phases
  99. (modify-phases %standard-phases
  100. (add-after 'unpack 'enter-source-directory
  101. (lambda _
  102. (chdir "src")))
  103. (add-before 'check 'pre-check
  104. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  105. (let ((perl (assoc-ref (or native-inputs inputs) "perl")))
  106. (substitute* "plugins/kdb/db2/libdb2/test/run.test"
  107. (("/bin/cat") (string-append perl "/bin/perl"))
  108. (("D/bin/sh") (string-append "D" (which "sh")))
  109. (("bindir=/bin/.") (string-append "bindir=" perl "/bin")))))))))
  110. (synopsis "MIT Kerberos 5")
  111. (description
  112. "Massachusetts Institute of Technology implementation of Kerberos.
  113. Kerberos is a network authentication protocol designed to provide strong
  114. authentication for client/server applications by using secret-key
  115. cryptography.")
  116. (license (license:non-copyleft "file://NOTICE"
  117. "See NOTICE in the distribution."))
  118. (home-page "https://web.mit.edu/kerberos/")
  119. (properties '((cpe-name . "kerberos")))))
  120. (define mit-krb5-1.19.2
  121. (package
  122. (inherit mit-krb5)
  123. (version "1.19.2")
  124. (source (origin
  125. (inherit (package-source mit-krb5))
  126. (uri (list
  127. (string-append "https://web.mit.edu/kerberos/dist/krb5/"
  128. (version-major+minor version)
  129. "/krb5-" version ".tar.gz")
  130. (string-append "https://kerberos.org/dist/krb5/"
  131. (version-major+minor version)
  132. "/krb5-" version ".tar.gz")))
  133. (sha256
  134. (base32
  135. "0snz1jm2w4dkk65zcz953jmmv9mqa30fanch2bk8r3rs9vp3yi8h"))))))
  136. (define-public shishi
  137. (package
  138. (name "shishi")
  139. (version "1.0.2")
  140. (source
  141. (origin
  142. (method url-fetch)
  143. (uri (string-append "mirror://gnu/shishi/shishi-"
  144. version ".tar.gz"))
  145. (patches (search-patches "shishi-fix-libgcrypt-detection.patch"))
  146. (sha256
  147. (base32
  148. "032qf72cpjdfffq1yq54gz3ahgqf2ijca4vl31sfabmjzq9q370d"))))
  149. (build-system gnu-build-system)
  150. (arguments
  151. '(;; This is required since we patch some of the build scripts.
  152. ;; Remove first two items for the next Shishi release after 1.0.2 or
  153. ;; when removing 'shishi-fix-libgcrypt-detection.patch'.
  154. #:configure-flags
  155. '("ac_cv_libgcrypt=yes" "--disable-static"
  156. "--with-key-dir=/etc/shishi" "--with-db-dir=/var/shishi")
  157. #:phases
  158. (modify-phases %standard-phases
  159. (add-after 'configure 'disable-automatic-key-generation
  160. (lambda* (#:key outputs #:allow-other-keys)
  161. (substitute* "Makefile"
  162. (("^install-data-hook:")
  163. "install-data-hook:\nx:\n"))
  164. #t)))))
  165. (native-inputs `(("pkg-config" ,pkg-config)))
  166. (inputs
  167. `(("gnutls" ,gnutls)
  168. ("libidn" ,libidn)
  169. ("linux-pam" ,linux-pam-1.2)
  170. ("zlib" ,zlib)
  171. ("libgcrypt" ,libgcrypt)
  172. ("libtasn1" ,libtasn1)))
  173. (home-page "https://www.gnu.org/software/shishi/")
  174. (synopsis "Implementation of the Kerberos 5 network security system")
  175. (description
  176. "GNU Shishi is a free implementation of the Kerberos 5 network security
  177. system. It is used to allow non-secure network nodes to communicate in a
  178. secure manner through client-server mutual authentication via tickets.
  179. After installation, the system administrator should generate keys using
  180. @code{shisa -a /etc/shishi/shishi.keys}.")
  181. (license license:gpl3+)))
  182. (define-public heimdal
  183. (package
  184. (name "heimdal")
  185. (version "7.7.0")
  186. (source (origin
  187. (method url-fetch)
  188. (uri (string-append
  189. "https://github.com/heimdal/heimdal/releases/download/"
  190. "heimdal-" version "/" "heimdal-" version ".tar.gz"))
  191. (sha256
  192. (base32
  193. "06vx3cb01s4lv3lpv0qzbbj97cln1np1wjphkkmmbk1lsqa36bgh"))
  194. (modules '((guix build utils)))
  195. (snippet
  196. '(begin
  197. (substitute* "configure"
  198. (("User=.*$") "User=Guix\n")
  199. (("Host=.*$") "Host=GNU")
  200. (("Date=.*$") "Date=2019\n"))
  201. #t))))
  202. (build-system gnu-build-system)
  203. (arguments
  204. `(#:configure-flags
  205. ,#~(list
  206. ;; Avoid 7 MiB of .a files.
  207. "--disable-static"
  208. ;; Do not build libedit.
  209. (string-append
  210. "--with-readline-lib="
  211. (assoc-ref %build-inputs "readline") "/lib")
  212. (string-append
  213. "--with-readline-include="
  214. (assoc-ref %build-inputs "readline") "/include")
  215. ;; Do not build sqlite.
  216. (string-append
  217. "--with-sqlite3="
  218. (assoc-ref %build-inputs "sqlite"))
  219. #$@(if (%current-target-system)
  220. ;; The configure script is too pessimistic.
  221. ;; Setting this also resolves a linking error.
  222. #~("ac_cv_func_getpwnam_r_posix=yes"
  223. ;; Allow 'slc' and 'asn1_compile' to be found.
  224. (string-append "--with-cross-tools="
  225. #+(file-append this-package
  226. "/libexec/heimdal")))
  227. #~()))
  228. #:phases (modify-phases %standard-phases
  229. (add-before 'configure 'pre-configure
  230. ;; TODO(core-updates): Unconditionally use the
  231. ;; %current-target-system branch.
  232. (,(if (%current-target-system)
  233. 'lambda*
  234. 'lambda)
  235. ,(if (%current-target-system)
  236. '(#:key inputs #:allow-other-keys)
  237. '_)
  238. ,@(if (%current-target-system)
  239. `((substitute* "configure"
  240. ;; The e2fsprogs input is included for libcom_err,
  241. ;; let's use it even if cross-compiling.
  242. (("test \"\\$\\{krb_cv_com_err\\}\" = \"yes\"")
  243. ":")
  244. ;; Our 'compile_et' is not in --with-cross-tools,
  245. ;; which confuses heimdal.
  246. (("ac_cv_prog_COMPILE_ET=\\$\\{with_cross_tools\\}compile_et")
  247. "ac_cv_PROG_COMPILE_ET=compile_et")))
  248. '())
  249. ,@(if (%current-target-system)
  250. '((substitute* '("appl/afsutil/pagsh.c" "appl/su/su.c")
  251. (("/bin/sh")
  252. (search-input-file inputs "bin/sh"))
  253. ;; Use the cross-compiled bash instead of the
  254. ;; native bash (XXX shouldn't _PATH_BSHELL point
  255. ;; to a cross-compiled bash?).
  256. (("_PATH_BSHELL")
  257. (string-append
  258. "\"" (search-input-file inputs "bin/sh") "\"")))
  259. (substitute* '("tools/Makefile.in")
  260. (("/bin/sh") (which "sh"))))
  261. '((substitute* '("appl/afsutil/pagsh.c"
  262. "tools/Makefile.in")
  263. (("/bin/sh") (which "sh")))
  264. #t))))
  265. (add-before 'check 'pre-check
  266. (lambda _
  267. ;; For 'getxxyyy-test'.
  268. (setenv "USER" (passwd:name (getpwuid (getuid))))
  269. ;; Skip 'db' and 'kdc' tests for now.
  270. ;; FIXME: figure out why 'kdc' tests fail.
  271. (with-output-to-file "tests/db/have-db.in"
  272. (lambda ()
  273. (format #t "#!~a~%exit 1~%" (which "sh"))))
  274. #t)))
  275. ;; Tests fail when run in parallel.
  276. #:parallel-tests? #f))
  277. (native-inputs `(("e2fsprogs" ,e2fsprogs) ;for 'compile_et'
  278. ("texinfo" ,texinfo)
  279. ("unzip" ,unzip) ;for tests
  280. ,@(if (%current-target-system)
  281. `(("perl" ,perl))
  282. '())))
  283. (inputs `(("readline" ,readline)
  284. ;; TODO(core-updates): Make this input unconditional.
  285. ,@(if (%current-target-system)
  286. `(("bash-minimal" ,bash-minimal))
  287. '())
  288. ("bdb" ,bdb)
  289. ("e2fsprogs" ,e2fsprogs) ;for libcom_err
  290. ("sqlite" ,sqlite)))
  291. (home-page "http://www.h5l.org/")
  292. (synopsis "Kerberos 5 network authentication")
  293. (description
  294. "Heimdal is an implementation of Kerberos 5 network authentication
  295. service.")
  296. (license license:bsd-3)))