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