gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / ssh.scm
CommitLineData
2fbf053b 1;;; GNU Guix --- Functional package management for GNU
4e847986 2;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
06ed5982 3;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
45f2ffb4 4;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
dec3e015 5;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
78d80c5c 6;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
c777570b 7;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
8caeb117 8;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
aa08ab38 9;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
c9a6a36f 10;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
227dbd84 11;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
b982fb1c 12;;; Copyright © 2017 ng0 <ng0@n0.is>
2fbf053b
AE
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages ssh)
2102ae2e
DC
30 #:use-module (gnu packages)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:autoload (gnu packages boost) (boost)
2fbf053b 34 #:use-module (gnu packages compression)
c9a6a36f 35 #:use-module (gnu packages crypto)
2102ae2e 36 #:use-module (gnu packages elf)
2fbf053b 37 #:use-module (gnu packages gnupg)
2102ae2e 38 #:use-module (gnu packages gperf)
fe0b8a78 39 #:use-module (gnu packages groff)
49d294e5 40 #:use-module (gnu packages guile)
2102ae2e 41 #:use-module (gnu packages linux)
c9a6a36f 42 #:use-module (gnu packages logging)
2102ae2e
DC
43 #:use-module (gnu packages m4)
44 #:use-module (gnu packages multiprecision)
87bf526b 45 #:use-module (gnu packages ncurses)
2102ae2e 46 #:use-module (gnu packages nettle)
89e34644 47 #:use-module (gnu packages kerberos)
2102ae2e
DC
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
c9a6a36f 50 #:use-module (gnu packages popt)
87bf526b 51 #:autoload (gnu packages protobuf) (protobuf)
2102ae2e
DC
52 #:use-module (gnu packages readline)
53 #:use-module (gnu packages texinfo)
cc2b77df 54 #:use-module (gnu packages tls)
2102ae2e
DC
55 #:use-module (gnu packages xorg)
56 #:use-module (guix build-system cmake)
57 #:use-module (guix build-system gnu)
2fbf053b 58 #:use-module (guix download)
817efe8b 59 #:use-module (guix git-download)
2102ae2e 60 #:use-module ((guix licenses) #:prefix license:)
befbaebf
LC
61 #:use-module (guix packages)
62 #:use-module (srfi srfi-1))
1681cd4a
LC
63
64(define-public libssh
4e847986
LC
65 ;; This commit from the 'v0-7' branch contains 7 memory-management-related
66 ;; bug fixes that we'd rather have.
67 (let ((commit "239d0f75b5f909174c2ef7fb08d23bcfa6b20ba0")
68 (revision "0"))
69 (package
70 (name "libssh")
71 (version (git-version "0.7.5" revision commit))
72 (source (origin
73 (method git-fetch)
74 (uri (git-reference
75 (url "https://git.libssh.org/projects/libssh.git")
76 (commit commit)))
77 (sha256
78 (base32
79 "01w72w1jsgs9ilj3n1gp6qkmdxr9n74i5h2nipi3x1vzm7bv8na1"))
80 (patches (search-patches "libssh-hostname-parser-bug.patch"))
81 (file-name (git-file-name name version))))
82 (build-system cmake-build-system)
83 (outputs '("out" "debug"))
84 (arguments
85 '(#:configure-flags '("-DWITH_GCRYPT=ON")
deed349b 86
4e847986
LC
87 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
88 #:tests? #f))
89 (inputs `(("zlib" ,zlib)
90 ("libgcrypt" ,libgcrypt)))
91 (synopsis "SSH client library")
92 (description
93 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for
1681cd4a
LC
94client and server implementations. With libssh, you can remotely execute
95programs, transfer files, and use a secure and transparent tunnel for your
96remote applications.")
4e847986
LC
97 (home-page "https://www.libssh.org")
98 (license license:lgpl2.1+))))
2fbf053b
AE
99
100(define-public libssh2
101 (package
102 (name "libssh2")
5d97f4c7 103 (version "1.8.0")
2fbf053b
AE
104 (source (origin
105 (method url-fetch)
106 (uri (string-append
78d80c5c 107 "https://www.libssh2.org/download/libssh2-"
2fbf053b 108 version ".tar.gz"))
78d80c5c
LF
109 (sha256
110 (base32
ac2d5de3
MB
111 "1m3n8spv79qhjq4yi0wgly5s5rc8783jb1pyra9bkx1md0plxwrr"))
112 (patches
113 (search-patches "libssh2-fix-build-failure-with-gcrypt.patch"))))
2fbf053b 114 (build-system gnu-build-system)
e9c14f37
EB
115 ;; The installed libssh2.pc file does not include paths to libgcrypt and
116 ;; zlib libraries, so we need to propagate the inputs.
117 (propagated-inputs `(("libgcrypt" ,libgcrypt)
118 ("zlib" ,zlib)))
ac2d5de3
MB
119 (arguments '(#:configure-flags `("--with-libgcrypt")
120 #:phases (modify-phases %standard-phases
121 (add-before 'configure 'autoreconf
122 (lambda _
123 (zero? (system* "autoreconf" "-v")))))))
124 (native-inputs `(("autoconf" ,autoconf)
125 ("automake" ,automake)))
35b9e423 126 (synopsis "Client-side C library implementing the SSH2 protocol")
2fbf053b
AE
127 (description
128 "libssh2 is a library intended to allow software developers access to
35b9e423 129the SSH-2 protocol in an easy-to-use self-contained package. It can be built
2fbf053b
AE
130into an application to perform many different tasks when communicating with
131a server that supports the SSH-2 protocol.")
132 (license license:bsd-3)
133 (home-page "http://www.libssh2.org/")))
fe0b8a78
AE
134
135(define-public openssh
136 (package
137 (name "openssh")
072acc61 138 (version "7.6p1")
fe0b8a78 139 (source (origin
644e5f17
TGR
140 (method url-fetch)
141 (uri (string-append "mirror://openbsd/OpenSSH/portable/"
142 name "-" version ".tar.gz"))
143 (sha256
144 (base32
072acc61 145 "08qpsb8mrzcx8wgvz9insiyvq7sbg26yj5nvl2m5n57yvppcl8x3"))))
fe0b8a78 146 (build-system gnu-build-system)
7d3373a0
LF
147 (native-inputs `(("groff" ,groff)))
148 (inputs `(("openssl" ,openssl)
39012aab 149 ("pam" ,linux-pam)
040b6299 150 ("mit-krb5" ,mit-krb5)
683a4a34
LC
151 ("zlib" ,zlib)
152 ("xauth" ,xauth))) ;for 'ssh -X' and 'ssh -Y'
fe0b8a78
AE
153 (arguments
154 `(#:test-target "tests"
040b6299 155 #:configure-flags `("--sysconfdir=/etc/ssh"
39012aab 156
040b6299 157 ;; Default value of 'PATH' used by sshd.
9af49832
LC
158 "--with-default-path=/run/current-system/profile/bin"
159
040b6299
JD
160 ;; configure needs to find krb5-config
161 ,(string-append "--with-kerberos5="
162 (assoc-ref %build-inputs "mit-krb5")
163 "/bin")
164
39012aab
LC
165 ;; Enable PAM support in sshd.
166 "--with-pam")
167
fe0b8a78 168 #:phases
a9ee11d5
RW
169 (modify-phases %standard-phases
170 (add-after 'configure 'reset-/var/empty
171 (lambda* (#:key outputs #:allow-other-keys)
172 (let ((out (assoc-ref outputs "out")))
173 (substitute* "Makefile"
174 (("PRIVSEP_PATH=/var/empty")
175 (string-append "PRIVSEP_PATH=" out "/var/empty")))
176 #t)))
177 (add-before 'check 'patch-tests
178 (lambda _
179 ;; remove 't-exec' regress target which requires user 'sshd'
180 (substitute* "regress/Makefile"
181 (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post)
182 (string-append pre post)))
183 #t))
184 (replace 'install
36f26211 185 (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
a9ee11d5 186 ;; install without host keys and system configuration files
36f26211
RW
187 (and (zero? (apply system* "make" "install-nosysconf" make-flags))
188 (begin
189 (install-file "contrib/ssh-copy-id"
190 (string-append (assoc-ref outputs "out")
191 "/bin/"))
192 (chmod (string-append (assoc-ref outputs "out")
193 "/bin/ssh-copy-id") #o555)
194 (install-file "contrib/ssh-copy-id.1"
195 (string-append (assoc-ref outputs "out")
196 "/share/man/man1/"))
197 #t)))))))
35b9e423 198 (synopsis "Client and server for the secure shell (ssh) protocol")
fe0b8a78
AE
199 (description
200 "The SSH2 protocol implemented in OpenSSH is standardised by the
201IETF secsh working group and is specified in several RFCs and drafts.
202It is composed of three layered components:
203
204The transport layer provides algorithm negotiation and a key exchange.
205The key exchange includes server authentication and results in a
206cryptographically secured connection: it provides integrity, confidentiality
207and optional compression.
208
209The user authentication layer uses the established connection and relies on
35b9e423
EB
210the services provided by the transport layer. It provides several mechanisms
211for user authentication. These include traditional password authentication
fe0b8a78
AE
212as well as public-key or host-based authentication mechanisms.
213
214The connection layer multiplexes many different concurrent channels over the
215authenticated connection and allows tunneling of login sessions and
35b9e423 216TCP-forwarding. It provides a flow control service for these channels.
fe0b8a78 217Additionally, various channel-specific options can be negotiated.")
166191b3 218 (license (license:non-copyleft "file://LICENSE"
fe0b8a78
AE
219 "See LICENSE in the distribution."))
220 (home-page "http://www.openssh.org/")))
221
49d294e5
LC
222(define-public guile-ssh
223 (package
224 (name "guile-ssh")
04b6d6f7 225 (version "0.11.2")
6634180f 226 (home-page "https://github.com/artyom-poptsov/guile-ssh")
49d294e5 227 (source (origin
44fd0994
LC
228 ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz
229 ;; exists, but the server appears to be too slow and unreliable.
6634180f
LC
230 ;; Also, using this URL allows the GitHub updater to work.
231 (method url-fetch)
232 (uri (string-append home-page "/archive/v"
233 version ".tar.gz"))
234 (file-name (string-append name "-" version ".tar.gz"))
49d294e5
LC
235 (sha256
236 (base32
04b6d6f7 237 "1w0k5s09xj5xycb7lbp5b7rm0xncclms3jwl98lwj8fxwngi1s90"))))
49d294e5 238 (build-system gnu-build-system)
74460d11 239 (outputs '("out" "debug"))
49d294e5 240 (arguments
8a8f6590
LC
241 '(#:phases (modify-phases %standard-phases
242 (add-after 'unpack 'autoreconf
243 (lambda* (#:key inputs #:allow-other-keys)
8a8f6590 244 (zero? (system* "autoreconf" "-vfi"))))
92b72582 245 (add-before 'build 'fix-libguile-ssh-file-name
8a8f6590 246 (lambda* (#:key outputs #:allow-other-keys)
92b72582
LC
247 ;; Build and install libguile-ssh.so so that we can use
248 ;; its absolute file name in .scm files, before we build
249 ;; the .go files.
250 (and (zero? (system* "make" "install"
251 "-C" "libguile-ssh"
252 "-j" (number->string
253 (parallel-job-count))))
254 (let* ((out (assoc-ref outputs "out"))
255 (libdir (string-append out "/lib")))
256 (substitute* (find-files "." "\\.scm$")
257 (("\"libguile-ssh\"")
258 (string-append "\"" libdir "/libguile-ssh\"")))
259 #t)))))
00ee3a71 260
afde8da3
LC
261 ;; Tests are not parallel-safe.
262 #:parallel-tests? #f))
49d294e5
LC
263 (native-inputs `(("autoconf" ,autoconf)
264 ("automake" ,automake)
3246cc91 265 ("libtool" ,libtool)
00ee3a71 266 ("texinfo" ,texinfo)
49d294e5
LC
267 ("pkg-config" ,pkg-config)
268 ("which" ,which)))
4d8806c3 269 (inputs `(("guile" ,guile-2.2)
6f9d5b2e 270 ("libssh" ,libssh)
44fd0994 271 ("libgcrypt" ,libgcrypt)))
49d294e5
LC
272 (synopsis "Guile bindings to libssh")
273 (description
274 "Guile-SSH is a library that provides access to the SSH protocol for
275programs written in GNU Guile interpreter. It is a wrapper to the underlying
276libssh library.")
49d294e5 277 (license license:gpl3+)))
513e1950 278
befbaebf 279(define-public guile2.2-ssh
4d8806c3
LC
280 (deprecated-package "guile2.2-ssh" guile-ssh))
281
282(define-public guile2.0-ssh
75c260ba
LC
283 (package
284 (inherit guile-ssh)
4d8806c3
LC
285 (name "guile2.0-ssh")
286 (inputs `(("guile" ,guile-2.0)
75c260ba 287 ,@(alist-delete "guile" (package-inputs guile-ssh))))))
befbaebf 288
513e1950
SHT
289(define-public corkscrew
290 (package
291 (name "corkscrew")
292 (version "2.0")
293 (source
294 (origin
295 (method url-fetch)
040ae44a
TGR
296 ;; The agroman.net domain name expired on 2017-03-23, and the original
297 ;; "http://www.agroman.net/corkscrew/corkscrew-2.0.tar.gz" now returns
298 ;; bogus HTML. Perhaps it will yet return. Until then, use a mirror.
299 (uri (string-append "https://downloads.openwrt.org/sources/"
300 "corkscrew-" version ".tar.gz"))
513e1950
SHT
301 (sha256 (base32
302 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
303 (build-system gnu-build-system)
304 (arguments
305 ;; Replace configure phase as the ./configure script does not link
306 ;; CONFIG_SHELL and SHELL passed as parameters
307 '(#:phases
91c52629
EF
308 (modify-phases %standard-phases
309 (replace 'configure
310 (lambda* (#:key outputs inputs system build target
311 #:allow-other-keys #:rest args)
312 (let* ((configure (assoc-ref %standard-phases 'configure))
313 (prefix (assoc-ref outputs "out"))
314 (bash (which "bash"))
315 ;; Set --build and --host flags as the provided config.guess
316 ;; is not able to detect them
317 (flags `(,(string-append "--prefix=" prefix)
318 ,(string-append "--build=" build)
319 ,(string-append "--host=" (or target build)))))
320 (setenv "CONFIG_SHELL" bash)
321 (zero? (apply system* bash
322 (string-append "." "/configure")
81d95a12
TGR
323 flags)))))
324 (add-after 'install 'install-documentation
325 (lambda* (#:key outputs #:allow-other-keys)
326 (let* ((out (assoc-ref outputs "out"))
327 (doc (string-append out "/share/doc/corkscrew")))
328 (install-file "README" doc)
329 #t))))))
513e1950 330 (home-page "http://www.agroman.net/corkscrew")
10c95711 331 (synopsis "SSH tunneling through HTTP(S) proxies")
513e1950 332 (description
10c95711
TGR
333 "Corkscrew tunnels SSH connections through most HTTP and HTTPS proxies.
334Proxy authentication is only supported through the plain-text HTTP basic
335authentication scheme.")
513e1950 336 (license license:gpl2+)))
87bf526b
LC
337
338(define-public mosh
339 (package
340 (name "mosh")
4b8b245b 341 (version "1.3.2")
87bf526b
LC
342 (source (origin
343 (method url-fetch)
c3671282 344 (uri (string-append "https://mosh.org/mosh-" version ".tar.gz"))
87bf526b
LC
345 (sha256
346 (base32
4b8b245b 347 "05hjhlp6lk8yjcy59zywpf0r6s0h0b9zxq0lw66dh9x8vxrhaq6s"))))
87bf526b
LC
348 (build-system gnu-build-system)
349 (arguments
11379192
EF
350 '(#:phases
351 (modify-phases %standard-phases
352 (add-after 'install 'wrap
353 (lambda* (#:key outputs #:allow-other-keys)
354 ;; Make sure 'mosh' can find 'mosh-client' and
355 ;; 'mosh-server'.
356 (let* ((out (assoc-ref outputs "out"))
357 (bin (string-append out "/bin")))
358 (wrap-program (string-append bin "/mosh")
359 `("PATH" ":" prefix (,bin)))))))))
87bf526b
LC
360 (native-inputs
361 `(("pkg-config" ,pkg-config)))
362 (inputs
363 `(("openssl" ,openssl)
364 ("perl" ,perl)
365 ("perl-io-tty" ,perl-io-tty)
366 ("zlib" ,zlib)
367 ("ncurses" ,ncurses)
368 ("protobuf" ,protobuf)
369 ("boost-headers" ,boost)))
c3671282 370 (home-page "https://mosh.org/")
87bf526b
LC
371 (synopsis "Remote shell tolerant to intermittent connectivity")
372 (description
373 "Remote terminal application that allows roaming, supports intermittent
374connectivity, and provides intelligent local echo and line editing of user
375keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
376especially over Wi-Fi, cellular, and long-distance links.")
377 (license license:gpl3+)))
8c6cfd55 378
c9a6a36f
SR
379(define-public et
380 (package
381 (name "et")
382 (version "3.1.0")
383 (source
384 (origin
385 (method url-fetch)
386 (uri (string-append
387 "https://github.com/MisterTea/EternalTCP/archive/et-v"
388 version ".tar.gz"))
389 (sha256
390 (base32 "1n2w2kqbshdmbb0gz4yizyw9gqfls6qm2dnwx1d9c2hz7hmi7521"))))
391 (build-system cmake-build-system)
392 (arguments `(#:tests? #f))
393 (native-inputs
394 `(("pkg-config" ,pkg-config)))
395 (inputs `(("glog" ,glog)
396 ("gflags" ,gflags)
397 ("libsodium" ,libsodium)
398 ("protobuf" ,protobuf)))
399 (synopsis "Remote shell that automatically reconnects")
400 (description
401 "Eternal Terminal (ET) is a remote shell that automatically reconnects
402without interrupting the session. Unlike SSH sessions, ET sessions will
839ee8d5
TGR
403survive even network outages and IP changes. ET uses a custom protocol over
404TCP, not the SSH protocol.")
c9a6a36f
SR
405 (home-page "https://mistertea.github.io/EternalTCP/")
406 (license license:asl2.0)))
407
8c6cfd55
JD
408(define-public dropbear
409 (package
410 (name "dropbear")
aa08ab38 411 (version "2018.76")
8c6cfd55
JD
412 (source (origin
413 (method url-fetch)
414 (uri (string-append
dec3e015 415 "https://matt.ucc.asn.au/" name "/releases/"
a124bbd2 416 name "-" version ".tar.bz2"))
8c6cfd55 417 (sha256
dec3e015 418 (base32
aa08ab38 419 "0rgavbzw7jrs5wslxm0dnwx2m409yzxd9hazd92r7kx8xikr3yzj"))))
8c6cfd55 420 (build-system gnu-build-system)
aa08ab38 421 (arguments `(#:tests? #f)) ; there is no "make check" or anything similar
8c6cfd55
JD
422 (inputs `(("zlib" ,zlib)))
423 (synopsis "Small SSH server and client")
424 (description "Dropbear is a relatively small SSH server and
35b9e423
EB
425client. It runs on a variety of POSIX-based platforms. Dropbear is
426particularly useful for embedded systems, such as wireless routers.")
8c6cfd55
JD
427 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
428 (license (license:x11-style "" "See file LICENSE."))))
2102ae2e
DC
429
430(define-public liboop
431 (package
432 (name "liboop")
433 (version "1.0")
434 (source
435 (origin
436 (method url-fetch)
437 (uri (string-append "http://download.ofb.net/liboop/liboop-"
438 version ".tar.gz"))
439 (sha256
440 (base32
441 "0z6rlalhvfca64jpvksppc9bdhs7jwhiw4y35g5ibvh91xp3rn1l"))
442 (patches (search-patches "liboop-mips64-deplibs-fix.patch"))))
443 (build-system gnu-build-system)
444 (home-page "http://www.lysator.liu.se/liboop/")
445 (synopsis "Event loop library")
446 (description "Liboop is a low-level event loop management library for
447POSIX-based operating systems. It supports the development of modular,
448multiplexed applications which may respond to events from several sources. It
449replaces the \"select() loop\" and allows the registration of event handlers
450for file and network I/O, timers and signals. Since processes use these
451mechanisms for almost all external communication, liboop can be used as the
452basis for almost any application.")
453 (license license:lgpl2.1+)))
454
455(define-public lsh
456 (package
457 (name "lsh")
458 (version "2.1")
459 (source (origin
460 (method url-fetch)
461 (uri (string-append "mirror://gnu/lsh/lsh-"
462 version ".tar.gz"))
463 (sha256
464 (base32
465 "1qqjy9zfzgny0rkb27c8c7dfsylvb6n0ld8h3an2r83pmaqr9gwb"))
466 (modules '((guix build utils)))
467 (snippet
468 '(begin
469 (substitute* "src/testsuite/functions.sh"
470 (("localhost")
471 ;; Avoid host name lookups since they don't work in
472 ;; chroot builds.
473 "127.0.0.1")
474 (("set -e")
475 ;; Make tests more verbose.
476 "set -e\nset -x"))
477
478 (substitute* (find-files "src/testsuite" "-test$")
479 (("localhost") "127.0.0.1"))
480
481 (substitute* "src/testsuite/login-auth-test"
6cbee49d
MW
482 (("/bin/cat") "cat"))
483 #t))))
2102ae2e
DC
484 (build-system gnu-build-system)
485 (native-inputs
486 `(("m4" ,m4)
487 ("guile" ,guile-2.0)
488 ("gperf" ,gperf)
489 ("psmisc" ,psmisc))) ; for `killall'
490 (inputs
491 `(("nettle" ,nettle-2)
492 ("linux-pam" ,linux-pam)
493
494 ;; 'rl.c' uses the 'CPPFunction' type, which is no longer in
495 ;; Readline 6.3.
496 ("readline" ,readline-6.2)
497
498 ("liboop" ,liboop)
499 ("zlib" ,zlib)
500 ("gmp" ,gmp)
501
502 ;; The server (lshd) invokes xauth when X11 forwarding is requested.
503 ;; This adds 24 MiB (or 27%) to the closure of lsh.
504 ("xauth" ,xauth)))
505 (arguments
506 '(;; Skip the `configure' test that checks whether /dev/ptmx &
507 ;; co. work as expected, because it relies on impurities (for
508 ;; instance, /dev/pts may be unavailable in chroots.)
d5c969ce
LC
509 #:configure-flags '("lsh_cv_sys_unix98_ptys=yes"
510
511 ;; Use glibc's argp rather than the bundled one.
512 "--with-system-argp"
513
514 ;; 'lsh_argp.h' checks HAVE_ARGP_PARSE but nothing
515 ;; defines it.
516 "CPPFLAGS=-DHAVE_ARGP_PARSE")
2102ae2e
DC
517
518 ;; FIXME: Tests won't run in a chroot, presumably because
519 ;; /etc/profile is missing, and thus clients get an empty $PATH
520 ;; and nothing works.
521 #:tests? #f
522
523 #:phases
524 (modify-phases %standard-phases
525 (add-before 'configure 'pre-configure
526 (lambda* (#:key inputs #:allow-other-keys)
527 (let* ((nettle (assoc-ref inputs "nettle"))
528 (sexp-conv (string-append nettle "/bin/sexp-conv")))
d5c969ce
LC
529 ;; Remove argp from the list of sub-directories; we don't want
530 ;; to build it, really.
531 (substitute* "src/Makefile.in"
532 (("^SUBDIRS = argp")
533 "SUBDIRS ="))
534
2102ae2e
DC
535 ;; Make sure 'lsh' and 'lshd' pick 'sexp-conv' in the right place
536 ;; by default.
537 (substitute* "src/environ.h.in"
538 (("^#define PATH_SEXP_CONV.*")
539 (string-append "#define PATH_SEXP_CONV \""
540 sexp-conv "\"\n")))
541
542 ;; Same for the 'lsh-authorize' script.
543 (substitute* "src/lsh-authorize"
544 (("=sexp-conv")
545 (string-append "=" sexp-conv)))
546
547 ;; Tell lshd where 'xauth' lives. Another option would be to
548 ;; hardcode "/run/current-system/profile/bin/xauth", thereby
549 ;; reducing the closure size, but that wouldn't work on foreign
550 ;; distros.
551 (with-fluids ((%default-port-encoding "ISO-8859-1"))
552 (substitute* "src/server_x11.c"
553 (("define XAUTH_PROGRAM.*")
554 (string-append "define XAUTH_PROGRAM \""
555 (assoc-ref inputs "xauth")
556 "/bin/xauth\"\n")))))
557
558 ;; Tests rely on $USER being set.
559 (setenv "USER" "guix"))))))
560 (home-page "http://www.lysator.liu.se/~nisse/lsh/")
561 (synopsis "GNU implementation of the Secure Shell (ssh) protocols")
562 (description
563 "GNU lsh is a free implementation of the SSH version 2 protocol. It is
564used to create a secure line of communication between two computers,
565providing shell access to the server system from the client. It provides
566both the server daemon and the client application, as well as tools for
567manipulating key files.")
568 (license license:gpl2+)))
c777570b
NG
569
570(define-public sshpass
571 (package
572 (name "sshpass")
573 (version "1.06")
574 (synopsis "Non-interactive password authentication with SSH")
575 (home-page "https://sourceforge.net/projects/sshpass/")
576 (source
577 (origin
578 (method url-fetch)
579 (uri (string-append "mirror://sourceforge/sshpass/sshpass/"
580 version "/sshpass-" version ".tar.gz"))
581 (sha256
582 (base32
583 "0q7fblaczb7kwbsz0gdy9267z0sllzgmf0c7z5c9mf88wv74ycn6"))))
584 (build-system gnu-build-system)
585 (description "sshpass is a tool for non-interactivly performing password
586authentication with SSH's so-called @dfn{interactive keyboard password
587authentication}.")
588 (license license:gpl2+)))
8caeb117
CAW
589
590(define-public autossh
591 (package
592 (name "autossh")
593 (version "1.4e")
594 (source
595 (origin
596 (method url-fetch)
597 (uri (string-append
598 "http://www.harding.motd.ca/autossh/autossh-"
599 version ".tgz"))
600 (sha256
601 (base32 "0mlicw28vq2jxa0jf0dys5ja75v0fxpjavlq9dpif6bnknji13ly"))))
602 (build-system gnu-build-system)
603 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
604 (inputs `(("openssh" ,openssh)))
605 (synopsis "Automatically restart SSH sessions and tunnels")
606 (description "autossh is a program to start a copy of @command{ssh} and
607monitor it, restarting it as necessary should it die or stop passing traffic.")
608 (home-page "http://www.harding.motd.ca/autossh/")
609 (license
610 ;; Why point to a source file? Well, all the individual files have a
611 ;; copy of this license in their headers, but there's no separate file
612 ;; with that information.
613 (license:non-copyleft "file://autossh.c"))))
227dbd84
RW
614
615(define-public pdsh
616 (package
617 (name "pdsh")
b982fb1c 618 (version "2.33")
227dbd84
RW
619 (source
620 (origin
621 (method url-fetch)
b982fb1c 622 (uri (string-append "https://github.com/chaos/pdsh/"
623 "releases/download/pdsh-" version
624 "/pdsh-" version ".tar.gz"))
625 (file-name (string-append name "-" version ".tar.gz"))
227dbd84 626 (sha256
b982fb1c 627 (base32 "0bwlkl9inj66iwvafg00pi3sk9n673phdi0kcc59y9nn55s0hs3k"))))
227dbd84
RW
628 (build-system gnu-build-system)
629 (arguments
630 `(#:configure-flags
631 (list "--with-ssh")
632 #:phases
633 (modify-phases %standard-phases
634 (add-after 'unpack 'patch-/bin/sh
635 (lambda _
b982fb1c 636 (substitute* '("tests/t0006-pdcp.sh"
637 "tests/t0004-module-loading.sh"
638 "tests/t2001-ssh.sh"
639 "tests/t1003-slurm.sh"
640 "tests/t6036-long-output-lines.sh"
641 "tests/aggregate-results.sh"
642 "tests/t2000-exec.sh"
643 "tests/t0002-internal.sh"
644 "tests/t1002-dshgroup.sh"
645 "tests/t5000-dshbak.sh"
646 "tests/t0001-basic.sh"
647 "tests/t0005-rcmd_type-and-user.sh"
227dbd84 648 "tests/test-lib.sh"
b982fb1c 649 "tests/t2002-mrsh.sh"
650 "tests/t0003-wcoll.sh"
227dbd84
RW
651 "tests/test-modules/pcptest.c")
652 (("/bin/sh") (which "bash")))
b982fb1c 653 #t))
654 (add-after 'unpack 'patch-tests
655 (lambda _
656 (substitute* "tests/t6036-long-output-lines.sh"
657 (("which") (which "which")))
227dbd84
RW
658 #t)))))
659 (inputs
660 `(("openssh" ,openssh)
661 ("mit-krb5" ,mit-krb5)
662 ("perl" ,perl)))
b982fb1c 663 (native-inputs
664 `(("which" ,which)))
665 (home-page "https://github.com/chaos/pdsh")
227dbd84
RW
666 (synopsis "Parallel distributed shell")
667 (description "Pdsh is a an efficient, multithreaded remote shell client
668which executes commands on multiple remote hosts in parallel. Pdsh implements
669dynamically loadable modules for extended functionality such as new remote
670shell services and remote host selection.")
671 (license license:gpl2+)))