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, 2020 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 ncurses)
57 #:use-module (gnu packages nss)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pkg-config)
60 #:use-module (gnu packages python)
61 #:use-module (gnu packages python-xyz)
62 #:use-module (gnu packages python-web)
63 #:use-module (gnu packages samba)
64 #:use-module (gnu packages tls)
65 #:use-module (gnu packages xml))
73 (uri (string-append "mirror://gnu/gvpe/gvpe-"
77 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
78 (build-system gnu-build-system)
79 (home-page "http://software.schmorp.de/pkg/gvpe.html")
80 (native-inputs `(("pkg-config" ,pkg-config)))
81 (inputs `(("openssl" ,openssl)
83 (synopsis "Secure VPN among multiple nodes over an untrusted network")
85 "The GNU Virtual Private Ethernet creates a virtual network
86 with multiple nodes using a variety of transport protocols. It works
87 by creating encrypted host-to-host tunnels between multiple
89 (license license:gpl3+)))
97 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
100 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
101 (build-system gnu-build-system)
102 (inputs `(("libgcrypt" ,libgcrypt)
104 ("vpnc-scripts" ,vpnc-scripts)))
106 `(#:tests? #f ; there is no check target
108 (modify-phases %standard-phases
109 (add-after 'unpack 'use-store-paths
110 (lambda* (#:key inputs outputs #:allow-other-keys)
111 (let ((out (assoc-ref outputs "out"))
112 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
113 (substitute* "config.c"
114 (("/etc/vpnc/vpnc-script")
115 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
116 (substitute* "Makefile"
118 (string-append "ETCDIR=" out "/etc/vpnc\n"))
120 (string-append "PREFIX=" out "\n")))
122 (delete 'configure)))) ; no configure script
123 (synopsis "Client for Cisco VPN concentrators")
125 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
126 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
127 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
128 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
129 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
130 (license license:gpl2+) ; some file are bsd-2, see COPYING
131 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
133 (define-public vpnc-scripts
134 (let ((commit "3885f8bbc4ae03fd6da0ada6de12f7223a59595c"))
136 (name "vpnc-scripts")
137 (version (string-append "20200925." (string-take commit 7)))
142 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
144 (file-name (git-file-name name version))
147 "1pmi4n58q81pmn9arvfixhvv6vkkf3rpwac3hwnwyl882q5q0ccx"))))
148 (build-system gnu-build-system)
149 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
150 ("coreutils" ,coreutils)
152 ("iproute2" ,iproute) ; for ‘ip’
153 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
158 (modify-phases %standard-phases
159 (add-after 'unpack 'use-relative-paths
160 ;; Patch the scripts to work with and use relative paths.
162 (for-each (lambda (script)
166 (("\\[ +-x +([^]]+) +\\]" _ command)
167 (string-append "command -v >/dev/null 2>&1 "
169 (find-files "." "^vpnc-script"))
171 (delete 'configure) ; no configure script
174 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
176 ;; There is no Makefile; manually install the relevant files.
177 (lambda* (#:key outputs #:allow-other-keys)
178 (let* ((out (assoc-ref outputs "out"))
179 (etc (string-append out "/etc/vpnc")))
180 (for-each (lambda (file)
181 (install-file file etc))
182 (append (find-files "." "^vpnc-script")
184 "xinetd.netns.conf")))
186 (add-after 'install 'wrap-scripts
187 ;; Wrap scripts with paths to their common hard dependencies.
188 ;; Optional dependencies will need to be installed by the user.
189 (lambda* (#:key inputs outputs #:allow-other-keys)
190 (let ((out (assoc-ref outputs "out")))
193 (wrap-script (string-append out "/etc/vpnc/" script)
196 (let ((input (assoc-ref inputs name)))
197 (string-append input "/bin:"
205 (list "vpnc-script-ptrtd"
209 #:tests? #f)) ; no tests
210 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
211 (synopsis "Network configuration scripts for Cisco VPN clients")
213 "This set of scripts configures routing and name services when invoked
214 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
216 The default @command{vpnc-script} automatically configures most common
217 connections, and provides hooks for performing custom actions at various stages
218 of the connection or disconnection process.
220 Alternative scripts are provided for more complicated set-ups, or to serve as an
221 example for writing your own. For example, @command{vpnc-script-sshd} contains
222 the entire VPN in a network namespace accessible only through SSH.")
223 (license license:gpl2+))))
225 (define-public ocproxy
232 (url "https://github.com/cernekee/ocproxy")
233 (commit (string-append "v" version))))
234 (file-name (git-file-name name version))
237 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
238 (build-system gnu-build-system)
240 `(("autoconf" ,autoconf)
241 ("automake" ,automake)))
243 `(("libevent" ,libevent)))
244 (home-page "https://github.com/cernekee/ocproxy")
245 (synopsis "OpenConnect proxy")
247 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
248 on LwIP. When using ocproxy, OpenConnect only handles network activity that
249 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
250 \"hijacks\" all network traffic on the host.")
251 (license license:bsd-3)))
253 (define-public openconnect
259 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
260 "openconnect-" version ".tar.gz"))
262 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
263 (build-system gnu-build-system)
265 `(("libxml2" ,libxml2)
266 ;; XXX ‘DTLS is insecure in GnuTLS v3.6.3 through v3.6.12.’
267 ;; See <https://gitlab.com/gnutls/gnutls/-/issues/960>.
268 ("gnutls" ,gnutls-3.6.14)
272 ("vpnc-scripts" ,vpnc-scripts)))
274 `(("gettext" ,gettext-minimal)
275 ("pkg-config" ,pkg-config)))
278 `(,(string-append "--with-vpnc-script="
279 (assoc-ref %build-inputs "vpnc-scripts")
280 "/etc/vpnc/vpnc-script"))))
281 (synopsis "Client for Cisco VPN")
283 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
284 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
285 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
286 and probably others.")
287 (license license:lgpl2.1)
288 (home-page "https://www.infradead.org/openconnect/")))
290 (define-public openvpn
297 "https://swupdate.openvpn.org/community/releases/openvpn-"
301 "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"))))
302 (build-system gnu-build-system)
304 '(#:configure-flags '("--enable-iproute2=yes")))
306 `(("iproute2" ,iproute)))
311 ("linux-pam" ,linux-pam)))
312 (home-page "https://openvpn.net/")
313 (synopsis "Virtual private network daemon")
315 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
316 for creating secure point-to-point or site-to-site connections in routed or
317 bridged configurations and remote access facilities. It uses a custom
318 security protocol that utilizes SSL/TLS for key exchange. It is capable of
319 traversing network address translators (@dfn{NAT}s) and firewalls.")
320 (license license:gpl2)))
322 (define-public protonvpn-cli
324 (name "protonvpn-cli")
328 ;; PyPI has a ".whl" file but not a proper source release.
329 ;; Thus, fetch code from Git.
332 (url "https://github.com/ProtonVPN/linux-cli")
333 (commit (string-append "v" version))))
334 (file-name (git-file-name name version))
337 "08yca0a0prrnrc7ir7ajd56yxvxpcs4m1k8f5kf273f5whgr7wzw"))))
338 (build-system python-build-system)
339 (arguments '(#:tests? #f)) ; no tests in repo
341 `(("python-docopt" ,python-docopt)))
343 `(("python-jinja2" ,python-jinja2)
344 ("python-pythondialog" ,python-pythondialog)
345 ("python-requests" ,python-requests)))
347 `(("openvpn" ,openvpn)
349 (synopsis "Command-line client for ProtonVPN")
351 "This is the official command-line interface for ProtonVPN, a secure
352 point-to-point virtual private networking (VPN) service with a gratis tier.
353 It can automatically find and connect to the fastest servers or use Tor over
354 VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
355 (home-page "https://github.com/ProtonVPN/linux-cli")
356 (license license:gpl3+)))
364 (uri (string-append "https://tinc-vpn.org/packages/"
365 "tinc-" version ".tar.gz"))
368 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
369 (build-system gnu-build-system)
372 '("--sysconfdir=/etc"
373 "--localstatedir=/var")))
374 (inputs `(("zlib" ,zlib)
376 ("openssl" ,openssl)))
377 (home-page "https://tinc-vpn.org")
378 (synopsis "Virtual Private Network (VPN) daemon")
380 "Tinc is a VPN that uses tunnelling and encryption to create a secure
381 private network between hosts on the internet.")
382 (license license:gpl2+)))
384 (define-public sshuttle
391 (uri (pypi-uri name version))
394 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
395 (build-system python-build-system)
398 (modify-phases %standard-phases
399 (add-after 'unpack 'patch-FHS-file-names
401 (substitute* "sshuttle/client.py"
402 (("/usr/bin/env") (which "env")))
403 (substitute* "sshuttle/ssh.py"
407 `(("python-setuptools-scm" ,python-setuptools-scm)
409 ("python-flake8" ,python-flake8)
410 ("python-mock" ,python-mock)
411 ("python-pytest-cov" ,python-pytest-cov)
412 ("python-pytest-runner" ,python-pytest-runner)))
413 (home-page "https://github.com/sshuttle/sshuttle")
414 (synopsis "VPN that transparently forwards connections over SSH")
415 (description "sshuttle creates an encrypted virtual private network (VPN)
416 connection to any remote server to which you have secure shell (SSH) access.
417 The only requirement is a suitable version of Python on the server;
418 administrative privileges are required only on the client. Unlike most VPNs,
419 sshuttle forwards entire sessions, not packets, using kernel transparent
420 proxying. This makes it faster and more reliable than SSH's own tunneling and
421 port forwarding features. It can forward both TCP and UDP traffic, including
422 DNS domain name queries.")
423 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
425 (define-public sshoot
432 (uri (pypi-uri name version))
435 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
436 (build-system python-build-system)
439 (modify-phases %standard-phases
440 (add-after 'unpack 'patch-paths
442 (substitute* "sshoot/tests/test_manager.py"
443 (("/bin/sh") (which "sh")))
446 `(("python-argcomplete" ,python-argcomplete)
447 ("python-prettytable" ,python-prettytable)
448 ("python-pyyaml" ,python-pyyaml)))
451 `(("python-fixtures" ,python-fixtures)
452 ("python-pbr" ,python-pbr)
453 ("python-testtools" ,python-testtools)))
454 (home-page "https://github.com/albertodonato/sshoot")
455 (synopsis "sshuttle VPN session manager")
456 (description "sshoot provides a command-line interface to manage multiple
457 @command{sshuttle} virtual private networks. It supports flexible profiles
458 with configuration options for most of @command{sshuttle}’s features.")
459 (license license:gpl3+)))
461 (define-public badvpn
464 (version "1.999.130")
469 (url "https://github.com/ambrop72/badvpn")
471 (file-name (git-file-name name version))
473 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
474 (build-system cmake-build-system)
476 '(#:tests? #f)) ; no tests
480 ("openssl" ,openssl)))
482 `(("pkg-config" ,pkg-config)))
483 (home-page "https://github.com/ambrop72/badvpn")
484 (synopsis "Peer-to-peer virtual private network (VPN)")
485 (description "@code{BadVPN} is a collection of virtual private
486 network (VPN) tools. It includes:
489 @item NCD programming language.\n
490 NCD (Network Configuration Daemon) is a daemon and programming/scripting
491 language for configuration of network interfaces and other aspects of the
493 @item Tun2socks network-layer proxifier.\n
494 The tun2socks program socksifes TCP connections at the network layer. It
495 implements a TUN device which accepts all incoming TCP connections (regardless
496 of destination IP), and forwards the connections through a SOCKS server.
497 @item Peer-to-peer VPN.\n
498 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
501 ;; This project contains a bundled lwIP. lwIP is also released under the
502 ;; 3-clause BSD license.
503 (license license:bsd-3)))
505 (define-public wireguard-linux-compat
507 (name "wireguard-linux-compat")
508 (version "1.0.20201112")
511 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
512 "snapshot/wireguard-linux-compat-" version
516 "1qcpg1rcmy4h529a0spjm50qgxjgjy20j29fpbrqsv5xq3qfgsl9"))))
517 (build-system linux-module-build-system)
521 `(#:linux ,linux-libre-5.4 ; mustn't have WG built-in
522 #:tests? #f ; no test suite
523 #:modules ((guix build linux-module-build-system)
526 (ice-9 textual-ports))
528 (modify-phases %standard-phases
529 (add-before 'build 'change-directory
533 (add-after 'build 'build-patch
534 (lambda* (#:key outputs #:allow-other-keys)
535 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
536 (port (open-input-pipe patch-builder))
537 (str (get-string-all port)))
539 (call-with-output-file "wireguard.patch"
541 (format port "~a" str))))
543 (add-after 'install 'install-patch
544 (lambda* (#:key outputs #:allow-other-keys)
545 (install-file "wireguard.patch"
546 (assoc-ref %outputs "kernel-patch"))
548 ;; So that 'install-license-files' works...
549 (add-before 'install-license-files 'reset-cwd
553 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
554 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
555 (description "This package contains an out-of-tree kernel patch and
556 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
557 WireGuard was added to Linux 5.6.")
558 (license license:gpl2)))
560 (define-public wireguard-tools
562 (name "wireguard-tools")
563 (version "1.0.20200827")
568 (url "https://git.zx2c4.com/wireguard-tools.git")
569 (commit (string-append "v" version))))
570 (file-name (git-file-name name version))
572 (base32 "1h351hn531z6z85sx9ya27xjz1jszgn1pkwibacjj49mds15f7gn"))))
573 (build-system gnu-build-system)
576 (list ,(string-append "CC=" (cc-for-target))
578 "WITH_BASHCOMPLETION=yes"
579 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
581 (string-append "PREFIX=" (assoc-ref %outputs "out"))
582 ;; Currently used only to create an empty /etc/wireguard directory.
583 (string-append "SYSCONFDIR=no-thanks"))
584 ;; The test suite is meant to be run interactively. It runs Clang's
585 ;; scan-build static analyzer and then starts a web server to display the
589 (modify-phases %standard-phases
590 ;; No configure script
592 (add-after 'install 'install-contrib-docs
593 (lambda* (#:key outputs #:allow-other-keys)
594 (let ((out (assoc-ref outputs "out")))
595 (copy-recursively "contrib/"
596 (string-append out "/share/doc/wireguard-tools"))
598 (add-after 'install 'wrap-wg-quick
599 (lambda* (#:key inputs outputs #:allow-other-keys)
600 (let* ((out (assoc-ref outputs "out"))
601 (inputs-sbin (map (lambda (input)
602 (string-append (assoc-ref inputs input) "/sbin"))
603 (list "resolvconf" "iproute" "procps"
605 (coreutils (string-append (assoc-ref inputs "coreutils")
607 (wrap-program (string-append out "/bin/wg-quick")
608 `("PATH" ":" prefix ,(append inputs-sbin
612 `(("resolvconf" ,openresolv)
613 ("coreutils" ,coreutils)
614 ("bash" ,bash) ; for scripts using /dev/tcp
617 ("iptables" ,iptables)))
618 (home-page "https://www.wireguard.com/")
619 (synopsis "Tools for configuring WireGuard tunnels")
621 "This package provides the user-space command-line tools for using and
622 configuring WireGuard tunnels.
624 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
625 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
626 to configure and deploy as SSH. VPN connections are made simply by exchanging
627 public keys and can roam across IP addresses.")
629 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
630 license:gpl2)))) ; everything else
632 (define-public wireguard
633 (deprecated-package "wireguard" wireguard-tools))
635 (define-public xl2tpd
642 (url "https://github.com/xelerance/xl2tpd")
643 (commit (string-append "v" version))))
644 (file-name (git-file-name name version))
647 "0is5ccrvijz0pfm45pfrlbb9y8231yz3c4zqs8mkgakl9rxajy6l"))))
648 (build-system gnu-build-system)
650 `(#:make-flags (list (string-append "PREFIX=" %output)
652 #:phases (modify-phases %standard-phases
653 (delete 'configure) ;no configure script
654 (add-before 'build 'setup-environment
655 (lambda* (#:key inputs #:allow-other-keys)
656 (substitute* "l2tp.h"
658 (string-append (assoc-ref inputs "ppp")
661 (assoc-ref inputs "linux-libre-headers"))
663 #:tests? #f)) ; no tests provided
664 (inputs `(("libpcap" ,libpcap)
665 ("linux-libre-headers" ,linux-libre-headers)
667 (home-page "https://www.xelerance.com/software/xl2tpd/")
668 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
670 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
671 L2TP allows you to tunnel PPP over UDP.")
672 (license license:gpl2)))