1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 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>
8 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
9 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages ssh)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages base)
31 #:autoload (gnu packages boost) (boost)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages crypto)
34 #:use-module (gnu packages elf)
35 #:use-module (gnu packages gnupg)
36 #:use-module (gnu packages gperf)
37 #:use-module (gnu packages groff)
38 #:use-module (gnu packages guile)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages logging)
41 #:use-module (gnu packages m4)
42 #:use-module (gnu packages multiprecision)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages nettle)
45 #:use-module (gnu packages kerberos)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages popt)
49 #:autoload (gnu packages protobuf) (protobuf)
50 #:use-module (gnu packages readline)
51 #:use-module (gnu packages texinfo)
52 #:use-module (gnu packages tls)
53 #:use-module (gnu packages xorg)
54 #:use-module (guix build-system cmake)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix download)
57 #:use-module (guix git-download)
58 #:use-module ((guix licenses) #:prefix license:)
59 #:use-module (guix packages)
60 #:use-module (srfi srfi-1))
69 "https://red.libssh.org/attachments/download/218/libssh-"
73 "15bh6dm9c50ndddzh3gqcgw7axp3ghrspjpkb1z3dr90vkanvs2l"))
74 (patches (search-patches "libssh-hostname-parser-bug.patch"))))
75 (build-system cmake-build-system)
76 (outputs '("out" "debug"))
78 '(#:configure-flags '("-DWITH_GCRYPT=ON")
80 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
82 (inputs `(("zlib" ,zlib)
83 ("libgcrypt" ,libgcrypt)))
84 (synopsis "SSH client library")
86 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for
87 client and server implementations. With libssh, you can remotely execute
88 programs, transfer files, and use a secure and transparent tunnel for your
89 remote applications.")
90 (home-page "https://www.libssh.org")
91 (license license:lgpl2.1+)))
93 (define-public libssh2
100 "https://www.libssh2.org/download/libssh2-"
104 "1m3n8spv79qhjq4yi0wgly5s5rc8783jb1pyra9bkx1md0plxwrr"))
106 (search-patches "libssh2-fix-build-failure-with-gcrypt.patch"))))
107 (build-system gnu-build-system)
108 ;; The installed libssh2.pc file does not include paths to libgcrypt and
109 ;; zlib libraries, so we need to propagate the inputs.
110 (propagated-inputs `(("libgcrypt" ,libgcrypt)
112 (arguments '(#:configure-flags `("--with-libgcrypt")
113 #:phases (modify-phases %standard-phases
114 (add-before 'configure 'autoreconf
116 (zero? (system* "autoreconf" "-v")))))))
117 (native-inputs `(("autoconf" ,autoconf)
118 ("automake" ,automake)))
119 (synopsis "Client-side C library implementing the SSH2 protocol")
121 "libssh2 is a library intended to allow software developers access to
122 the SSH-2 protocol in an easy-to-use self-contained package. It can be built
123 into an application to perform many different tasks when communicating with
124 a server that supports the SSH-2 protocol.")
125 (license license:bsd-3)
126 (home-page "http://www.libssh2.org/")))
128 (define-public openssh
134 (uri (let ((tail (string-append name "-" version ".tar.gz")))
135 (list (string-append "http://openbsd.cs.fau.de/pub/OpenBSD/OpenSSH/portable/"
137 (string-append "http://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
139 (string-append "http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
142 "1w7rb5gbrikxdkp8w7zxnci4549gk4bw1lml01s59w5rzb2y6ilq"))))
143 (build-system gnu-build-system)
144 (native-inputs `(("groff" ,groff)))
145 (inputs `(("openssl" ,openssl)
147 ("mit-krb5" ,mit-krb5)
149 ("xauth" ,xauth))) ;for 'ssh -X' and 'ssh -Y'
151 `(#:test-target "tests"
152 #:configure-flags `("--sysconfdir=/etc/ssh"
154 ;; Default value of 'PATH' used by sshd.
155 "--with-default-path=/run/current-system/profile/bin"
157 ;; configure needs to find krb5-config
158 ,(string-append "--with-kerberos5="
159 (assoc-ref %build-inputs "mit-krb5")
162 ;; Enable PAM support in sshd.
166 (modify-phases %standard-phases
167 (add-after 'configure 'reset-/var/empty
168 (lambda* (#:key outputs #:allow-other-keys)
169 (let ((out (assoc-ref outputs "out")))
170 (substitute* "Makefile"
171 (("PRIVSEP_PATH=/var/empty")
172 (string-append "PRIVSEP_PATH=" out "/var/empty")))
174 (add-before 'check 'patch-tests
176 ;; remove 't-exec' regress target which requires user 'sshd'
177 (substitute* "regress/Makefile"
178 (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post)
179 (string-append pre post)))
182 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
183 ;; install without host keys and system configuration files
184 (and (zero? (apply system* "make" "install-nosysconf" make-flags))
186 (install-file "contrib/ssh-copy-id"
187 (string-append (assoc-ref outputs "out")
189 (chmod (string-append (assoc-ref outputs "out")
190 "/bin/ssh-copy-id") #o555)
191 (install-file "contrib/ssh-copy-id.1"
192 (string-append (assoc-ref outputs "out")
195 (synopsis "Client and server for the secure shell (ssh) protocol")
197 "The SSH2 protocol implemented in OpenSSH is standardised by the
198 IETF secsh working group and is specified in several RFCs and drafts.
199 It is composed of three layered components:
201 The transport layer provides algorithm negotiation and a key exchange.
202 The key exchange includes server authentication and results in a
203 cryptographically secured connection: it provides integrity, confidentiality
204 and optional compression.
206 The user authentication layer uses the established connection and relies on
207 the services provided by the transport layer. It provides several mechanisms
208 for user authentication. These include traditional password authentication
209 as well as public-key or host-based authentication mechanisms.
211 The connection layer multiplexes many different concurrent channels over the
212 authenticated connection and allows tunneling of login sessions and
213 TCP-forwarding. It provides a flow control service for these channels.
214 Additionally, various channel-specific options can be negotiated.")
215 (license (license:non-copyleft "file://LICENSE"
216 "See LICENSE in the distribution."))
217 (home-page "http://www.openssh.org/")))
219 (define-public guile-ssh
223 (home-page "https://github.com/artyom-poptsov/guile-ssh")
225 ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz
226 ;; exists, but the server appears to be too slow and unreliable.
227 ;; Also, using this URL allows the GitHub updater to work.
229 (uri (string-append home-page "/archive/v"
231 (file-name (string-append name "-" version ".tar.gz"))
234 "0r261i8kc3avbmbwgyzak2vnqwssjlgz37g2y2fwm80w9bmn2m7j"))
235 (patches (search-patches "guile-ssh-rexec-bug.patch"
236 "guile-ssh-double-free.patch"
237 "guile-ssh-channel-finalization.patch"))
238 (modules '((guix build utils)))
240 ;; 'configure.ac' mistakenly tries to link files from examples/
241 ;; that are not instantiated yet. Work around it.
242 '(substitute* "configure.ac"
243 (("AC_CONFIG_LINKS\\(\\[examples/([^:]+):.*" _ file)
244 (string-append "AC_CONFIG_FILES([examples/" file
245 "], [chmod +x examples/"
247 (build-system gnu-build-system)
248 (outputs '("out" "debug"))
250 '(#:phases (modify-phases %standard-phases
251 (add-after 'unpack 'autoreconf
252 (lambda* (#:key inputs #:allow-other-keys)
253 (zero? (system* "autoreconf" "-vfi"))))
254 (add-before 'build 'fix-libguile-ssh-file-name
255 (lambda* (#:key outputs #:allow-other-keys)
256 ;; Build and install libguile-ssh.so so that we can use
257 ;; its absolute file name in .scm files, before we build
259 (and (zero? (system* "make" "install"
262 (parallel-job-count))))
263 (let* ((out (assoc-ref outputs "out"))
264 (libdir (string-append out "/lib")))
265 (substitute* (find-files "." "\\.scm$")
266 (("\"libguile-ssh\"")
267 (string-append "\"" libdir "/libguile-ssh\"")))
270 ;; Tests are not parallel-safe.
271 #:parallel-tests? #f))
272 (native-inputs `(("autoconf" ,autoconf)
273 ("automake" ,automake)
276 ("pkg-config" ,pkg-config)
278 (inputs `(("guile" ,guile-2.2)
280 ("libgcrypt" ,libgcrypt)))
281 (synopsis "Guile bindings to libssh")
283 "Guile-SSH is a library that provides access to the SSH protocol for
284 programs written in GNU Guile interpreter. It is a wrapper to the underlying
286 (license license:gpl3+)))
288 (define-public guile2.2-ssh
289 (deprecated-package "guile2.2-ssh" guile-ssh))
291 (define-public guile2.0-ssh
294 (name "guile2.0-ssh")
295 (inputs `(("guile" ,guile-2.0)
296 ,@(alist-delete "guile" (package-inputs guile-ssh))))))
298 (define-public corkscrew
305 ;; The agroman.net domain name expired on 2017-03-23, and the original
306 ;; "http://www.agroman.net/corkscrew/corkscrew-2.0.tar.gz" now returns
307 ;; bogus HTML. Perhaps it will yet return. Until then, use a mirror.
308 (uri (string-append "https://downloads.openwrt.org/sources/"
309 "corkscrew-" version ".tar.gz"))
311 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
312 (build-system gnu-build-system)
314 ;; Replace configure phase as the ./configure script does not link
315 ;; CONFIG_SHELL and SHELL passed as parameters
317 (modify-phases %standard-phases
319 (lambda* (#:key outputs inputs system build target
320 #:allow-other-keys #:rest args)
321 (let* ((configure (assoc-ref %standard-phases 'configure))
322 (prefix (assoc-ref outputs "out"))
323 (bash (which "bash"))
324 ;; Set --build and --host flags as the provided config.guess
325 ;; is not able to detect them
326 (flags `(,(string-append "--prefix=" prefix)
327 ,(string-append "--build=" build)
328 ,(string-append "--host=" (or target build)))))
329 (setenv "CONFIG_SHELL" bash)
330 (zero? (apply system* bash
331 (string-append "." "/configure")
333 (add-after 'install 'install-documentation
334 (lambda* (#:key outputs #:allow-other-keys)
335 (let* ((out (assoc-ref outputs "out"))
336 (doc (string-append out "/share/doc/corkscrew")))
337 (install-file "README" doc)
339 (home-page "http://www.agroman.net/corkscrew")
340 (synopsis "SSH tunneling through HTTP(S) proxies")
342 "Corkscrew tunnels SSH connections through most HTTP and HTTPS proxies.
343 Proxy authentication is only supported through the plain-text HTTP basic
344 authentication scheme.")
345 (license license:gpl2+)))
353 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
356 "0xikz40q873g9ihvz3x6bwkcb9hb8kcnp5wpcmb72pg5c7s143ij"))))
357 (build-system gnu-build-system)
360 (modify-phases %standard-phases
361 (add-after 'install 'wrap
362 (lambda* (#:key outputs #:allow-other-keys)
363 ;; Make sure 'mosh' can find 'mosh-client' and
365 (let* ((out (assoc-ref outputs "out"))
366 (bin (string-append out "/bin")))
367 (wrap-program (string-append bin "/mosh")
368 `("PATH" ":" prefix (,bin)))))))))
370 `(("pkg-config" ,pkg-config)))
372 `(("openssl" ,openssl)
374 ("perl-io-tty" ,perl-io-tty)
377 ("protobuf" ,protobuf)
378 ("boost-headers" ,boost)))
379 (home-page "https://mosh.org/")
380 (synopsis "Remote shell tolerant to intermittent connectivity")
382 "Remote terminal application that allows roaming, supports intermittent
383 connectivity, and provides intelligent local echo and line editing of user
384 keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
385 especially over Wi-Fi, cellular, and long-distance links.")
386 (license license:gpl3+)))
396 "https://github.com/MisterTea/EternalTCP/archive/et-v"
399 (base32 "1n2w2kqbshdmbb0gz4yizyw9gqfls6qm2dnwx1d9c2hz7hmi7521"))))
400 (build-system cmake-build-system)
401 (arguments `(#:tests? #f))
403 `(("pkg-config" ,pkg-config)))
404 (inputs `(("glog" ,glog)
406 ("libsodium" ,libsodium)
407 ("protobuf" ,protobuf)))
408 (synopsis "Remote shell that automatically reconnects")
410 "Eternal Terminal (ET) is a remote shell that automatically reconnects
411 without interrupting the session. Unlike SSH sessions, ET sessions will
412 survive even after the network outages or IP changes. ET uses a custom
413 protocol over TCP, not the SSH protocol.")
414 (home-page "https://mistertea.github.io/EternalTCP/")
415 (license license:asl2.0)))
417 (define-public dropbear
424 "https://matt.ucc.asn.au/" name "/releases/"
425 name "-" version ".tar.bz2"))
428 "1309cm2aw62n9m3h38prvgsqr8bj85hfasgnvwkd42cp3k5ivg3c"))))
429 (build-system gnu-build-system)
430 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
431 (inputs `(("zlib" ,zlib)))
432 (synopsis "Small SSH server and client")
433 (description "Dropbear is a relatively small SSH server and
434 client. It runs on a variety of POSIX-based platforms. Dropbear is
435 particularly useful for embedded systems, such as wireless routers.")
436 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
437 (license (license:x11-style "" "See file LICENSE."))))
439 (define-public liboop
446 (uri (string-append "http://download.ofb.net/liboop/liboop-"
450 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
451 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
452 (build-system gnu-build-system)
453 (home-page "http://www.lysator.liu.se/liboop/")
454 (synopsis "Event loop library")
455 (description "Liboop is a low-level event loop management library for
456 POSIX-based operating systems. It supports the development of modular,
457 multiplexed applications which may respond to events from several sources. It
458 replaces the \"select() loop\" and allows the registration of event handlers
459 for file and network I/O, timers and signals. Since processes use these
460 mechanisms for almost all external communication, liboop can be used as the
461 basis for almost any application.")
462 (license license:lgpl2.1+)))
470 (uri (string-append "mirror://gnu/lsh/lsh-"
474 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
475 (modules '((guix build utils)))
478 (substitute* "src/testsuite/functions.sh"
480 ;; Avoid host name lookups since they don't work in
484 ;; Make tests more verbose.
487 (substitute* (find-files "src/testsuite" "-test$")
488 (("localhost") "127.0.0.1"))
490 (substitute* "src/testsuite/login-auth-test"
491 (("/bin/cat") "cat"))))))
492 (build-system gnu-build-system)
497 ("psmisc" ,psmisc))) ; for `killall'
499 `(("nettle" ,nettle-2)
500 ("linux-pam" ,linux-pam)
502 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
504 ("readline" ,readline-6.2)
510 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
511 ;; This adds 24 MiB (or 27%) to the closure of lsh.
514 '(;; Skip the `configure' test that checks whether /dev/ptmx &
515 ;; co. work as expected, because it relies on impurities (for
516 ;; instance, /dev/pts may be unavailable in chroots.)
517 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes"
519 ;; Use glibc's argp rather than the bundled one.
522 ;; 'lsh_argp.h' checks HAVE_ARGP_PARSE but nothing
524 "CPPFLAGS=-DHAVE_ARGP_PARSE")
526 ;; FIXME: Tests won't run in a chroot, presumably because
527 ;; /etc/profile is missing, and thus clients get an empty $PATH
528 ;; and nothing works.
532 (modify-phases %standard-phases
533 (add-before 'configure 'pre-configure
534 (lambda* (#:key inputs #:allow-other-keys)
535 (let* ((nettle (assoc-ref inputs "nettle"))
536 (sexp-conv (string-append nettle "/bin/sexp-conv")))
537 ;; Remove argp from the list of sub-directories; we don't want
538 ;; to build it, really.
539 (substitute* "src/Makefile.in"
543 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
545 (substitute* "src/environ.h.in"
546 (("^#define PATH_SEXP_CONV.*")
547 (string-append "#define PATH_SEXP_CONV \""
550 ;; Same for the 'lsh-authorize' script.
551 (substitute* "src/lsh-authorize"
553 (string-append "=" sexp-conv)))
555 ;; Tell lshd where 'xauth' lives. Another option would be to
556 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
557 ;; reducing the closure size, but that wouldn't work on foreign
559 (with-fluids ((%default-port-encoding "ISO-8859-1"))
560 (substitute* "src/server_x11.c"
561 (("define XAUTH_PROGRAM.*")
562 (string-append "define XAUTH_PROGRAM \""
563 (assoc-ref inputs "xauth")
564 "/bin/xauth\"\n")))))
566 ;; Tests rely on $USER being set.
567 (setenv "USER" "guix"))))))
568 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
569 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
571 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
572 used to create a secure line of communication between two computers,
573 providing shell access to the server system from the client. It provides
574 both the server daemon and the client application, as well as tools for
575 manipulating key files.")
576 (license license:gpl2+)))
578 (define-public sshpass
582 (synopsis "Non-interactive password authentication with SSH")
583 (home-page "https://sourceforge.net/projects/sshpass/")
587 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
588 version "/sshpass-" version ".tar.gz"))
591 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
592 (build-system gnu-build-system)
593 (description "sshpass is a tool for non-interactivly performing password
594 authentication with SSH's so-called @dfn{interactive keyboard password
596 (license license:gpl2+)))
598 (define-public autossh
606 "http://www.harding.motd.ca/autossh/autossh-"
609 (base32 "0mlicw28vq2jxa0jf0dys5ja75v0fxpjavlq9dpif6bnknji13ly"))))
610 (build-system gnu-build-system)
611 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
612 (inputs `(("openssh" ,openssh)))
613 (synopsis "Automatically restart SSH sessions and tunnels")
614 (description "autossh is a program to start a copy of @command{ssh} and
615 monitor it, restarting it as necessary should it die or stop passing traffic.")
616 (home-page "http://www.harding.motd.ca/autossh/")
618 ;; Why point to a source file? Well, all the individual files have a
619 ;; copy of this license in their headers, but there's no separate file
620 ;; with that information.
621 (license:non-copyleft "file://autossh.c"))))