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>
17 ;;; This file is part of GNU Guix.
19 ;;; GNU Guix is free software; you can redistribute it and/or modify it
20 ;;; under the terms of the GNU General Public License as published by
21 ;;; the Free Software Foundation; either version 3 of the License, or (at
22 ;;; your option) any later version.
24 ;;; GNU Guix is distributed in the hope that it will be useful, but
25 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ;;; GNU General Public License for more details.
29 ;;; You should have received a copy of the GNU General Public License
30 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32 (define-module (gnu packages vpn)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system cmake)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system linux-module)
40 #:use-module (guix build-system python)
41 #:use-module (gnu packages)
42 #:use-module (gnu packages admin)
43 #:use-module (gnu packages base)
44 #:use-module (gnu packages bash)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages dns)
47 #:use-module (gnu packages autotools)
48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages gettext)
50 #:use-module (gnu packages gnupg)
51 #:use-module (gnu packages guile)
52 #:use-module (gnu packages libevent)
53 #:use-module (gnu packages linux)
54 #:use-module (gnu packages nss)
55 #:use-module (gnu packages perl)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-xyz)
59 #:use-module (gnu packages python-web)
60 #:use-module (gnu packages tls)
61 #:use-module (gnu packages xml))
69 (uri (string-append "mirror://gnu/gvpe/gvpe-"
73 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
74 (build-system gnu-build-system)
75 (home-page "http://software.schmorp.de/pkg/gvpe.html")
76 (native-inputs `(("pkg-config" ,pkg-config)))
77 (inputs `(("openssl" ,openssl)
79 (synopsis "Secure VPN among multiple nodes over an untrusted network")
81 "The GNU Virtual Private Ethernet creates a virtual network
82 with multiple nodes using a variety of transport protocols. It works
83 by creating encrypted host-to-host tunnels between multiple
85 (license license:gpl3+)))
93 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
96 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
97 (build-system gnu-build-system)
98 (inputs `(("libgcrypt" ,libgcrypt)
100 ("vpnc-scripts" ,vpnc-scripts)))
102 `(#:tests? #f ; there is no check target
104 (modify-phases %standard-phases
105 (add-after 'unpack 'use-store-paths
106 (lambda* (#:key inputs outputs #:allow-other-keys)
107 (let ((out (assoc-ref outputs "out"))
108 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
109 (substitute* "config.c"
110 (("/etc/vpnc/vpnc-script")
111 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
112 (substitute* "Makefile"
114 (string-append "ETCDIR=" out "/etc/vpnc\n"))
116 (string-append "PREFIX=" out "\n")))
118 (delete 'configure)))) ; no configure script
119 (synopsis "Client for Cisco VPN concentrators")
121 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
122 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
123 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
124 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
125 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
126 (license license:gpl2+) ; some file are bsd-2, see COPYING
127 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
129 (define-public vpnc-scripts
130 (let ((commit "1000e0f6dd7d6bff163169a46359211c1fc3a6d2"))
132 (name "vpnc-scripts")
133 (version (string-append "20190116." (string-take commit 7)))
138 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
140 (file-name (git-file-name name version))
143 "1g41yarz2bl0f73kbjqnywr485ghanbp7nmspklfb0n07yp0z6ak"))))
144 (build-system gnu-build-system)
145 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
146 ("coreutils" ,coreutils)
148 ("iproute2" ,iproute) ; for ‘ip’
149 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
154 (modify-phases %standard-phases
155 (add-after 'unpack 'use-relative-paths
156 ;; Patch the scripts to work with and use relative paths.
158 (for-each (lambda (script)
162 (("\\[ +-x +([^]]+) +\\]" _ command)
163 (string-append "command -v >/dev/null 2>&1 "
165 (find-files "." "^vpnc-script"))
167 (delete 'configure) ; no configure script
170 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
172 ;; There is no Makefile; manually install the relevant files.
173 (lambda* (#:key outputs #:allow-other-keys)
174 (let* ((out (assoc-ref outputs "out"))
175 (etc (string-append out "/etc/vpnc")))
176 (for-each (lambda (file)
177 (install-file file etc))
178 (append (find-files "." "^vpnc-script")
180 "xinetd.netns.conf")))
182 (add-after 'install 'wrap-scripts
183 ;; Wrap scripts with paths to their common hard dependencies.
184 ;; Optional dependencies will need to be installed by the user.
185 (lambda* (#:key inputs outputs #:allow-other-keys)
186 (let ((out (assoc-ref outputs "out")))
189 (wrap-script (string-append out "/etc/vpnc/" script)
192 (let ((input (assoc-ref inputs name)))
193 (string-append input "/bin:"
201 (list "vpnc-script-ptrtd"
205 #:tests? #f)) ; no tests
206 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
207 (synopsis "Network configuration scripts for Cisco VPN clients")
209 "This set of scripts configures routing and name services when invoked
210 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
212 The default @command{vpnc-script} automatically configures most common
213 connections, and provides hooks for performing custom actions at various stages
214 of the connection or disconnection process.
216 Alternative scripts are provided for more complicated set-ups, or to serve as an
217 example for writing your own. For example, @command{vpnc-script-sshd} contains
218 the entire VPN in a network namespace accessible only through SSH.")
219 (license license:gpl2+))))
221 (define-public ocproxy
228 (url "https://github.com/cernekee/ocproxy.git")
229 (commit (string-append "v" version))))
230 (file-name (git-file-name name version))
233 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
234 (build-system gnu-build-system)
236 `(("autoconf" ,autoconf)
237 ("automake" ,automake)))
239 `(("libevent" ,libevent)))
240 (home-page "https://github.com/cernekee/ocproxy")
241 (synopsis "OpenConnect proxy")
243 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
244 on LwIP. When using ocproxy, OpenConnect only handles network activity that
245 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
246 \"hijacks\" all network traffic on the host.")
247 (license license:bsd-3)))
249 (define-public openconnect
255 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
256 "openconnect-" version ".tar.gz"))
258 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
259 (build-system gnu-build-system)
261 `(("libxml2" ,libxml2)
262 ("gnutls" ,gnutls-3.6.13)
266 ("vpnc-scripts" ,vpnc-scripts)))
268 `(("gettext" ,gettext-minimal)
269 ("pkg-config" ,pkg-config)))
272 `(,(string-append "--with-vpnc-script="
273 (assoc-ref %build-inputs "vpnc-scripts")
274 "/etc/vpnc/vpnc-script"))))
275 (synopsis "Client for Cisco VPN")
277 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
278 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
279 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
280 and probably others.")
281 (license license:lgpl2.1)
282 (home-page "https://www.infradead.org/openconnect/")))
284 (define-public openvpn
291 "https://swupdate.openvpn.org/community/releases/openvpn-"
295 "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"))))
296 (build-system gnu-build-system)
298 '(#:configure-flags '("--enable-iproute2=yes")))
300 `(("iproute2" ,iproute)))
305 ("linux-pam" ,linux-pam)))
306 (home-page "https://openvpn.net/")
307 (synopsis "Virtual private network daemon")
309 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
310 for creating secure point-to-point or site-to-site connections in routed or
311 bridged configurations and remote access facilities. It uses a custom
312 security protocol that utilizes SSL/TLS for key exchange. It is capable of
313 traversing network address translators (@dfn{NAT}s) and firewalls.")
314 (license license:gpl2)))
316 (define-public protonvpn-cli
318 (name "protonvpn-cli")
322 ;; PyPI has a ".whl" file but not a proper source release.
323 ;; Thus, fetch code from Git.
326 (url "https://github.com/ProtonVPN/linux-cli.git")
327 (commit (string-append "v" version))))
328 (file-name (git-file-name name version))
331 "0ixjb02kj4z79whm1izd8mrn2h0rp9cmw4im1qvp93rahqxdd4n8"))))
332 (build-system python-build-system)
333 (arguments '(#:tests? #f)) ; no tests in repo
335 `(("docopt" ,python-docopt)))
337 `(("pythondialog" ,python-pythondialog)
338 ("requests" ,python-requests)))
340 `(("openvpn" ,openvpn)))
341 (synopsis "Command-line client for ProtonVPN")
343 "This is the official command-line interface for ProtonVPN, a secure
344 point-to-point virtual private networking (VPN) service with a gratis tier.
345 It can automatically find and connect to the fastest servers or use Tor over
346 VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
347 (home-page "https://github.com/ProtonVPN/linux-cli")
348 (license license:gpl3+)))
356 (uri (string-append "https://tinc-vpn.org/packages/"
357 "tinc-" version ".tar.gz"))
360 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
361 (build-system gnu-build-system)
364 '("--sysconfdir=/etc"
365 "--localstatedir=/var")))
366 (inputs `(("zlib" ,zlib)
368 ("openssl" ,openssl)))
369 (home-page "https://tinc-vpn.org")
370 (synopsis "Virtual Private Network (VPN) daemon")
372 "Tinc is a VPN that uses tunnelling and encryption to create a secure
373 private network between hosts on the internet.")
374 (license license:gpl2+)))
376 (define-public sshuttle
383 (uri (pypi-uri name version))
386 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
387 (build-system python-build-system)
390 (modify-phases %standard-phases
391 (add-after 'unpack 'patch-FHS-file-names
393 (substitute* "sshuttle/client.py"
394 (("/usr/bin/env") (which "env")))
395 (substitute* "sshuttle/ssh.py"
399 `(("python-setuptools-scm" ,python-setuptools-scm)
401 ("python-flake8", python-flake8)
402 ("python-mock" ,python-mock)
403 ("python-pytest-cov" ,python-pytest-cov)
404 ("python-pytest-runner" ,python-pytest-runner)))
405 (home-page "https://github.com/sshuttle/sshuttle")
406 (synopsis "VPN that transparently forwards connections over SSH")
407 (description "sshuttle creates an encrypted virtual private network (VPN)
408 connection to any remote server to which you have secure shell (SSH) access.
409 The only requirement is a suitable version of Python on the server;
410 administrative privileges are required only on the client. Unlike most VPNs,
411 sshuttle forwards entire sessions, not packets, using kernel transparent
412 proxying. This makes it faster and more reliable than SSH's own tunneling and
413 port forwarding features. It can forward both TCP and UDP traffic, including
414 DNS domain name queries.")
415 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
417 (define-public sshoot
424 (uri (pypi-uri name version))
427 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
428 (build-system python-build-system)
431 (modify-phases %standard-phases
432 (add-after 'unpack 'patch-paths
434 (substitute* "sshoot/tests/test_manager.py"
435 (("/bin/sh") (which "sh")))
438 `(("python-argcomplete" ,python-argcomplete)
439 ("python-prettytable" ,python-prettytable)
440 ("python-pyyaml" ,python-pyyaml)))
443 `(("python-fixtures" ,python-fixtures)
444 ("python-pbr" ,python-pbr)
445 ("python-testtools" ,python-testtools)))
446 (home-page "https://github.com/albertodonato/sshoot")
447 (synopsis "sshuttle VPN session manager")
448 (description "sshoot provides a command-line interface to manage multiple
449 @command{sshuttle} virtual private networks. It supports flexible profiles
450 with configuration options for most of @command{sshuttle}’s features.")
451 (license license:gpl3+)))
453 (define-public badvpn
456 (version "1.999.130")
461 (url "https://github.com/ambrop72/badvpn.git")
463 (file-name (git-file-name name version))
465 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
466 (build-system cmake-build-system)
468 '(#:tests? #f)) ; no tests
472 ("openssl" ,openssl)))
474 `(("pkg-config" ,pkg-config)))
475 (home-page "https://github.com/ambrop72/badvpn")
476 (synopsis "Peer-to-peer virtual private network (VPN)")
477 (description "@code{BadVPN} is a collection of virtual private
478 network (VPN) tools. It includes:
481 @item NCD programming language.\n
482 NCD (Network Configuration Daemon) is a daemon and programming/scripting
483 language for configuration of network interfaces and other aspects of the
485 @item Tun2socks network-layer proxifier.\n
486 The tun2socks program socksifes TCP connections at the network layer. It
487 implements a TUN device which accepts all incoming TCP connections (regardless
488 of destination IP), and forwards the connections through a SOCKS server.
489 @item Peer-to-peer VPN.\n
490 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
493 ;; This project contains a bundled lwIP. lwIP is also released under the
494 ;; 3-clause BSD license.
495 (license license:bsd-3)))
497 (define-public wireguard-linux-compat
499 (name "wireguard-linux-compat")
500 (version "1.0.20200401")
503 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
504 "snapshot/wireguard-linux-compat-" version
508 "0ymprz3h4b92wlcqm5k5vmcgap8pjv202bgkdx0axmp12n1lmyvx"))))
509 (build-system linux-module-build-system)
513 `(#:tests? #f ; No test suite
514 #:modules ((guix build linux-module-build-system)
517 (ice-9 textual-ports))
519 (modify-phases %standard-phases
520 (add-before 'build 'change-directory
524 (add-after 'build 'build-patch
525 (lambda* (#:key outputs #:allow-other-keys)
526 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
527 (port (open-input-pipe patch-builder))
528 (str (get-string-all port)))
530 (call-with-output-file "wireguard.patch"
532 (format port "~a" str))))
534 (add-after 'install 'install-patch
535 (lambda* (#:key outputs #:allow-other-keys)
536 (install-file "wireguard.patch"
537 (assoc-ref %outputs "kernel-patch"))
539 ;; So that 'install-license-files' works...
540 (add-before 'install-license-files 'reset-cwd
544 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
545 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
546 (description "This package contains an out-of-tree kernel patch and
547 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
548 WireGuard was added to Linux 5.6.")
549 (license license:gpl2)))
551 (define-public wireguard-tools
553 (name "wireguard-tools")
554 (version "1.0.20200206")
559 (url "https://git.zx2c4.com/wireguard-tools.git")
560 (commit (string-append "v" version))))
561 (file-name (git-file-name name version))
563 (base32 "0ivc08lds5w39a6f2xdfih9wlk5g724hl3kpdvxvh5yff4l84qb7"))))
564 (build-system gnu-build-system)
569 "WITH_BASHCOMPLETION=yes"
570 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
572 (string-append "PREFIX=" (assoc-ref %outputs "out"))
573 ;; Currently used only to create an empty /etc/wireguard directory.
574 (string-append "SYSCONFDIR=no-thanks"))
575 ;; The test suite is meant to be run interactively. It runs Clang's
576 ;; scan-build static analyzer and then starts a web server to display the
580 (modify-phases %standard-phases
581 ;; No configure script
583 (add-after 'install 'install-contrib-docs
584 (lambda* (#:key outputs #:allow-other-keys)
585 (let ((out (assoc-ref outputs "out")))
586 (copy-recursively "contrib/"
587 (string-append out "/share/doc/wireguard-tools"))
589 (add-after 'install 'wrap-wg-quick
590 (lambda* (#:key inputs outputs #:allow-other-keys)
591 (let* ((out (assoc-ref outputs "out"))
592 (inputs-sbin (map (lambda (input)
593 (string-append (assoc-ref inputs input) "/sbin"))
594 (list "resolvconf" "iproute" "procps"
596 (coreutils (string-append (assoc-ref inputs "coreutils")
598 (wrap-program (string-append out "/bin/wg-quick")
599 `("PATH" ":" prefix ,(append inputs-sbin
603 `(("resolvconf" ,openresolv)
604 ("coreutils" ,coreutils)
605 ("bash" ,bash) ; for scripts using /dev/tcp
608 ("iptables" ,iptables)))
609 (home-page "https://www.wireguard.com/")
610 (synopsis "Tools for configuring WireGuard tunnels")
612 "This package provides the user-space command-line tools for using and
613 configuring WireGuard tunnels.
615 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
616 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
617 to configure and deploy as SSH. VPN connections are made simply by exchanging
618 public keys and can roam across IP addresses.")
620 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
621 license:gpl2)))) ; everything else
623 (define-public wireguard
624 (deprecated-package "wireguard" wireguard-tools))
626 (define-public xl2tpd
633 (url "https://github.com/xelerance/xl2tpd")
634 (commit (string-append "v" version))))
635 (file-name (git-file-name name version))
638 "0ppwza8nwm1av1vldw40gin9wrjrs4l9si50jad414js3k8ycaag"))))
639 (build-system gnu-build-system)
641 `(#:make-flags (list (string-append "PREFIX=" %output)
643 #:phases (modify-phases %standard-phases
644 (delete 'configure)) ; no configure script
645 #:tests? #f)) ; no tests provided
646 (inputs `(("libpcap" ,libpcap)))
647 (home-page "https://www.xelerance.com/software/xl2tpd/")
648 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
650 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
651 L2TP allows you to tunnel PPP over UDP.")
652 (license license:gpl2)))