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 (string-append "mirror://openbsd/OpenSSH/portable/"
135 name "-" version ".tar.gz"))
138 "08qpsb8mrzcx8wgvz9insiyvq7sbg26yj5nvl2m5n57yvppcl8x3"))))
139 (build-system gnu-build-system)
140 (native-inputs `(("groff" ,groff)))
141 (inputs `(("openssl" ,openssl)
143 ("mit-krb5" ,mit-krb5)
145 ("xauth" ,xauth))) ;for 'ssh -X' and 'ssh -Y'
147 `(#:test-target "tests"
148 #:configure-flags `("--sysconfdir=/etc/ssh"
150 ;; Default value of 'PATH' used by sshd.
151 "--with-default-path=/run/current-system/profile/bin"
153 ;; configure needs to find krb5-config
154 ,(string-append "--with-kerberos5="
155 (assoc-ref %build-inputs "mit-krb5")
158 ;; Enable PAM support in sshd.
162 (modify-phases %standard-phases
163 (add-after 'configure 'reset-/var/empty
164 (lambda* (#:key outputs #:allow-other-keys)
165 (let ((out (assoc-ref outputs "out")))
166 (substitute* "Makefile"
167 (("PRIVSEP_PATH=/var/empty")
168 (string-append "PRIVSEP_PATH=" out "/var/empty")))
170 (add-before 'check 'patch-tests
172 ;; remove 't-exec' regress target which requires user 'sshd'
173 (substitute* "regress/Makefile"
174 (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post)
175 (string-append pre post)))
178 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
179 ;; install without host keys and system configuration files
180 (and (zero? (apply system* "make" "install-nosysconf" make-flags))
182 (install-file "contrib/ssh-copy-id"
183 (string-append (assoc-ref outputs "out")
185 (chmod (string-append (assoc-ref outputs "out")
186 "/bin/ssh-copy-id") #o555)
187 (install-file "contrib/ssh-copy-id.1"
188 (string-append (assoc-ref outputs "out")
191 (synopsis "Client and server for the secure shell (ssh) protocol")
193 "The SSH2 protocol implemented in OpenSSH is standardised by the
194 IETF secsh working group and is specified in several RFCs and drafts.
195 It is composed of three layered components:
197 The transport layer provides algorithm negotiation and a key exchange.
198 The key exchange includes server authentication and results in a
199 cryptographically secured connection: it provides integrity, confidentiality
200 and optional compression.
202 The user authentication layer uses the established connection and relies on
203 the services provided by the transport layer. It provides several mechanisms
204 for user authentication. These include traditional password authentication
205 as well as public-key or host-based authentication mechanisms.
207 The connection layer multiplexes many different concurrent channels over the
208 authenticated connection and allows tunneling of login sessions and
209 TCP-forwarding. It provides a flow control service for these channels.
210 Additionally, various channel-specific options can be negotiated.")
211 (license (license:non-copyleft "file://LICENSE"
212 "See LICENSE in the distribution."))
213 (home-page "http://www.openssh.org/")))
215 (define-public guile-ssh
219 (home-page "https://github.com/artyom-poptsov/guile-ssh")
221 ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz
222 ;; exists, but the server appears to be too slow and unreliable.
223 ;; Also, using this URL allows the GitHub updater to work.
225 (uri (string-append home-page "/archive/v"
227 (file-name (string-append name "-" version ".tar.gz"))
230 "1w0k5s09xj5xycb7lbp5b7rm0xncclms3jwl98lwj8fxwngi1s90"))))
231 (build-system gnu-build-system)
232 (outputs '("out" "debug"))
234 '(#:phases (modify-phases %standard-phases
235 (add-after 'unpack 'autoreconf
236 (lambda* (#:key inputs #:allow-other-keys)
237 (zero? (system* "autoreconf" "-vfi"))))
238 (add-before 'build 'fix-libguile-ssh-file-name
239 (lambda* (#:key outputs #:allow-other-keys)
240 ;; Build and install libguile-ssh.so so that we can use
241 ;; its absolute file name in .scm files, before we build
243 (and (zero? (system* "make" "install"
246 (parallel-job-count))))
247 (let* ((out (assoc-ref outputs "out"))
248 (libdir (string-append out "/lib")))
249 (substitute* (find-files "." "\\.scm$")
250 (("\"libguile-ssh\"")
251 (string-append "\"" libdir "/libguile-ssh\"")))
254 ;; Tests are not parallel-safe.
255 #:parallel-tests? #f))
256 (native-inputs `(("autoconf" ,autoconf)
257 ("automake" ,automake)
260 ("pkg-config" ,pkg-config)
262 (inputs `(("guile" ,guile-2.2)
264 ("libgcrypt" ,libgcrypt)))
265 (synopsis "Guile bindings to libssh")
267 "Guile-SSH is a library that provides access to the SSH protocol for
268 programs written in GNU Guile interpreter. It is a wrapper to the underlying
270 (license license:gpl3+)))
272 (define-public guile2.2-ssh
273 (deprecated-package "guile2.2-ssh" guile-ssh))
275 (define-public guile2.0-ssh
278 (name "guile2.0-ssh")
279 (inputs `(("guile" ,guile-2.0)
280 ,@(alist-delete "guile" (package-inputs guile-ssh))))))
282 (define-public corkscrew
289 ;; The agroman.net domain name expired on 2017-03-23, and the original
290 ;; "http://www.agroman.net/corkscrew/corkscrew-2.0.tar.gz" now returns
291 ;; bogus HTML. Perhaps it will yet return. Until then, use a mirror.
292 (uri (string-append "https://downloads.openwrt.org/sources/"
293 "corkscrew-" version ".tar.gz"))
295 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
296 (build-system gnu-build-system)
298 ;; Replace configure phase as the ./configure script does not link
299 ;; CONFIG_SHELL and SHELL passed as parameters
301 (modify-phases %standard-phases
303 (lambda* (#:key outputs inputs system build target
304 #:allow-other-keys #:rest args)
305 (let* ((configure (assoc-ref %standard-phases 'configure))
306 (prefix (assoc-ref outputs "out"))
307 (bash (which "bash"))
308 ;; Set --build and --host flags as the provided config.guess
309 ;; is not able to detect them
310 (flags `(,(string-append "--prefix=" prefix)
311 ,(string-append "--build=" build)
312 ,(string-append "--host=" (or target build)))))
313 (setenv "CONFIG_SHELL" bash)
314 (zero? (apply system* bash
315 (string-append "." "/configure")
317 (add-after 'install 'install-documentation
318 (lambda* (#:key outputs #:allow-other-keys)
319 (let* ((out (assoc-ref outputs "out"))
320 (doc (string-append out "/share/doc/corkscrew")))
321 (install-file "README" doc)
323 (home-page "http://www.agroman.net/corkscrew")
324 (synopsis "SSH tunneling through HTTP(S) proxies")
326 "Corkscrew tunnels SSH connections through most HTTP and HTTPS proxies.
327 Proxy authentication is only supported through the plain-text HTTP basic
328 authentication scheme.")
329 (license license:gpl2+)))
337 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
340 "05hjhlp6lk8yjcy59zywpf0r6s0h0b9zxq0lw66dh9x8vxrhaq6s"))))
341 (build-system gnu-build-system)
344 (modify-phases %standard-phases
345 (add-after 'install 'wrap
346 (lambda* (#:key outputs #:allow-other-keys)
347 ;; Make sure 'mosh' can find 'mosh-client' and
349 (let* ((out (assoc-ref outputs "out"))
350 (bin (string-append out "/bin")))
351 (wrap-program (string-append bin "/mosh")
352 `("PATH" ":" prefix (,bin)))))))))
354 `(("pkg-config" ,pkg-config)))
356 `(("openssl" ,openssl)
358 ("perl-io-tty" ,perl-io-tty)
361 ("protobuf" ,protobuf)
362 ("boost-headers" ,boost)))
363 (home-page "https://mosh.org/")
364 (synopsis "Remote shell tolerant to intermittent connectivity")
366 "Remote terminal application that allows roaming, supports intermittent
367 connectivity, and provides intelligent local echo and line editing of user
368 keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
369 especially over Wi-Fi, cellular, and long-distance links.")
370 (license license:gpl3+)))
380 "https://github.com/MisterTea/EternalTCP/archive/et-v"
383 (base32 "1n2w2kqbshdmbb0gz4yizyw9gqfls6qm2dnwx1d9c2hz7hmi7521"))))
384 (build-system cmake-build-system)
385 (arguments `(#:tests? #f))
387 `(("pkg-config" ,pkg-config)))
388 (inputs `(("glog" ,glog)
390 ("libsodium" ,libsodium)
391 ("protobuf" ,protobuf)))
392 (synopsis "Remote shell that automatically reconnects")
394 "Eternal Terminal (ET) is a remote shell that automatically reconnects
395 without interrupting the session. Unlike SSH sessions, ET sessions will
396 survive even network outages and IP changes. ET uses a custom protocol over
397 TCP, not the SSH protocol.")
398 (home-page "https://mistertea.github.io/EternalTCP/")
399 (license license:asl2.0)))
401 (define-public dropbear
408 "https://matt.ucc.asn.au/" name "/releases/"
409 name "-" version ".tar.bz2"))
412 "1309cm2aw62n9m3h38prvgsqr8bj85hfasgnvwkd42cp3k5ivg3c"))))
413 (build-system gnu-build-system)
414 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
415 (inputs `(("zlib" ,zlib)))
416 (synopsis "Small SSH server and client")
417 (description "Dropbear is a relatively small SSH server and
418 client. It runs on a variety of POSIX-based platforms. Dropbear is
419 particularly useful for embedded systems, such as wireless routers.")
420 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
421 (license (license:x11-style "" "See file LICENSE."))))
423 (define-public liboop
430 (uri (string-append "http://download.ofb.net/liboop/liboop-"
434 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
435 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
436 (build-system gnu-build-system)
437 (home-page "http://www.lysator.liu.se/liboop/")
438 (synopsis "Event loop library")
439 (description "Liboop is a low-level event loop management library for
440 POSIX-based operating systems. It supports the development of modular,
441 multiplexed applications which may respond to events from several sources. It
442 replaces the \"select() loop\" and allows the registration of event handlers
443 for file and network I/O, timers and signals. Since processes use these
444 mechanisms for almost all external communication, liboop can be used as the
445 basis for almost any application.")
446 (license license:lgpl2.1+)))
454 (uri (string-append "mirror://gnu/lsh/lsh-"
458 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
459 (modules '((guix build utils)))
462 (substitute* "src/testsuite/functions.sh"
464 ;; Avoid host name lookups since they don't work in
468 ;; Make tests more verbose.
471 (substitute* (find-files "src/testsuite" "-test$")
472 (("localhost") "127.0.0.1"))
474 (substitute* "src/testsuite/login-auth-test"
475 (("/bin/cat") "cat"))))))
476 (build-system gnu-build-system)
481 ("psmisc" ,psmisc))) ; for `killall'
483 `(("nettle" ,nettle-2)
484 ("linux-pam" ,linux-pam)
486 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
488 ("readline" ,readline-6.2)
494 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
495 ;; This adds 24 MiB (or 27%) to the closure of lsh.
498 '(;; Skip the `configure' test that checks whether /dev/ptmx &
499 ;; co. work as expected, because it relies on impurities (for
500 ;; instance, /dev/pts may be unavailable in chroots.)
501 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes"
503 ;; Use glibc's argp rather than the bundled one.
506 ;; 'lsh_argp.h' checks HAVE_ARGP_PARSE but nothing
508 "CPPFLAGS=-DHAVE_ARGP_PARSE")
510 ;; FIXME: Tests won't run in a chroot, presumably because
511 ;; /etc/profile is missing, and thus clients get an empty $PATH
512 ;; and nothing works.
516 (modify-phases %standard-phases
517 (add-before 'configure 'pre-configure
518 (lambda* (#:key inputs #:allow-other-keys)
519 (let* ((nettle (assoc-ref inputs "nettle"))
520 (sexp-conv (string-append nettle "/bin/sexp-conv")))
521 ;; Remove argp from the list of sub-directories; we don't want
522 ;; to build it, really.
523 (substitute* "src/Makefile.in"
527 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
529 (substitute* "src/environ.h.in"
530 (("^#define PATH_SEXP_CONV.*")
531 (string-append "#define PATH_SEXP_CONV \""
534 ;; Same for the 'lsh-authorize' script.
535 (substitute* "src/lsh-authorize"
537 (string-append "=" sexp-conv)))
539 ;; Tell lshd where 'xauth' lives. Another option would be to
540 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
541 ;; reducing the closure size, but that wouldn't work on foreign
543 (with-fluids ((%default-port-encoding "ISO-8859-1"))
544 (substitute* "src/server_x11.c"
545 (("define XAUTH_PROGRAM.*")
546 (string-append "define XAUTH_PROGRAM \""
547 (assoc-ref inputs "xauth")
548 "/bin/xauth\"\n")))))
550 ;; Tests rely on $USER being set.
551 (setenv "USER" "guix"))))))
552 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
553 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
555 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
556 used to create a secure line of communication between two computers,
557 providing shell access to the server system from the client. It provides
558 both the server daemon and the client application, as well as tools for
559 manipulating key files.")
560 (license license:gpl2+)))
562 (define-public sshpass
566 (synopsis "Non-interactive password authentication with SSH")
567 (home-page "https://sourceforge.net/projects/sshpass/")
571 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
572 version "/sshpass-" version ".tar.gz"))
575 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
576 (build-system gnu-build-system)
577 (description "sshpass is a tool for non-interactivly performing password
578 authentication with SSH's so-called @dfn{interactive keyboard password
580 (license license:gpl2+)))
582 (define-public autossh
590 "http://www.harding.motd.ca/autossh/autossh-"
593 (base32 "0mlicw28vq2jxa0jf0dys5ja75v0fxpjavlq9dpif6bnknji13ly"))))
594 (build-system gnu-build-system)
595 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
596 (inputs `(("openssh" ,openssh)))
597 (synopsis "Automatically restart SSH sessions and tunnels")
598 (description "autossh is a program to start a copy of @command{ssh} and
599 monitor it, restarting it as necessary should it die or stop passing traffic.")
600 (home-page "http://www.harding.motd.ca/autossh/")
602 ;; Why point to a source file? Well, all the individual files have a
603 ;; copy of this license in their headers, but there's no separate file
604 ;; with that information.
605 (license:non-copyleft "file://autossh.c"))))