Merge remote-tracking branch 'origin/master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / ssh.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016, 2019 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, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
10 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
11 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2017 Nikita <nikita@n0.is>
13 ;;; Copyright © 2018 Manuel Graf <graf@init.at>
14 ;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
15 ;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
16 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
17 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
18 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
19 ;;;
20 ;;; This file is part of GNU Guix.
21 ;;;
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
26 ;;;
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
31 ;;;
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35 (define-module (gnu packages ssh)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages boost)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages crypto)
42 #:use-module (gnu packages elf)
43 #:use-module (gnu packages gnupg)
44 #:use-module (gnu packages gperf)
45 #:use-module (gnu packages groff)
46 #:use-module (gnu packages guile)
47 #:use-module (gnu packages libedit)
48 #:use-module (gnu packages linux)
49 #:use-module (gnu packages logging)
50 #:use-module (gnu packages m4)
51 #:use-module (gnu packages multiprecision)
52 #:use-module (gnu packages ncurses)
53 #:use-module (gnu packages nettle)
54 #:use-module (gnu packages kerberos)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages popt)
58 #:use-module (gnu packages protobuf)
59 #:use-module (gnu packages python)
60 #:use-module (gnu packages python-crypto)
61 #:use-module (gnu packages python-web)
62 #:use-module (gnu packages python-xyz)
63 #:use-module (gnu packages readline)
64 #:use-module (gnu packages texinfo)
65 #:use-module (gnu packages tls)
66 #:use-module (gnu packages xorg)
67 #:use-module (guix build-system cmake)
68 #:use-module (guix build-system gnu)
69 #:use-module (guix build-system python)
70 #:use-module (guix download)
71 #:use-module (guix git-download)
72 #:use-module ((guix licenses) #:prefix license:)
73 #:use-module (guix packages)
74 #:use-module (guix utils)
75 #:use-module (srfi srfi-1))
76
77 (define-public hss
78 (package
79 (name "hss")
80 (version "1.8")
81 (source (origin
82 (method git-fetch)
83 (uri (git-reference
84 (url "https://github.com/six-ddc/hss")
85 (commit (string-append "v" version))))
86 (file-name (git-file-name name version))
87 (sha256
88 (base32
89 "1rpysj65j9ls30bf2c5k5hykzzjfknrihs58imp178bx1wqzw4jl"))))
90 (inputs
91 `(("readline" ,readline)))
92 (arguments
93 `(#:make-flags
94 (list ,(string-append "CC=" (cc-for-target))
95 (string-append "INSTALL_BIN=" (assoc-ref %outputs "out") "/bin"))
96 #:tests? #f ; no tests
97 #:phases
98 (modify-phases %standard-phases
99 (add-after 'unpack 'patch-file-names
100 (lambda* (#:key inputs outputs #:allow-other-keys)
101 (substitute* "Makefile"
102 (("/usr/local/opt/readline")
103 (assoc-ref inputs "readline")))
104 #t))
105 (delete 'configure)))) ; no configure script
106 (build-system gnu-build-system)
107 (home-page "https://github.com/six-ddc/hss/")
108 (synopsis "Interactive SSH client for multiple servers")
109 (description
110 "@command{hss} is an interactive SSH client for multiple servers. Commands
111 are executed on all servers in parallel. Execution on one server does not need
112 to wait for that on another server to finish before starting. One can run a
113 command on hundreds of servers at the same time, with almost the same experience
114 as a local Bash shell.
115
116 It supports:
117 @itemize @bullet
118 @item interactive input: based on GNU readline.
119 @item history: responding to the @kbd{C-r} key.
120 @item auto-completion: @key{TAB}-completion from remote servers for commands and
121 file names.
122 @end itemize\n")
123 (license license:expat)))
124
125 (define-public libssh
126 (package
127 (name "libssh")
128 (version "0.9.5")
129 (source (origin
130 (method git-fetch)
131 (uri (git-reference
132 (url "https://git.libssh.org/projects/libssh.git")
133 (commit (string-append "libssh-" version))))
134 (sha256
135 (base32
136 "1b2klflmn0mdkcyjl4dqfg116bf9nhmqm4qla5cqa9xis89a5bn6"))
137 (file-name (git-file-name name version))))
138 (build-system cmake-build-system)
139 (outputs '("out" "debug"))
140 (arguments
141 '(#:configure-flags '("-DWITH_GCRYPT=ON")
142
143 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
144 #:tests? #f))
145 (inputs `(("zlib" ,zlib)
146 ("libgcrypt" ,libgcrypt)
147 ("mit-krb5" ,mit-krb5)))
148 (synopsis "SSH client library")
149 (description
150 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for client
151 and server implementations. With libssh, you can remotely execute programs,
152 transfer files, and use a secure and transparent tunnel for your remote
153 applications.")
154 (home-page "https://www.libssh.org")
155 (license license:lgpl2.1+)))
156
157 (define-public libssh2
158 (package
159 (name "libssh2")
160 (version "1.9.0")
161 (source (origin
162 (method url-fetch)
163 (uri (string-append
164 "https://www.libssh2.org/download/libssh2-"
165 version ".tar.gz"))
166 (sha256
167 (base32
168 "1zfsz9nldakfz61d2j70pk29zlmj7w2vv46s9l3x2prhcgaqpyym"))))
169 (build-system gnu-build-system)
170 ;; The installed libssh2.pc file does not include paths to libgcrypt and
171 ;; zlib libraries, so we need to propagate the inputs.
172 (propagated-inputs `(("libgcrypt" ,libgcrypt)
173 ("zlib" ,zlib)))
174 (arguments `(#:configure-flags `("--with-libgcrypt")))
175 (synopsis "Client-side C library implementing the SSH2 protocol")
176 (description
177 "libssh2 is a library intended to allow software developers access to
178 the SSH-2 protocol in an easy-to-use self-contained package. It can be built
179 into an application to perform many different tasks when communicating with
180 a server that supports the SSH-2 protocol.")
181 (license license:bsd-3)
182 (home-page "https://www.libssh2.org/")))
183
184 (define-public openssh
185 (package
186 (name "openssh")
187 (version "8.4p1")
188 (source (origin
189 (method url-fetch)
190 (uri (string-append "mirror://openbsd/OpenSSH/portable/"
191 "openssh-" version ".tar.gz"))
192 (patches (search-patches "openssh-hurd.patch"
193 "openssh-fix-ssh-copy-id.patch"))
194 (sha256
195 (base32
196 "091b3pxdlj47scxx6kkf4agkx8c8sdacdxx8m1dw1cby80pd40as"))))
197 (build-system gnu-build-system)
198 (native-inputs `(("groff" ,groff)
199 ("pkg-config" ,pkg-config)))
200 (inputs `(("libedit" ,libedit)
201 ("openssl" ,openssl)
202 ("pam" ,linux-pam)
203 ("mit-krb5" ,mit-krb5)
204 ("zlib" ,zlib)
205 ("xauth" ,xauth))) ; for 'ssh -X' and 'ssh -Y'
206 (arguments
207 `(#:test-target "tests"
208 ;; Otherwise, the test scripts try to use a nonexistent directory and
209 ;; fail.
210 #:make-flags '("REGRESSTMP=\"$${BUILDDIR}/regress\"")
211 #:configure-flags `("--sysconfdir=/etc/ssh"
212
213 ;; Default value of 'PATH' used by sshd.
214 "--with-default-path=/run/current-system/profile/bin"
215
216 ;; configure needs to find krb5-config.
217 ,(string-append "--with-kerberos5="
218 (assoc-ref %build-inputs "mit-krb5")
219 "/bin")
220
221 ;; libedit is needed for sftp completion.
222 "--with-libedit"
223
224 ;; Enable PAM support in sshd.
225 "--with-pam"
226
227 ;; "make install" runs "install -s" by default,
228 ;; which doesn't work for cross-compiled binaries
229 ;; because it invokes 'strip' instead of
230 ;; 'TRIPLET-strip'. Work around this.
231 ,,@(if (%current-target-system)
232 '("--disable-strip")
233 '()))
234
235 #:phases
236 (modify-phases %standard-phases
237 (add-after 'configure 'reset-/var/empty
238 (lambda* (#:key outputs #:allow-other-keys)
239 (let ((out (assoc-ref outputs "out")))
240 (substitute* "Makefile"
241 (("PRIVSEP_PATH=/var/empty")
242 (string-append "PRIVSEP_PATH=" out "/var/empty")))
243 #t)))
244 (add-before 'check 'patch-tests
245 (lambda _
246 (substitute* "regress/test-exec.sh"
247 (("/bin/sh") (which "sh")))
248
249 ;; Remove 't-exec' regress target which requires user 'sshd'.
250 (substitute* (list "Makefile"
251 "regress/Makefile")
252 (("^(tests:.*) t-exec(.*)" all pre post)
253 (string-append pre post)))
254 #t))
255 (replace 'install
256 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
257 ;; Install without host keys and system configuration files.
258 (apply invoke "make" "install-nosysconf" make-flags)
259 (install-file "contrib/ssh-copy-id"
260 (string-append (assoc-ref outputs "out")
261 "/bin/"))
262 (chmod (string-append (assoc-ref outputs "out")
263 "/bin/ssh-copy-id") #o555)
264 (install-file "contrib/ssh-copy-id.1"
265 (string-append (assoc-ref outputs "out")
266 "/share/man/man1/"))
267 #t)))))
268 (synopsis "Client and server for the secure shell (ssh) protocol")
269 (description
270 "The SSH2 protocol implemented in OpenSSH is standardised by the
271 IETF secsh working group and is specified in several RFCs and drafts.
272 It is composed of three layered components:
273
274 The transport layer provides algorithm negotiation and a key exchange.
275 The key exchange includes server authentication and results in a
276 cryptographically secured connection: it provides integrity, confidentiality
277 and optional compression.
278
279 The user authentication layer uses the established connection and relies on
280 the services provided by the transport layer. It provides several mechanisms
281 for user authentication. These include traditional password authentication
282 as well as public-key or host-based authentication mechanisms.
283
284 The connection layer multiplexes many different concurrent channels over the
285 authenticated connection and allows tunneling of login sessions and
286 TCP-forwarding. It provides a flow control service for these channels.
287 Additionally, various channel-specific options can be negotiated.")
288 (license (license:non-copyleft "file://LICENSE"
289 "See LICENSE in the distribution."))
290 (home-page "https://www.openssh.com/")))
291
292 ;; OpenSSH without X support. This allows to use OpenSSH without dragging X
293 ;; libraries to the closure.
294 (define-public openssh-sans-x
295 (package
296 (inherit openssh)
297 (name "openssh-sans-x")
298 (inputs (alist-delete "xauth" (package-inputs openssh)))
299 (synopsis "OpenSSH client and server without X11 support")))
300
301 (define-public guile-ssh
302 (package
303 (name "guile-ssh")
304 (version "0.13.1")
305 (home-page "https://github.com/artyom-poptsov/guile-ssh")
306 (source (origin
307 (method git-fetch)
308 (uri (git-reference
309 (url home-page)
310 (commit (string-append "v" version))))
311 (file-name (string-append name "-" version ".tar.gz"))
312 (sha256
313 (base32
314 "1xpxkvgj7wgcl450djkcrmrf957mcy2f36hfs5g6kpla1gax2d1g"))
315 (modules '((guix build utils)))))
316 (build-system gnu-build-system)
317 (outputs '("out" "debug"))
318 (arguments
319 `(;; It makes no sense to build libguile-ssh.a.
320 #:configure-flags '("--disable-static")
321
322 #:phases (modify-phases %standard-phases
323 (add-before 'build 'fix-libguile-ssh-file-name
324 (lambda* (#:key outputs #:allow-other-keys)
325 ;; Build and install libguile-ssh.so so that we can use
326 ;; its absolute file name in .scm files, before we build
327 ;; the .go files.
328 (let* ((out (assoc-ref outputs "out"))
329 (lib (string-append out "/lib")))
330 (invoke "make" "install"
331 "-C" "libguile-ssh"
332 "-j" (number->string
333 (parallel-job-count)))
334 (substitute* (find-files "." "\\.scm$")
335 (("\"libguile-ssh\"")
336 (string-append "\"" lib "/libguile-ssh\"")))
337 #t)))
338 ,@(if (%current-target-system)
339 '()
340 '((add-before 'check 'fix-guile-path
341 (lambda* (#:key inputs #:allow-other-keys)
342 (let ((guile (assoc-ref inputs "guile")))
343 (substitute* "tests/common.scm"
344 (("/usr/bin/guile")
345 (string-append guile "/bin/guile")))
346 #t)))))
347 (add-after 'install 'remove-bin-directory
348 (lambda* (#:key outputs #:allow-other-keys)
349 (let* ((out (assoc-ref outputs "out"))
350 (bin (string-append out "/bin"))
351 (examples (string-append
352 out "/share/guile-ssh/examples")))
353 (mkdir-p examples)
354 (rename-file (string-append bin "/ssshd.scm")
355 (string-append examples "/ssshd.scm"))
356 (rename-file (string-append bin "/sssh.scm")
357 (string-append examples "/sssh.scm"))
358 (delete-file-recursively bin)
359 #t))))))
360 (native-inputs `(("autoconf" ,autoconf)
361 ("automake" ,automake)
362 ("libtool" ,libtool)
363 ("texinfo" ,texinfo)
364 ("pkg-config" ,pkg-config)
365 ("which" ,which)
366 ("guile" ,guile-3.0))) ;needed when cross-compiling.
367 (inputs `(("guile" ,guile-3.0)
368 ("libssh" ,libssh)
369 ("libgcrypt" ,libgcrypt)))
370 (synopsis "Guile bindings to libssh")
371 (description
372 "Guile-SSH is a library that provides access to the SSH protocol for
373 programs written in GNU Guile interpreter. It is a wrapper to the underlying
374 libssh library.")
375 (license license:gpl3+)))
376
377 (define-public guile2.0-ssh
378 (package
379 (inherit guile-ssh)
380 (name "guile2.0-ssh")
381 (native-inputs
382 `(("guile" ,guile-2.0) ;needed when cross-compiling.
383 ,@(alist-delete "guile" (package-native-inputs guile-ssh))))
384 (inputs `(("guile" ,guile-2.0)
385 ,@(alist-delete "guile" (package-inputs guile-ssh))))))
386
387 (define-public guile2.2-ssh
388 (package
389 (inherit guile-ssh)
390 (name "guile2.2-ssh")
391 (native-inputs
392 `(("guile" ,guile-2.2) ;needed when cross-compiling.
393 ,@(alist-delete "guile" (package-native-inputs guile-ssh))))
394 (inputs `(("guile" ,guile-2.2)
395 ,@(alist-delete "guile" (package-inputs guile-ssh))))))
396
397 (define-public guile3.0-ssh
398 (deprecated-package "guile3.0-ssh" guile-ssh))
399
400 (define-public corkscrew
401 (package
402 (name "corkscrew")
403 (version "2.0")
404 (source
405 (origin
406 (method git-fetch)
407 (uri (git-reference
408 (url "https://github.com/patpadgett/corkscrew")
409 (commit (string-append "v" version))))
410 (sha256
411 (base32 "0g4pkczrc1zqpnxyyjwcjmyzdj5qqcpzwf1bm3965zdwp94bpppf"))
412 (file-name (git-file-name name version))))
413 (build-system gnu-build-system)
414 (arguments
415 `(#:phases
416 (modify-phases %standard-phases
417 (replace 'configure
418 ;; Replace configure phase as the ./configure script does not like
419 ;; CONFIG_SHELL and SHELL passed as parameters.
420 (lambda* (#:key outputs build target #:allow-other-keys)
421 (let* ((out (assoc-ref outputs "out"))
422 (bash (which "bash"))
423 ;; Set --build and --host flags as the provided config.guess
424 ;; is not able to detect them.
425 (flags `(,(string-append "--prefix=" out)
426 ,(string-append "--build=" build)
427 ,(string-append "--host=" (or target build)))))
428 (setenv "CONFIG_SHELL" bash)
429 (apply invoke bash "./configure" flags))))
430 (add-after 'install 'install-documentation
431 (lambda* (#:key outputs #:allow-other-keys)
432 (let* ((out (assoc-ref outputs "out"))
433 (doc (string-append out "/share/doc/" ,name "-" ,version)))
434 (install-file "README.markdown" doc)
435 #t))))))
436 (home-page "https://github.com/patpadgett/corkscrew")
437 (synopsis "SSH tunneling through HTTP(S) proxies")
438 (description
439 "Corkscrew tunnels SSH connections through most HTTP and HTTPS proxies.
440 Proxy authentication is only supported through the plain-text HTTP basic
441 authentication scheme.")
442 (license license:gpl2+)))
443
444 (define-public mosh
445 (package
446 (name "mosh")
447 (version "1.3.2")
448 (source (origin
449 (method url-fetch)
450 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
451 (sha256
452 (base32
453 "05hjhlp6lk8yjcy59zywpf0r6s0h0b9zxq0lw66dh9x8vxrhaq6s"))))
454 (build-system gnu-build-system)
455 (arguments
456 '(#:phases
457 (modify-phases %standard-phases
458 (add-after 'unpack 'patch-FHS-file-names
459 (lambda _
460 (substitute* "scripts/mosh.pl"
461 (("/bin/sh")
462 (which "sh")))
463 #t))
464 (add-after 'install 'wrap
465 (lambda* (#:key outputs #:allow-other-keys)
466 ;; Make sure 'mosh' can find 'mosh-client' and
467 ;; 'mosh-server'.
468 (let* ((out (assoc-ref outputs "out"))
469 (bin (string-append out "/bin")))
470 (wrap-program (string-append bin "/mosh")
471 `("PATH" ":" prefix (,bin)))))))))
472 (native-inputs
473 `(("pkg-config" ,pkg-config)))
474 (inputs
475 `(("openssl" ,openssl)
476 ("perl" ,perl)
477 ("perl-io-tty" ,perl-io-tty)
478 ("zlib" ,zlib)
479 ("ncurses" ,ncurses)
480 ("protobuf" ,protobuf)
481 ("boost-headers" ,boost)))
482 (home-page "https://mosh.org/")
483 (synopsis "Remote shell tolerant to intermittent connectivity")
484 (description
485 "Mosh is a remote terminal application that allows client roaming, supports
486 intermittent connectivity, and provides intelligent local echo and line editing
487 of user keystrokes. It's a replacement for SSH that's more robust and
488 responsive, especially over Wi-Fi, cellular, and long-distance links.")
489 (license license:gpl3+)))
490
491 (define-public dropbear
492 (package
493 (name "dropbear")
494 (version "2020.81")
495 (source
496 (origin
497 (method url-fetch)
498 (uri (string-append
499 "https://matt.ucc.asn.au/dropbear/releases/"
500 "dropbear-" version ".tar.bz2"))
501 (sha256
502 (base32 "0fy5ma4cfc2pk25mcccc67b2mf1rnb2c06ilb7ddnxbpnc85s8s8"))))
503 (build-system gnu-build-system)
504 (arguments `(#:tests? #f)) ; there is no "make check" or anything similar
505 ;; TODO: Investigate unbundling libtommath and libtomcrypt or at least
506 ;; cherry-picking important bug fixes from them. See <bugs.gnu.org/24674>
507 ;; for more information.
508 (inputs `(("zlib" ,zlib)))
509 (synopsis "Small SSH server and client")
510 (description "Dropbear is a relatively small SSH server and
511 client. It runs on a variety of POSIX-based platforms. Dropbear is
512 particularly useful for embedded systems, such as wireless routers.")
513 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
514 (license (license:x11-style "" "See file LICENSE."))))
515
516 (define-public liboop
517 (package
518 (name "liboop")
519 (version "1.0.1")
520 (source
521 (origin
522 (method url-fetch)
523 (uri (string-append "http://ftp.lysator.liu.se/pub/liboop/"
524 name "-" version ".tar.gz"))
525 (sha256
526 (base32
527 "1q0p1l72pq9k3bi7a366j2rishv7dzzkg3i6r2npsfg7cnnidbsn"))))
528 (build-system gnu-build-system)
529 (home-page "https://www.lysator.liu.se/liboop/")
530 (synopsis "Event loop library")
531 (description "Liboop is a low-level event loop management library for
532 POSIX-based operating systems. It supports the development of modular,
533 multiplexed applications which may respond to events from several sources. It
534 replaces the \"select() loop\" and allows the registration of event handlers
535 for file and network I/O, timers and signals. Since processes use these
536 mechanisms for almost all external communication, liboop can be used as the
537 basis for almost any application.")
538 (license license:lgpl2.1+)))
539
540 (define-public lsh
541 (package
542 (name "lsh")
543 (version "2.1")
544 (source (origin
545 (method url-fetch)
546 (uri (string-append "mirror://gnu/lsh/lsh-"
547 version ".tar.gz"))
548 (sha256
549 (base32
550 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
551 (modules '((guix build utils)))
552 (snippet
553 '(begin
554 (substitute* "src/testsuite/functions.sh"
555 (("localhost")
556 ;; Avoid host name lookups since they don't work in
557 ;; chroot builds.
558 "127.0.0.1")
559 (("set -e")
560 ;; Make tests more verbose.
561 "set -e\nset -x"))
562
563 (substitute* (find-files "src/testsuite" "-test$")
564 (("localhost") "127.0.0.1"))
565
566 (substitute* "src/testsuite/login-auth-test"
567 (("/bin/cat") "cat"))
568 #t))
569 (patches (search-patches "lsh-fix-x11-forwarding.patch"))))
570 (build-system gnu-build-system)
571 (native-inputs
572 `(("autoconf" ,autoconf)
573 ("automake" ,automake)
574 ("m4" ,m4)
575 ("guile" ,guile-2.0)
576 ("gperf" ,gperf)
577 ("psmisc" ,psmisc))) ; for `killall'
578 (inputs
579 `(("nettle" ,nettle-2)
580 ("linux-pam" ,linux-pam)
581
582 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
583 ;; Readline 6.3.
584 ("readline" ,readline-6.2)
585
586 ("liboop" ,liboop)
587 ("zlib" ,zlib)
588 ("gmp" ,gmp)
589
590 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
591 ;; This adds 24 MiB (or 27%) to the closure of lsh.
592 ("xauth" ,xauth)
593 ("libxau" ,libxau))) ;also required for x11-forwarding
594 (arguments
595 '(;; Skip the `configure' test that checks whether /dev/ptmx &
596 ;; co. work as expected, because it relies on impurities (for
597 ;; instance, /dev/pts may be unavailable in chroots.)
598 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes"
599
600 ;; Use glibc's argp rather than the bundled one.
601 "--with-system-argp"
602
603 ;; 'lsh_argp.h' checks HAVE_ARGP_PARSE but nothing
604 ;; defines it.
605 "CPPFLAGS=-DHAVE_ARGP_PARSE")
606 #:phases
607 (modify-phases %standard-phases
608 (add-after 'unpack 'disable-failing-tests
609 (lambda _
610 ;; FIXME: Most tests won't run in a chroot, presumably because
611 ;; /etc/profile is missing, and thus clients get an empty $PATH
612 ;; and nothing works. Run only the subset that passes.
613 (delete-file "configure") ;force rebootstrap
614 (substitute* "src/testsuite/Makefile.am"
615 (("seed-test \\\\") ;prevent trailing slash
616 "seed-test")
617 (("^\t(lsh|daemon|tcpip|socks|lshg|lcp|rapid7|lshd).*test.*")
618 ""))
619 #t))
620 (add-before 'configure 'pre-configure
621 (lambda* (#:key inputs #:allow-other-keys)
622 (let* ((nettle (assoc-ref inputs "nettle"))
623 (sexp-conv (string-append nettle "/bin/sexp-conv")))
624 ;; Remove argp from the list of sub-directories; we don't want
625 ;; to build it, really.
626 (substitute* "src/Makefile.in"
627 (("^SUBDIRS = argp")
628 "SUBDIRS ="))
629
630 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
631 ;; by default.
632 (substitute* "src/environ.h.in"
633 (("^#define PATH_SEXP_CONV.*")
634 (string-append "#define PATH_SEXP_CONV \""
635 sexp-conv "\"\n")))
636
637 ;; Same for the 'lsh-authorize' script.
638 (substitute* "src/lsh-authorize"
639 (("=sexp-conv")
640 (string-append "=" sexp-conv)))
641
642 ;; Tell lshd where 'xauth' lives. Another option would be to
643 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
644 ;; reducing the closure size, but that wouldn't work on foreign
645 ;; distros.
646 (with-fluids ((%default-port-encoding "ISO-8859-1"))
647 (substitute* "src/server_x11.c"
648 (("define XAUTH_PROGRAM.*")
649 (string-append "define XAUTH_PROGRAM \""
650 (assoc-ref inputs "xauth")
651 "/bin/xauth\"\n")))))
652
653 ;; Tests rely on $USER being set.
654 (setenv "USER" "guix"))))))
655 (home-page "https://www.lysator.liu.se/~nisse/lsh/")
656 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
657 (description
658 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
659 used to create a secure line of communication between two computers,
660 providing shell access to the server system from the client. It provides
661 both the server daemon and the client application, as well as tools for
662 manipulating key files.")
663 (license license:gpl2+)))
664
665 (define-public sshpass
666 (package
667 (name "sshpass")
668 (version "1.06")
669 (synopsis "Non-interactive password authentication with SSH")
670 (home-page "https://sourceforge.net/projects/sshpass/")
671 (source
672 (origin
673 (method url-fetch)
674 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
675 version "/sshpass-" version ".tar.gz"))
676 (sha256
677 (base32
678 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
679 (build-system gnu-build-system)
680 (description "sshpass is a tool for non-interactively performing password
681 authentication with SSH's so-called @dfn{interactive keyboard password
682 authentication}.")
683 (license license:gpl2+)))
684
685 (define-public autossh
686 (package
687 (name "autossh")
688 (version "1.4g")
689 (source
690 (origin
691 (method url-fetch)
692 (uri (string-append
693 "https://www.harding.motd.ca/autossh/autossh-"
694 version ".tgz"))
695 (sha256
696 (base32 "0xqjw8df68f4kzkns5gcah61s5wk0m44qdk2z1d6388w6viwxhsz"))))
697 (build-system gnu-build-system)
698 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
699 (inputs `(("openssh" ,openssh)))
700 (synopsis "Automatically restart SSH sessions and tunnels")
701 (description "autossh is a program to start a copy of @command{ssh} and
702 monitor it, restarting it as necessary should it die or stop passing traffic.")
703 (home-page "https://www.harding.motd.ca/autossh/")
704 (license
705 ;; Why point to a source file? Well, all the individual files have a
706 ;; copy of this license in their headers, but there's no separate file
707 ;; with that information.
708 (license:non-copyleft "file://autossh.c"))))
709
710 (define-public pdsh
711 (package
712 (name "pdsh")
713 (version "2.34")
714 (source
715 (origin
716 (method url-fetch)
717 (uri (string-append "https://github.com/chaos/pdsh/"
718 "releases/download/pdsh-" version
719 "/pdsh-" version ".tar.gz"))
720 (sha256
721 (base32 "1s91hmhrz7rfb6h3l5k97s393rcm1ww3svp8dx5z8vkkc933wyxl"))))
722 (build-system gnu-build-system)
723 (arguments
724 `(#:configure-flags
725 (list "--with-ssh")
726 #:phases
727 (modify-phases %standard-phases
728 (add-after 'unpack 'patch-/bin/sh
729 (lambda _
730 (substitute* '("tests/t0006-pdcp.sh"
731 "tests/t0004-module-loading.sh"
732 "tests/t2001-ssh.sh"
733 "tests/t1003-slurm.sh"
734 "tests/t6036-long-output-lines.sh"
735 "tests/aggregate-results.sh"
736 "tests/t2000-exec.sh"
737 "tests/t0002-internal.sh"
738 "tests/t1002-dshgroup.sh"
739 "tests/t5000-dshbak.sh"
740 "tests/t0001-basic.sh"
741 "tests/t0005-rcmd_type-and-user.sh"
742 "tests/test-lib.sh"
743 "tests/t2002-mrsh.sh"
744 "tests/t0003-wcoll.sh"
745 "tests/test-modules/pcptest.c")
746 (("/bin/sh") (which "bash")))
747 #t))
748 (add-after 'unpack 'patch-tests
749 (lambda _
750 (substitute* "tests/t6036-long-output-lines.sh"
751 (("which") (which "which")))
752 #t)))))
753 (inputs
754 `(("openssh" ,openssh)
755 ("mit-krb5" ,mit-krb5)
756 ("perl" ,perl)))
757 (native-inputs
758 `(("which" ,which)))
759 (home-page "https://github.com/chaos/pdsh")
760 (synopsis "Parallel distributed shell")
761 (description "Pdsh is a an efficient, multithreaded remote shell client
762 which executes commands on multiple remote hosts in parallel. Pdsh implements
763 dynamically loadable modules for extended functionality such as new remote
764 shell services and remote host selection.")
765 (license license:gpl2+)))
766
767 (define-public python-asyncssh
768 (package
769 (name "python-asyncssh")
770 (version "2.3.0")
771 (source
772 (origin
773 (method url-fetch)
774 (uri (pypi-uri "asyncssh" version))
775 (sha256
776 (base32
777 "0pi6npmsgx7l9r1qrfvg8mxx3i23ipff492xz4yhrw13f56a7ga4"))))
778 (build-system python-build-system)
779 (propagated-inputs
780 `(("python-cryptography" ,python-cryptography)
781 ("python-pyopenssl" ,python-pyopenssl)
782 ("python-gssapi" ,python-gssapi)
783 ("python-bcrypt" ,python-bcrypt)))
784 (native-inputs
785 `(("openssh" ,openssh)
786 ("openssl" ,openssl)))
787 (arguments
788 `(#:phases
789 (modify-phases %standard-phases
790 (add-after 'unpack 'disable-tests
791 (lambda* _
792 (substitute* "tests/test_agent.py"
793 ;; TODO Test fails for unknown reason
794 (("(.+)async def test_confirm" all indent)
795 (string-append indent "@unittest.skip('disabled by guix')\n"
796 indent "async def test_confirm")))
797 #t)))))
798 (home-page "https://asyncssh.readthedocs.io/")
799 (synopsis "Asynchronous SSHv2 client and server library for Python")
800 (description
801 "AsyncSSH is a Python package which provides an asynchronous client and
802 server implementation of the SSHv2 protocol on top of the Python 3.6+ asyncio
803 framework.")
804 (license license:epl2.0)))
805
806 (define-public clustershell
807 (package
808 (name "clustershell")
809 (version "1.8.3")
810 (source
811 (origin
812 (method url-fetch)
813 (uri (string-append "https://github.com/cea-hpc/clustershell/releases"
814 "/download/v" version
815 "/ClusterShell-" version ".tar.gz"))
816 (sha256
817 (base32 "1qdcgh733szwj9r1gambrgfkizvbjci0bnnkds9a8mnyb3sasnan"))))
818 (build-system python-build-system)
819 (inputs `(("openssh" ,openssh)))
820 (propagated-inputs `(("python-pyyaml" ,python-pyyaml)))
821 (arguments
822 `(#:phases (modify-phases %standard-phases
823 (add-before 'build 'record-openssh-file-name
824 (lambda* (#:key inputs #:allow-other-keys)
825 (let ((ssh (assoc-ref inputs "openssh")))
826 (substitute* "lib/ClusterShell/Worker/Ssh.py"
827 (("info\\(\"ssh_path\"\\) or \"ssh\"")
828 (string-append "info(\"ssh_path\") or \""
829 ssh "/bin/ssh\"")))
830 #t))))))
831 (home-page "https://cea-hpc.github.io/clustershell/")
832 (synopsis "Scalable event-driven Python framework for cluster administration")
833 (description
834 "ClusterShell is an event-driven Python framework, designed to run local
835 or distant commands in parallel on server farms or on large GNU/Linux
836 clusters. It will take care of common issues encountered on HPC clusters,
837 such as operating on groups of nodes, running distributed commands using
838 optimized execution algorithms, as well as gathering results and merging
839 identical outputs, or retrieving return codes. ClusterShell takes advantage
840 of existing remote shell facilities such as SSH.")
841 (license license:lgpl2.1+)))
842
843 (define-public endlessh
844 (package
845 (name "endlessh")
846 (version "1.1")
847 (source
848 (origin
849 (method git-fetch)
850 (uri (git-reference
851 (url "https://github.com/skeeto/endlessh")
852 (commit version)))
853 (file-name (git-file-name name version))
854 (sha256
855 (base32 "0ziwr8j1frsp3dajr8h5glkm1dn5cci404kazz5w1jfrp0736x68"))))
856 (build-system gnu-build-system)
857 (arguments
858 '(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
859 "CC=gcc")
860 #:tests? #f ; no test target
861 #:phases
862 (modify-phases %standard-phases
863 (delete 'configure)))) ; no configure script
864 (home-page "https://github.com/skeeto/endlessh")
865 (synopsis "SSH tarpit that slowly sends an endless banner")
866 (description
867 "Endlessh is an SSH tarpit that very slowly sends an endless, random SSH
868 banner. It keeps SSH clients locked up for hours or even days at a time. The
869 purpose is to put your real SSH server on another port and then let the script
870 kiddies get stuck in this tarpit instead of bothering a real server.
871
872 Since the tarpit is in the banner before any cryptographic exchange occurs, this
873 program doesn't depend on any cryptographic libraries. It's a simple,
874 single-threaded, standalone C program. It uses @code{poll()} to trap multiple
875 clients at a time.")
876 (license license:unlicense)))
877
878 (define-public webssh
879 (package
880 (name "webssh")
881 (version "1.5.2")
882 (source (origin
883 (method git-fetch)
884 (uri (git-reference
885 (url "https://github.com/huashengdun/webssh")
886 (commit (string-append "v" version))))
887 (file-name (git-file-name name version))
888 (sha256
889 (base32
890 "1l4bwzaifsd6pl120d400qkhvaznj2ck1lvwg76ycb08jsk6gpaz"))))
891 (build-system python-build-system)
892 (propagated-inputs
893 `(("python-paramiko" ,python-paramiko)
894 ("python-tornado" ,python-tornado)))
895 (home-page "https://webssh.huashengdun.org/")
896 (synopsis "Web application to be used as an SSH client")
897 (description "This package provides a web application to be used as an SSH
898 client.
899
900 Features:
901 @itemize @bullet
902 @item SSH password authentication supported, including empty password.
903 @item SSH public-key authentication supported, including DSA RSA ECDSA
904 Ed25519 keys.
905 @item Encrypted keys supported.
906 @item Two-Factor Authentication (time-based one-time password) supported.
907 @item Fullscreen terminal supported.
908 @item Terminal window resizable.
909 @item Auto detect the ssh server's default encoding.
910 @item Modern browsers are supported.
911 @end itemize")
912 (license license:expat)))