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, 2020 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>
15 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
16 ;;; Copyright © 2020 Ivan Kozlov <kanichos@yandex.ru>
18 ;;; This file is part of GNU Guix.
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33 (define-module (gnu packages vpn)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages)
36 #:use-module (guix download)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix build-system linux-module)
41 #:use-module (guix build-system python)
42 #:use-module (guix utils)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages admin)
45 #:use-module (gnu packages base)
46 #:use-module (gnu packages bash)
47 #:use-module (gnu packages check)
48 #:use-module (gnu packages dns)
49 #:use-module (gnu packages autotools)
50 #:use-module (gnu packages compression)
51 #:use-module (gnu packages gettext)
52 #:use-module (gnu packages gnupg)
53 #:use-module (gnu packages guile)
54 #:use-module (gnu packages libevent)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages nss)
57 #:use-module (gnu packages perl)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages python)
60 #:use-module (gnu packages python-xyz)
61 #:use-module (gnu packages python-web)
62 #:use-module (gnu packages samba)
63 #:use-module (gnu packages tls)
64 #:use-module (gnu packages xml))
72 (uri (string-append "mirror://gnu/gvpe/gvpe-"
76 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
77 (build-system gnu-build-system)
78 (home-page "http://software.schmorp.de/pkg/gvpe.html")
79 (native-inputs `(("pkg-config" ,pkg-config)))
80 (inputs `(("openssl" ,openssl)
82 (synopsis "Secure VPN among multiple nodes over an untrusted network")
84 "The GNU Virtual Private Ethernet creates a virtual network
85 with multiple nodes using a variety of transport protocols. It works
86 by creating encrypted host-to-host tunnels between multiple
88 (license license:gpl3+)))
96 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
99 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
100 (build-system gnu-build-system)
101 (inputs `(("libgcrypt" ,libgcrypt)
103 ("vpnc-scripts" ,vpnc-scripts)))
105 `(#:tests? #f ; there is no check target
107 (modify-phases %standard-phases
108 (add-after 'unpack 'use-store-paths
109 (lambda* (#:key inputs outputs #:allow-other-keys)
110 (let ((out (assoc-ref outputs "out"))
111 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
112 (substitute* "config.c"
113 (("/etc/vpnc/vpnc-script")
114 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
115 (substitute* "Makefile"
117 (string-append "ETCDIR=" out "/etc/vpnc\n"))
119 (string-append "PREFIX=" out "\n")))
121 (delete 'configure)))) ; no configure script
122 (synopsis "Client for Cisco VPN concentrators")
124 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
125 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
126 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
127 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
128 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
129 (license license:gpl2+) ; some file are bsd-2, see COPYING
130 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
132 (define-public vpnc-scripts
133 (let ((commit "1000e0f6dd7d6bff163169a46359211c1fc3a6d2"))
135 (name "vpnc-scripts")
136 (version (string-append "20190116." (string-take commit 7)))
141 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
143 (file-name (git-file-name name version))
146 "1g41yarz2bl0f73kbjqnywr485ghanbp7nmspklfb0n07yp0z6ak"))))
147 (build-system gnu-build-system)
148 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
149 ("coreutils" ,coreutils)
151 ("iproute2" ,iproute) ; for ‘ip’
152 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
157 (modify-phases %standard-phases
158 (add-after 'unpack 'use-relative-paths
159 ;; Patch the scripts to work with and use relative paths.
161 (for-each (lambda (script)
165 (("\\[ +-x +([^]]+) +\\]" _ command)
166 (string-append "command -v >/dev/null 2>&1 "
168 (find-files "." "^vpnc-script"))
170 (delete 'configure) ; no configure script
173 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
175 ;; There is no Makefile; manually install the relevant files.
176 (lambda* (#:key outputs #:allow-other-keys)
177 (let* ((out (assoc-ref outputs "out"))
178 (etc (string-append out "/etc/vpnc")))
179 (for-each (lambda (file)
180 (install-file file etc))
181 (append (find-files "." "^vpnc-script")
183 "xinetd.netns.conf")))
185 (add-after 'install 'wrap-scripts
186 ;; Wrap scripts with paths to their common hard dependencies.
187 ;; Optional dependencies will need to be installed by the user.
188 (lambda* (#:key inputs outputs #:allow-other-keys)
189 (let ((out (assoc-ref outputs "out")))
192 (wrap-script (string-append out "/etc/vpnc/" script)
195 (let ((input (assoc-ref inputs name)))
196 (string-append input "/bin:"
204 (list "vpnc-script-ptrtd"
208 #:tests? #f)) ; no tests
209 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
210 (synopsis "Network configuration scripts for Cisco VPN clients")
212 "This set of scripts configures routing and name services when invoked
213 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
215 The default @command{vpnc-script} automatically configures most common
216 connections, and provides hooks for performing custom actions at various stages
217 of the connection or disconnection process.
219 Alternative scripts are provided for more complicated set-ups, or to serve as an
220 example for writing your own. For example, @command{vpnc-script-sshd} contains
221 the entire VPN in a network namespace accessible only through SSH.")
222 (license license:gpl2+))))
224 (define-public ocproxy
231 (url "https://github.com/cernekee/ocproxy")
232 (commit (string-append "v" version))))
233 (file-name (git-file-name name version))
236 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
237 (build-system gnu-build-system)
239 `(("autoconf" ,autoconf)
240 ("automake" ,automake)))
242 `(("libevent" ,libevent)))
243 (home-page "https://github.com/cernekee/ocproxy")
244 (synopsis "OpenConnect proxy")
246 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
247 on LwIP. When using ocproxy, OpenConnect only handles network activity that
248 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
249 \"hijacks\" all network traffic on the host.")
250 (license license:bsd-3)))
252 (define-public openconnect
258 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
259 "openconnect-" version ".tar.gz"))
261 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
262 (build-system gnu-build-system)
264 `(("libxml2" ,libxml2)
265 ;; XXX ‘DTLS is insecure in GnuTLS v3.6.3 through v3.6.12.’
266 ;; See <https://gitlab.com/gnutls/gnutls/-/issues/960>.
267 ("gnutls" ,gnutls-3.6.14)
271 ("vpnc-scripts" ,vpnc-scripts)))
273 `(("gettext" ,gettext-minimal)
274 ("pkg-config" ,pkg-config)))
277 `(,(string-append "--with-vpnc-script="
278 (assoc-ref %build-inputs "vpnc-scripts")
279 "/etc/vpnc/vpnc-script"))))
280 (synopsis "Client for Cisco VPN")
282 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
283 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
284 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
285 and probably others.")
286 (license license:lgpl2.1)
287 (home-page "https://www.infradead.org/openconnect/")))
289 (define-public openvpn
296 "https://swupdate.openvpn.org/community/releases/openvpn-"
300 "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"))))
301 (build-system gnu-build-system)
303 '(#:configure-flags '("--enable-iproute2=yes")))
305 `(("iproute2" ,iproute)))
310 ("linux-pam" ,linux-pam)))
311 (home-page "https://openvpn.net/")
312 (synopsis "Virtual private network daemon")
314 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
315 for creating secure point-to-point or site-to-site connections in routed or
316 bridged configurations and remote access facilities. It uses a custom
317 security protocol that utilizes SSL/TLS for key exchange. It is capable of
318 traversing network address translators (@dfn{NAT}s) and firewalls.")
319 (license license:gpl2)))
321 (define-public protonvpn-cli
323 (name "protonvpn-cli")
327 ;; PyPI has a ".whl" file but not a proper source release.
328 ;; Thus, fetch code from Git.
331 (url "https://github.com/ProtonVPN/linux-cli")
332 (commit (string-append "v" version))))
333 (file-name (git-file-name name version))
336 "0ixjb02kj4z79whm1izd8mrn2h0rp9cmw4im1qvp93rahqxdd4n8"))))
337 (build-system python-build-system)
338 (arguments '(#:tests? #f)) ; no tests in repo
340 `(("docopt" ,python-docopt)))
342 `(("pythondialog" ,python-pythondialog)
343 ("requests" ,python-requests)))
345 `(("openvpn" ,openvpn)))
346 (synopsis "Command-line client for ProtonVPN")
348 "This is the official command-line interface for ProtonVPN, a secure
349 point-to-point virtual private networking (VPN) service with a gratis tier.
350 It can automatically find and connect to the fastest servers or use Tor over
351 VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
352 (home-page "https://github.com/ProtonVPN/linux-cli")
353 (license license:gpl3+)))
361 (uri (string-append "https://tinc-vpn.org/packages/"
362 "tinc-" version ".tar.gz"))
365 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
366 (build-system gnu-build-system)
369 '("--sysconfdir=/etc"
370 "--localstatedir=/var")))
371 (inputs `(("zlib" ,zlib)
373 ("openssl" ,openssl)))
374 (home-page "https://tinc-vpn.org")
375 (synopsis "Virtual Private Network (VPN) daemon")
377 "Tinc is a VPN that uses tunnelling and encryption to create a secure
378 private network between hosts on the internet.")
379 (license license:gpl2+)))
381 (define-public sshuttle
388 (uri (pypi-uri name version))
391 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
392 (build-system python-build-system)
395 (modify-phases %standard-phases
396 (add-after 'unpack 'patch-FHS-file-names
398 (substitute* "sshuttle/client.py"
399 (("/usr/bin/env") (which "env")))
400 (substitute* "sshuttle/ssh.py"
404 `(("python-setuptools-scm" ,python-setuptools-scm)
406 ("python-flake8", python-flake8)
407 ("python-mock" ,python-mock)
408 ("python-pytest-cov" ,python-pytest-cov)
409 ("python-pytest-runner" ,python-pytest-runner)))
410 (home-page "https://github.com/sshuttle/sshuttle")
411 (synopsis "VPN that transparently forwards connections over SSH")
412 (description "sshuttle creates an encrypted virtual private network (VPN)
413 connection to any remote server to which you have secure shell (SSH) access.
414 The only requirement is a suitable version of Python on the server;
415 administrative privileges are required only on the client. Unlike most VPNs,
416 sshuttle forwards entire sessions, not packets, using kernel transparent
417 proxying. This makes it faster and more reliable than SSH's own tunneling and
418 port forwarding features. It can forward both TCP and UDP traffic, including
419 DNS domain name queries.")
420 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
422 (define-public sshoot
429 (uri (pypi-uri name version))
432 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
433 (build-system python-build-system)
436 (modify-phases %standard-phases
437 (add-after 'unpack 'patch-paths
439 (substitute* "sshoot/tests/test_manager.py"
440 (("/bin/sh") (which "sh")))
443 `(("python-argcomplete" ,python-argcomplete)
444 ("python-prettytable" ,python-prettytable)
445 ("python-pyyaml" ,python-pyyaml)))
448 `(("python-fixtures" ,python-fixtures)
449 ("python-pbr" ,python-pbr)
450 ("python-testtools" ,python-testtools)))
451 (home-page "https://github.com/albertodonato/sshoot")
452 (synopsis "sshuttle VPN session manager")
453 (description "sshoot provides a command-line interface to manage multiple
454 @command{sshuttle} virtual private networks. It supports flexible profiles
455 with configuration options for most of @command{sshuttle}’s features.")
456 (license license:gpl3+)))
458 (define-public badvpn
461 (version "1.999.130")
466 (url "https://github.com/ambrop72/badvpn")
468 (file-name (git-file-name name version))
470 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
471 (build-system cmake-build-system)
473 '(#:tests? #f)) ; no tests
477 ("openssl" ,openssl)))
479 `(("pkg-config" ,pkg-config)))
480 (home-page "https://github.com/ambrop72/badvpn")
481 (synopsis "Peer-to-peer virtual private network (VPN)")
482 (description "@code{BadVPN} is a collection of virtual private
483 network (VPN) tools. It includes:
486 @item NCD programming language.\n
487 NCD (Network Configuration Daemon) is a daemon and programming/scripting
488 language for configuration of network interfaces and other aspects of the
490 @item Tun2socks network-layer proxifier.\n
491 The tun2socks program socksifes TCP connections at the network layer. It
492 implements a TUN device which accepts all incoming TCP connections (regardless
493 of destination IP), and forwards the connections through a SOCKS server.
494 @item Peer-to-peer VPN.\n
495 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
498 ;; This project contains a bundled lwIP. lwIP is also released under the
499 ;; 3-clause BSD license.
500 (license license:bsd-3)))
502 (define-public wireguard-linux-compat
504 (name "wireguard-linux-compat")
505 (version "1.0.20200623")
508 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
509 "snapshot/wireguard-linux-compat-" version
513 "0iclixsqfckaz6kz6a4lhzdary3xhfy1d0pz0pgrwy8m8mr3f28k"))))
514 (build-system linux-module-build-system)
518 `(#:tests? #f ; No test suite
519 #:modules ((guix build linux-module-build-system)
522 (ice-9 textual-ports))
524 (modify-phases %standard-phases
525 (add-before 'build 'change-directory
529 (add-after 'build 'build-patch
530 (lambda* (#:key outputs #:allow-other-keys)
531 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
532 (port (open-input-pipe patch-builder))
533 (str (get-string-all port)))
535 (call-with-output-file "wireguard.patch"
537 (format port "~a" str))))
539 (add-after 'install 'install-patch
540 (lambda* (#:key outputs #:allow-other-keys)
541 (install-file "wireguard.patch"
542 (assoc-ref %outputs "kernel-patch"))
544 ;; So that 'install-license-files' works...
545 (add-before 'install-license-files 'reset-cwd
549 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
550 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
551 (description "This package contains an out-of-tree kernel patch and
552 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
553 WireGuard was added to Linux 5.6.")
554 (license license:gpl2)))
556 (define-public wireguard-tools
558 (name "wireguard-tools")
559 (version "1.0.20200827")
564 (url "https://git.zx2c4.com/wireguard-tools.git")
565 (commit (string-append "v" version))))
566 (file-name (git-file-name name version))
568 (base32 "1h351hn531z6z85sx9ya27xjz1jszgn1pkwibacjj49mds15f7gn"))))
569 (build-system gnu-build-system)
572 (list ,(string-append "CC=" (cc-for-target))
574 "WITH_BASHCOMPLETION=yes"
575 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
577 (string-append "PREFIX=" (assoc-ref %outputs "out"))
578 ;; Currently used only to create an empty /etc/wireguard directory.
579 (string-append "SYSCONFDIR=no-thanks"))
580 ;; The test suite is meant to be run interactively. It runs Clang's
581 ;; scan-build static analyzer and then starts a web server to display the
585 (modify-phases %standard-phases
586 ;; No configure script
588 (add-after 'install 'install-contrib-docs
589 (lambda* (#:key outputs #:allow-other-keys)
590 (let ((out (assoc-ref outputs "out")))
591 (copy-recursively "contrib/"
592 (string-append out "/share/doc/wireguard-tools"))
594 (add-after 'install 'wrap-wg-quick
595 (lambda* (#:key inputs outputs #:allow-other-keys)
596 (let* ((out (assoc-ref outputs "out"))
597 (inputs-sbin (map (lambda (input)
598 (string-append (assoc-ref inputs input) "/sbin"))
599 (list "resolvconf" "iproute" "procps"
601 (coreutils (string-append (assoc-ref inputs "coreutils")
603 (wrap-program (string-append out "/bin/wg-quick")
604 `("PATH" ":" prefix ,(append inputs-sbin
608 `(("resolvconf" ,openresolv)
609 ("coreutils" ,coreutils)
610 ("bash" ,bash) ; for scripts using /dev/tcp
613 ("iptables" ,iptables)))
614 (home-page "https://www.wireguard.com/")
615 (synopsis "Tools for configuring WireGuard tunnels")
617 "This package provides the user-space command-line tools for using and
618 configuring WireGuard tunnels.
620 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
621 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
622 to configure and deploy as SSH. VPN connections are made simply by exchanging
623 public keys and can roam across IP addresses.")
625 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
626 license:gpl2)))) ; everything else
628 (define-public wireguard
629 (deprecated-package "wireguard" wireguard-tools))
631 (define-public xl2tpd
638 (url "https://github.com/xelerance/xl2tpd")
639 (commit (string-append "v" version))))
640 (file-name (git-file-name name version))
643 "0ppwza8nwm1av1vldw40gin9wrjrs4l9si50jad414js3k8ycaag"))))
644 (build-system gnu-build-system)
646 `(#:make-flags (list (string-append "PREFIX=" %output)
648 #:phases (modify-phases %standard-phases
649 (delete 'configure) ;no configure script
650 (add-before 'build 'setup-environment
651 (lambda* (#:key inputs #:allow-other-keys)
652 (substitute* "l2tp.h"
654 (string-append (assoc-ref inputs "ppp")
657 (assoc-ref inputs "linux-libre-headers"))
659 #:tests? #f)) ; no tests provided
660 (inputs `(("libpcap" ,libpcap)
661 ("linux-libre-headers" ,linux-libre-headers)
663 (home-page "https://www.xelerance.com/software/xl2tpd/")
664 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
666 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
667 L2TP allows you to tunnel PPP over UDP.")
668 (license license:gpl2)))