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 (gnu packages)
43 #:use-module (gnu packages admin)
44 #:use-module (gnu packages base)
45 #:use-module (gnu packages bash)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages dns)
48 #:use-module (gnu packages autotools)
49 #:use-module (gnu packages compression)
50 #:use-module (gnu packages gettext)
51 #:use-module (gnu packages gnupg)
52 #:use-module (gnu packages guile)
53 #:use-module (gnu packages libevent)
54 #:use-module (gnu packages linux)
55 #:use-module (gnu packages nss)
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages python)
59 #:use-module (gnu packages python-xyz)
60 #:use-module (gnu packages python-web)
61 #:use-module (gnu packages samba)
62 #:use-module (gnu packages tls)
63 #:use-module (gnu packages xml))
71 (uri (string-append "mirror://gnu/gvpe/gvpe-"
75 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
76 (build-system gnu-build-system)
77 (home-page "http://software.schmorp.de/pkg/gvpe.html")
78 (native-inputs `(("pkg-config" ,pkg-config)))
79 (inputs `(("openssl" ,openssl)
81 (synopsis "Secure VPN among multiple nodes over an untrusted network")
83 "The GNU Virtual Private Ethernet creates a virtual network
84 with multiple nodes using a variety of transport protocols. It works
85 by creating encrypted host-to-host tunnels between multiple
87 (license license:gpl3+)))
95 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
98 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
99 (build-system gnu-build-system)
100 (inputs `(("libgcrypt" ,libgcrypt)
102 ("vpnc-scripts" ,vpnc-scripts)))
104 `(#:tests? #f ; there is no check target
106 (modify-phases %standard-phases
107 (add-after 'unpack 'use-store-paths
108 (lambda* (#:key inputs outputs #:allow-other-keys)
109 (let ((out (assoc-ref outputs "out"))
110 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
111 (substitute* "config.c"
112 (("/etc/vpnc/vpnc-script")
113 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
114 (substitute* "Makefile"
116 (string-append "ETCDIR=" out "/etc/vpnc\n"))
118 (string-append "PREFIX=" out "\n")))
120 (delete 'configure)))) ; no configure script
121 (synopsis "Client for Cisco VPN concentrators")
123 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
124 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
125 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
126 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
127 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
128 (license license:gpl2+) ; some file are bsd-2, see COPYING
129 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
131 (define-public vpnc-scripts
132 (let ((commit "1000e0f6dd7d6bff163169a46359211c1fc3a6d2"))
134 (name "vpnc-scripts")
135 (version (string-append "20190116." (string-take commit 7)))
140 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
142 (file-name (git-file-name name version))
145 "1g41yarz2bl0f73kbjqnywr485ghanbp7nmspklfb0n07yp0z6ak"))))
146 (build-system gnu-build-system)
147 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
148 ("coreutils" ,coreutils)
150 ("iproute2" ,iproute) ; for ‘ip’
151 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
156 (modify-phases %standard-phases
157 (add-after 'unpack 'use-relative-paths
158 ;; Patch the scripts to work with and use relative paths.
160 (for-each (lambda (script)
164 (("\\[ +-x +([^]]+) +\\]" _ command)
165 (string-append "command -v >/dev/null 2>&1 "
167 (find-files "." "^vpnc-script"))
169 (delete 'configure) ; no configure script
172 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
174 ;; There is no Makefile; manually install the relevant files.
175 (lambda* (#:key outputs #:allow-other-keys)
176 (let* ((out (assoc-ref outputs "out"))
177 (etc (string-append out "/etc/vpnc")))
178 (for-each (lambda (file)
179 (install-file file etc))
180 (append (find-files "." "^vpnc-script")
182 "xinetd.netns.conf")))
184 (add-after 'install 'wrap-scripts
185 ;; Wrap scripts with paths to their common hard dependencies.
186 ;; Optional dependencies will need to be installed by the user.
187 (lambda* (#:key inputs outputs #:allow-other-keys)
188 (let ((out (assoc-ref outputs "out")))
191 (wrap-script (string-append out "/etc/vpnc/" script)
194 (let ((input (assoc-ref inputs name)))
195 (string-append input "/bin:"
203 (list "vpnc-script-ptrtd"
207 #:tests? #f)) ; no tests
208 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
209 (synopsis "Network configuration scripts for Cisco VPN clients")
211 "This set of scripts configures routing and name services when invoked
212 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
214 The default @command{vpnc-script} automatically configures most common
215 connections, and provides hooks for performing custom actions at various stages
216 of the connection or disconnection process.
218 Alternative scripts are provided for more complicated set-ups, or to serve as an
219 example for writing your own. For example, @command{vpnc-script-sshd} contains
220 the entire VPN in a network namespace accessible only through SSH.")
221 (license license:gpl2+))))
223 (define-public ocproxy
230 (url "https://github.com/cernekee/ocproxy.git")
231 (commit (string-append "v" version))))
232 (file-name (git-file-name name version))
235 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
236 (build-system gnu-build-system)
238 `(("autoconf" ,autoconf)
239 ("automake" ,automake)))
241 `(("libevent" ,libevent)))
242 (home-page "https://github.com/cernekee/ocproxy")
243 (synopsis "OpenConnect proxy")
245 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
246 on LwIP. When using ocproxy, OpenConnect only handles network activity that
247 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
248 \"hijacks\" all network traffic on the host.")
249 (license license:bsd-3)))
251 (define-public openconnect
257 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
258 "openconnect-" version ".tar.gz"))
260 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
261 (build-system gnu-build-system)
263 `(("libxml2" ,libxml2)
264 ;; XXX ‘DTLS is insecure in GnuTLS v3.6.3 through v3.6.12.’
265 ;; See <https://gitlab.com/gnutls/gnutls/-/issues/960>.
266 ("gnutls" ,gnutls-3.6.14)
270 ("vpnc-scripts" ,vpnc-scripts)))
272 `(("gettext" ,gettext-minimal)
273 ("pkg-config" ,pkg-config)))
276 `(,(string-append "--with-vpnc-script="
277 (assoc-ref %build-inputs "vpnc-scripts")
278 "/etc/vpnc/vpnc-script"))))
279 (synopsis "Client for Cisco VPN")
281 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
282 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
283 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
284 and probably others.")
285 (license license:lgpl2.1)
286 (home-page "https://www.infradead.org/openconnect/")))
288 (define-public openvpn
295 "https://swupdate.openvpn.org/community/releases/openvpn-"
299 "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"))))
300 (build-system gnu-build-system)
302 '(#:configure-flags '("--enable-iproute2=yes")))
304 `(("iproute2" ,iproute)))
309 ("linux-pam" ,linux-pam)))
310 (home-page "https://openvpn.net/")
311 (synopsis "Virtual private network daemon")
313 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
314 for creating secure point-to-point or site-to-site connections in routed or
315 bridged configurations and remote access facilities. It uses a custom
316 security protocol that utilizes SSL/TLS for key exchange. It is capable of
317 traversing network address translators (@dfn{NAT}s) and firewalls.")
318 (license license:gpl2)))
320 (define-public protonvpn-cli
322 (name "protonvpn-cli")
326 ;; PyPI has a ".whl" file but not a proper source release.
327 ;; Thus, fetch code from Git.
330 (url "https://github.com/ProtonVPN/linux-cli.git")
331 (commit (string-append "v" version))))
332 (file-name (git-file-name name version))
335 "0ixjb02kj4z79whm1izd8mrn2h0rp9cmw4im1qvp93rahqxdd4n8"))))
336 (build-system python-build-system)
337 (arguments '(#:tests? #f)) ; no tests in repo
339 `(("docopt" ,python-docopt)))
341 `(("pythondialog" ,python-pythondialog)
342 ("requests" ,python-requests)))
344 `(("openvpn" ,openvpn)))
345 (synopsis "Command-line client for ProtonVPN")
347 "This is the official command-line interface for ProtonVPN, a secure
348 point-to-point virtual private networking (VPN) service with a gratis tier.
349 It can automatically find and connect to the fastest servers or use Tor over
350 VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
351 (home-page "https://github.com/ProtonVPN/linux-cli")
352 (license license:gpl3+)))
360 (uri (string-append "https://tinc-vpn.org/packages/"
361 "tinc-" version ".tar.gz"))
364 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
365 (build-system gnu-build-system)
368 '("--sysconfdir=/etc"
369 "--localstatedir=/var")))
370 (inputs `(("zlib" ,zlib)
372 ("openssl" ,openssl)))
373 (home-page "https://tinc-vpn.org")
374 (synopsis "Virtual Private Network (VPN) daemon")
376 "Tinc is a VPN that uses tunnelling and encryption to create a secure
377 private network between hosts on the internet.")
378 (license license:gpl2+)))
380 (define-public sshuttle
387 (uri (pypi-uri name version))
390 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
391 (build-system python-build-system)
394 (modify-phases %standard-phases
395 (add-after 'unpack 'patch-FHS-file-names
397 (substitute* "sshuttle/client.py"
398 (("/usr/bin/env") (which "env")))
399 (substitute* "sshuttle/ssh.py"
403 `(("python-setuptools-scm" ,python-setuptools-scm)
405 ("python-flake8", python-flake8)
406 ("python-mock" ,python-mock)
407 ("python-pytest-cov" ,python-pytest-cov)
408 ("python-pytest-runner" ,python-pytest-runner)))
409 (home-page "https://github.com/sshuttle/sshuttle")
410 (synopsis "VPN that transparently forwards connections over SSH")
411 (description "sshuttle creates an encrypted virtual private network (VPN)
412 connection to any remote server to which you have secure shell (SSH) access.
413 The only requirement is a suitable version of Python on the server;
414 administrative privileges are required only on the client. Unlike most VPNs,
415 sshuttle forwards entire sessions, not packets, using kernel transparent
416 proxying. This makes it faster and more reliable than SSH's own tunneling and
417 port forwarding features. It can forward both TCP and UDP traffic, including
418 DNS domain name queries.")
419 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
421 (define-public sshoot
428 (uri (pypi-uri name version))
431 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
432 (build-system python-build-system)
435 (modify-phases %standard-phases
436 (add-after 'unpack 'patch-paths
438 (substitute* "sshoot/tests/test_manager.py"
439 (("/bin/sh") (which "sh")))
442 `(("python-argcomplete" ,python-argcomplete)
443 ("python-prettytable" ,python-prettytable)
444 ("python-pyyaml" ,python-pyyaml)))
447 `(("python-fixtures" ,python-fixtures)
448 ("python-pbr" ,python-pbr)
449 ("python-testtools" ,python-testtools)))
450 (home-page "https://github.com/albertodonato/sshoot")
451 (synopsis "sshuttle VPN session manager")
452 (description "sshoot provides a command-line interface to manage multiple
453 @command{sshuttle} virtual private networks. It supports flexible profiles
454 with configuration options for most of @command{sshuttle}’s features.")
455 (license license:gpl3+)))
457 (define-public badvpn
460 (version "1.999.130")
465 (url "https://github.com/ambrop72/badvpn.git")
467 (file-name (git-file-name name version))
469 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
470 (build-system cmake-build-system)
472 '(#:tests? #f)) ; no tests
476 ("openssl" ,openssl)))
478 `(("pkg-config" ,pkg-config)))
479 (home-page "https://github.com/ambrop72/badvpn")
480 (synopsis "Peer-to-peer virtual private network (VPN)")
481 (description "@code{BadVPN} is a collection of virtual private
482 network (VPN) tools. It includes:
485 @item NCD programming language.\n
486 NCD (Network Configuration Daemon) is a daemon and programming/scripting
487 language for configuration of network interfaces and other aspects of the
489 @item Tun2socks network-layer proxifier.\n
490 The tun2socks program socksifes TCP connections at the network layer. It
491 implements a TUN device which accepts all incoming TCP connections (regardless
492 of destination IP), and forwards the connections through a SOCKS server.
493 @item Peer-to-peer VPN.\n
494 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
497 ;; This project contains a bundled lwIP. lwIP is also released under the
498 ;; 3-clause BSD license.
499 (license license:bsd-3)))
501 (define-public wireguard-linux-compat
503 (name "wireguard-linux-compat")
504 (version "1.0.20200520")
507 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
508 "snapshot/wireguard-linux-compat-" version
512 "1hvpbfpdd3v2k27ypa1y1j422irx7hxpz87f50s28jvkxx5sxrqn"))))
513 (build-system linux-module-build-system)
517 `(#:tests? #f ; No test suite
518 #:modules ((guix build linux-module-build-system)
521 (ice-9 textual-ports))
523 (modify-phases %standard-phases
524 (add-before 'build 'change-directory
528 (add-after 'build 'build-patch
529 (lambda* (#:key outputs #:allow-other-keys)
530 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
531 (port (open-input-pipe patch-builder))
532 (str (get-string-all port)))
534 (call-with-output-file "wireguard.patch"
536 (format port "~a" str))))
538 (add-after 'install 'install-patch
539 (lambda* (#:key outputs #:allow-other-keys)
540 (install-file "wireguard.patch"
541 (assoc-ref %outputs "kernel-patch"))
543 ;; So that 'install-license-files' works...
544 (add-before 'install-license-files 'reset-cwd
548 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
549 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
550 (description "This package contains an out-of-tree kernel patch and
551 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
552 WireGuard was added to Linux 5.6.")
553 (license license:gpl2)))
555 (define-public wireguard-tools
557 (name "wireguard-tools")
558 (version "1.0.20200513")
563 (url "https://git.zx2c4.com/wireguard-tools.git")
564 (commit (string-append "v" version))))
565 (file-name (git-file-name name version))
567 (base32 "1yk8hng0qw2rf76hnawjbdpjssmah88bd5fk20h1c0j1yazlx0a9"))))
568 (build-system gnu-build-system)
573 "WITH_BASHCOMPLETION=yes"
574 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
576 (string-append "PREFIX=" (assoc-ref %outputs "out"))
577 ;; Currently used only to create an empty /etc/wireguard directory.
578 (string-append "SYSCONFDIR=no-thanks"))
579 ;; The test suite is meant to be run interactively. It runs Clang's
580 ;; scan-build static analyzer and then starts a web server to display the
584 (modify-phases %standard-phases
585 ;; No configure script
587 (add-after 'install 'install-contrib-docs
588 (lambda* (#:key outputs #:allow-other-keys)
589 (let ((out (assoc-ref outputs "out")))
590 (copy-recursively "contrib/"
591 (string-append out "/share/doc/wireguard-tools"))
593 (add-after 'install 'wrap-wg-quick
594 (lambda* (#:key inputs outputs #:allow-other-keys)
595 (let* ((out (assoc-ref outputs "out"))
596 (inputs-sbin (map (lambda (input)
597 (string-append (assoc-ref inputs input) "/sbin"))
598 (list "resolvconf" "iproute" "procps"
600 (coreutils (string-append (assoc-ref inputs "coreutils")
602 (wrap-program (string-append out "/bin/wg-quick")
603 `("PATH" ":" prefix ,(append inputs-sbin
607 `(("resolvconf" ,openresolv)
608 ("coreutils" ,coreutils)
609 ("bash" ,bash) ; for scripts using /dev/tcp
612 ("iptables" ,iptables)))
613 (home-page "https://www.wireguard.com/")
614 (synopsis "Tools for configuring WireGuard tunnels")
616 "This package provides the user-space command-line tools for using and
617 configuring WireGuard tunnels.
619 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
620 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
621 to configure and deploy as SSH. VPN connections are made simply by exchanging
622 public keys and can roam across IP addresses.")
624 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
625 license:gpl2)))) ; everything else
627 (define-public wireguard
628 (deprecated-package "wireguard" wireguard-tools))
630 (define-public xl2tpd
637 (url "https://github.com/xelerance/xl2tpd")
638 (commit (string-append "v" version))))
639 (file-name (git-file-name name version))
642 "0ppwza8nwm1av1vldw40gin9wrjrs4l9si50jad414js3k8ycaag"))))
643 (build-system gnu-build-system)
645 `(#:make-flags (list (string-append "PREFIX=" %output)
647 #:phases (modify-phases %standard-phases
648 (delete 'configure) ;no configure script
649 (add-before 'build 'setup-environment
650 (lambda* (#:key inputs #:allow-other-keys)
652 (string-append "-DPPPD=\""
653 (assoc-ref inputs "ppp")
656 (assoc-ref inputs "linux-libre-headers"))
658 #:tests? #f)) ; no tests provided
659 (inputs `(("libpcap" ,libpcap)
660 ("linux-libre-headers" ,linux-libre-headers)
662 (home-page "https://www.xelerance.com/software/xl2tpd/")
663 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
665 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
666 L2TP allows you to tunnel PPP over UDP.")
667 (license license:gpl2)))