1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
6 ;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
9 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
10 ;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
11 ;;; Copyright © 2019, 2020 Leo Famulari <leo@famulari.name>
12 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
13 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
14 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
16 ;;; This file is part of GNU Guix.
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31 (define-module (gnu packages vpn)
32 #:use-module ((guix licenses) #:prefix license:)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix git-download)
36 #:use-module (guix build-system cmake)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix build-system linux-module)
39 #:use-module (guix build-system python)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages admin)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages check)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages compression)
46 #:use-module (gnu packages gettext)
47 #:use-module (gnu packages gnupg)
48 #:use-module (gnu packages guile)
49 #:use-module (gnu packages libevent)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages nss)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages tls)
57 #:use-module (gnu packages xml))
65 (uri (string-append "mirror://gnu/gvpe/gvpe-"
69 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
70 (build-system gnu-build-system)
71 (home-page "http://software.schmorp.de/pkg/gvpe.html")
72 (native-inputs `(("pkg-config" ,pkg-config)))
73 (inputs `(("openssl" ,openssl)
75 (synopsis "Secure VPN among multiple nodes over an untrusted network")
77 "The GNU Virtual Private Ethernet creates a virtual network
78 with multiple nodes using a variety of transport protocols. It works
79 by creating encrypted host-to-host tunnels between multiple
81 (license license:gpl3+)))
89 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
92 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
93 (build-system gnu-build-system)
94 (inputs `(("libgcrypt" ,libgcrypt)
96 ("vpnc-scripts" ,vpnc-scripts)))
98 `(#:tests? #f ; there is no check target
100 (modify-phases %standard-phases
101 (add-after 'unpack 'use-store-paths
102 (lambda* (#:key inputs outputs #:allow-other-keys)
103 (let ((out (assoc-ref outputs "out"))
104 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
105 (substitute* "config.c"
106 (("/etc/vpnc/vpnc-script")
107 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
108 (substitute* "Makefile"
110 (string-append "ETCDIR=" out "/etc/vpnc\n"))
112 (string-append "PREFIX=" out "\n")))
114 (delete 'configure)))) ; no configure script
115 (synopsis "Client for Cisco VPN concentrators")
117 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
118 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
119 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
120 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
121 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
122 (license license:gpl2+) ; some file are bsd-2, see COPYING
123 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
125 (define-public vpnc-scripts
126 (let ((commit "1000e0f6dd7d6bff163169a46359211c1fc3a6d2"))
128 (name "vpnc-scripts")
129 (version (string-append "20190116." (string-take commit 7)))
134 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
136 (file-name (git-file-name name version))
139 "1g41yarz2bl0f73kbjqnywr485ghanbp7nmspklfb0n07yp0z6ak"))))
140 (build-system gnu-build-system)
141 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
142 ("coreutils" ,coreutils)
144 ("iproute2" ,iproute) ; for ‘ip’
145 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
150 (modify-phases %standard-phases
151 (add-after 'unpack 'use-relative-paths
152 ;; Patch the scripts to work with and use relative paths.
154 (for-each (lambda (script)
158 (("\\[ +-x +([^]]+) +\\]" _ command)
159 (string-append "command -v >/dev/null 2>&1 "
161 (find-files "." "^vpnc-script"))
163 (delete 'configure) ; no configure script
166 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
168 ;; There is no Makefile; manually install the relevant files.
169 (lambda* (#:key outputs #:allow-other-keys)
170 (let* ((out (assoc-ref outputs "out"))
171 (etc (string-append out "/etc/vpnc")))
172 (for-each (lambda (file)
173 (install-file file etc))
174 (append (find-files "." "^vpnc-script")
176 "xinetd.netns.conf")))
178 (add-after 'install 'wrap-scripts
179 ;; Wrap scripts with paths to their common hard dependencies.
180 ;; Optional dependencies will need to be installed by the user.
181 (lambda* (#:key inputs outputs #:allow-other-keys)
182 (let ((out (assoc-ref outputs "out")))
185 (wrap-script (string-append out "/etc/vpnc/" script)
188 (let ((input (assoc-ref inputs name)))
189 (string-append input "/bin:"
197 (list "vpnc-script-ptrtd"
201 #:tests? #f)) ; no tests
202 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
203 (synopsis "Network configuration scripts for Cisco VPN clients")
205 "This set of scripts configures routing and name services when invoked
206 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
208 The default @command{vpnc-script} automatically configures most common
209 connections, and provides hooks for performing custom actions at various stages
210 of the connection or disconnection process.
212 Alternative scripts are provided for more complicated set-ups, or to serve as an
213 example for writing your own. For example, @command{vpnc-script-sshd} contains
214 the entire VPN in a network namespace accessible only through SSH.")
215 (license license:gpl2+))))
217 (define-public ocproxy
224 (url "https://github.com/cernekee/ocproxy.git")
225 (commit (string-append "v" version))))
226 (file-name (git-file-name name version))
229 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
230 (build-system gnu-build-system)
232 `(("autoconf" ,autoconf)
233 ("automake" ,automake)))
235 `(("libevent" ,libevent)))
236 (home-page "https://github.com/cernekee/ocproxy")
237 (synopsis "OpenConnect proxy")
239 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
240 on LwIP. When using ocproxy, OpenConnect only handles network activity that
241 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
242 \"hijacks\" all network traffic on the host.")
243 (license license:bsd-3)))
245 (define-public openconnect
251 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
252 "openconnect-" version ".tar.gz"))
254 (base32 "1s3rjdazx1n5izpcgz05p1sirm7kf4z3gh26dq2h2j5xmgmk0jxp"))))
255 (build-system gnu-build-system)
257 `(("libxml2" ,libxml2)
258 ("gnutls" ,gnutls-3.6.13)
261 `(("vpnc-scripts" ,vpnc-scripts)))
263 `(("gettext" ,gettext-minimal)
264 ("pkg-config" ,pkg-config)))
267 `(,(string-append "--with-vpnc-script="
268 (assoc-ref %build-inputs "vpnc-scripts")
269 "/etc/vpnc/vpnc-script"))))
270 (synopsis "Client for Cisco VPN")
272 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
273 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
274 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
275 and probably others.")
276 (license license:lgpl2.1)
277 (home-page "https://www.infradead.org/openconnect/")))
279 (define-public openvpn
286 "https://swupdate.openvpn.org/community/releases/openvpn-"
290 "149z3agjy03i66mcj5bplim2mh45s2ps1wmxbxczyzw0nxmsd37v"))))
291 (build-system gnu-build-system)
293 '(#:configure-flags '("--enable-iproute2=yes")))
295 `(("iproute2" ,iproute)))
300 ("linux-pam" ,linux-pam)))
301 (home-page "https://openvpn.net/")
302 (synopsis "Virtual private network daemon")
304 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
305 for creating secure point-to-point or site-to-site connections in routed or
306 bridged configurations and remote access facilities. It uses a custom
307 security protocol that utilizes SSL/TLS for key exchange. It is capable of
308 traversing network address translators (@dfn{NAT}s) and firewalls.")
309 (license license:gpl2)))
317 (uri (string-append "https://tinc-vpn.org/packages/"
318 "tinc-" version ".tar.gz"))
321 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
322 (build-system gnu-build-system)
325 '("--sysconfdir=/etc"
326 "--localstatedir=/var")))
327 (inputs `(("zlib" ,zlib)
329 ("openssl" ,openssl)))
330 (home-page "https://tinc-vpn.org")
331 (synopsis "Virtual Private Network (VPN) daemon")
333 "Tinc is a VPN that uses tunnelling and encryption to create a secure
334 private network between hosts on the internet.")
335 (license license:gpl2+)))
337 (define-public sshuttle
344 (uri (pypi-uri name version))
347 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
348 (build-system python-build-system)
351 (modify-phases %standard-phases
352 (add-after 'unpack 'patch-FHS-file-names
354 (substitute* "sshuttle/client.py"
355 (("/usr/bin/env") (which "env")))
356 (substitute* "sshuttle/ssh.py"
360 `(("python-setuptools-scm" ,python-setuptools-scm)
362 ("python-flake8", python-flake8)
363 ("python-mock" ,python-mock)
364 ("python-pytest-cov" ,python-pytest-cov)
365 ("python-pytest-runner" ,python-pytest-runner)))
366 (home-page "https://github.com/sshuttle/sshuttle")
367 (synopsis "VPN that transparently forwards connections over SSH")
368 (description "sshuttle creates an encrypted virtual private network (VPN)
369 connection to any remote server to which you have secure shell (SSH) access.
370 The only requirement is a suitable version of Python on the server;
371 administrative privileges are required only on the client. Unlike most VPNs,
372 sshuttle forwards entire sessions, not packets, using kernel transparent
373 proxying. This makes it faster and more reliable than SSH's own tunneling and
374 port forwarding features. It can forward both TCP and UDP traffic, including
375 DNS domain name queries.")
376 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
378 (define-public sshoot
385 (uri (pypi-uri name version))
388 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
389 (build-system python-build-system)
392 (modify-phases %standard-phases
393 (add-after 'unpack 'patch-paths
395 (substitute* "sshoot/tests/test_manager.py"
396 (("/bin/sh") (which "sh")))
399 `(("python-argcomplete" ,python-argcomplete)
400 ("python-prettytable" ,python-prettytable)
401 ("python-pyyaml" ,python-pyyaml)))
404 `(("python-fixtures" ,python-fixtures)
405 ("python-pbr" ,python-pbr)
406 ("python-testtools" ,python-testtools)))
407 (home-page "https://github.com/albertodonato/sshoot")
408 (synopsis "sshuttle VPN session manager")
409 (description "sshoot provides a command-line interface to manage multiple
410 @command{sshuttle} virtual private networks. It supports flexible profiles
411 with configuration options for most of @command{sshuttle}’s features.")
412 (license license:gpl3+)))
414 (define-public badvpn
417 (version "1.999.130")
422 (url "https://github.com/ambrop72/badvpn.git")
424 (file-name (git-file-name name version))
426 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
427 (build-system cmake-build-system)
429 '(#:tests? #f)) ; no tests
433 ("openssl" ,openssl)))
435 `(("pkg-config" ,pkg-config)))
436 (home-page "https://github.com/ambrop72/badvpn")
437 (synopsis "Peer-to-peer virtual private network (VPN)")
438 (description "@code{BadVPN} is a collection of virtual private
439 network (VPN) tools. It includes:
442 @item NCD programming language.\n
443 NCD (Network Configuration Daemon) is a daemon and programming/scripting
444 language for configuration of network interfaces and other aspects of the
446 @item Tun2socks network-layer proxifier.\n
447 The tun2socks program socksifes TCP connections at the network layer. It
448 implements a TUN device which accepts all incoming TCP connections (regardless
449 of destination IP), and forwards the connections through a SOCKS server.
450 @item Peer-to-peer VPN.\n
451 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
454 ;; This project contains a bundled lwIP. lwIP is also released under the
455 ;; 3-clause BSD license.
456 (license license:bsd-3)))
458 (define-public wireguard-linux-compat
460 (name "wireguard-linux-compat")
461 (version "1.0.20200401")
464 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
465 "snapshot/wireguard-linux-compat-" version
469 "0ymprz3h4b92wlcqm5k5vmcgap8pjv202bgkdx0axmp12n1lmyvx"))))
470 (build-system linux-module-build-system)
474 `(#:tests? #f ; No test suite
475 #:modules ((guix build linux-module-build-system)
478 (ice-9 textual-ports))
480 (modify-phases %standard-phases
481 (add-before 'build 'change-directory
485 (add-after 'build 'build-patch
486 (lambda* (#:key outputs #:allow-other-keys)
487 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
488 (port (open-input-pipe patch-builder))
489 (str (get-string-all port)))
491 (call-with-output-file "wireguard.patch"
493 (format port "~a" str))))
495 (add-after 'install 'install-patch
496 (lambda* (#:key outputs #:allow-other-keys)
497 (install-file "wireguard.patch"
498 (assoc-ref %outputs "kernel-patch"))
500 ;; So that 'install-license-files' works...
501 (add-before 'install-license-files 'reset-cwd
505 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
506 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
507 (description "This package contains an out-of-tree kernel patch and
508 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
509 WireGuard was added to Linux 5.6.")
510 (license license:gpl2)))
512 (define-public wireguard-tools
514 (name "wireguard-tools")
515 (version "1.0.20200206")
520 (url "https://git.zx2c4.com/wireguard-tools.git")
521 (commit (string-append "v" version))))
522 (file-name (git-file-name name version))
524 (base32 "0ivc08lds5w39a6f2xdfih9wlk5g724hl3kpdvxvh5yff4l84qb7"))))
525 (build-system gnu-build-system)
530 "WITH_BASHCOMPLETION=yes"
531 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
533 (string-append "PREFIX=" (assoc-ref %outputs "out"))
534 ;; Currently used only to create an empty /etc/wireguard directory.
535 (string-append "SYSCONFDIR=no-thanks"))
536 ;; The test suite is meant to be run interactively. It runs Clang's
537 ;; scan-build static analyzer and then starts a web server to display the
541 (modify-phases %standard-phases
542 ;; No configure script
543 (delete 'configure))))
544 (home-page "https://www.wireguard.com/")
545 (synopsis "Tools for configuring WireGuard tunnels")
547 "This package provides the user-space command-line tools for using and
548 configuring WireGuard tunnels.
550 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
551 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
552 to configure and deploy as SSH. VPN connections are made simply by exchanging
553 public keys and can roam across IP addresses.")
555 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
556 license:gpl2)))) ; everything else
558 (define-public wireguard
559 (deprecated-package "wireguard" wireguard-tools))
561 (define-public xl2tpd
568 (url "https://github.com/xelerance/xl2tpd")
569 (commit (string-append "v" version))))
570 (file-name (git-file-name name version))
573 "0ppwza8nwm1av1vldw40gin9wrjrs4l9si50jad414js3k8ycaag"))))
574 (build-system gnu-build-system)
576 `(#:make-flags (list (string-append "PREFIX=" %output)
578 #:phases (modify-phases %standard-phases
579 (delete 'configure)) ; no configure script
580 #:tests? #f)) ; no tests provided
581 (inputs `(("libpcap" ,libpcap)))
582 (home-page "https://www.xelerance.com/software/xl2tpd/")
583 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
585 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
586 L2TP allows you to tunnel PPP over UDP.")
587 (license license:gpl2)))