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>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages ssh)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages base)
29 #:autoload (gnu packages boost) (boost)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages elf)
32 #:use-module (gnu packages gnupg)
33 #:use-module (gnu packages gperf)
34 #:use-module (gnu packages groff)
35 #:use-module (gnu packages guile)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages m4)
38 #:use-module (gnu packages multiprecision)
39 #:use-module (gnu packages ncurses)
40 #:use-module (gnu packages nettle)
41 #:use-module (gnu packages kerberos)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages pkg-config)
44 #:autoload (gnu packages protobuf) (protobuf)
45 #:use-module (gnu packages readline)
46 #:use-module (gnu packages texinfo)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages xorg)
49 #:use-module (guix build-system cmake)
50 #:use-module (guix build-system gnu)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module ((guix licenses) #:prefix license:)
54 #:use-module (guix packages))
63 "https://red.libssh.org/attachments/download/210/libssh-"
67 "03bcp9ksqp0s1pmwfmzhcknvkxay5k0mjzzxp3rjlifbng1vxq9r"))))
68 (build-system cmake-build-system)
70 '(#:configure-flags '("-DWITH_GCRYPT=ON")
72 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
74 (inputs `(("zlib" ,zlib)
75 ("libgcrypt" ,libgcrypt)))
76 (synopsis "SSH client library")
78 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for
79 client and server implementations. With libssh, you can remotely execute
80 programs, transfer files, and use a secure and transparent tunnel for your
81 remote applications.")
82 (home-page "https://www.libssh.org")
83 (license license:lgpl2.1+)))
85 (define-public libssh2
92 "https://www.libssh2.org/download/libssh2-"
96 "116mh112w48vv9k3f15ggp5kxw5sj4b88dzb5j69llsh7ba1ymp4"))))
97 (build-system gnu-build-system)
98 ;; The installed libssh2.pc file does not include paths to libgcrypt and
99 ;; zlib libraries, so we need to propagate the inputs.
100 (propagated-inputs `(("libgcrypt" ,libgcrypt)
102 (arguments '(#:configure-flags `("--with-libgcrypt")))
103 (synopsis "Client-side C library implementing the SSH2 protocol")
105 "libssh2 is a library intended to allow software developers access to
106 the SSH-2 protocol in an easy-to-use self-contained package. It can be built
107 into an application to perform many different tasks when communicating with
108 a server that supports the SSH-2 protocol.")
109 (license license:bsd-3)
110 (home-page "http://www.libssh2.org/")))
112 (define-public openssh
118 (uri (let ((tail (string-append name "-" version ".tar.gz")))
119 (list (string-append "http://openbsd.cs.fau.de/pub/OpenBSD/OpenSSH/portable/"
121 (string-append "http://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
123 (string-append "http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
126 "1l8r3x4fr2kb6xm95s7kjdif1wp6f94d4kljh4qjj9109shw87qv"))))
127 (build-system gnu-build-system)
128 (inputs `(("groff" ,groff)
131 ("mit-krb5" ,mit-krb5)
133 ("xauth" ,xauth))) ;for 'ssh -X' and 'ssh -Y'
135 `(#:test-target "tests"
136 #:configure-flags `("--sysconfdir=/etc/ssh"
138 ;; Default value of 'PATH' used by sshd.
139 "--with-default-path=/run/current-system/profile/bin"
141 ;; configure needs to find krb5-config
142 ,(string-append "--with-kerberos5="
143 (assoc-ref %build-inputs "mit-krb5")
146 ;; Enable PAM support in sshd.
150 (modify-phases %standard-phases
151 (add-after 'configure 'reset-/var/empty
152 (lambda* (#:key outputs #:allow-other-keys)
153 (let ((out (assoc-ref outputs "out")))
154 (substitute* "Makefile"
155 (("PRIVSEP_PATH=/var/empty")
156 (string-append "PRIVSEP_PATH=" out "/var/empty")))
158 (add-before 'check 'patch-tests
160 ;; remove 't-exec' regress target which requires user 'sshd'
161 (substitute* "regress/Makefile"
162 (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post)
163 (string-append pre post)))
166 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
167 ;; install without host keys and system configuration files
168 (and (zero? (apply system* "make" "install-nosysconf" make-flags))
170 (install-file "contrib/ssh-copy-id"
171 (string-append (assoc-ref outputs "out")
173 (chmod (string-append (assoc-ref outputs "out")
174 "/bin/ssh-copy-id") #o555)
175 (install-file "contrib/ssh-copy-id.1"
176 (string-append (assoc-ref outputs "out")
179 (synopsis "Client and server for the secure shell (ssh) protocol")
181 "The SSH2 protocol implemented in OpenSSH is standardised by the
182 IETF secsh working group and is specified in several RFCs and drafts.
183 It is composed of three layered components:
185 The transport layer provides algorithm negotiation and a key exchange.
186 The key exchange includes server authentication and results in a
187 cryptographically secured connection: it provides integrity, confidentiality
188 and optional compression.
190 The user authentication layer uses the established connection and relies on
191 the services provided by the transport layer. It provides several mechanisms
192 for user authentication. These include traditional password authentication
193 as well as public-key or host-based authentication mechanisms.
195 The connection layer multiplexes many different concurrent channels over the
196 authenticated connection and allows tunneling of login sessions and
197 TCP-forwarding. It provides a flow control service for these channels.
198 Additionally, various channel-specific options can be negotiated.")
199 (license (license:non-copyleft "file://LICENSE"
200 "See LICENSE in the distribution."))
201 (home-page "http://www.openssh.org/")))
203 (define-public guile-ssh
207 (home-page "https://github.com/artyom-poptsov/guile-ssh")
209 ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz
210 ;; exists, but the server appears to be too slow and unreliable.
211 ;; Also, using this URL allows the GitHub updater to work.
213 (uri (string-append home-page "/archive/v"
215 (file-name (string-append name "-" version ".tar.gz"))
218 "0pkiq3fm15pr4w1r420rrwwfmi4jz492r6l6vzjk6v73xlyfyfl3"))))
219 (build-system gnu-build-system)
221 '(#:phases (modify-phases %standard-phases
222 (add-after 'unpack 'autoreconf
223 (lambda* (#:key inputs #:allow-other-keys)
224 (zero? (system* "autoreconf" "-vfi"))))
225 (add-before 'build 'fix-libguile-ssh-file-name
226 (lambda* (#:key outputs #:allow-other-keys)
227 ;; Build and install libguile-ssh.so so that we can use
228 ;; its absolute file name in .scm files, before we build
230 (and (zero? (system* "make" "install"
233 (parallel-job-count))))
234 (let* ((out (assoc-ref outputs "out"))
235 (libdir (string-append out "/lib")))
236 (substitute* (find-files "." "\\.scm$")
237 (("\"libguile-ssh\"")
238 (string-append "\"" libdir "/libguile-ssh\"")))
241 ;; Tests are not parallel-safe.
242 #:parallel-tests? #f))
243 (native-inputs `(("autoconf" ,autoconf)
244 ("automake" ,automake)
247 ("pkg-config" ,pkg-config)
249 (inputs `(("guile" ,guile-2.0)
251 ("libgcrypt" ,libgcrypt)))
252 (synopsis "Guile bindings to libssh")
254 "Guile-SSH is a library that provides access to the SSH protocol for
255 programs written in GNU Guile interpreter. It is a wrapper to the underlying
257 (license license:gpl3+)))
259 (define-public corkscrew
266 (uri (string-append "http://www.agroman.net/corkscrew/corkscrew-"
269 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
270 (build-system gnu-build-system)
272 ;; Replace configure phase as the ./configure script does not link
273 ;; CONFIG_SHELL and SHELL passed as parameters
275 (modify-phases %standard-phases
277 (lambda* (#:key outputs inputs system build target
278 #:allow-other-keys #:rest args)
279 (let* ((configure (assoc-ref %standard-phases 'configure))
280 (prefix (assoc-ref outputs "out"))
281 (bash (which "bash"))
282 ;; Set --build and --host flags as the provided config.guess
283 ;; is not able to detect them
284 (flags `(,(string-append "--prefix=" prefix)
285 ,(string-append "--build=" build)
286 ,(string-append "--host=" (or target build)))))
287 (setenv "CONFIG_SHELL" bash)
288 (zero? (apply system* bash
289 (string-append "." "/configure")
291 (home-page "http://www.agroman.net/corkscrew")
292 (synopsis "Tunneling SSH through HTTP proxies")
294 "Corkscrew allows creating TCP tunnels through HTTP proxies. WARNING:
295 At the moment only plain text authentication is supported, should you require
296 to use it with your HTTP proxy. Digest based authentication may be supported
297 in future and NTLM based authentication is most likey never be supported.")
298 (license license:gpl2+)))
306 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
309 "118fhpm754wpklf1blnlq5xbvrxqml6rdfs3b07wg666zkxvg0ky"))))
310 (build-system gnu-build-system)
313 (modify-phases %standard-phases
314 (add-after 'install 'wrap
315 (lambda* (#:key outputs #:allow-other-keys)
316 ;; Make sure 'mosh' can find 'mosh-client' and
318 (let* ((out (assoc-ref outputs "out"))
319 (bin (string-append out "/bin")))
320 (wrap-program (string-append bin "/mosh")
321 `("PATH" ":" prefix (,bin)))))))))
323 `(("pkg-config" ,pkg-config)))
325 `(("openssl" ,openssl)
327 ("perl-io-tty" ,perl-io-tty)
330 ("protobuf" ,protobuf)
331 ("boost-headers" ,boost)))
332 (home-page "https://mosh.org/")
333 (synopsis "Remote shell tolerant to intermittent connectivity")
335 "Remote terminal application that allows roaming, supports intermittent
336 connectivity, and provides intelligent local echo and line editing of user
337 keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
338 especially over Wi-Fi, cellular, and long-distance links.")
339 (license license:gpl3+)))
341 (define-public dropbear
348 "https://matt.ucc.asn.au/" name "/releases/"
349 name "-" version ".tar.bz2"))
352 "14c8f4gzixf0j9fkx68jgl85q7b05852kk0vf09gi6h0xmafl817"))))
353 (build-system gnu-build-system)
354 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
355 (inputs `(("zlib" ,zlib)))
356 (synopsis "Small SSH server and client")
357 (description "Dropbear is a relatively small SSH server and
358 client. It runs on a variety of POSIX-based platforms. Dropbear is
359 particularly useful for embedded systems, such as wireless routers.")
360 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
361 (license (license:x11-style "" "See file LICENSE."))))
363 (define-public liboop
370 (uri (string-append "http://download.ofb.net/liboop/liboop-"
374 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
375 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
376 (build-system gnu-build-system)
377 (home-page "http://www.lysator.liu.se/liboop/")
378 (synopsis "Event loop library")
379 (description "Liboop is a low-level event loop management library for
380 POSIX-based operating systems. It supports the development of modular,
381 multiplexed applications which may respond to events from several sources. It
382 replaces the \"select() loop\" and allows the registration of event handlers
383 for file and network I/O, timers and signals. Since processes use these
384 mechanisms for almost all external communication, liboop can be used as the
385 basis for almost any application.")
386 (license license:lgpl2.1+)))
394 (uri (string-append "mirror://gnu/lsh/lsh-"
398 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
399 (modules '((guix build utils)))
402 (substitute* "src/testsuite/functions.sh"
404 ;; Avoid host name lookups since they don't work in
408 ;; Make tests more verbose.
411 (substitute* (find-files "src/testsuite" "-test$")
412 (("localhost") "127.0.0.1"))
414 (substitute* "src/testsuite/login-auth-test"
415 (("/bin/cat") "cat"))))))
416 (build-system gnu-build-system)
421 ("psmisc" ,psmisc))) ; for `killall'
423 `(("nettle" ,nettle-2)
424 ("linux-pam" ,linux-pam)
426 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
428 ("readline" ,readline-6.2)
434 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
435 ;; This adds 24 MiB (or 27%) to the closure of lsh.
438 '(;; Skip the `configure' test that checks whether /dev/ptmx &
439 ;; co. work as expected, because it relies on impurities (for
440 ;; instance, /dev/pts may be unavailable in chroots.)
441 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes")
443 ;; FIXME: Tests won't run in a chroot, presumably because
444 ;; /etc/profile is missing, and thus clients get an empty $PATH
445 ;; and nothing works.
449 (modify-phases %standard-phases
450 (add-before 'configure 'pre-configure
451 (lambda* (#:key inputs #:allow-other-keys)
452 (let* ((nettle (assoc-ref inputs "nettle"))
453 (sexp-conv (string-append nettle "/bin/sexp-conv")))
454 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
456 (substitute* "src/environ.h.in"
457 (("^#define PATH_SEXP_CONV.*")
458 (string-append "#define PATH_SEXP_CONV \""
461 ;; Same for the 'lsh-authorize' script.
462 (substitute* "src/lsh-authorize"
464 (string-append "=" sexp-conv)))
466 ;; Tell lshd where 'xauth' lives. Another option would be to
467 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
468 ;; reducing the closure size, but that wouldn't work on foreign
470 (with-fluids ((%default-port-encoding "ISO-8859-1"))
471 (substitute* "src/server_x11.c"
472 (("define XAUTH_PROGRAM.*")
473 (string-append "define XAUTH_PROGRAM \""
474 (assoc-ref inputs "xauth")
475 "/bin/xauth\"\n")))))
477 ;; Tests rely on $USER being set.
478 (setenv "USER" "guix"))))))
479 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
480 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
482 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
483 used to create a secure line of communication between two computers,
484 providing shell access to the server system from the client. It provides
485 both the server daemon and the client application, as well as tools for
486 manipulating key files.")
487 (license license:gpl2+)))
489 (define-public sshpass
493 (synopsis "Non-interactive password authentication with SSH")
494 (home-page "https://sourceforge.net/projects/sshpass/")
498 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
499 version "/sshpass-" version ".tar.gz"))
502 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
503 (build-system gnu-build-system)
504 (description "sshpass is a tool for non-interactivly performing password
505 authentication with SSH's so-called @dfn{interactive keyboard password
507 (license license:gpl2+)))
509 (define-public autossh
517 "http://www.harding.motd.ca/autossh/autossh-"
520 (base32 "0mlicw28vq2jxa0jf0dys5ja75v0fxpjavlq9dpif6bnknji13ly"))))
521 (build-system gnu-build-system)
522 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
523 (inputs `(("openssh" ,openssh)))
524 (synopsis "Automatically restart SSH sessions and tunnels")
525 (description "autossh is a program to start a copy of @command{ssh} and
526 monitor it, restarting it as necessary should it die or stop passing traffic.")
527 (home-page "http://www.harding.motd.ca/autossh/")
529 ;; Why point to a source file? Well, all the individual files have a
530 ;; copy of this license in their headers, but there's no separate file
531 ;; with that information.
532 (license:non-copyleft "file://autossh.c"))))