1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages ssh)
21 #:use-module ((guix licenses)
22 #:renamer (symbol-prefix-proc 'license:))
23 #:use-module (gnu packages compression)
24 #:use-module (gnu packages gnupg)
25 #:use-module (gnu packages groff)
26 #:use-module (gnu packages openssl)
27 #:use-module (gnu packages elf)
28 #:use-module (gnu packages guile)
29 #:use-module (gnu packages pkg-config)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages texinfo)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages ncurses)
34 #:autoload (gnu packages protobuf) (protobuf)
35 #:autoload (gnu packages boost) (boost)
36 #:use-module (gnu packages which)
37 #:use-module (gnu packages)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system cmake))
49 (uri (string-append "https://red.libssh.org/attachments/download/87/libssh-"
53 "1jyaj9h1iglvn02hrvcchbx8ycjpj8b91h8mi459k7q5jp2xgd9b"))))
54 (build-system cmake-build-system)
56 '(#:configure-flags '("-DWITH_GCRYPT=ON")
58 ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
60 (inputs `(("zlib" ,zlib)
61 ;; Link against an older gcrypt, because libssh tries to access
62 ;; fields of 'gcry_thread_cbs' that are now private:
63 ;; src/threads.c:72:26: error: 'struct gcry_thread_cbs' has no member named 'mutex_init'
64 ("libgcrypt", libgcrypt-1.5)))
65 (native-inputs `(("patchelf" ,patchelf)))
66 (synopsis "SSH client library")
68 "libssh is a C library implementing the SSHv2 and SSHv1 protocol for
69 client and server implementations. With libssh, you can remotely execute
70 programs, transfer files, and use a secure and transparent tunnel for your
71 remote applications.")
72 (home-page "http://www.libssh.org")
73 (license license:lgpl2.1+)))
75 (define libssh-0.5 ; kept private
76 (package (inherit libssh)
80 (uri (string-append "https://red.libssh.org/attachments/download/51/libssh-"
84 "17cfdff4hc0ijzrr15biq29fiabafz0bw621zlkbwbc1zh2hzpy0"))
85 (patches (list (search-patch "libssh-CVE-2014-0017.patch")))))))
87 (define-public libssh2
94 "http://www.libssh2.org/download/libssh2-"
97 "0vdr478dbhbdgnniqmirawjb7mrcxckn4slhhrijxnzrkmgziipa"))))
98 (build-system gnu-build-system)
99 ;; The installed libssh2.pc file does not include paths to libgcrypt and
100 ;; zlib libraries, so we need to propagate the inputs.
101 (propagated-inputs `(("libgcrypt" ,libgcrypt)
103 (arguments '(#:configure-flags `("--with-libgcrypt")))
104 (synopsis "libssh2, a client-side C library implementing the SSH2 protocol")
106 "libssh2 is a library intended to allow software developers access to
107 the SSH-2 protocol in an easy-to-use self-contained package. It can be built
108 into an application to perform many different tasks when communicating with
109 a server that supports the SSH-2 protocol.")
110 (license license:bsd-3)
111 (home-page "http://www.libssh2.org/")))
113 (define-public openssh
119 (uri (let ((tail (string-append name "-" version ".tar.gz")))
120 (list (string-append "ftp://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
122 (string-append "ftp://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/"
125 "1fq3w86q05y5nn6z878wm312k0svaprw8k007188fd259dkg1ha8"))))
126 (build-system gnu-build-system)
127 (inputs `(("groff" ,groff)
131 `(#:test-target "tests"
134 'configure 'reset-/var/empty
135 (lambda* (#:key outputs #:allow-other-keys)
136 (let ((out (assoc-ref outputs "out")))
137 (substitute* "Makefile"
138 (("PRIVSEP_PATH=/var/empty")
139 (string-append "PRIVSEP_PATH=" out "/var/empty")))))
143 ;; remove tests that require the user sshd
144 (substitute* "regress/Makefile"
145 (("t10 t-exec") "t10")))
148 (lambda* (#:key (make-flags '()) #:allow-other-keys)
149 ;; install without host keys and system configuration files
150 (zero? (apply system* "make" "install-nosysconf" make-flags)))
151 %standard-phases)))))
152 (synopsis "OpenSSH, a client and server for the secure shell (ssh) protocol")
154 "The SSH2 protocol implemented in OpenSSH is standardised by the
155 IETF secsh working group and is specified in several RFCs and drafts.
156 It is composed of three layered components:
158 The transport layer provides algorithm negotiation and a key exchange.
159 The key exchange includes server authentication and results in a
160 cryptographically secured connection: it provides integrity, confidentiality
161 and optional compression.
163 The user authentication layer uses the established connection and relies on
164 the services provided by the transport layer. It provides several mechanisms
165 for user authentication. These include traditional password authentication
166 as well as public-key or host-based authentication mechanisms.
168 The connection layer multiplexes many different concurrent channels over the
169 authenticated connection and allows tunneling of login sessions and
170 TCP-forwarding. It provides a flow control service for these channels.
171 Additionally, various channel-specific options can be negotiated.")
172 (license (license:bsd-style "file://LICENSE"
173 "See LICENSE in the distribution."))
174 (home-page "http://www.openssh.org/")))
176 (define-public guile-ssh
183 "https://github.com/artyom-poptsov/libguile-ssh/archive/v"
187 "1v4y5vrwg0g6804pzbr160zahlqvj7k7iwys2bdpfzp7m2i47siq"))))
188 (build-system gnu-build-system)
190 '(#:phases (alist-cons-before
191 'configure 'autoreconf
192 (lambda* (#:key inputs #:allow-other-keys)
193 (substitute* "ssh/Makefile.am"
194 (("-lssh_threads" match)
195 (string-append "-L" (assoc-ref inputs "libssh")
198 (zero? (system* "autoreconf" "-vfi")))
200 'install 'fix-libguile-ssh-file-name
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let* ((out (assoc-ref outputs "out"))
203 (libdir (string-append out "/lib"))
204 (guiledir (string-append out
205 "/share/guile/site/2.0")))
206 (substitute* (find-files guiledir ".scm")
207 (("\"libguile-ssh\"")
208 (string-append "\"" libdir "/libguile-ssh\"")))
210 ;; Make sure it works.
211 (setenv "GUILE_LOAD_PATH" guiledir)
212 (setenv "GUILE_LOAD_COMPILED_PATH" guiledir)
213 (system* "guile" "-c" "(use-modules (ssh session))")))
215 #:configure-flags (list (string-append "--with-guilesitedir="
216 (assoc-ref %outputs "out")
217 "/share/guile/site/2.0"))
219 ;; Building the .go requires building libguile-ssh.so first.
222 ;; Tests are not parallel-safe.
223 #:parallel-tests? #f))
224 (native-inputs `(("autoconf" ,autoconf)
225 ("automake" ,automake)
226 ("libtool" ,libtool "bin")
228 ("pkg-config" ,pkg-config)
230 (inputs `(("guile" ,guile-2.0)
231 ("libssh" ,libssh-0.5)))
232 (synopsis "Guile bindings to libssh")
234 "Guile-SSH is a library that provides access to the SSH protocol for
235 programs written in GNU Guile interpreter. It is a wrapper to the underlying
237 (home-page "https://github.com/artyom-poptsov/libguile-ssh")
238 (license license:gpl3+)))
240 (define-public corkscrew
247 (uri (string-append "http://www.agroman.net/corkscrew/corkscrew-"
250 "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd"))))
251 (build-system gnu-build-system)
253 ;; Replace configure phase as the ./configure script does not link
254 ;; CONFIG_SHELL and SHELL passed as parameters
258 (lambda* (#:key outputs inputs system target
259 #:allow-other-keys #:rest args)
260 (let* ((configure (assoc-ref %standard-phases 'configure))
261 (prefix (assoc-ref outputs "out"))
262 (bash (which "bash"))
263 ;; Set --build and --host flags as the provided config.guess
264 ;; is not able to detect them
265 (flags `(,(string-append "--prefix=" prefix)
266 ,(string-append "--build=" system)
267 ,(string-append "--host="
268 (or target system)))))
269 (setenv "CONFIG_SHELL" bash)
270 (zero? (apply system* bash
271 (string-append "." "/configure")
274 (home-page "http://www.agroman.net/corkscrew")
275 (synopsis "A tool for tunneling SSH through HTTP proxies")
277 "Corkscrew allows creating TCP tunnels through HTTP proxies. WARNING:
278 At the moment only plain text authentication is supported, should you require
279 to use it with your HTTP proxy. Digest based authentication may be supported
280 in future and NTLM based authentication is most likey never be supported.")
281 (license license:gpl2+)))
289 (uri (string-append "http://mosh.mit.edu/mosh-"
293 "0inzfmqrab3n97m7rrmhd4xh3hjz0xva2sfl5m06w11668r0skg7"))))
294 (build-system gnu-build-system)
296 '(#:phases (alist-cons-after
298 (lambda* (#:key outputs #:allow-other-keys)
299 ;; Make sure 'mosh' can find 'mosh-client' and
301 (let* ((out (assoc-ref outputs "out"))
302 (bin (string-append out "/bin")))
303 (wrap-program (string-append bin "/mosh")
304 `("PATH" ":" prefix (,bin)))))
307 `(("pkg-config" ,pkg-config)))
309 `(("openssl" ,openssl)
311 ("perl-io-tty" ,perl-io-tty)
314 ("protobuf" ,protobuf)
315 ("boost-headers" ,boost)))
316 (home-page "http://mosh.mit.edu/")
317 (synopsis "Remote shell tolerant to intermittent connectivity")
319 "Remote terminal application that allows roaming, supports intermittent
320 connectivity, and provides intelligent local echo and line editing of user
321 keystrokes. Mosh is a replacement for SSH. It's more robust and responsive,
322 especially over Wi-Fi, cellular, and long-distance links.")
323 (license license:gpl3+)))
325 (define-public dropbear
332 "http://matt.ucc.asn.au/" name "/releases/" name "-" version ".tar.bz2"))
334 (base32 "1bjpbg2vi5f332q4bqxkidkjfxsqmnqvp4g1wyh8d99b8gg94nar"))))
335 (build-system gnu-build-system)
336 (arguments `(#:tests? #f)) ; There is no "make check" or anything similar
337 (inputs `(("zlib" ,zlib)))
338 (synopsis "Small SSH server and client")
339 (description "Dropbear is a relatively small SSH server and
340 client. It runs on a variety of POSIX-based platforms. Dropbear is
341 particularly useful for embedded systems, such as wireless routers.")
342 (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html")
343 (license (license:x11-style "" "See file LICENSE."))))