Merge branch 'master' into ungrafting
[jackhill/guix/guix.git] / gnu / packages / vpn.scm
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>
17 ;;; Copyright © 2020 David Dashyan <mail@davie.li>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages vpn)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix packages)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system gnu)
41 #:use-module (guix build-system linux-module)
42 #:use-module (guix build-system python)
43 #:use-module (guix utils)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages admin)
46 #:use-module (gnu packages base)
47 #:use-module (gnu packages bash)
48 #:use-module (gnu packages check)
49 #:use-module (gnu packages dns)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages compression)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages gnupg)
54 #:use-module (gnu packages guile)
55 #:use-module (gnu packages libevent)
56 #:use-module (gnu packages linux)
57 #:use-module (gnu packages ncurses)
58 #:use-module (gnu packages nss)
59 #:use-module (gnu packages perl)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages python-xyz)
63 #:use-module (gnu packages python-web)
64 #:use-module (gnu packages samba)
65 #:use-module (gnu packages tls)
66 #:use-module (gnu packages xml))
67
68 (define-public gvpe
69 (package
70 (name "gvpe")
71 (version "3.1")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/gvpe/gvpe-"
75 version ".tar.gz"))
76 (sha256
77 (base32
78 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
79 (build-system gnu-build-system)
80 (home-page "http://software.schmorp.de/pkg/gvpe.html")
81 (native-inputs `(("pkg-config" ,pkg-config)))
82 (inputs `(("openssl" ,openssl)
83 ("zlib" ,zlib)))
84 (synopsis "Secure VPN among multiple nodes over an untrusted network")
85 (description
86 "The GNU Virtual Private Ethernet creates a virtual network
87 with multiple nodes using a variety of transport protocols. It works
88 by creating encrypted host-to-host tunnels between multiple
89 endpoints.")
90 (license license:gpl3+)))
91
92 (define-public vpnc
93 (package
94 (name "vpnc")
95 (version "0.5.3")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
99 version ".tar.gz"))
100 (sha256 (base32
101 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
102 (build-system gnu-build-system)
103 (inputs `(("libgcrypt" ,libgcrypt)
104 ("perl" ,perl)
105 ("vpnc-scripts" ,vpnc-scripts)))
106 (arguments
107 `(#:tests? #f ; there is no check target
108 #:phases
109 (modify-phases %standard-phases
110 (add-after 'unpack 'use-store-paths
111 (lambda* (#:key inputs outputs #:allow-other-keys)
112 (let ((out (assoc-ref outputs "out"))
113 (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
114 (substitute* "config.c"
115 (("/etc/vpnc/vpnc-script")
116 (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
117 (substitute* "Makefile"
118 (("ETCDIR=.*")
119 (string-append "ETCDIR=" out "/etc/vpnc\n"))
120 (("PREFIX=.*")
121 (string-append "PREFIX=" out "\n")))
122 #t)))
123 (delete 'configure)))) ; no configure script
124 (synopsis "Client for Cisco VPN concentrators")
125 (description
126 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
127 It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
128 shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
129 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
130 Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
131 (license license:gpl2+) ; some file are bsd-2, see COPYING
132 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
133
134 (define-public vpnc-scripts
135 (let ((commit "3885f8bbc4ae03fd6da0ada6de12f7223a59595c"))
136 (package
137 (name "vpnc-scripts")
138 (version (string-append "20200925." (string-take commit 7)))
139 (source (origin
140 (method git-fetch)
141 (uri
142 (git-reference
143 (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
144 (commit commit)))
145 (file-name (git-file-name name version))
146 (sha256
147 (base32
148 "1pmi4n58q81pmn9arvfixhvv6vkkf3rpwac3hwnwyl882q5q0ccx"))))
149 (build-system gnu-build-system)
150 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
151 ("coreutils" ,coreutils)
152 ("grep" ,grep)
153 ("iproute2" ,iproute) ; for ‘ip’
154 ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
155 ("sed" ,sed)
156 ("which" ,which)))
157 (arguments
158 `(#:phases
159 (modify-phases %standard-phases
160 (add-after 'unpack 'use-relative-paths
161 ;; Patch the scripts to work with and use relative paths.
162 (lambda* _
163 (for-each (lambda (script)
164 (substitute* script
165 (("^PATH=.*") "")
166 (("/usr/s?bin/") "")
167 (("\\[ +-x +([^]]+) +\\]" _ command)
168 (string-append "command -v >/dev/null 2>&1 "
169 command))))
170 (find-files "." "^vpnc-script"))
171 #t))
172 (delete 'configure) ; no configure script
173 (replace 'build
174 (lambda _
175 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
176 (replace 'install
177 ;; There is no Makefile; manually install the relevant files.
178 (lambda* (#:key outputs #:allow-other-keys)
179 (let* ((out (assoc-ref outputs "out"))
180 (etc (string-append out "/etc/vpnc")))
181 (for-each (lambda (file)
182 (install-file file etc))
183 (append (find-files "." "^vpnc-script")
184 (list "netunshare"
185 "xinetd.netns.conf")))
186 #t)))
187 (add-after 'install 'wrap-scripts
188 ;; Wrap scripts with paths to their common hard dependencies.
189 ;; Optional dependencies will need to be installed by the user.
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 (let ((out (assoc-ref outputs "out")))
192 (for-each
193 (lambda (script)
194 (wrap-script (string-append out "/etc/vpnc/" script)
195 `("PATH" ":" prefix
196 ,(map (lambda (name)
197 (let ((input (assoc-ref inputs name)))
198 (string-append input "/bin:"
199 input "/sbin")))
200 (list "coreutils"
201 "grep"
202 "iproute2"
203 "net-tools"
204 "sed"
205 "which")))))
206 (list "vpnc-script-ptrtd"
207 "vpnc-script-sshd"
208 "vpnc-script"))
209 #t))))
210 #:tests? #f)) ; no tests
211 (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
212 (synopsis "Network configuration scripts for Cisco VPN clients")
213 (description
214 "This set of scripts configures routing and name services when invoked
215 by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
216
217 The default @command{vpnc-script} automatically configures most common
218 connections, and provides hooks for performing custom actions at various stages
219 of the connection or disconnection process.
220
221 Alternative scripts are provided for more complicated set-ups, or to serve as an
222 example for writing your own. For example, @command{vpnc-script-sshd} contains
223 the entire VPN in a network namespace accessible only through SSH.")
224 (license license:gpl2+))))
225
226 (define-public ocproxy
227 (package
228 (name "ocproxy")
229 (version "1.60")
230 (source (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/cernekee/ocproxy")
234 (commit (string-append "v" version))))
235 (file-name (git-file-name name version))
236 (sha256
237 (base32
238 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
239 (build-system gnu-build-system)
240 (native-inputs
241 `(("autoconf" ,autoconf)
242 ("automake" ,automake)))
243 (inputs
244 `(("libevent" ,libevent)))
245 (home-page "https://github.com/cernekee/ocproxy")
246 (synopsis "OpenConnect proxy")
247 (description
248 "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
249 on LwIP. When using ocproxy, OpenConnect only handles network activity that
250 the user specifically asks to proxy, so the @dfn{VPN} interface no longer
251 \"hijacks\" all network traffic on the host.")
252 (license license:bsd-3)))
253
254 (define-public openconnect
255 (package
256 (name "openconnect")
257 (version "8.10")
258 (source (origin
259 (method url-fetch)
260 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
261 "openconnect-" version ".tar.gz"))
262 (sha256
263 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
264 (build-system gnu-build-system)
265 (propagated-inputs
266 `(("libxml2" ,libxml2)
267 ("gnutls" ,gnutls)
268 ("zlib" ,zlib)))
269 (inputs
270 `(("lz4" ,lz4)
271 ("vpnc-scripts" ,vpnc-scripts)))
272 (native-inputs
273 `(("gettext" ,gettext-minimal)
274 ("pkg-config" ,pkg-config)))
275 (arguments
276 `(#:configure-flags
277 `(,(string-append "--with-vpnc-script="
278 (assoc-ref %build-inputs "vpnc-scripts")
279 "/etc/vpnc/vpnc-script"))))
280 (synopsis "Client for Cisco VPN")
281 (description
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/")))
288
289 (define-public openfortivpn
290 (package
291 (name "openfortivpn")
292 (version "1.15.0")
293 (source (origin
294 (method git-fetch)
295 (uri (git-reference
296 (url "https://github.com/adrienverge/openfortivpn")
297 (commit (string-append "v" version))))
298 (file-name (git-file-name name version))
299 (sha256
300 (base32
301 "1qsfgpxg553s8rc9cyrc4k96z0pislxsdxb9wyhp8fdprkak2mw2"))))
302 (build-system gnu-build-system)
303 (native-inputs
304 `(("autoconf" ,autoconf)
305 ("autotools" ,automake)
306 ("pkg-config" ,pkg-config)))
307 (inputs
308 `(("openssl" ,openssl)
309 ("ppp" ,ppp)))
310 (home-page "https://github.com/adrienverge/openfortivpn")
311 (synopsis "Client for PPP+SSL VPN tunnel services")
312 (description "Openfortivpn is a client for PPP+SSL VPN tunnel services. It
313 spawns a pppd process and operates the communication between the gateway and
314 this process. It is compatible with Fortinet VPNs.")
315 (license license:gpl3+)))
316
317 (define-public openvpn
318 (package
319 (name "openvpn")
320 (version "2.4.10")
321 (source (origin
322 (method url-fetch)
323 (uri (string-append
324 "https://swupdate.openvpn.org/community/releases/openvpn-"
325 version ".tar.xz"))
326 (sha256
327 (base32
328 "0xx378ja2rdfaayc257z0z5ddsp8h0jcpqnd1a6bdw3rlsam6a6g"))))
329 (build-system gnu-build-system)
330 (arguments
331 '(#:configure-flags '("--enable-iproute2=yes")))
332 (native-inputs
333 `(("iproute2" ,iproute)))
334 (inputs
335 `(("lz4" ,lz4)
336 ("lzo" ,lzo)
337 ("openssl" ,openssl)
338 ("linux-pam" ,linux-pam)))
339 (home-page "https://openvpn.net/")
340 (synopsis "Virtual private network daemon")
341 (description
342 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
343 for creating secure point-to-point or site-to-site connections in routed or
344 bridged configurations and remote access facilities. It uses a custom
345 security protocol that utilizes SSL/TLS for key exchange. It is capable of
346 traversing network address translators (@dfn{NAT}s) and firewalls.")
347 (license license:gpl2)))
348
349 (define-public protonvpn-cli
350 (package
351 (name "protonvpn-cli")
352 (version "2.2.6")
353 (source
354 (origin
355 ;; PyPI has a ".whl" file but not a proper source release.
356 ;; Thus, fetch code from Git.
357 (method git-fetch)
358 (uri (git-reference
359 (url "https://github.com/ProtonVPN/linux-cli")
360 (commit (string-append "v" version))))
361 (file-name (git-file-name name version))
362 (sha256
363 (base32 "0y7v9ikrmy5dbjlpbpacp08gy838i8z54m8m4ps7ldk1j6kyia3n"))))
364 (build-system python-build-system)
365 (arguments '(#:tests? #f)) ; no tests in repo
366 (native-inputs
367 `(("python-docopt" ,python-docopt)))
368 (inputs
369 `(("python-jinja2" ,python-jinja2)
370 ("python-pythondialog" ,python-pythondialog)
371 ("python-requests" ,python-requests)))
372 (propagated-inputs
373 `(("openvpn" ,openvpn)
374 ("dialog" ,dialog)))
375 (synopsis "Command-line client for ProtonVPN")
376 (description
377 "This is the official command-line interface for ProtonVPN, a secure
378 point-to-point virtual private networking (VPN) service with a gratis tier.
379 It can automatically find and connect to the fastest servers or use Tor over
380 VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
381 (home-page "https://github.com/ProtonVPN/linux-cli")
382 (license license:gpl3+)))
383
384 (define-public tinc
385 (package
386 (name "tinc")
387 (version "1.0.36")
388 (source (origin
389 (method url-fetch)
390 (uri (string-append "https://tinc-vpn.org/packages/"
391 "tinc-" version ".tar.gz"))
392 (sha256
393 (base32
394 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
395 (build-system gnu-build-system)
396 (arguments
397 '(#:configure-flags
398 '("--sysconfdir=/etc"
399 "--localstatedir=/var")))
400 (inputs `(("zlib" ,zlib)
401 ("lzo" ,lzo)
402 ("openssl" ,openssl)))
403 (home-page "https://tinc-vpn.org")
404 (synopsis "Virtual Private Network (VPN) daemon")
405 (description
406 "Tinc is a VPN that uses tunnelling and encryption to create a secure
407 private network between hosts on the internet.")
408 (license license:gpl2+)))
409
410 (define-public sshuttle
411 (package
412 (name "sshuttle")
413 (version "0.78.5")
414 (source
415 (origin
416 (method url-fetch)
417 (uri (pypi-uri name version))
418 (sha256
419 (base32
420 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
421 (build-system python-build-system)
422 (arguments
423 `(#:phases
424 (modify-phases %standard-phases
425 (add-after 'unpack 'patch-FHS-file-names
426 (lambda _
427 (substitute* "sshuttle/client.py"
428 (("/usr/bin/env") (which "env")))
429 (substitute* "sshuttle/ssh.py"
430 (("/bin/sh") "sh"))
431 #t)))))
432 (native-inputs
433 `(("python-setuptools-scm" ,python-setuptools-scm)
434 ;; For tests only.
435 ("python-flake8" ,python-flake8)
436 ("python-mock" ,python-mock)
437 ("python-pytest-cov" ,python-pytest-cov)
438 ("python-pytest-runner" ,python-pytest-runner)))
439 (home-page "https://github.com/sshuttle/sshuttle")
440 (synopsis "VPN that transparently forwards connections over SSH")
441 (description "sshuttle creates an encrypted virtual private network (VPN)
442 connection to any remote server to which you have secure shell (SSH) access.
443 The only requirement is a suitable version of Python on the server;
444 administrative privileges are required only on the client. Unlike most VPNs,
445 sshuttle forwards entire sessions, not packets, using kernel transparent
446 proxying. This makes it faster and more reliable than SSH's own tunneling and
447 port forwarding features. It can forward both TCP and UDP traffic, including
448 DNS domain name queries.")
449 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
450
451 (define-public sshoot
452 (package
453 (name "sshoot")
454 (version "1.2.6")
455 (source
456 (origin
457 (method url-fetch)
458 (uri (pypi-uri name version))
459 (sha256
460 (base32
461 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
462 (build-system python-build-system)
463 (arguments
464 '(#:phases
465 (modify-phases %standard-phases
466 (add-after 'unpack 'patch-paths
467 (lambda _
468 (substitute* "sshoot/tests/test_manager.py"
469 (("/bin/sh") (which "sh")))
470 #t)))))
471 (inputs
472 `(("python-argcomplete" ,python-argcomplete)
473 ("python-prettytable" ,python-prettytable)
474 ("python-pyyaml" ,python-pyyaml)))
475 ;; For tests only.
476 (native-inputs
477 `(("python-fixtures" ,python-fixtures)
478 ("python-pbr" ,python-pbr)
479 ("python-testtools" ,python-testtools)))
480 (home-page "https://github.com/albertodonato/sshoot")
481 (synopsis "sshuttle VPN session manager")
482 (description "sshoot provides a command-line interface to manage multiple
483 @command{sshuttle} virtual private networks. It supports flexible profiles
484 with configuration options for most of @command{sshuttle}’s features.")
485 (license license:gpl3+)))
486
487 (define-public badvpn
488 (package
489 (name "badvpn")
490 (version "1.999.130")
491 (source
492 (origin
493 (method git-fetch)
494 (uri (git-reference
495 (url "https://github.com/ambrop72/badvpn")
496 (commit version)))
497 (file-name (git-file-name name version))
498 (sha256
499 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
500 (build-system cmake-build-system)
501 (arguments
502 '(#:tests? #f)) ; no tests
503 (inputs
504 `(("nspr" ,nspr)
505 ("nss" ,nss)
506 ("openssl" ,openssl)))
507 (native-inputs
508 `(("pkg-config" ,pkg-config)))
509 (home-page "https://github.com/ambrop72/badvpn")
510 (synopsis "Peer-to-peer virtual private network (VPN)")
511 (description "@code{BadVPN} is a collection of virtual private
512 network (VPN) tools. It includes:
513
514 @enumerate
515 @item NCD programming language.\n
516 NCD (Network Configuration Daemon) is a daemon and programming/scripting
517 language for configuration of network interfaces and other aspects of the
518 operating system.
519 @item Tun2socks network-layer proxifier.\n
520 The tun2socks program socksifes TCP connections at the network layer. It
521 implements a TUN device which accepts all incoming TCP connections (regardless
522 of destination IP), and forwards the connections through a SOCKS server.
523 @item Peer-to-peer VPN.\n
524 The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
525 (VPN nodes).
526 @end enumerate")
527 ;; This project contains a bundled lwIP. lwIP is also released under the
528 ;; 3-clause BSD license.
529 (license license:bsd-3)))
530
531 (define-public wireguard-linux-compat
532 (package
533 (name "wireguard-linux-compat")
534 (version "1.0.20201112")
535 (source (origin
536 (method url-fetch)
537 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
538 "snapshot/wireguard-linux-compat-" version
539 ".tar.xz"))
540 (sha256
541 (base32
542 "1qcpg1rcmy4h529a0spjm50qgxjgjy20j29fpbrqsv5xq3qfgsl9"))))
543 (build-system linux-module-build-system)
544 (outputs '("out"
545 "kernel-patch"))
546 (arguments
547 `(#:linux ,linux-libre-5.4 ; mustn't have WG built-in
548 #:tests? #f ; no test suite
549 #:modules ((guix build linux-module-build-system)
550 (guix build utils)
551 (ice-9 popen)
552 (ice-9 textual-ports))
553 #:phases
554 (modify-phases %standard-phases
555 (add-before 'build 'change-directory
556 (lambda _
557 (chdir "./src")
558 #t))
559 (add-after 'build 'build-patch
560 (lambda* (#:key outputs #:allow-other-keys)
561 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
562 (port (open-input-pipe patch-builder))
563 (str (get-string-all port)))
564 (close-pipe port)
565 (call-with-output-file "wireguard.patch"
566 (lambda (port)
567 (format port "~a" str))))
568 #t))
569 (add-after 'install 'install-patch
570 (lambda* (#:key outputs #:allow-other-keys)
571 (install-file "wireguard.patch"
572 (assoc-ref %outputs "kernel-patch"))
573 #t))
574 ;; So that 'install-license-files' works...
575 (add-before 'install-license-files 'reset-cwd
576 (lambda _
577 (chdir "..")
578 #t)))))
579 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
580 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
581 (description "This package contains an out-of-tree kernel patch and
582 a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
583 WireGuard was added to Linux 5.6.")
584 (license license:gpl2)))
585
586 (define-public wireguard-tools
587 (package
588 (name "wireguard-tools")
589 (version "1.0.20200827")
590 (source
591 (origin
592 (method git-fetch)
593 (uri (git-reference
594 (url "https://git.zx2c4.com/wireguard-tools.git")
595 (commit (string-append "v" version))))
596 (file-name (git-file-name name version))
597 (sha256
598 (base32 "1h351hn531z6z85sx9ya27xjz1jszgn1pkwibacjj49mds15f7gn"))))
599 (build-system gnu-build-system)
600 (arguments
601 `(#:make-flags
602 (list ,(string-append "CC=" (cc-for-target))
603 "--directory=src"
604 "WITH_BASHCOMPLETION=yes"
605 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
606 "WITH_WGQUICK=yes"
607 (string-append "PREFIX=" (assoc-ref %outputs "out"))
608 ;; Currently used only to create an empty /etc/wireguard directory.
609 (string-append "SYSCONFDIR=no-thanks"))
610 ;; The test suite is meant to be run interactively. It runs Clang's
611 ;; scan-build static analyzer and then starts a web server to display the
612 ;; results.
613 #:tests? #f
614 #:phases
615 (modify-phases %standard-phases
616 ;; No configure script
617 (delete 'configure)
618 (add-after 'install 'install-contrib-docs
619 (lambda* (#:key outputs #:allow-other-keys)
620 (let ((out (assoc-ref outputs "out")))
621 (copy-recursively "contrib/"
622 (string-append out "/share/doc/wireguard-tools"))
623 #t)))
624 (add-after 'install 'wrap-wg-quick
625 (lambda* (#:key inputs outputs #:allow-other-keys)
626 (let* ((out (assoc-ref outputs "out"))
627 (inputs-sbin (map (lambda (input)
628 (string-append (assoc-ref inputs input) "/sbin"))
629 (list "resolvconf" "iproute" "procps"
630 "iptables")))
631 (coreutils (string-append (assoc-ref inputs "coreutils")
632 "/bin")))
633 (wrap-program (string-append out "/bin/wg-quick")
634 `("PATH" ":" prefix ,(append inputs-sbin
635 (list coreutils))))
636 #t))))))
637 (inputs
638 `(("resolvconf" ,openresolv)
639 ("coreutils" ,coreutils)
640 ("bash" ,bash) ; for scripts using /dev/tcp
641 ("procps" ,procps)
642 ("iproute" ,iproute)
643 ("iptables" ,iptables)))
644 (home-page "https://www.wireguard.com/")
645 (synopsis "Tools for configuring WireGuard tunnels")
646 (description
647 "This package provides the user-space command-line tools for using and
648 configuring WireGuard tunnels.
649
650 WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
651 Network} that securely encapsulates IP packets over UDP. It aims to be as easy
652 to configure and deploy as SSH. VPN connections are made simply by exchanging
653 public keys and can roam across IP addresses.")
654 (license
655 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
656 license:gpl2)))) ; everything else
657
658 (define-public wireguard
659 (deprecated-package "wireguard" wireguard-tools))
660
661 (define-public xl2tpd
662 (package
663 (name "xl2tpd")
664 (version "1.3.16")
665 (source (origin
666 (method git-fetch)
667 (uri (git-reference
668 (url "https://github.com/xelerance/xl2tpd")
669 (commit (string-append "v" version))))
670 (file-name (git-file-name name version))
671 (sha256
672 (base32
673 "0is5ccrvijz0pfm45pfrlbb9y8231yz3c4zqs8mkgakl9rxajy6l"))))
674 (build-system gnu-build-system)
675 (arguments
676 `(#:make-flags (list (string-append "PREFIX=" %output)
677 "CC=gcc")
678 #:phases (modify-phases %standard-phases
679 (delete 'configure) ;no configure script
680 (add-before 'build 'setup-environment
681 (lambda* (#:key inputs #:allow-other-keys)
682 (substitute* "l2tp.h"
683 (("/usr/sbin/pppd")
684 (string-append (assoc-ref inputs "ppp")
685 "/sbin/pppd")))
686 (setenv "KERNELSRC"
687 (assoc-ref inputs "linux-libre-headers"))
688 #t)))
689 #:tests? #f)) ; no tests provided
690 (inputs `(("libpcap" ,libpcap)
691 ("linux-libre-headers" ,linux-libre-headers)
692 ("ppp" ,ppp)))
693 (home-page "https://www.xelerance.com/software/xl2tpd/")
694 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
695 (description
696 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
697 L2TP allows you to tunnel PPP over UDP.")
698 (license license:gpl2)))