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>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages vpn)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages admin)
40 #:use-module (gnu packages base)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages compression)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages gnupg)
46 #:use-module (gnu packages guile)
47 #:use-module (gnu packages libevent)
48 #:use-module (gnu packages linux)
49 #:use-module (gnu packages nss)
50 #:use-module (gnu packages perl)
51 #:use-module (gnu packages pkg-config)
52 #:use-module (gnu packages python)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages xml))
63 (uri (string-append "mirror://gnu/gvpe/gvpe-"
67 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
68 (build-system gnu-build-system)
69 (home-page "http://software.schmorp.de/pkg/gvpe.html")
70 (native-inputs `(("pkg-config" ,pkg-config)))
71 (inputs `(("openssl" ,openssl)
73 (synopsis "Secure VPN among multiple nodes over an untrusted network")
75 "The GNU Virtual Private Ethernet creates a virtual network
76 with multiple nodes using a variety of transport protocols. It works
77 by creating encrypted host-to-host tunnels between multiple
79 (license license:gpl3+)))
87 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
90 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
91 (build-system gnu-build-system)
92 (inputs `(("libgcrypt" ,libgcrypt)
94 ("vpnc-scripts" ,vpnc-scripts)))
96 `(#:tests? #f ; there is no check target
98 (modify-phases %standard-phases
99 (add-after 'unpack 'use-store-paths
100 (lambda* (#:key inputs outputs #:allow-other-keys)
101 (let ((out (assoc-ref outputs "out"))
102 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
103 (substitute* "config.c"
104 (("/etc/vpnc/vpnc-script")
105 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
106 (substitute* "Makefile"
108 (string-append "ETCDIR=" out "/etc/vpnc\n"))
110 (string-append "PREFIX=" out "\n")))
112 (delete 'configure)))) ; no configure script
113 (synopsis "Client for Cisco VPN concentrators")
115 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
116 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
117 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
118 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
119 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
120 (license license:gpl2+) ; some file are bsd-2, see COPYING
121 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
123 (define-public vpnc-scripts
124 (let ((commit "1000e0f6dd7d6bff163169a46359211c1fc3a6d2"))
126 (name "vpnc-scripts")
127 (version (string-append "20190116." (string-take commit 7)))
132 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
134 (file-name (git-file-name name version))
137 "1g41yarz2bl0f73kbjqnywr485ghanbp7nmspklfb0n07yp0z6ak"))))
138 (build-system gnu-build-system)
139 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
140 ("coreutils" ,coreutils)
142 ("iproute2" ,iproute) ; for ‘ip’
143 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
148 (modify-phases %standard-phases
149 (add-after 'unpack 'use-relative-paths
150 ;; Patch the scripts to work with and use relative paths.
152 (for-each (lambda (script)
156 (("\\[ +-x +([^]]+) +\\]" _ command)
157 (string-append "command -v >/dev/null 2>&1 "
159 (find-files "." "^vpnc-script"))
161 (delete 'configure) ; no configure script
164 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
166 ;; There is no Makefile; manually install the relevant files.
167 (lambda* (#:key outputs #:allow-other-keys)
168 (let* ((out (assoc-ref outputs "out"))
169 (etc (string-append out "/etc/vpnc")))
170 (for-each (lambda (file)
171 (install-file file etc))
172 (append (find-files "." "^vpnc-script")
174 "xinetd.netns.conf")))
176 (add-after 'install 'wrap-scripts
177 ;; Wrap scripts with paths to their common hard dependencies.
178 ;; Optional dependencies will need to be installed by the user.
179 (lambda* (#:key inputs outputs #:allow-other-keys)
180 (let ((out (assoc-ref outputs "out")))
183 (wrap-script (string-append out "/etc/vpnc/" script)
186 (let ((input (assoc-ref inputs name)))
187 (string-append input "/bin:"
195 (list "vpnc-script-ptrtd"
199 #:tests? #f)) ; no tests
200 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
201 (synopsis "Network configuration scripts for Cisco VPN clients")
203 "This set of scripts configures routing and name services when invoked
204 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
206 The default @command{vpnc-script} automatically configures most common
207 connections, and provides hooks for performing custom actions at various stages
208 of the connection or disconnection process.
210 Alternative scripts are provided for more complicated set-ups, or to serve as an
211 example for writing your own. For example, @command{vpnc-script-sshd} contains
212 the entire VPN in a network namespace accessible only through SSH.")
213 (license license:gpl2+))))
215 (define-public ocproxy
222 (url "https://github.com/cernekee/ocproxy.git")
223 (commit (string-append "v" version))))
224 (file-name (git-file-name name version))
227 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
228 (build-system gnu-build-system)
230 `(("autoconf" ,autoconf)
231 ("automake" ,automake)))
233 `(("libevent" ,libevent)))
234 (home-page "https://github.com/cernekee/ocproxy")
235 (synopsis "OpenConnect proxy")
237 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
238 on LwIP. When using ocproxy, OpenConnect only handles network activity that
239 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
240 \"hijacks\" all network traffic on the host.")
241 (license license:bsd-3)))
243 (define-public openconnect
249 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
250 "openconnect-" version ".tar.gz"))
252 (base32 "14i9q727c2zc9xhzp1a9hz3gzb5lwgsslbhircm84dnbs192jp1k"))))
253 (build-system gnu-build-system)
255 `(("libxml2" ,libxml2)
259 `(("vpnc-scripts" ,vpnc-scripts)))
261 `(("gettext" ,gettext-minimal)
262 ("pkg-config" ,pkg-config)))
265 `(,(string-append "--with-vpnc-script="
266 (assoc-ref %build-inputs "vpnc-scripts")
267 "/etc/vpnc/vpnc-script"))))
268 (synopsis "Client for Cisco VPN")
270 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
271 supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
272 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
273 and probably others.")
274 (license license:lgpl2.1)
275 (home-page "https://www.infradead.org/openconnect/")))
277 (define-public openvpn
284 "https://swupdate.openvpn.org/community/releases/openvpn-"
288 "149z3agjy03i66mcj5bplim2mh45s2ps1wmxbxczyzw0nxmsd37v"))))
289 (build-system gnu-build-system)
291 '(#:configure-flags '("--enable-iproute2=yes")))
293 `(("iproute2" ,iproute)))
298 ("linux-pam" ,linux-pam)))
299 (home-page "https://openvpn.net/")
300 (synopsis "Virtual private network daemon")
302 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
303 for creating secure point-to-point or site-to-site connections in routed or
304 bridged configurations and remote access facilities. It uses a custom
305 security protocol that utilizes SSL/TLS for key exchange. It is capable of
306 traversing network address translators (@dfn{NAT}s) and firewalls.")
307 (license license:gpl2)))
315 (uri (string-append "https://tinc-vpn.org/packages/"
316 "tinc-" version ".tar.gz"))
319 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
320 (build-system gnu-build-system)
323 '("--sysconfdir=/etc"
324 "--localstatedir=/var")))
325 (inputs `(("zlib" ,zlib)
327 ("openssl" ,openssl)))
328 (home-page "https://tinc-vpn.org")
329 (synopsis "Virtual Private Network (VPN) daemon")
331 "Tinc is a VPN that uses tunnelling and encryption to create a secure
332 private network between hosts on the internet.")
333 (license license:gpl2+)))
335 (define-public sshuttle
342 (uri (pypi-uri name version))
345 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
346 (build-system python-build-system)
349 (modify-phases %standard-phases
350 (add-after 'unpack 'patch-FHS-file-names
352 (substitute* "sshuttle/client.py"
353 (("/usr/bin/env") (which "env")))
354 (substitute* "sshuttle/ssh.py"
358 `(("python-setuptools-scm" ,python-setuptools-scm)
360 ("python-flake8", python-flake8)
361 ("python-mock" ,python-mock)
362 ("python-pytest-cov" ,python-pytest-cov)
363 ("python-pytest-runner" ,python-pytest-runner)))
364 (home-page "https://github.com/sshuttle/sshuttle")
365 (synopsis "VPN that transparently forwards connections over SSH")
366 (description "sshuttle creates an encrypted virtual private network (VPN)
367 connection to any remote server to which you have secure shell (SSH) access.
368 The only requirement is a suitable version of Python on the server;
369 administrative privileges are required only on the client. Unlike most VPNs,
370 sshuttle forwards entire sessions, not packets, using kernel transparent
371 proxying. This makes it faster and more reliable than SSH's own tunneling and
372 port forwarding features. It can forward both TCP and UDP traffic, including
373 DNS domain name queries.")
374 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
376 (define-public sshoot
383 (uri (pypi-uri name version))
386 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
387 (build-system python-build-system)
390 (modify-phases %standard-phases
391 (add-after 'unpack 'patch-paths
393 (substitute* "sshoot/tests/test_manager.py"
394 (("/bin/sh") (which "sh")))
397 `(("python-argcomplete" ,python-argcomplete)
398 ("python-prettytable" ,python-prettytable)
399 ("python-pyyaml" ,python-pyyaml)))
402 `(("python-fixtures" ,python-fixtures)
403 ("python-pbr" ,python-pbr)
404 ("python-testtools" ,python-testtools)))
405 (home-page "https://github.com/albertodonato/sshoot")
406 (synopsis "sshuttle VPN session manager")
407 (description "sshoot provides a command-line interface to manage multiple
408 @command{sshuttle} virtual private networks. It supports flexible profiles
409 with configuration options for most of @command{sshuttle}’s features.")
410 (license license:gpl3+)))
412 (define-public badvpn
415 (version "1.999.130")
420 (url "https://github.com/ambrop72/badvpn.git")
422 (file-name (git-file-name name version))
424 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
425 (build-system cmake-build-system)
427 '(#:tests? #f)) ; no tests
431 ("openssl" ,openssl)))
433 `(("pkg-config" ,pkg-config)))
434 (home-page "https://github.com/ambrop72/badvpn")
435 (synopsis "Peer-to-peer virtual private network (VPN)")
436 (description "@code{BadVPN} is a collection of virtual private
437 network (VPN) tools. It includes:
440 @item NCD programming language.\n
441 NCD (Network Configuration Daemon) is a daemon and programming/scripting
442 language for configuration of network interfaces and other aspects of the
444 @item Tun2socks network-layer proxifier.\n
445 The tun2socks program socksifes TCP connections at the network layer. It
446 implements a TUN device which accepts all incoming TCP connections (regardless
447 of destination IP), and forwards the connections through a SOCKS server.
448 @item Peer-to-peer VPN.\n
449 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
452 ;; This project contains a bundled lwIP. lwIP is also released under the
453 ;; 3-clause BSD license.
454 (license license:bsd-3)))
456 (define-public wireguard-linux-compat
458 (name "wireguard-linux-compat")
459 (version "1.0.20200401")
462 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
463 "snapshot/wireguard-linux-compat-" version
467 "0ymprz3h4b92wlcqm5k5vmcgap8pjv202bgkdx0axmp12n1lmyvx"))))
468 (build-system gnu-build-system)
470 `(#:tests? #f ; No test suite
471 #:modules ((guix build gnu-build-system)
474 (ice-9 textual-ports))
476 (modify-phases %standard-phases
477 (delete 'configure) ; No ./configure script
479 (lambda* (#:key outputs #:allow-other-keys)
480 (let* ((patch-builder "./kernel-tree-scripts/create-patch.sh")
481 (port (open-input-pipe patch-builder))
482 (str (get-string-all port)))
484 (call-with-output-file "wireguard.patch"
486 (format port "~a" str))))
489 (lambda* (#:key outputs #:allow-other-keys)
490 (install-file "wireguard.patch"
491 (assoc-ref %outputs "out"))
493 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
494 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
495 (description "This is an out-of-tree Linux kernel patch adding WireGuard to
496 kernel versions 3.10 through 5.5. WireGuard was added to Linux 5.6.")
497 (license license:gpl2)))
499 (define-public wireguard-tools
501 (name "wireguard-tools")
502 (version "1.0.20200206")
507 (url "https://git.zx2c4.com/wireguard-tools.git")
508 (commit (string-append "v" version))))
509 (file-name (git-file-name name version))
511 (base32 "0ivc08lds5w39a6f2xdfih9wlk5g724hl3kpdvxvh5yff4l84qb7"))))
512 (build-system gnu-build-system)
517 "WITH_BASHCOMPLETION=yes"
518 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
520 (string-append "PREFIX=" (assoc-ref %outputs "out"))
521 ;; Currently used only to create an empty /etc/wireguard directory.
522 (string-append "SYSCONFDIR=no-thanks"))
523 ;; The test suite is meant to be run interactively. It runs Clang's
524 ;; scan-build static analyzer and then starts a web server to display the
528 (modify-phases %standard-phases
529 ;; No configure script
530 (delete 'configure))))
531 (home-page "https://www.wireguard.com/")
532 (synopsis "Tools for configuring WireGuard tunnels")
534 "This package provides the user-space command-line tools for using and
535 configuring WireGuard tunnels.
537 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
538 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
539 to configure and deploy as SSH. VPN connections are made simply by exchanging
540 public keys and can roam across IP addresses.")
542 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
543 license:gpl2)))) ; everything else
545 (define-public wireguard
546 (deprecated-package "wireguard" wireguard-tools))
548 (define-public xl2tpd
555 (url "https://github.com/xelerance/xl2tpd")
556 (commit (string-append "v" version))))
557 (file-name (git-file-name name version))
560 "0ppwza8nwm1av1vldw40gin9wrjrs4l9si50jad414js3k8ycaag"))))
561 (build-system gnu-build-system)
563 `(#:make-flags (list (string-append "PREFIX=" %output)
565 #:phases (modify-phases %standard-phases
566 (delete 'configure)) ; no configure script
567 #:tests? #f)) ; no tests provided
568 (inputs `(("libpcap" ,libpcap)))
569 (home-page "https://www.xelerance.com/software/xl2tpd/")
570 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
572 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
573 L2TP allows you to tunnel PPP over UDP.")
574 (license license:gpl2)))