gnu: straw-viewer: Update to 0.1.2.
[jackhill/guix/guix.git] / gnu / packages / vpn.scm
CommitLineData
49f24f41
AE
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
b6bee63b 3;;; Copyright © 2013, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
d4bf49b1 4;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
feca8e2b 5;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
0d7f282b 6;;; Copyright © 2016, 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
e4aa83be 7;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
fa3346b8 8;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
fc4338b8 9;;; Copyright © 2018, 2020 Pierre Langlois <pierre.langlois@gmx.com>
7ba2b274 10;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
c1005113 11;;; Copyright © 2019, 2020 Leo Famulari <leo@famulari.name>
9fd6ad3e 12;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
b47e083b 13;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
3b177a6c 14;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
c873980d 15;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
8331e235 16;;; Copyright © 2020 Ivan Kozlov <kanichos@yandex.ru>
18918ebe 17;;; Copyright © 2020 David Dashyan <mail@davie.li>
49f24f41
AE
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)
b5b73a82 35 #:use-module ((guix licenses) #:prefix license:)
49f24f41
AE
36 #:use-module (guix packages)
37 #:use-module (guix download)
06d91fd9 38 #:use-module (guix git-download)
7ba2b274 39 #:use-module (guix build-system cmake)
49f24f41 40 #:use-module (guix build-system gnu)
3b177a6c 41 #:use-module (guix build-system linux-module)
5c863d57 42 #:use-module (guix build-system python)
598afe95 43 #:use-module (guix utils)
49f24f41 44 #:use-module (gnu packages)
1b17c23e 45 #:use-module (gnu packages admin)
06d91fd9 46 #:use-module (gnu packages base)
d084e71c 47 #:use-module (gnu packages bash)
ac257f12 48 #:use-module (gnu packages check)
d084e71c 49 #:use-module (gnu packages dns)
01224157 50 #:use-module (gnu packages autotools)
71f4b81a 51 #:use-module (gnu packages compression)
1dba6407 52 #:use-module (gnu packages gettext)
49f24f41 53 #:use-module (gnu packages gnupg)
b47e083b 54 #:use-module (gnu packages guile)
01224157 55 #:use-module (gnu packages libevent)
dc77f0d3 56 #:use-module (gnu packages linux)
90a69913 57 #:use-module (gnu packages ncurses)
aff0cce9 58 #:use-module (gnu packages nss)
71f4b81a
AE
59 #:use-module (gnu packages perl)
60 #:use-module (gnu packages pkg-config)
5c863d57 61 #:use-module (gnu packages python)
44d10b1f 62 #:use-module (gnu packages python-xyz)
c873980d 63 #:use-module (gnu packages python-web)
8331e235 64 #:use-module (gnu packages samba)
a7fd7b68 65 #:use-module (gnu packages tls)
71f4b81a 66 #:use-module (gnu packages xml))
49f24f41 67
7af8a9b7
LC
68(define-public gvpe
69 (package
70 (name "gvpe")
574d877e 71 (version "3.1")
7af8a9b7
LC
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://gnu/gvpe/gvpe-"
75 version ".tar.gz"))
76 (sha256
77 (base32
574d877e 78 "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
7af8a9b7
LC
79 (build-system gnu-build-system)
80 (home-page "http://software.schmorp.de/pkg/gvpe.html")
574d877e 81 (native-inputs `(("pkg-config" ,pkg-config)))
7af8a9b7
LC
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
87with multiple nodes using a variety of transport protocols. It works
88by creating encrypted host-to-host tunnels between multiple
89endpoints.")
90 (license license:gpl3+)))
91
49f24f41
AE
92(define-public vpnc
93 (package
94 (name "vpnc")
95 (version "0.5.3")
96 (source (origin
97 (method url-fetch)
594360f5 98 (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
49f24f41
AE
99 version ".tar.gz"))
100 (sha256 (base32
101e67ac 101 "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
49f24f41
AE
102 (build-system gnu-build-system)
103 (inputs `(("libgcrypt" ,libgcrypt)
42c97811 104 ("perl" ,perl)
101e67ac 105 ("vpnc-scripts" ,vpnc-scripts)))
49f24f41
AE
106 (arguments
107 `(#:tests? #f ; there is no check target
49f24f41 108 #:phases
42c97811 109 (modify-phases %standard-phases
101e67ac 110 (add-after 'unpack 'use-store-paths
42c97811 111 (lambda* (#:key inputs outputs #:allow-other-keys)
101e67ac
TGR
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
799dcdc4 124 (synopsis "Client for Cisco VPN concentrators")
49f24f41
AE
125 (description
126 "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
35b9e423 127It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
49f24f41 128shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
35b9e423 1291DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
49f24f41
AE
130Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
131 (license license:gpl2+) ; some file are bsd-2, see COPYING
d61043c7 132 (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
71f4b81a 133
06d91fd9 134(define-public vpnc-scripts
fc4338b8 135 (let ((commit "3885f8bbc4ae03fd6da0ada6de12f7223a59595c"))
06d91fd9
TGR
136 (package
137 (name "vpnc-scripts")
fc4338b8 138 (version (string-append "20200925." (string-take commit 7)))
06d91fd9
TGR
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)))
728ee9d6 145 (file-name (git-file-name name version))
06d91fd9
TGR
146 (sha256
147 (base32
fc4338b8 148 "1pmi4n58q81pmn9arvfixhvv6vkkf3rpwac3hwnwyl882q5q0ccx"))))
06d91fd9 149 (build-system gnu-build-system)
b6bee63b 150 (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
b47e083b 151 ("coreutils" ,coreutils)
06d91fd9
TGR
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=.*") "")
92594b2e 166 (("/usr/s?bin/") "")
06d91fd9
TGR
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 _
863501b7 175 (invoke "gcc" "-o" "netunshare" "netunshare.c")))
06d91fd9
TGR
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)
b47e083b 194 (wrap-script (string-append out "/etc/vpnc/" script)
06d91fd9
TGR
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")))))
b47e083b
RW
206 (list "vpnc-script-ptrtd"
207 "vpnc-script-sshd"
208 "vpnc-script"))
863501b7 209 #t))))
06d91fd9
TGR
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
215by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
216
217The default @command{vpnc-script} automatically configures most common
218connections, and provides hooks for performing custom actions at various stages
219of the connection or disconnection process.
220
221Alternative scripts are provided for more complicated set-ups, or to serve as an
222example for writing your own. For example, @command{vpnc-script-sshd} contains
223the entire VPN in a network namespace accessible only through SSH.")
224 (license license:gpl2+))))
71f4b81a 225
01224157
PL
226(define-public ocproxy
227 (package
228 (name "ocproxy")
229 (version "1.60")
230 (source (origin
98ebc8fd
EF
231 (method git-fetch)
232 (uri (git-reference
b0e7b699 233 (url "https://github.com/cernekee/ocproxy")
98ebc8fd
EF
234 (commit (string-append "v" version))))
235 (file-name (git-file-name name version))
01224157
PL
236 (sha256
237 (base32
98ebc8fd 238 "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
01224157
PL
239 (build-system gnu-build-system)
240 (native-inputs
241 `(("autoconf" ,autoconf)
242 ("automake" ,automake)))
243 (inputs
244 `(("libevent" ,libevent)))
01224157
PL
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
249on LwIP. When using ocproxy, OpenConnect only handles network activity that
250the 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
71f4b81a
AE
254(define-public openconnect
255 (package
256 (name "openconnect")
57b13d1c 257 (version "8.10")
71f4b81a
AE
258 (source (origin
259 (method url-fetch)
d4bf49b1
EB
260 (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
261 "openconnect-" version ".tar.gz"))
c383c36e 262 (sha256
57b13d1c 263 (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
71f4b81a 264 (build-system gnu-build-system)
0d7f282b 265 (propagated-inputs
c4c4cc05 266 `(("libxml2" ,libxml2)
5c5bd76f
TGR
267 ;; XXX ‘DTLS is insecure in GnuTLS v3.6.3 through v3.6.12.’
268 ;; See <https://gitlab.com/gnutls/gnutls/-/issues/960>.
c5df560f 269 ("gnutls" ,gnutls/fixed)
71f4b81a 270 ("zlib" ,zlib)))
0d7f282b 271 (inputs
1d7f3c00
TGR
272 `(("lz4" ,lz4)
273 ("vpnc-scripts" ,vpnc-scripts)))
c4c4cc05 274 (native-inputs
b94a6ca0 275 `(("gettext" ,gettext-minimal)
c4c4cc05 276 ("pkg-config" ,pkg-config)))
71f4b81a 277 (arguments
d4bf49b1
EB
278 `(#:configure-flags
279 `(,(string-append "--with-vpnc-script="
a6d06e86 280 (assoc-ref %build-inputs "vpnc-scripts")
d4bf49b1 281 "/etc/vpnc/vpnc-script"))))
799dcdc4 282 (synopsis "Client for Cisco VPN")
71f4b81a
AE
283 (description
284 "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
285supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
286870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
287and probably others.")
288 (license license:lgpl2.1)
8b1d0ff4 289 (home-page "https://www.infradead.org/openconnect/")))
dc77f0d3 290
18918ebe
DD
291(define-public openfortivpn
292 (package
293 (name "openfortivpn")
294 (version "1.15.0")
295 (source (origin
296 (method git-fetch)
297 (uri (git-reference
298 (url "https://github.com/adrienverge/openfortivpn")
299 (commit (string-append "v" version))))
300 (file-name (git-file-name name version))
301 (sha256
302 (base32
303 "1qsfgpxg553s8rc9cyrc4k96z0pislxsdxb9wyhp8fdprkak2mw2"))))
304 (build-system gnu-build-system)
305 (native-inputs
306 `(("autoconf" ,autoconf)
307 ("autotools" ,automake)
308 ("pkg-config" ,pkg-config)))
309 (inputs
310 `(("openssl" ,openssl)
311 ("ppp" ,ppp)))
312 (home-page "https://github.com/adrienverge/openfortivpn")
313 (synopsis "Client for PPP+SSL VPN tunnel services")
314 (description "Openfortivpn is a client for PPP+SSL VPN tunnel services. It
315spawns a pppd process and operates the communication between the gateway and
316this process. It is compatible with Fortinet VPNs.")
317 (license license:gpl3+)))
318
dc77f0d3
DT
319(define-public openvpn
320 (package
321 (name "openvpn")
c5a2b701 322 (version "2.4.9")
dc77f0d3
DT
323 (source (origin
324 (method url-fetch)
325 (uri (string-append
326 "https://swupdate.openvpn.org/community/releases/openvpn-"
327 version ".tar.xz"))
328 (sha256
329 (base32
c5a2b701 330 "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"))))
dc77f0d3
DT
331 (build-system gnu-build-system)
332 (arguments
333 '(#:configure-flags '("--enable-iproute2=yes")))
334 (native-inputs
335 `(("iproute2" ,iproute)))
336 (inputs
dee9a262
EF
337 `(("lz4" ,lz4)
338 ("lzo" ,lzo)
dc77f0d3
DT
339 ("openssl" ,openssl)
340 ("linux-pam" ,linux-pam)))
341 (home-page "https://openvpn.net/")
342 (synopsis "Virtual private network daemon")
9599339c
TGR
343 (description
344 "OpenVPN implements virtual private network (@dfn{VPN}) techniques
dc77f0d3
DT
345for creating secure point-to-point or site-to-site connections in routed or
346bridged configurations and remote access facilities. It uses a custom
347security protocol that utilizes SSL/TLS for key exchange. It is capable of
9599339c 348traversing network address translators (@dfn{NAT}s) and firewalls.")
dc77f0d3 349 (license license:gpl2)))
feca8e2b 350
c873980d
RP
351(define-public protonvpn-cli
352 (package
353 (name "protonvpn-cli")
90a69913 354 (version "2.2.4")
c873980d
RP
355 (source
356 (origin
357 ;; PyPI has a ".whl" file but not a proper source release.
358 ;; Thus, fetch code from Git.
359 (method git-fetch)
360 (uri (git-reference
b0e7b699 361 (url "https://github.com/ProtonVPN/linux-cli")
c873980d
RP
362 (commit (string-append "v" version))))
363 (file-name (git-file-name name version))
364 (sha256
365 (base32
90a69913 366 "08yca0a0prrnrc7ir7ajd56yxvxpcs4m1k8f5kf273f5whgr7wzw"))))
c873980d
RP
367 (build-system python-build-system)
368 (arguments '(#:tests? #f)) ; no tests in repo
369 (native-inputs
f39b7612 370 `(("python-docopt" ,python-docopt)))
c873980d 371 (inputs
36045fa6
TGR
372 `(("python-jinja2" ,python-jinja2)
373 ("python-pythondialog" ,python-pythondialog)
f39b7612 374 ("python-requests" ,python-requests)))
c873980d 375 (propagated-inputs
90a69913
RP
376 `(("openvpn" ,openvpn)
377 ("dialog" ,dialog)))
c873980d
RP
378 (synopsis "Command-line client for ProtonVPN")
379 (description
86ac14b2
LC
380 "This is the official command-line interface for ProtonVPN, a secure
381point-to-point virtual private networking (VPN) service with a gratis tier.
382It can automatically find and connect to the fastest servers or use Tor over
383VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
c873980d
RP
384 (home-page "https://github.com/ProtonVPN/linux-cli")
385 (license license:gpl3+)))
386
feca8e2b
JM
387(define-public tinc
388 (package
389 (name "tinc")
2b247e51 390 (version "1.0.36")
feca8e2b
JM
391 (source (origin
392 (method url-fetch)
e81ddeda 393 (uri (string-append "https://tinc-vpn.org/packages/"
657c3ff6 394 "tinc-" version ".tar.gz"))
feca8e2b
JM
395 (sha256
396 (base32
2b247e51 397 "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
feca8e2b 398 (build-system gnu-build-system)
7b770eca
SB
399 (arguments
400 '(#:configure-flags
401 '("--sysconfdir=/etc"
402 "--localstatedir=/var")))
feca8e2b
JM
403 (inputs `(("zlib" ,zlib)
404 ("lzo" ,lzo)
405 ("openssl" ,openssl)))
e81ddeda 406 (home-page "https://tinc-vpn.org")
feca8e2b
JM
407 (synopsis "Virtual Private Network (VPN) daemon")
408 (description
409 "Tinc is a VPN that uses tunnelling and encryption to create a secure
410private network between hosts on the internet.")
411 (license license:gpl2+)))
5c863d57
TGR
412
413(define-public sshuttle
414 (package
415 (name "sshuttle")
627c6531 416 (version "0.78.5")
5c863d57
TGR
417 (source
418 (origin
419 (method url-fetch)
420 (uri (pypi-uri name version))
421 (sha256
422 (base32
627c6531 423 "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
5c863d57 424 (build-system python-build-system)
c32863e0
TGR
425 (arguments
426 `(#:phases
427 (modify-phases %standard-phases
428 (add-after 'unpack 'patch-FHS-file-names
429 (lambda _
430 (substitute* "sshuttle/client.py"
431 (("/usr/bin/env") (which "env")))
432 (substitute* "sshuttle/ssh.py"
0e2d3ce2 433 (("/bin/sh") "sh"))
c32863e0 434 #t)))))
5c863d57 435 (native-inputs
3308591f 436 `(("python-setuptools-scm" ,python-setuptools-scm)
5c863d57 437 ;; For tests only.
1628d57b 438 ("python-flake8" ,python-flake8)
5c863d57 439 ("python-mock" ,python-mock)
627c6531 440 ("python-pytest-cov" ,python-pytest-cov)
3308591f 441 ("python-pytest-runner" ,python-pytest-runner)))
5c863d57
TGR
442 (home-page "https://github.com/sshuttle/sshuttle")
443 (synopsis "VPN that transparently forwards connections over SSH")
444 (description "sshuttle creates an encrypted virtual private network (VPN)
445connection to any remote server to which you have secure shell (SSH) access.
446The only requirement is a suitable version of Python on the server;
447administrative privileges are required only on the client. Unlike most VPNs,
448sshuttle forwards entire sessions, not packets, using kernel transparent
449proxying. This makes it faster and more reliable than SSH's own tunneling and
450port forwarding features. It can forward both TCP and UDP traffic, including
451DNS domain name queries.")
452 (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
1ce6f33b
TGR
453
454(define-public sshoot
455 (package
456 (name "sshoot")
3b4018d6 457 (version "1.2.6")
1ce6f33b
TGR
458 (source
459 (origin
460 (method url-fetch)
461 (uri (pypi-uri name version))
462 (sha256
463 (base32
3b4018d6 464 "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
1ce6f33b 465 (build-system python-build-system)
c0b12a60
MB
466 (arguments
467 '(#:phases
468 (modify-phases %standard-phases
469 (add-after 'unpack 'patch-paths
470 (lambda _
471 (substitute* "sshoot/tests/test_manager.py"
472 (("/bin/sh") (which "sh")))
473 #t)))))
1ce6f33b
TGR
474 (inputs
475 `(("python-argcomplete" ,python-argcomplete)
476 ("python-prettytable" ,python-prettytable)
477 ("python-pyyaml" ,python-pyyaml)))
478 ;; For tests only.
479 (native-inputs
480 `(("python-fixtures" ,python-fixtures)
481 ("python-pbr" ,python-pbr)
482 ("python-testtools" ,python-testtools)))
3b4018d6 483 (home-page "https://github.com/albertodonato/sshoot")
1ce6f33b
TGR
484 (synopsis "sshuttle VPN session manager")
485 (description "sshoot provides a command-line interface to manage multiple
486@command{sshuttle} virtual private networks. It supports flexible profiles
487with configuration options for most of @command{sshuttle}’s features.")
488 (license license:gpl3+)))
7ba2b274
MP
489
490(define-public badvpn
491 (package
492 (name "badvpn")
493 (version "1.999.130")
494 (source
495 (origin
496 (method git-fetch)
497 (uri (git-reference
b0e7b699 498 (url "https://github.com/ambrop72/badvpn")
7ba2b274
MP
499 (commit version)))
500 (file-name (git-file-name name version))
501 (sha256
502 (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
503 (build-system cmake-build-system)
504 (arguments
505 '(#:tests? #f)) ; no tests
506 (inputs
507 `(("nspr" ,nspr)
508 ("nss" ,nss)
509 ("openssl" ,openssl)))
510 (native-inputs
511 `(("pkg-config" ,pkg-config)))
512 (home-page "https://github.com/ambrop72/badvpn")
513 (synopsis "Peer-to-peer virtual private network (VPN)")
514 (description "@code{BadVPN} is a collection of virtual private
515network (VPN) tools. It includes:
516
517@enumerate
518@item NCD programming language.\n
519NCD (Network Configuration Daemon) is a daemon and programming/scripting
520language for configuration of network interfaces and other aspects of the
521operating system.
522@item Tun2socks network-layer proxifier.\n
523The tun2socks program socksifes TCP connections at the network layer. It
524implements a TUN device which accepts all incoming TCP connections (regardless
525of destination IP), and forwards the connections through a SOCKS server.
526@item Peer-to-peer VPN.\n
527The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
528(VPN nodes).
529@end enumerate")
530 ;; This project contains a bundled lwIP. lwIP is also released under the
531 ;; 3-clause BSD license.
532 (license license:bsd-3)))
7a0479bb 533
336d7644 534(define-public wireguard-linux-compat
7a0479bb 535 (package
336d7644 536 (name "wireguard-linux-compat")
76ad9547 537 (version "1.0.20201112")
7a0479bb
LF
538 (source (origin
539 (method url-fetch)
336d7644
LF
540 (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
541 "snapshot/wireguard-linux-compat-" version
542 ".tar.xz"))
7a0479bb
LF
543 (sha256
544 (base32
76ad9547 545 "1qcpg1rcmy4h529a0spjm50qgxjgjy20j29fpbrqsv5xq3qfgsl9"))))
3b177a6c
BW
546 (build-system linux-module-build-system)
547 (outputs '("out"
548 "kernel-patch"))
7a0479bb 549 (arguments
76ad9547
TGR
550 `(#:linux ,linux-libre-5.4 ; mustn't have WG built-in
551 #:tests? #f ; no test suite
3b177a6c 552 #:modules ((guix build linux-module-build-system)
7a0479bb
LF
553 (guix build utils)
554 (ice-9 popen)
555 (ice-9 textual-ports))
556 #:phases
557 (modify-phases %standard-phases
3b177a6c
BW
558 (add-before 'build 'change-directory
559 (lambda _
560 (chdir "./src")
561 #t))
562 (add-after 'build 'build-patch
7a0479bb 563 (lambda* (#:key outputs #:allow-other-keys)
3b177a6c 564 (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
7a0479bb
LF
565 (port (open-input-pipe patch-builder))
566 (str (get-string-all port)))
567 (close-pipe port)
336d7644 568 (call-with-output-file "wireguard.patch"
7a0479bb
LF
569 (lambda (port)
570 (format port "~a" str))))
76ad9547 571 #t))
3b177a6c 572 (add-after 'install 'install-patch
336d7644
LF
573 (lambda* (#:key outputs #:allow-other-keys)
574 (install-file "wireguard.patch"
3b177a6c
BW
575 (assoc-ref %outputs "kernel-patch"))
576 #t))
577 ;; So that 'install-license-files' works...
578 (add-before 'install-license-files 'reset-cwd
579 (lambda _
580 (chdir "..")
336d7644
LF
581 #t)))))
582 (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
583 (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
3b177a6c
BW
584 (description "This package contains an out-of-tree kernel patch and
585a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
586WireGuard was added to Linux 5.6.")
7a0479bb 587 (license license:gpl2)))
1b17c23e 588
10650b89
TGR
589(define-public wireguard-tools
590 (package
591 (name "wireguard-tools")
f0117fcd 592 (version "1.0.20200827")
10650b89
TGR
593 (source
594 (origin
595 (method git-fetch)
596 (uri (git-reference
597 (url "https://git.zx2c4.com/wireguard-tools.git")
598 (commit (string-append "v" version))))
599 (file-name (git-file-name name version))
600 (sha256
f0117fcd 601 (base32 "1h351hn531z6z85sx9ya27xjz1jszgn1pkwibacjj49mds15f7gn"))))
10650b89
TGR
602 (build-system gnu-build-system)
603 (arguments
19781930 604 `(#:make-flags
598afe95 605 (list ,(string-append "CC=" (cc-for-target))
c1005113 606 "--directory=src"
10650b89
TGR
607 "WITH_BASHCOMPLETION=yes"
608 ;; Install the ‘simple and dirty’ helper script wg-quick(8).
609 "WITH_WGQUICK=yes"
610 (string-append "PREFIX=" (assoc-ref %outputs "out"))
611 ;; Currently used only to create an empty /etc/wireguard directory.
612 (string-append "SYSCONFDIR=no-thanks"))
19781930
LF
613 ;; The test suite is meant to be run interactively. It runs Clang's
614 ;; scan-build static analyzer and then starts a web server to display the
615 ;; results.
616 #:tests? #f
10650b89
TGR
617 #:phases
618 (modify-phases %standard-phases
c1005113 619 ;; No configure script
d084e71c
BW
620 (delete 'configure)
621 (add-after 'install 'install-contrib-docs
622 (lambda* (#:key outputs #:allow-other-keys)
623 (let ((out (assoc-ref outputs "out")))
624 (copy-recursively "contrib/"
625 (string-append out "/share/doc/wireguard-tools"))
626 #t)))
627 (add-after 'install 'wrap-wg-quick
628 (lambda* (#:key inputs outputs #:allow-other-keys)
629 (let* ((out (assoc-ref outputs "out"))
630 (inputs-sbin (map (lambda (input)
631 (string-append (assoc-ref inputs input) "/sbin"))
632 (list "resolvconf" "iproute" "procps"
633 "iptables")))
634 (coreutils (string-append (assoc-ref inputs "coreutils")
635 "/bin")))
636 (wrap-program (string-append out "/bin/wg-quick")
637 `("PATH" ":" prefix ,(append inputs-sbin
638 (list coreutils))))
639 #t))))))
640 (inputs
641 `(("resolvconf" ,openresolv)
642 ("coreutils" ,coreutils)
643 ("bash" ,bash) ; for scripts using /dev/tcp
644 ("procps" ,procps)
645 ("iproute" ,iproute)
646 ("iptables" ,iptables)))
10650b89
TGR
647 (home-page "https://www.wireguard.com/")
648 (synopsis "Tools for configuring WireGuard tunnels")
649 (description
650 "This package provides the user-space command-line tools for using and
651configuring WireGuard tunnels.
652
653WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
654Network} that securely encapsulates IP packets over UDP. It aims to be as easy
655to configure and deploy as SSH. VPN connections are made simply by exchanging
656public keys and can roam across IP addresses.")
657 (license
658 (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
659 license:gpl2)))) ; everything else
660
336d7644
LF
661(define-public wireguard
662 (deprecated-package "wireguard" wireguard-tools))
663
1b17c23e
664(define-public xl2tpd
665 (package
666 (name "xl2tpd")
c3469513 667 (version "1.3.16")
1b17c23e
668 (source (origin
669 (method git-fetch)
670 (uri (git-reference
671 (url "https://github.com/xelerance/xl2tpd")
672 (commit (string-append "v" version))))
28341601 673 (file-name (git-file-name name version))
1b17c23e
674 (sha256
675 (base32
c3469513 676 "0is5ccrvijz0pfm45pfrlbb9y8231yz3c4zqs8mkgakl9rxajy6l"))))
1b17c23e
677 (build-system gnu-build-system)
678 (arguments
0309e004 679 `(#:make-flags (list (string-append "PREFIX=" %output)
1b17c23e
680 "CC=gcc")
681 #:phases (modify-phases %standard-phases
8331e235
IK
682 (delete 'configure) ;no configure script
683 (add-before 'build 'setup-environment
684 (lambda* (#:key inputs #:allow-other-keys)
0919d614
MO
685 (substitute* "l2tp.h"
686 (("/usr/sbin/pppd")
687 (string-append (assoc-ref inputs "ppp")
688 "/sbin/pppd")))
8331e235
IK
689 (setenv "KERNELSRC"
690 (assoc-ref inputs "linux-libre-headers"))
691 #t)))
14ccd8f8 692 #:tests? #f)) ; no tests provided
8331e235
IK
693 (inputs `(("libpcap" ,libpcap)
694 ("linux-libre-headers" ,linux-libre-headers)
695 ("ppp" ,ppp)))
1b17c23e
696 (home-page "https://www.xelerance.com/software/xl2tpd/")
697 (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
698 (description
699 "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
700L2TP allows you to tunnel PPP over UDP.")
701 (license license:gpl2)))