1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
7 ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
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 ssh)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages base)
28 #:autoload (gnu packages boost) (boost)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages elf)
31 #:use-module (gnu packages gnupg)
32 #:use-module (gnu packages gperf)
33 #:use-module (gnu packages groff)
34 #:use-module (gnu packages guile)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages m4)
37 #:use-module (gnu packages multiprecision)
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages nettle)
40 #:use-module (gnu packages perl)
41 #:use-module (gnu packages pkg-config)
42 #:autoload (gnu packages protobuf) (protobuf)
43 #:use-module (gnu packages readline)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages xorg)
47 #:use-module (guix build-system cmake)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix download)
50 #:use-module (guix git-download)
51 #:use-module ((guix licenses) #:prefix license:)
52 #:use-module (guix packages))
61 "https://red.libssh.org/attachments/download/195/libssh-"
65 "165g49i4kmm3bfsjm0n8hm21kadv79g9yjqyq09138jxanz4dvr6"))))
66 (build-system cmake-build-system)
68 '(#:configure-flags '("-DWITH_GCRYPT=ON")
70 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
72 (inputs `(("zlib" ,zlib)
73 ("libgcrypt" ,libgcrypt)))
74 (synopsis "SSH client library")
76 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for
77 client and server implementations. With libssh, you can remotely execute
78 programs, transfer files, and use a secure and transparent tunnel for your
79 remote applications.")
80 (home-page "http://www.libssh.org")
81 (license license:lgpl2.1+)))
83 (define libssh-0.6 ; kept private for use in guile-ssh
84 (package (inherit libssh)
88 (uri (string-append "https://red.libssh.org/attachments/"
89 "download/121/libssh-"
93 "0b6wyx6bwbb8jpn8x4rhlrdiqwqrwrs0mxjmrnqykm9kw1ijgm8g"))
94 (patches (search-patches
95 "libssh-0.6.5-CVE-2016-0739.patch"))))))
97 (define-public libssh2
104 "https://www.libssh2.org/download/libssh2-"
108 "116mh112w48vv9k3f15ggp5kxw5sj4b88dzb5j69llsh7ba1ymp4"))))
109 (build-system gnu-build-system)
110 ;; The installed libssh2.pc file does not include paths to libgcrypt and
111 ;; zlib libraries, so we need to propagate the inputs.
112 (propagated-inputs `(("libgcrypt" ,libgcrypt)
114 (arguments '(#:configure-flags `("--with-libgcrypt")))
115 (synopsis "Client-side C library implementing the SSH2 protocol")
117 "libssh2 is a library intended to allow software developers access to
118 the SSH-2 protocol in an easy-to-use self-contained package. It can be built
119 into an application to perform many different tasks when communicating with
120 a server that supports the SSH-2 protocol.")
121 (license license:bsd-3)
122 (home-page "http://www.libssh2.org/")))
124 (define-public openssh
130 (uri (let ((tail (string-append name "-" version ".tar.gz")))
131 (list (string-append "http://openbsd.cs.fau.de/pub/OpenBSD/OpenSSH/portable/"
133 (string-append "http://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
135 (string-append "http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
138 "1k5y1wi29d47cgizbryxrhc1fbjsba2x8l5mqfa9b9nadnd9iyrz"))))
139 (build-system gnu-build-system)
140 (inputs `(("groff" ,groff)
144 ("xauth" ,xauth))) ;for 'ssh -X' and 'ssh -Y'
146 `(#:test-target "tests"
147 #:configure-flags '("--sysconfdir=/etc"
149 ;; Default value of 'PATH' used by sshd.
150 "--with-default-path=/run/current-system/profile/bin"
152 ;; Enable PAM support in sshd.
156 (modify-phases %standard-phases
157 (add-after 'configure 'reset-/var/empty
158 (lambda* (#:key outputs #:allow-other-keys)
159 (let ((out (assoc-ref outputs "out")))
160 (substitute* "Makefile"
161 (("PRIVSEP_PATH=/var/empty")
162 (string-append "PRIVSEP_PATH=" out "/var/empty")))
164 (add-before 'check 'patch-tests
166 ;; remove 't-exec' regress target which requires user 'sshd'
167 (substitute* "regress/Makefile"
168 (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post)
169 (string-append pre post)))
172 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
173 ;; install without host keys and system configuration files
174 (and (zero? (apply system* "make" "install-nosysconf" make-flags))
176 (install-file "contrib/ssh-copy-id"
177 (string-append (assoc-ref outputs "out")
179 (chmod (string-append (assoc-ref outputs "out")
180 "/bin/ssh-copy-id") #o555)
181 (install-file "contrib/ssh-copy-id.1"
182 (string-append (assoc-ref outputs "out")
185 (synopsis "Client and server for the secure shell (ssh) protocol")
187 "The SSH2 protocol implemented in OpenSSH is standardised by the
188 IETF secsh working group and is specified in several RFCs and drafts.
189 It is composed of three layered components:
191 The transport layer provides algorithm negotiation and a key exchange.
192 The key exchange includes server authentication and results in a
193 cryptographically secured connection: it provides integrity, confidentiality
194 and optional compression.
196 The user authentication layer uses the established connection and relies on
197 the services provided by the transport layer. It provides several mechanisms
198 for user authentication. These include traditional password authentication
199 as well as public-key or host-based authentication mechanisms.
201 The connection layer multiplexes many different concurrent channels over the
202 authenticated connection and allows tunneling of login sessions and
203 TCP-forwarding. It provides a flow control service for these channels.
204 Additionally, various channel-specific options can be negotiated.")
205 (license (license:non-copyleft "file://LICENSE"
206 "See LICENSE in the distribution."))
207 (home-page "http://www.openssh.org/")))
209 (define-public guile-ssh
214 ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz
215 ;; exists, but the server appears to be too slow and unreliable.
218 (url "https://github.com/artyom-poptsov/libguile-ssh.git")
219 (commit (string-append "v" version))))
220 (file-name (string-append name "-" version "-checkout"))
223 "04zs1cykwdyj51ag62ymrkgsja9dbhbaaglkvbfbac0bkxl2ir6d"))))
224 (build-system gnu-build-system)
226 '(#:phases (alist-cons-after
228 (lambda* (#:key inputs #:allow-other-keys)
229 (chmod "doc/version.texi" #o777) ;make it writable
230 (zero? (system* "autoreconf" "-vfi")))
232 'install 'fix-libguile-ssh-file-name
233 (lambda* (#:key outputs #:allow-other-keys)
234 (let* ((out (assoc-ref outputs "out"))
235 (libdir (string-append out "/lib"))
236 (guiledir (string-append out
237 "/share/guile/site/2.0")))
238 (substitute* (find-files guiledir ".scm")
239 (("\"libguile-ssh\"")
240 (string-append "\"" libdir "/libguile-ssh\"")))
242 ;; Make sure it works.
243 (setenv "GUILE_LOAD_PATH" guiledir)
244 (setenv "GUILE_LOAD_COMPILED_PATH" guiledir)
246 (system* "guile" "-c" "(use-modules (ssh session))"))))
248 #:configure-flags (list (string-append "--with-guilesitedir="
249 (assoc-ref %outputs "out")
250 "/share/guile/site/2.0"))
252 ;; Tests are not parallel-safe.
253 #:parallel-tests? #f))
254 (native-inputs `(("autoconf" ,autoconf)
255 ("automake" ,automake)
258 ("pkg-config" ,pkg-config)
260 (inputs `(("guile" ,guile-2.0)
261 ("libssh" ,libssh-0.6)
262 ("libgcrypt" ,libgcrypt)))
263 (synopsis "Guile bindings to libssh")
265 "Guile-SSH is a library that provides access to the SSH protocol for
266 programs written in GNU Guile interpreter. It is a wrapper to the underlying
268 (home-page "https://github.com/artyom-poptsov/libguile-ssh")
269 (license license:gpl3+)))
271 (define-public corkscrew
278 (uri (string-append "http://www.agroman.net/corkscrew/corkscrew-"
281 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
282 (build-system gnu-build-system)
284 ;; Replace configure phase as the ./configure script does not link
285 ;; CONFIG_SHELL and SHELL passed as parameters
287 (modify-phases %standard-phases
289 (lambda* (#:key outputs inputs system build target
290 #:allow-other-keys #:rest args)
291 (let* ((configure (assoc-ref %standard-phases 'configure))
292 (prefix (assoc-ref outputs "out"))
293 (bash (which "bash"))
294 ;; Set --build and --host flags as the provided config.guess
295 ;; is not able to detect them
296 (flags `(,(string-append "--prefix=" prefix)
297 ,(string-append "--build=" build)
298 ,(string-append "--host=" (or target build)))))
299 (setenv "CONFIG_SHELL" bash)
300 (zero? (apply system* bash
301 (string-append "." "/configure")
303 (home-page "http://www.agroman.net/corkscrew")
304 (synopsis "Tunneling SSH through HTTP proxies")
306 "Corkscrew allows creating TCP tunnels through HTTP proxies. WARNING:
307 At the moment only plain text authentication is supported, should you require
308 to use it with your HTTP proxy. Digest based authentication may be supported
309 in future and NTLM based authentication is most likey never be supported.")
310 (license license:gpl2+)))
318 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
321 "118fhpm754wpklf1blnlq5xbvrxqml6rdfs3b07wg666zkxvg0ky"))))
322 (build-system gnu-build-system)
325 (modify-phases %standard-phases
326 (add-after 'install 'wrap
327 (lambda* (#:key outputs #:allow-other-keys)
328 ;; Make sure 'mosh' can find 'mosh-client' and
330 (let* ((out (assoc-ref outputs "out"))
331 (bin (string-append out "/bin")))
332 (wrap-program (string-append bin "/mosh")
333 `("PATH" ":" prefix (,bin)))))))))
335 `(("pkg-config" ,pkg-config)))
337 `(("openssl" ,openssl)
339 ("perl-io-tty" ,perl-io-tty)
342 ("protobuf" ,protobuf)
343 ("boost-headers" ,boost)))
344 (home-page "https://mosh.org/")
345 (synopsis "Remote shell tolerant to intermittent connectivity")
347 "Remote terminal application that allows roaming, supports intermittent
348 connectivity, and provides intelligent local echo and line editing of user
349 keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
350 especially over Wi-Fi, cellular, and long-distance links.")
351 (license license:gpl3+)))
353 (define-public dropbear
360 "https://matt.ucc.asn.au/" name "/releases/"
361 name "-" version ".tar.bz2"))
364 "14c8f4gzixf0j9fkx68jgl85q7b05852kk0vf09gi6h0xmafl817"))))
365 (build-system gnu-build-system)
366 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
367 (inputs `(("zlib" ,zlib)))
368 (synopsis "Small SSH server and client")
369 (description "Dropbear is a relatively small SSH server and
370 client. It runs on a variety of POSIX-based platforms. Dropbear is
371 particularly useful for embedded systems, such as wireless routers.")
372 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
373 (license (license:x11-style "" "See file LICENSE."))))
375 (define-public liboop
382 (uri (string-append "http://download.ofb.net/liboop/liboop-"
386 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
387 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
388 (build-system gnu-build-system)
389 (home-page "http://www.lysator.liu.se/liboop/")
390 (synopsis "Event loop library")
391 (description "Liboop is a low-level event loop management library for
392 POSIX-based operating systems. It supports the development of modular,
393 multiplexed applications which may respond to events from several sources. It
394 replaces the \"select() loop\" and allows the registration of event handlers
395 for file and network I/O, timers and signals. Since processes use these
396 mechanisms for almost all external communication, liboop can be used as the
397 basis for almost any application.")
398 (license license:lgpl2.1+)))
406 (uri (string-append "mirror://gnu/lsh/lsh-"
410 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
411 (modules '((guix build utils)))
414 (substitute* "src/testsuite/functions.sh"
416 ;; Avoid host name lookups since they don't work in
420 ;; Make tests more verbose.
423 (substitute* (find-files "src/testsuite" "-test$")
424 (("localhost") "127.0.0.1"))
426 (substitute* "src/testsuite/login-auth-test"
427 (("/bin/cat") "cat"))))))
428 (build-system gnu-build-system)
433 ("psmisc" ,psmisc))) ; for `killall'
435 `(("nettle" ,nettle-2)
436 ("linux-pam" ,linux-pam)
438 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
440 ("readline" ,readline-6.2)
446 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
447 ;; This adds 24 MiB (or 27%) to the closure of lsh.
450 '(;; Skip the `configure' test that checks whether /dev/ptmx &
451 ;; co. work as expected, because it relies on impurities (for
452 ;; instance, /dev/pts may be unavailable in chroots.)
453 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes")
455 ;; FIXME: Tests won't run in a chroot, presumably because
456 ;; /etc/profile is missing, and thus clients get an empty $PATH
457 ;; and nothing works.
461 (modify-phases %standard-phases
462 (add-before 'configure 'pre-configure
463 (lambda* (#:key inputs #:allow-other-keys)
464 (let* ((nettle (assoc-ref inputs "nettle"))
465 (sexp-conv (string-append nettle "/bin/sexp-conv")))
466 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
468 (substitute* "src/environ.h.in"
469 (("^#define PATH_SEXP_CONV.*")
470 (string-append "#define PATH_SEXP_CONV \""
473 ;; Same for the 'lsh-authorize' script.
474 (substitute* "src/lsh-authorize"
476 (string-append "=" sexp-conv)))
478 ;; Tell lshd where 'xauth' lives. Another option would be to
479 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
480 ;; reducing the closure size, but that wouldn't work on foreign
482 (with-fluids ((%default-port-encoding "ISO-8859-1"))
483 (substitute* "src/server_x11.c"
484 (("define XAUTH_PROGRAM.*")
485 (string-append "define XAUTH_PROGRAM \""
486 (assoc-ref inputs "xauth")
487 "/bin/xauth\"\n")))))
489 ;; Tests rely on $USER being set.
490 (setenv "USER" "guix"))))))
491 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
492 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
494 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
495 used to create a secure line of communication between two computers,
496 providing shell access to the server system from the client. It provides
497 both the server daemon and the client application, as well as tools for
498 manipulating key files.")
499 (license license:gpl2+)))
501 (define-public sshpass
505 (synopsis "Non-interactive password authentication with SSH")
506 (home-page "https://sourceforge.net/projects/sshpass/")
510 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
511 version "/sshpass-" version ".tar.gz"))
514 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
515 (build-system gnu-build-system)
516 (description "sshpass is a tool for non-interactivly performing password
517 authentication with SSH's so-called @dfn{interactive keyboard password
519 (license license:gpl2+)))