| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr> |
| 3 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; |
| 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. |
| 11 | ;;; |
| 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. |
| 16 | ;;; |
| 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/>. |
| 19 | |
| 20 | (define-module (gnu packages ssh) |
| 21 | #:use-module ((guix licenses) #:prefix license:) |
| 22 | #:use-module (gnu packages compression) |
| 23 | #:use-module (gnu packages gnupg) |
| 24 | #:use-module (gnu packages groff) |
| 25 | #:use-module (gnu packages elf) |
| 26 | #:use-module (gnu packages guile) |
| 27 | #:use-module (gnu packages pkg-config) |
| 28 | #:use-module (gnu packages autotools) |
| 29 | #:use-module (gnu packages texinfo) |
| 30 | #:use-module (gnu packages perl) |
| 31 | #:use-module (gnu packages ncurses) |
| 32 | #:autoload (gnu packages protobuf) (protobuf) |
| 33 | #:autoload (gnu packages boost) (boost) |
| 34 | #:use-module (gnu packages base) |
| 35 | #:use-module (gnu packages tls) |
| 36 | #:use-module (gnu packages) |
| 37 | #:use-module (guix packages) |
| 38 | #:use-module (guix download) |
| 39 | #:use-module (guix git-download) |
| 40 | #:use-module (guix build-system gnu) |
| 41 | #:use-module (guix build-system cmake)) |
| 42 | |
| 43 | (define-public libssh |
| 44 | (package |
| 45 | (name "libssh") |
| 46 | (version "0.6.5") |
| 47 | (source (origin |
| 48 | (method url-fetch) |
| 49 | (uri (string-append |
| 50 | "https://red.libssh.org/attachments/download/121/libssh-" |
| 51 | version ".tar.xz")) |
| 52 | (sha256 |
| 53 | (base32 |
| 54 | "0b6wyx6bwbb8jpn8x4rhlrdiqwqrwrs0mxjmrnqykm9kw1ijgm8g")))) |
| 55 | (build-system cmake-build-system) |
| 56 | (arguments |
| 57 | '(#:configure-flags '("-DWITH_GCRYPT=ON") |
| 58 | |
| 59 | ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite. |
| 60 | #:tests? #f)) |
| 61 | (inputs `(("zlib" ,zlib) |
| 62 | ("libgcrypt", libgcrypt))) |
| 63 | (synopsis "SSH client library") |
| 64 | (description |
| 65 | "libssh is a C library implementing the SSHv2 and SSHv1 protocol for |
| 66 | client and server implementations. With libssh, you can remotely execute |
| 67 | programs, transfer files, and use a secure and transparent tunnel for your |
| 68 | remote applications.") |
| 69 | (home-page "http://www.libssh.org") |
| 70 | (license license:lgpl2.1+))) |
| 71 | |
| 72 | (define libssh-0.5 ; kept private |
| 73 | (package (inherit libssh) |
| 74 | (version "0.5.5") |
| 75 | (source (origin |
| 76 | (method url-fetch) |
| 77 | (uri (string-append "https://red.libssh.org/attachments/download/51/libssh-" |
| 78 | version ".tar.gz")) |
| 79 | (sha256 |
| 80 | (base32 |
| 81 | "17cfdff4hc0ijzrr15biq29fiabafz0bw621zlkbwbc1zh2hzpy0")) |
| 82 | (patches (list (search-patch "libssh-CVE-2014-0017.patch"))))))) |
| 83 | |
| 84 | (define-public libssh2 |
| 85 | (package |
| 86 | (name "libssh2") |
| 87 | (version "1.4.3") |
| 88 | (source (origin |
| 89 | (method url-fetch) |
| 90 | (uri (string-append |
| 91 | "http://www.libssh2.org/download/libssh2-" |
| 92 | version ".tar.gz")) |
| 93 | (sha256 (base32 |
| 94 | "0vdr478dbhbdgnniqmirawjb7mrcxckn4slhhrijxnzrkmgziipa")))) |
| 95 | (build-system gnu-build-system) |
| 96 | ;; The installed libssh2.pc file does not include paths to libgcrypt and |
| 97 | ;; zlib libraries, so we need to propagate the inputs. |
| 98 | (propagated-inputs `(("libgcrypt" ,libgcrypt) |
| 99 | ("zlib" ,zlib))) |
| 100 | (arguments '(#:configure-flags `("--with-libgcrypt"))) |
| 101 | (synopsis "Client-side C library implementing the SSH2 protocol") |
| 102 | (description |
| 103 | "libssh2 is a library intended to allow software developers access to |
| 104 | the SSH-2 protocol in an easy-to-use self-contained package. It can be built |
| 105 | into an application to perform many different tasks when communicating with |
| 106 | a server that supports the SSH-2 protocol.") |
| 107 | (license license:bsd-3) |
| 108 | (home-page "http://www.libssh2.org/"))) |
| 109 | |
| 110 | (define-public openssh |
| 111 | (package |
| 112 | (name "openssh") |
| 113 | (version "7.0p1") |
| 114 | (source (origin |
| 115 | (method url-fetch) |
| 116 | (uri (let ((tail (string-append name "-" version ".tar.gz"))) |
| 117 | (list (string-append "http://openbsd.cs.fau.de/pub/OpenBSD/OpenSSH/portable/" |
| 118 | tail) |
| 119 | (string-append "http://ftp.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/" |
| 120 | tail) |
| 121 | (string-append "http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/" |
| 122 | tail)))) |
| 123 | (sha256 (base32 |
| 124 | "1rc52jyc5v5b8j9kvasrnz9vnj9b0i7fw4nqac8wix0r794k4ngx")))) |
| 125 | (build-system gnu-build-system) |
| 126 | (inputs `(("groff" ,groff) |
| 127 | ("openssl" ,openssl) |
| 128 | ("zlib" ,zlib))) |
| 129 | (arguments |
| 130 | `(#:test-target "tests" |
| 131 | #:phases |
| 132 | (alist-cons-after |
| 133 | 'configure 'reset-/var/empty |
| 134 | (lambda* (#:key outputs #:allow-other-keys) |
| 135 | (let ((out (assoc-ref outputs "out"))) |
| 136 | (substitute* "Makefile" |
| 137 | (("PRIVSEP_PATH=/var/empty") |
| 138 | (string-append "PRIVSEP_PATH=" out "/var/empty"))))) |
| 139 | (alist-cons-before |
| 140 | 'check 'patch-tests |
| 141 | (lambda _ |
| 142 | ;; remove 't-exec' regress target which requires user 'sshd' |
| 143 | (substitute* "regress/Makefile" |
| 144 | (("^(REGRESS_TARGETS=.*) t-exec(.*)" all pre post) |
| 145 | (string-append pre post)))) |
| 146 | (alist-replace |
| 147 | 'install |
| 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 "Client and server for the secure shell (ssh) protocol") |
| 153 | (description |
| 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: |
| 157 | |
| 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. |
| 162 | |
| 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. |
| 167 | |
| 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:non-copyleft "file://LICENSE" |
| 173 | "See LICENSE in the distribution.")) |
| 174 | (home-page "http://www.openssh.org/"))) |
| 175 | |
| 176 | (define-public guile-ssh |
| 177 | (package |
| 178 | (name "guile-ssh") |
| 179 | (version "0.8.0") |
| 180 | (source (origin |
| 181 | ;; ftp://memory-heap.org/software/guile-ssh/guile-ssh-VERSION.tar.gz |
| 182 | ;; exists, but the server appears to be too slow and unreliable. |
| 183 | (method git-fetch) |
| 184 | (uri (git-reference |
| 185 | (url "https://github.com/artyom-poptsov/libguile-ssh.git") |
| 186 | (commit (string-append "v" version)))) |
| 187 | (sha256 |
| 188 | (base32 |
| 189 | "1ld2khzylaylhqfsfcvbxs95frvm8pkr7dq40ia1wwn9c349fcdv")))) |
| 190 | (build-system gnu-build-system) |
| 191 | (arguments |
| 192 | '(#:phases (alist-cons-after |
| 193 | 'unpack 'autoreconf |
| 194 | (lambda* (#:key inputs #:allow-other-keys) |
| 195 | (chmod "doc/version.texi" #o777) ;make it writable |
| 196 | (zero? (system* "autoreconf" "-vfi"))) |
| 197 | (alist-cons-after |
| 198 | 'install 'fix-libguile-ssh-file-name |
| 199 | (lambda* (#:key outputs #:allow-other-keys) |
| 200 | (let* ((out (assoc-ref outputs "out")) |
| 201 | (libdir (string-append out "/lib")) |
| 202 | (guiledir (string-append out |
| 203 | "/share/guile/site/2.0"))) |
| 204 | (substitute* (find-files guiledir ".scm") |
| 205 | (("\"libguile-ssh\"") |
| 206 | (string-append "\"" libdir "/libguile-ssh\""))) |
| 207 | |
| 208 | ;; Make sure it works. |
| 209 | (setenv "GUILE_LOAD_PATH" guiledir) |
| 210 | (setenv "GUILE_LOAD_COMPILED_PATH" guiledir) |
| 211 | (zero? |
| 212 | (system* "guile" "-c" "(use-modules (ssh session))")))) |
| 213 | %standard-phases)) |
| 214 | #:configure-flags (list (string-append "--with-guilesitedir=" |
| 215 | (assoc-ref %outputs "out") |
| 216 | "/share/guile/site/2.0")) |
| 217 | |
| 218 | ;; Tests are not parallel-safe. |
| 219 | #:parallel-tests? #f)) |
| 220 | (native-inputs `(("autoconf" ,autoconf) |
| 221 | ("automake" ,automake) |
| 222 | ("libtool" ,libtool) |
| 223 | ("texinfo" ,texinfo) |
| 224 | ("pkg-config" ,pkg-config) |
| 225 | ("which" ,which))) |
| 226 | (inputs `(("guile" ,guile-2.0) |
| 227 | ("libssh" ,libssh) |
| 228 | ("libgcrypt" ,libgcrypt))) |
| 229 | (synopsis "Guile bindings to libssh") |
| 230 | (description |
| 231 | "Guile-SSH is a library that provides access to the SSH protocol for |
| 232 | programs written in GNU Guile interpreter. It is a wrapper to the underlying |
| 233 | libssh library.") |
| 234 | (home-page "https://github.com/artyom-poptsov/libguile-ssh") |
| 235 | (license license:gpl3+))) |
| 236 | |
| 237 | (define-public corkscrew |
| 238 | (package |
| 239 | (name "corkscrew") |
| 240 | (version "2.0") |
| 241 | (source |
| 242 | (origin |
| 243 | (method url-fetch) |
| 244 | (uri (string-append "http://www.agroman.net/corkscrew/corkscrew-" |
| 245 | version ".tar.gz")) |
| 246 | (sha256 (base32 |
| 247 | "1gmhas4va6gd70i2x2mpxpwpgww6413mji29mg282jms3jscn3qd")))) |
| 248 | (build-system gnu-build-system) |
| 249 | (arguments |
| 250 | ;; Replace configure phase as the ./configure script does not link |
| 251 | ;; CONFIG_SHELL and SHELL passed as parameters |
| 252 | '(#:phases |
| 253 | (alist-replace |
| 254 | 'configure |
| 255 | (lambda* (#:key outputs inputs system build target |
| 256 | #:allow-other-keys #:rest args) |
| 257 | (let* ((configure (assoc-ref %standard-phases 'configure)) |
| 258 | (prefix (assoc-ref outputs "out")) |
| 259 | (bash (which "bash")) |
| 260 | ;; Set --build and --host flags as the provided config.guess |
| 261 | ;; is not able to detect them |
| 262 | (flags `(,(string-append "--prefix=" prefix) |
| 263 | ,(string-append "--build=" build) |
| 264 | ,(string-append "--host=" (or target build))))) |
| 265 | (setenv "CONFIG_SHELL" bash) |
| 266 | (zero? (apply system* bash |
| 267 | (string-append "." "/configure") |
| 268 | flags)))) |
| 269 | %standard-phases))) |
| 270 | (home-page "http://www.agroman.net/corkscrew") |
| 271 | (synopsis "Tunneling SSH through HTTP proxies") |
| 272 | (description |
| 273 | "Corkscrew allows creating TCP tunnels through HTTP proxies. WARNING: |
| 274 | At the moment only plain text authentication is supported, should you require |
| 275 | to use it with your HTTP proxy. Digest based authentication may be supported |
| 276 | in future and NTLM based authentication is most likey never be supported.") |
| 277 | (license license:gpl2+))) |
| 278 | |
| 279 | (define-public mosh |
| 280 | (package |
| 281 | (name "mosh") |
| 282 | (version "1.2.5") |
| 283 | (source (origin |
| 284 | (method url-fetch) |
| 285 | (uri (string-append "https://mosh.mit.edu/mosh-" |
| 286 | version ".tar.gz")) |
| 287 | (sha256 |
| 288 | (base32 |
| 289 | "1qsb0y882yfgwnpy6f98pi5xqm6kykdsrxzvaal37hs7szjhky0s")))) |
| 290 | (build-system gnu-build-system) |
| 291 | (arguments |
| 292 | '(#:phases (alist-cons-after |
| 293 | 'install 'wrap |
| 294 | (lambda* (#:key outputs #:allow-other-keys) |
| 295 | ;; Make sure 'mosh' can find 'mosh-client' and |
| 296 | ;; 'mosh-server'. |
| 297 | (let* ((out (assoc-ref outputs "out")) |
| 298 | (bin (string-append out "/bin"))) |
| 299 | (wrap-program (string-append bin "/mosh") |
| 300 | `("PATH" ":" prefix (,bin))))) |
| 301 | %standard-phases))) |
| 302 | (native-inputs |
| 303 | `(("pkg-config" ,pkg-config))) |
| 304 | (inputs |
| 305 | `(("openssl" ,openssl) |
| 306 | ("perl" ,perl) |
| 307 | ("perl-io-tty" ,perl-io-tty) |
| 308 | ("zlib" ,zlib) |
| 309 | ("ncurses" ,ncurses) |
| 310 | ("protobuf" ,protobuf) |
| 311 | ("boost-headers" ,boost))) |
| 312 | (home-page "http://mosh.mit.edu/") |
| 313 | (synopsis "Remote shell tolerant to intermittent connectivity") |
| 314 | (description |
| 315 | "Remote terminal application that allows roaming, supports intermittent |
| 316 | connectivity, and provides intelligent local echo and line editing of user |
| 317 | keystrokes. Mosh is a replacement for SSH. It's more robust and responsive, |
| 318 | especially over Wi-Fi, cellular, and long-distance links.") |
| 319 | (license license:gpl3+))) |
| 320 | |
| 321 | (define-public dropbear |
| 322 | (package |
| 323 | (name "dropbear") |
| 324 | (version "2014.63") |
| 325 | (source (origin |
| 326 | (method url-fetch) |
| 327 | (uri (string-append |
| 328 | "http://matt.ucc.asn.au/" name "/releases/" name "-" version ".tar.bz2")) |
| 329 | (sha256 |
| 330 | (base32 "1bjpbg2vi5f332q4bqxkidkjfxsqmnqvp4g1wyh8d99b8gg94nar")))) |
| 331 | (build-system gnu-build-system) |
| 332 | (arguments `(#:tests? #f)) ; There is no "make check" or anything similar |
| 333 | (inputs `(("zlib" ,zlib))) |
| 334 | (synopsis "Small SSH server and client") |
| 335 | (description "Dropbear is a relatively small SSH server and |
| 336 | client. It runs on a variety of POSIX-based platforms. Dropbear is |
| 337 | particularly useful for embedded systems, such as wireless routers.") |
| 338 | (home-page "https://matt.ucc.asn.au/dropbear/dropbear.html") |
| 339 | (license (license:x11-style "" "See file LICENSE.")))) |