vpn.scm 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
  3. ;;; Copyright © 2013, 2016, 2018, 2019, 2020, 2021 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, 2021 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2016–2021 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. ;;; Copyright © 2021 Domagoj Stolfa <ds815@gmx.com>
  19. ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
  20. ;;; Copyright © 2021 jgart <jgart@dismail.de>
  21. ;;;
  22. ;;; This file is part of GNU Guix.
  23. ;;;
  24. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  25. ;;; under the terms of the GNU General Public License as published by
  26. ;;; the Free Software Foundation; either version 3 of the License, or (at
  27. ;;; your option) any later version.
  28. ;;;
  29. ;;; GNU Guix is distributed in the hope that it will be useful, but
  30. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  31. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  32. ;;; GNU General Public License for more details.
  33. ;;;
  34. ;;; You should have received a copy of the GNU General Public License
  35. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  36. (define-module (gnu packages vpn)
  37. #:use-module ((guix licenses) #:prefix license:)
  38. #:use-module (guix packages)
  39. #:use-module (guix download)
  40. #:use-module (guix git-download)
  41. #:use-module (guix build-system cmake)
  42. #:use-module (guix build-system copy)
  43. #:use-module (guix build-system gnu)
  44. #:use-module (guix build-system go)
  45. #:use-module (guix build-system linux-module)
  46. #:use-module (guix build-system python)
  47. #:use-module (guix build-system qt)
  48. #:use-module (guix utils)
  49. #:use-module (gnu packages)
  50. #:use-module (gnu packages admin)
  51. #:use-module (gnu packages base)
  52. #:use-module (gnu packages bash)
  53. #:use-module (gnu packages check)
  54. #:use-module (gnu packages dns)
  55. #:use-module (gnu packages autotools)
  56. #:use-module (gnu packages compression)
  57. #:use-module (gnu packages curl)
  58. #:use-module (gnu packages freedesktop)
  59. #:use-module (gnu packages gettext)
  60. #:use-module (gnu packages gnome)
  61. #:use-module (gnu packages gl)
  62. #:use-module (gnu packages gnupg)
  63. #:use-module (gnu packages golang)
  64. #:use-module (gnu packages guile)
  65. #:use-module (gnu packages libevent)
  66. #:use-module (gnu packages linux)
  67. #:use-module (gnu packages multiprecision)
  68. #:use-module (gnu packages ncurses)
  69. #:use-module (gnu packages nss)
  70. #:use-module (gnu packages perl)
  71. #:use-module (gnu packages pkg-config)
  72. #:use-module (gnu packages polkit)
  73. #:use-module (gnu packages python)
  74. #:use-module (gnu packages python-build)
  75. #:use-module (gnu packages python-crypto)
  76. #:use-module (gnu packages python-xyz)
  77. #:use-module (gnu packages python-web)
  78. #:use-module (gnu packages qt)
  79. #:use-module (gnu packages samba)
  80. #:use-module (gnu packages tls)
  81. #:use-module (gnu packages xml))
  82. (define-public bitmask
  83. (package
  84. (name "bitmask")
  85. (version "0.21.6")
  86. (source
  87. (origin
  88. (method git-fetch)
  89. (uri
  90. (git-reference
  91. (url "https://0xacab.org/leap/bitmask-vpn")
  92. (commit version)))
  93. (file-name (git-file-name name version))
  94. (sha256
  95. (base32 "0xmn0pkpn0mcwi1jlgm5skydcnfxk5fawg5hl2inn50m0ikgxk1c"))
  96. (modules
  97. '((guix build utils)))
  98. (snippet
  99. `(begin
  100. (delete-file-recursively "branding/thirdparty")
  101. (call-with-output-file "pkg/config/version/version.go"
  102. (lambda (port)
  103. (format port "package version\n")
  104. (format port "\n")
  105. (format port (string-append "var VERSION = \"" ,version "\""))))
  106. #t))))
  107. (build-system go-build-system)
  108. (arguments
  109. `(#:imported-modules
  110. ((guix build cmake-build-system)
  111. (guix build copy-build-system)
  112. (guix build python-build-system)
  113. (guix build qt-build-system)
  114. (guix build qt-utils)
  115. ,@%go-build-system-modules)
  116. #:modules
  117. (((guix build copy-build-system)
  118. #:prefix copy:)
  119. ((guix build python-build-system)
  120. #:prefix python:)
  121. ((guix build qt-build-system)
  122. #:prefix qt:)
  123. (guix build utils)
  124. (guix build go-build-system))
  125. #:unpack-path "0xacab.org/leap/bitmask-vpn"
  126. #:import-path "0xacab.org/leap/bitmask-vpn/cmd/bitmask-helper"
  127. #:phases
  128. (modify-phases %standard-phases
  129. (add-after 'setup-go-environment 'insert-missing-sources
  130. ;; For some reason this package is left out.
  131. (lambda* (#:key inputs #:allow-other-keys)
  132. (let* ((name "go-0xacab-org-leap-shapeshifter")
  133. (shapeshifter (assoc-ref inputs name))
  134. (shapeshifter-src (string-append shapeshifter "/src")))
  135. (copy-recursively shapeshifter-src "src"))))
  136. (add-after 'unpack 'patch
  137. (lambda* (#:key inputs outputs #:allow-other-keys)
  138. (with-directory-excursion "src/0xacab.org/leap/bitmask-vpn"
  139. ;; Use 'emersion/go-autostart',
  140. ;; instead of 'ProtonMail/go-autostart',
  141. ;; as the latter no longer exists.
  142. (substitute* (find-files "." "\\.go$")
  143. (("github.com/ProtonMail/go-autostart")
  144. "github.com/emersion/go-autostart"))
  145. ;; Use correct paths for referenced items.
  146. (let* ((out (assoc-ref outputs "out"))
  147. (policy-dir (string-append out "/share/polkit-1/actions"))
  148. (policy-file "se.leap.bitmask.policy")
  149. (policy-path (string-append policy-dir "/" policy-file))
  150. (ip (string-append (assoc-ref inputs "iproute")
  151. "/sbin/ip"))
  152. (iptables (string-append (assoc-ref inputs "iptables")
  153. "/sbin/iptables"))
  154. (ip6tables (string-append (assoc-ref inputs "iptables")
  155. "/sbin/ip6tables"))
  156. (sysctl (string-append (assoc-ref inputs "procps")
  157. "/sbin/sysctl"))
  158. (pkttyagent (string-append (assoc-ref inputs "polkit")
  159. "/bin/pkttyagent"))
  160. (openvpn (string-append (assoc-ref inputs "openvpn")
  161. "/sbin/openvpn"))
  162. (bitmask-root (string-append (assoc-ref outputs "out")
  163. "/sbin/bitmask-root")))
  164. (substitute* (find-files "." "(\\.go$|\\.policy$|bitmask-root)")
  165. (("swhich\\(\"ip\"\\)")
  166. (string-append "\"" ip "\""))
  167. (("swhich\\(\"iptables\"\\)")
  168. (string-append "\"" iptables "\""))
  169. (("swhich\\(\"ip6tables\"\\)")
  170. (string-append "\"" ip6tables "\""))
  171. (("swhich\\(\"sysctl\"\\)")
  172. (string-append "\"" sysctl "\""))
  173. (("/usr/(bin|lib|libexec)/.*(kit|agent|agent-1)") pkttyagent)
  174. (("/usr/sbin/openvpn") openvpn)
  175. (("/usr/sbin/bitmask-root") bitmask-root)
  176. (("/usr/local/sbin/bitmask-root") bitmask-root)
  177. (("/usr/share.*\\.policy") policy-path)))
  178. (substitute* (find-files "." "\\.pro$")
  179. ;; Use correct path for goshim files,
  180. ;; which are generated in 'build-continued phase.
  181. (("-L.*/lib") "-L./lib")
  182. ;; FIXME: Unable to build i18n files.
  183. (("TRANSLATIONS.*i18n.*$") "")
  184. (("RESOURCES.*i18n.*$") "")))))
  185. (add-after 'build 'build-continued
  186. (lambda _
  187. ;; Generate goshim library and header files.
  188. (let* ((dir "src/0xacab.org/leap/bitmask-vpn")
  189. (source (string-append dir "/gui/backend.go"))
  190. (target (string-append dir "/lib/libgoshim.a")))
  191. (mkdir-p (string-append dir "/lib"))
  192. (invoke "go" "build" "-buildmode=c-archive" "-o" target source))
  193. ;; Build bitmask application.
  194. (with-directory-excursion "src/0xacab.org/leap/bitmask-vpn"
  195. (delete-file "Makefile")
  196. (invoke "qmake" "bitmask.pro")
  197. (invoke "make"))))
  198. (add-after 'check 'check-continued
  199. (lambda* (#:key tests? #:allow-other-keys)
  200. (when tests?
  201. ;; Run bitmask test-suite.
  202. (with-directory-excursion "src/0xacab.org/leap/bitmask-vpn"
  203. (delete-file "Makefile")
  204. (invoke "qmake" "test.pro")
  205. ;; Tests require display-server.
  206. (setenv "QT_QPA_PLATFORM" "offscreen")
  207. ;; Tests look for $XDG_RUNTIME_DIR.
  208. (setenv "XDG_RUNTIME_DIR" (getenv "TEMP"))
  209. ;; Tests write to $HOME.
  210. (setenv "HOME" (getenv "TEMP"))
  211. (invoke "make" "check")))))
  212. (add-after 'install 'install-continued
  213. (lambda args
  214. (apply (assoc-ref copy:%standard-phases 'install)
  215. #:install-plan
  216. ;; Install bitmask program.
  217. '(("src/0xacab.org/leap/bitmask-vpn/release"
  218. "bin"
  219. #:include ("bitmask"))
  220. ;; Install bitmask-root script.
  221. ("src/0xacab.org/leap/bitmask-vpn/helpers"
  222. "sbin"
  223. #:include ("bitmask-root"))
  224. ;; Install polkit-policy.
  225. ("src/0xacab.org/leap/bitmask-vpn/helpers"
  226. "share/polkit-1/actions"
  227. #:include ("se.leap.bitmask.policy")))
  228. args)))
  229. (add-after 'install-continued 'post-install
  230. (lambda* (#:key outputs #:allow-other-keys)
  231. (let* ((out (assoc-ref outputs "out"))
  232. (bitmask (string-append out "/bin/bitmask"))
  233. (bitmask-root (string-append out "/sbin/bitmask-root")))
  234. ;; Make bitmask-root script executable.
  235. (chmod bitmask-root #o777))))
  236. (add-after 'post-install 'python-wrap
  237. (assoc-ref python:%standard-phases 'wrap))
  238. (add-after 'python-wrap 'qt-wrap
  239. (assoc-ref qt:%standard-phases 'qt-wrap)))))
  240. (native-inputs
  241. `(("pkg-config" ,pkg-config)))
  242. (inputs
  243. `(("iproute" ,iproute)
  244. ("iptables" ,iptables)
  245. ("mesa" ,mesa)
  246. ("openvpn" ,openvpn)
  247. ("polkit" ,polkit)
  248. ("procps" ,procps)
  249. ("python" ,python)
  250. ("qtbase" ,qtbase-5)
  251. ("qtdeclarative" ,qtdeclarative)
  252. ("qtquickcontrols" ,qtquickcontrols)
  253. ("qtquickcontrols2" ,qtquickcontrols2)))
  254. (propagated-inputs
  255. `(("go-0xacab-org-leap-shapeshifter"
  256. ,go-0xacab-org-leap-shapeshifter)
  257. ("go-github-com-apparentlymart-go-openvpn-mgmt"
  258. ,go-github-com-apparentlymart-go-openvpn-mgmt)
  259. ("go-github-com-emersion-go-autostart"
  260. ,go-github-com-emersion-go-autostart)
  261. ("go-github-com-keybase-go-ps"
  262. ,go-github-com-keybase-go-ps)
  263. ("go-github-com-rakyll-statik"
  264. ,go-github-com-rakyll-statik)
  265. ("go-github-com-sevlyar-go-daemon"
  266. ,go-github-com-sevlyar-go-daemon)
  267. ("go-golang-org-x-sys" ,go-golang-org-x-sys)))
  268. (synopsis "Generic VPN client by LEAP")
  269. (description "Bitmask, by @acronym{LEAP, LEAP Encryption Access Project},
  270. is an application to provide easy and secure encrypted communication with a
  271. @acronym{VPN, Virtual Private Network}. It allows you to select from a variety
  272. of trusted service provider all from one app. Current providers include Riseup
  273. Networks and The Calyx Institute, where the former is default.")
  274. (home-page "https://bitmask.net/")
  275. (license license:gpl3+)))
  276. (define-public gvpe
  277. (package
  278. (name "gvpe")
  279. (version "3.1")
  280. (source (origin
  281. (method url-fetch)
  282. (uri (string-append "mirror://gnu/gvpe/gvpe-"
  283. version ".tar.gz"))
  284. (sha256
  285. (base32
  286. "1cz8n75ksl0l908zc5l3rnfm1hv7130s2w8710799fr5sxrdbszi"))))
  287. (build-system gnu-build-system)
  288. (home-page "http://software.schmorp.de/pkg/gvpe.html")
  289. (native-inputs `(("pkg-config" ,pkg-config)))
  290. (inputs `(("openssl" ,openssl)
  291. ("zlib" ,zlib)))
  292. (synopsis "Secure VPN among multiple nodes over an untrusted network")
  293. (description
  294. "The GNU Virtual Private Ethernet creates a virtual network
  295. with multiple nodes using a variety of transport protocols. It works
  296. by creating encrypted host-to-host tunnels between multiple
  297. endpoints.")
  298. (license license:gpl3+)))
  299. (define-public strongswan
  300. (package
  301. (name "strongswan")
  302. (version "5.9.3")
  303. (source
  304. (origin
  305. (method url-fetch)
  306. (uri (string-append "https://download.strongswan.org/strongswan-"
  307. version ".tar.bz2"))
  308. (sha256
  309. (base32 "1xy6c9c7bq5a5jmm04r9f9iqn39yrr1dkq81jhvpxsd4l1ban9ck"))))
  310. (build-system gnu-build-system)
  311. (arguments
  312. `(#:phases
  313. (modify-phases %standard-phases
  314. (add-before 'build 'patch-command-file-names
  315. (lambda* (#:key inputs #:allow-other-keys)
  316. (substitute* "src/ipsec/_ipsec.in"
  317. (("cat|kill|sleep|rm|uname" command)
  318. (string-append (assoc-ref inputs "coreutils")
  319. "/bin/" command)))
  320. (substitute* "src/libstrongswan/utils/process.c"
  321. (("/bin/sh")
  322. (search-input-file inputs "/bin/sh")))
  323. (substitute* "src/libstrongswan/tests/suites/test_process.c"
  324. (("/bin/sh") (which "sh"))
  325. (("/bin/echo") (which "echo"))
  326. (("cat") (which "cat")))
  327. #t))
  328. (add-before 'check 'set-up-test-environment
  329. (lambda* (#:key inputs #:allow-other-keys)
  330. (setenv "TZDIR"
  331. (search-input-directory inputs "share/zoneinfo")))))
  332. #:configure-flags
  333. (list
  334. "--disable-ldap"
  335. "--disable-mysql"
  336. "--disable-systemd"
  337. ;; Disable BSD-4 licensed plugins.
  338. "--disable-blowfish"
  339. "--disable-des"
  340. ;; Make it usable. The default configuration is far too minimal to be
  341. ;; used with most common VPN set-ups.
  342. ;; See <https://wiki.strongswan.org/projects/strongswan/wiki/Autoconf>.
  343. "--enable-aesni"
  344. "--enable-attr-sql"
  345. "--enable-chapoly"
  346. "--enable-curl"
  347. "--enable-dhcp"
  348. "--enable-eap-aka"
  349. "--enable-eap-aka-3gpp"
  350. "--enable-eap-dynamic"
  351. "--enable-eap-identity"
  352. "--enable-eap-md5"
  353. "--enable-eap-mschapv2"
  354. "--enable-eap-peap"
  355. "--enable-eap-radius"
  356. "--enable-eap-sim"
  357. "--enable-eap-sim-file"
  358. "--enable-eap-simaka-pseudonym"
  359. "--enable-eap-simaka-reauth"
  360. "--enable-eap-simaka-sql"
  361. "--enable-eap-tls"
  362. "--enable-eap-tnc"
  363. "--enable-eap-ttls"
  364. "--enable-ext-auth"
  365. "--enable-farp"
  366. "--enable-ha"
  367. "--enable-led"
  368. "--enable-md4"
  369. "--enable-mediation"
  370. "--enable-openssl"
  371. "--enable-soup"
  372. "--enable-sql"
  373. "--enable-sqlite"
  374. "--enable-xauth-eap"
  375. "--enable-xauth-noauth"
  376. "--enable-xauth-pam"
  377. ;; Use libcap by default.
  378. "--with-capabilities=libcap")))
  379. (inputs
  380. `(("coreutils" ,coreutils)
  381. ("curl" ,curl)
  382. ("gmp" ,gmp)
  383. ("libcap" ,libcap)
  384. ("libgcrypt" ,libgcrypt)
  385. ("libsoup" ,libsoup)
  386. ("linux-pam" ,linux-pam)
  387. ("openssl" ,openssl)))
  388. (native-inputs
  389. `(("coreutils" ,coreutils)
  390. ("pkg-config" ,pkg-config)
  391. ("tzdata" ,tzdata-for-tests)))
  392. (synopsis "IKEv1/v2 keying daemon")
  393. (description "StrongSwan is an IPsec implementation originally based upon
  394. the FreeS/WAN project. It contains support for IKEv1, IKEv2, MOBIKE, IPv6,
  395. NAT-T and more.")
  396. (home-page "https://strongswan.org/")
  397. (license
  398. (list license:gpl2+
  399. ;; src/aikgen/*
  400. ;; src/libcharon/plugins/dnscert/*
  401. ;; src/libcharon/plugins/ext_auth/*
  402. ;; src/libcharon/plugins/vici/ruby/*
  403. ;; src/libcharon/plugins/xauth_pam/xauth_pam_listener.[ch]
  404. license:expat
  405. ;; src/inclue/sys/*
  406. license:bsd-3
  407. ;; src/libstrongswan/plugins/sha3/sha3_keccak.c
  408. license:public-domain
  409. ;; src/libstrongswan/plugins/pkcs11/pkcs11.h
  410. (license:non-copyleft
  411. "file://src/libstrongswan/plugins/pkcs11/pkcs11.h"
  412. "pkcs11 contains a unknown permissive license. View the specific
  413. file for more details.")
  414. ;; These files are not included in the
  415. ;; build, they are disabled through
  416. ;; options to ./configure
  417. ;;
  418. ;; src/libstrongswan/plugins/blowfish/bf_enc.c
  419. ;; src/libstrongswan/plugins/blowfish/bf_locl.h
  420. ;; src/libstrongswan/plugins/blowfish/bf_pi.h
  421. ;; src/libstrongswan/plugins/blowfish/bf_skey.c
  422. ;; src/libstrongswan/plugins/blowfish/blowfish_crypter.c
  423. ;; src/libstrongswan/plugins/des/des_crypter.c
  424. license:bsd-4))))
  425. (define-public vpnc
  426. (package
  427. (name "vpnc")
  428. (version "0.5.3")
  429. (source (origin
  430. (method url-fetch)
  431. (uri (string-append "https://www.unix-ag.uni-kl.de/~massar/vpnc/vpnc-"
  432. version ".tar.gz"))
  433. (sha256 (base32
  434. "1128860lis89g1s21hqxvap2nq426c9j4bvgghncc1zj0ays7kj6"))))
  435. (build-system gnu-build-system)
  436. (inputs `(("libgcrypt" ,libgcrypt)
  437. ("perl" ,perl)
  438. ("vpnc-scripts" ,vpnc-scripts)))
  439. (arguments
  440. `(#:tests? #f ; there is no check target
  441. #:phases
  442. (modify-phases %standard-phases
  443. (add-after 'unpack 'use-store-paths
  444. (lambda* (#:key inputs outputs #:allow-other-keys)
  445. (let ((out (assoc-ref outputs "out"))
  446. (vpnc-scripts (assoc-ref inputs "vpnc-scripts")))
  447. (substitute* "config.c"
  448. (("/etc/vpnc/vpnc-script")
  449. (string-append vpnc-scripts "/etc/vpnc/vpnc-script")))
  450. (substitute* "Makefile"
  451. (("ETCDIR=.*")
  452. (string-append "ETCDIR=" out "/etc/vpnc\n"))
  453. (("PREFIX=.*")
  454. (string-append "PREFIX=" out "\n")))
  455. #t)))
  456. (delete 'configure)))) ; no configure script
  457. (synopsis "Client for Cisco VPN concentrators")
  458. (description
  459. "vpnc is a VPN client compatible with Cisco's EasyVPN equipment.
  460. It supports IPSec (ESP) with Mode Configuration and Xauth. It supports only
  461. shared-secret IPSec authentication with Xauth, AES (256, 192, 128), 3DES,
  462. 1DES, MD5, SHA1, DH1/2/5 and IP tunneling. It runs entirely in userspace.
  463. Only \"Universal TUN/TAP device driver support\" is needed in the kernel.")
  464. (license license:gpl2+) ; some file are bsd-2, see COPYING
  465. (home-page "https://www.unix-ag.uni-kl.de/~massar/vpnc/")))
  466. (define-public vpnc-scripts
  467. (let ((commit "3885f8bbc4ae03fd6da0ada6de12f7223a59595c"))
  468. (package
  469. (name "vpnc-scripts")
  470. (version (string-append "20200925." (string-take commit 7)))
  471. (source (origin
  472. (method git-fetch)
  473. (uri
  474. (git-reference
  475. (url "git://git.infradead.org/users/dwmw2/vpnc-scripts.git")
  476. (commit commit)))
  477. (file-name (git-file-name name version))
  478. (sha256
  479. (base32
  480. "1pmi4n58q81pmn9arvfixhvv6vkkf3rpwac3hwnwyl882q5q0ccx"))))
  481. (build-system gnu-build-system)
  482. (inputs `(("guile" ,guile-3.0) ; for the wrapper scripts
  483. ("coreutils" ,coreutils)
  484. ("grep" ,grep)
  485. ("iproute2" ,iproute) ; for ‘ip’
  486. ("net-tools" ,net-tools) ; for ‘ifconfig’, ‘route’
  487. ("sed" ,sed)
  488. ("which" ,which)))
  489. (arguments
  490. `(#:phases
  491. (modify-phases %standard-phases
  492. (add-after 'unpack 'use-relative-paths
  493. ;; Patch the scripts to work with and use relative paths.
  494. (lambda* _
  495. (for-each (lambda (script)
  496. (substitute* script
  497. (("^PATH=.*") "")
  498. (("/usr/s?bin/") "")
  499. (("\\[ +-x +([^]]+) +\\]" _ command)
  500. (string-append "command -v >/dev/null 2>&1 "
  501. command))))
  502. (find-files "." "^vpnc-script"))
  503. #t))
  504. (delete 'configure) ; no configure script
  505. (replace 'build
  506. (lambda _
  507. (invoke "gcc" "-o" "netunshare" "netunshare.c")))
  508. (replace 'install
  509. ;; There is no Makefile; manually install the relevant files.
  510. (lambda* (#:key outputs #:allow-other-keys)
  511. (let* ((out (assoc-ref outputs "out"))
  512. (etc (string-append out "/etc/vpnc")))
  513. (for-each (lambda (file)
  514. (install-file file etc))
  515. (append (find-files "." "^vpnc-script")
  516. (list "netunshare"
  517. "xinetd.netns.conf")))
  518. #t)))
  519. (add-after 'install 'wrap-scripts
  520. ;; Wrap scripts with paths to their common hard dependencies.
  521. ;; Optional dependencies will need to be installed by the user.
  522. (lambda* (#:key inputs outputs #:allow-other-keys)
  523. (let ((out (assoc-ref outputs "out"))
  524. (guile (search-input-file inputs "bin/guile")))
  525. (for-each
  526. (lambda (script)
  527. (wrap-script (string-append out "/etc/vpnc/" script)
  528. #:guile guile
  529. `("PATH" ":" prefix
  530. ,(map (lambda (name)
  531. (let ((input (assoc-ref inputs name)))
  532. (string-append input "/bin:"
  533. input "/sbin")))
  534. (list "coreutils"
  535. "grep"
  536. "iproute2"
  537. "net-tools"
  538. "sed"
  539. "which")))))
  540. (list "vpnc-script-ptrtd"
  541. "vpnc-script-sshd"
  542. "vpnc-script"))
  543. #t))))
  544. #:tests? #f)) ; no tests
  545. (home-page "http://git.infradead.org/users/dwmw2/vpnc-scripts.git")
  546. (synopsis "Network configuration scripts for Cisco VPN clients")
  547. (description
  548. "This set of scripts configures routing and name services when invoked
  549. by the VPNC or OpenConnect Cisco @dfn{Virtual Private Network} (VPN) clients.
  550. The default @command{vpnc-script} automatically configures most common
  551. connections, and provides hooks for performing custom actions at various stages
  552. of the connection or disconnection process.
  553. Alternative scripts are provided for more complicated set-ups, or to serve as an
  554. example for writing your own. For example, @command{vpnc-script-sshd} contains
  555. the entire VPN in a network namespace accessible only through SSH.")
  556. (license license:gpl2+))))
  557. (define-public ocproxy
  558. (package
  559. (name "ocproxy")
  560. (version "1.60")
  561. (source (origin
  562. (method git-fetch)
  563. (uri (git-reference
  564. (url "https://github.com/cernekee/ocproxy")
  565. (commit (string-append "v" version))))
  566. (file-name (git-file-name name version))
  567. (sha256
  568. (base32
  569. "03323nnhb4y9nzwva04mq7xg03dvdrgp689g89f69jqc261skcqx"))))
  570. (build-system gnu-build-system)
  571. (native-inputs
  572. `(("autoconf" ,autoconf)
  573. ("automake" ,automake)))
  574. (inputs
  575. `(("libevent" ,libevent)))
  576. (home-page "https://github.com/cernekee/ocproxy")
  577. (synopsis "OpenConnect proxy")
  578. (description
  579. "User-level @dfn{SOCKS} and port forwarding proxy for OpenConnect based
  580. on LwIP. When using ocproxy, OpenConnect only handles network activity that
  581. the user specifically asks to proxy, so the @dfn{VPN} interface no longer
  582. \"hijacks\" all network traffic on the host.")
  583. (license license:bsd-3)))
  584. (define-public openconnect
  585. (package
  586. (name "openconnect")
  587. (version "8.10")
  588. (source (origin
  589. (method url-fetch)
  590. (uri (string-append "ftp://ftp.infradead.org/pub/openconnect/"
  591. "openconnect-" version ".tar.gz"))
  592. (sha256
  593. (base32 "1cdsx4nsrwawbsisfkldfc9i4qn60g03vxb13nzppr2br9p4rrih"))))
  594. (build-system gnu-build-system)
  595. (propagated-inputs
  596. `(("libxml2" ,libxml2)
  597. ("gnutls" ,gnutls)
  598. ("zlib" ,zlib)))
  599. (inputs
  600. `(("lz4" ,lz4)
  601. ("vpnc-scripts" ,vpnc-scripts)))
  602. (native-inputs
  603. `(("gettext" ,gettext-minimal)
  604. ("pkg-config" ,pkg-config)))
  605. (arguments
  606. `(#:configure-flags
  607. `(,(string-append "--with-vpnc-script="
  608. (assoc-ref %build-inputs "vpnc-scripts")
  609. "/etc/vpnc/vpnc-script"))))
  610. (synopsis "Client for Cisco VPN")
  611. (description
  612. "OpenConnect is a client for Cisco's AnyConnect SSL VPN, which is
  613. supported by the ASA5500 Series, by IOS 12.4(9)T or later on Cisco SR500,
  614. 870, 880, 1800, 2800, 3800, 7200 Series and Cisco 7301 Routers,
  615. and probably others.")
  616. (license license:lgpl2.1)
  617. (home-page "https://www.infradead.org/openconnect/")))
  618. (define-public openconnect-sso
  619. (package
  620. (name "openconnect-sso")
  621. (version "0.7.3")
  622. (source
  623. (origin
  624. (method url-fetch)
  625. (uri (pypi-uri "openconnect-sso" version))
  626. (sha256
  627. (base32 "065s5c8q80jh0psdw7694nlabwpra7aw6yc4jlgsc9vxx8rx2na1"))))
  628. (build-system python-build-system)
  629. (arguments
  630. `(#:tests? #f ; Tests not included, building from git requires poetry.
  631. #:phases
  632. (modify-phases %standard-phases
  633. (add-after 'unpack 'patch-openconnect
  634. (lambda _
  635. (substitute* "openconnect_sso/app.py"
  636. (("\"openconnect\"")
  637. (string-append "\"" (which "openconnect") "\"")))
  638. #t))
  639. (replace 'check
  640. (lambda* (#:key tests? #:allow-other-keys)
  641. (when tests?
  642. (invoke "pytest" "-v"))
  643. #t))
  644. (add-after 'install 'wrap-qt-process-path
  645. (lambda* (#:key inputs outputs #:allow-other-keys)
  646. (let* ((out (assoc-ref outputs "out"))
  647. (bin (string-append out "/bin/openconnect-sso"))
  648. (qt-process-path (string-append
  649. (assoc-ref inputs "qtwebengine")
  650. "/lib/qt5/libexec/QtWebEngineProcess")))
  651. (wrap-program bin
  652. #:sh (search-input-file inputs "bin/bash")
  653. `("QTWEBENGINEPROCESS_PATH" = (,qt-process-path)))
  654. #t))))))
  655. (inputs
  656. `(("openconnect" ,openconnect)
  657. ("python-attrs" ,python-attrs)
  658. ("python-colorama" ,python-colorama)
  659. ("python-keyring" ,python-keyring)
  660. ("python-lxml" ,python-lxml)
  661. ("python-prompt-toolkit" ,python-prompt-toolkit)
  662. ("python-requests" ,python-requests)
  663. ("python-pyqt" ,python-pyqt)
  664. ("python-pyqtwebengine" ,python-pyqtwebengine)
  665. ("python-pysocks" ,python-pysocks)
  666. ("python-pyxdg" ,python-pyxdg)
  667. ("python-structlog" ,python-structlog)
  668. ("python-toml" ,python-toml)
  669. ("qtwebengine" ,qtwebengine)))
  670. (native-inputs
  671. `(("python-pytest" ,python-pytest)
  672. ("python-setuptools-scm" ,python-setuptools-scm)))
  673. (home-page "https://github.com/vlaci/openconnect-sso")
  674. (synopsis "OpenConnect wrapper script supporting Azure AD (SAMLv2)")
  675. (description
  676. "This package provides a wrapper script for OpenConnect supporting Azure AD
  677. (SAMLv2) authentication to Cisco SSL-VPNs.")
  678. (license license:gpl3)))
  679. (define-public openfortivpn
  680. (package
  681. (name "openfortivpn")
  682. (version "1.15.0")
  683. (source (origin
  684. (method git-fetch)
  685. (uri (git-reference
  686. (url "https://github.com/adrienverge/openfortivpn")
  687. (commit (string-append "v" version))))
  688. (file-name (git-file-name name version))
  689. (sha256
  690. (base32
  691. "1qsfgpxg553s8rc9cyrc4k96z0pislxsdxb9wyhp8fdprkak2mw2"))))
  692. (build-system gnu-build-system)
  693. (native-inputs
  694. `(("autoconf" ,autoconf)
  695. ("autotools" ,automake)
  696. ("pkg-config" ,pkg-config)))
  697. (inputs
  698. `(("openssl" ,openssl)
  699. ("ppp" ,ppp)))
  700. (home-page "https://github.com/adrienverge/openfortivpn")
  701. (synopsis "Client for PPP+SSL VPN tunnel services")
  702. (description "Openfortivpn is a client for PPP+SSL VPN tunnel services. It
  703. spawns a pppd process and operates the communication between the gateway and
  704. this process. It is compatible with Fortinet VPNs.")
  705. (license license:gpl3+)))
  706. (define-public openvpn
  707. (package
  708. (name "openvpn")
  709. (version "2.5.3")
  710. (source (origin
  711. (method url-fetch)
  712. (uri (string-append
  713. "https://swupdate.openvpn.org/community/releases/openvpn-"
  714. version ".tar.xz"))
  715. (sha256
  716. (base32
  717. "0zlski66mw10klmwvg445z051mld7xjng4iyl4f9b883qr1rjspv"))))
  718. (build-system gnu-build-system)
  719. (arguments
  720. '(#:configure-flags '("--enable-iproute2=yes")))
  721. (native-inputs
  722. `(("iproute2" ,iproute)))
  723. (inputs
  724. `(("lz4" ,lz4)
  725. ("lzo" ,lzo)
  726. ("openssl" ,openssl)
  727. ("linux-pam" ,linux-pam)))
  728. (home-page "https://openvpn.net/")
  729. (synopsis "Virtual private network daemon")
  730. (description
  731. "OpenVPN implements virtual private network (@dfn{VPN}) techniques
  732. for creating secure point-to-point or site-to-site connections in routed or
  733. bridged configurations and remote access facilities. It uses a custom
  734. security protocol that utilizes SSL/TLS for key exchange. It is capable of
  735. traversing network address translators (@dfn{NAT}s) and firewalls.")
  736. (license license:gpl2)))
  737. (define-public protonvpn-cli
  738. (package
  739. (name "protonvpn-cli")
  740. (version "2.2.6")
  741. (source
  742. (origin
  743. ;; PyPI has a ".whl" file but not a proper source release.
  744. ;; Thus, fetch code from Git.
  745. (method git-fetch)
  746. (uri (git-reference
  747. (url "https://github.com/ProtonVPN/linux-cli")
  748. (commit (string-append "v" version))))
  749. (file-name (git-file-name name version))
  750. (sha256
  751. (base32 "0y7v9ikrmy5dbjlpbpacp08gy838i8z54m8m4ps7ldk1j6kyia3n"))))
  752. (build-system python-build-system)
  753. (arguments
  754. '(#:tests? #f ; no tests in repo
  755. #:phases
  756. (modify-phases %standard-phases
  757. (add-after 'wrap 'wrap-wrapper
  758. ;; Wrap entrypoint with paths to its hard dependencies.
  759. (lambda* (#:key inputs outputs #:allow-other-keys)
  760. (let ((entrypoint (string-append (assoc-ref outputs "out")
  761. "/bin/.protonvpn-real")))
  762. (wrap-program entrypoint
  763. #:sh (search-input-file inputs "bin/bash")
  764. `("PATH" ":" prefix
  765. ,(map (lambda (name)
  766. (let ((input (assoc-ref inputs name)))
  767. (string-append input "/bin:"
  768. input "/sbin")))
  769. (list "dialog"
  770. "iproute2"
  771. "iptables"
  772. "ncurses"
  773. "openvpn"
  774. "procps"
  775. "which")))))
  776. #t)))))
  777. (native-inputs
  778. `(("python-docopt" ,python-docopt)))
  779. (inputs
  780. `(("dialog" ,dialog)
  781. ("iproute2" ,iproute)
  782. ("iptables" ,iptables)
  783. ("ncurses" ,ncurses)
  784. ("openvpn" ,openvpn)
  785. ("procps" ,procps)
  786. ("python-jinja2" ,python-jinja2)
  787. ("python-pythondialog" ,python-pythondialog)
  788. ("python-requests" ,python-requests)
  789. ("which" ,which)))
  790. (synopsis "Command-line client for ProtonVPN")
  791. (description
  792. "This is the official command-line interface for ProtonVPN, a secure
  793. point-to-point virtual private networking (VPN) service with a gratis tier.
  794. It can automatically find and connect to the fastest servers or use Tor over
  795. VPN. The gratis tier offers unlimited bandwidth for up to 10 devices.")
  796. (home-page "https://github.com/ProtonVPN/linux-cli")
  797. (license license:gpl3+)))
  798. (define-public tinc
  799. (package
  800. (name "tinc")
  801. (version "1.0.36")
  802. (source (origin
  803. (method url-fetch)
  804. (uri (string-append "https://tinc-vpn.org/packages/"
  805. "tinc-" version ".tar.gz"))
  806. (sha256
  807. (base32
  808. "021i2sl2mjscbm8g59d7vs74iw3gf0m48wg7w3zhwj6czarkpxs0"))))
  809. (build-system gnu-build-system)
  810. (arguments
  811. '(#:configure-flags
  812. '("--sysconfdir=/etc"
  813. "--localstatedir=/var")))
  814. (inputs `(("zlib" ,zlib)
  815. ("lzo" ,lzo)
  816. ("openssl" ,openssl)))
  817. (home-page "https://tinc-vpn.org")
  818. (synopsis "Virtual Private Network (VPN) daemon")
  819. (description
  820. "Tinc is a VPN that uses tunnelling and encryption to create a secure
  821. private network between hosts on the internet.")
  822. (license license:gpl2+)))
  823. (define-public sshuttle
  824. (package
  825. (name "sshuttle")
  826. (version "0.78.5")
  827. (source
  828. (origin
  829. (method url-fetch)
  830. (uri (pypi-uri name version))
  831. (sha256
  832. (base32
  833. "0vp13xwrhx4m6zgsyzvai84lkq9mzkaw47j58dk0ll95kaymk2x8"))))
  834. (build-system python-build-system)
  835. (arguments
  836. `(#:phases
  837. (modify-phases %standard-phases
  838. (add-after 'unpack 'patch-FHS-file-names
  839. (lambda _
  840. (substitute* "sshuttle/client.py"
  841. (("/usr/bin/env") (which "env")))
  842. (substitute* "sshuttle/ssh.py"
  843. (("/bin/sh") "sh"))
  844. #t)))))
  845. (native-inputs
  846. `(("python-setuptools-scm" ,python-setuptools-scm)
  847. ;; For tests only.
  848. ("python-flake8" ,python-flake8)
  849. ("python-mock" ,python-mock)
  850. ("python-pytest-cov" ,python-pytest-cov)
  851. ("python-pytest-runner" ,python-pytest-runner)))
  852. (home-page "https://github.com/sshuttle/sshuttle")
  853. (synopsis "VPN that transparently forwards connections over SSH")
  854. (description "sshuttle creates an encrypted virtual private network (VPN)
  855. connection to any remote server to which you have secure shell (SSH) access.
  856. The only requirement is a suitable version of Python on the server;
  857. administrative privileges are required only on the client. Unlike most VPNs,
  858. sshuttle forwards entire sessions, not packets, using kernel transparent
  859. proxying. This makes it faster and more reliable than SSH's own tunneling and
  860. port forwarding features. It can forward both TCP and UDP traffic, including
  861. DNS domain name queries.")
  862. (license license:lgpl2.0))) ; incorrectly identified as GPL in ‘setup.py’
  863. (define-public sshoot
  864. (package
  865. (name "sshoot")
  866. (version "1.2.6")
  867. (source
  868. (origin
  869. (method url-fetch)
  870. (uri (pypi-uri name version))
  871. (sha256
  872. (base32
  873. "1ccgh0hjyxrwkgy3hnxz3hgbjbs0lmfs25d5l5jam0xbpcpj63h0"))))
  874. (build-system python-build-system)
  875. (arguments
  876. '(#:phases
  877. (modify-phases %standard-phases
  878. (add-after 'unpack 'patch-paths
  879. (lambda _
  880. (substitute* "sshoot/tests/test_manager.py"
  881. (("/bin/sh") (which "sh")))
  882. #t)))))
  883. (inputs
  884. `(("python-argcomplete" ,python-argcomplete)
  885. ("python-prettytable" ,python-prettytable)
  886. ("python-pyyaml" ,python-pyyaml)))
  887. ;; For tests only.
  888. (native-inputs
  889. `(("python-fixtures" ,python-fixtures)
  890. ("python-pbr" ,python-pbr)
  891. ("python-testtools" ,python-testtools)))
  892. (home-page "https://github.com/albertodonato/sshoot")
  893. (synopsis "sshuttle VPN session manager")
  894. (description "sshoot provides a command-line interface to manage multiple
  895. @command{sshuttle} virtual private networks. It supports flexible profiles
  896. with configuration options for most of @command{sshuttle}’s features.")
  897. (license license:gpl3+)))
  898. (define-public badvpn
  899. (package
  900. (name "badvpn")
  901. (version "1.999.130")
  902. (source
  903. (origin
  904. (method git-fetch)
  905. (uri (git-reference
  906. (url "https://github.com/ambrop72/badvpn")
  907. (commit version)))
  908. (file-name (git-file-name name version))
  909. (sha256
  910. (base32 "0rm67xhi7bh3yph1vh07imv5y1pwyldvw3wa5bz471g8mnkc7d3c"))))
  911. (build-system cmake-build-system)
  912. (arguments
  913. '(#:tests? #f)) ; no tests
  914. (inputs
  915. `(("nspr" ,nspr)
  916. ("nss" ,nss)
  917. ("openssl" ,openssl)))
  918. (native-inputs
  919. `(("pkg-config" ,pkg-config)))
  920. (home-page "https://github.com/ambrop72/badvpn")
  921. (synopsis "Peer-to-peer virtual private network (VPN)")
  922. (description "@code{BadVPN} is a collection of virtual private
  923. network (VPN) tools. It includes:
  924. @enumerate
  925. @item NCD programming language.\n
  926. NCD (Network Configuration Daemon) is a daemon and programming/scripting
  927. language for configuration of network interfaces and other aspects of the
  928. operating system.
  929. @item Tun2socks network-layer proxifier.\n
  930. The tun2socks program socksifes TCP connections at the network layer. It
  931. implements a TUN device which accepts all incoming TCP connections (regardless
  932. of destination IP), and forwards the connections through a SOCKS server.
  933. @item Peer-to-peer VPN.\n
  934. The peer-to-peer VPN implements a Layer 2 (Ethernet) network between the peers
  935. (VPN nodes).
  936. @end enumerate")
  937. ;; This project contains a bundled lwIP. lwIP is also released under the
  938. ;; 3-clause BSD license.
  939. (license license:bsd-3)))
  940. (define-public wireguard-linux-compat
  941. (package
  942. (name "wireguard-linux-compat")
  943. (version "1.0.20201221")
  944. (source (origin
  945. (method url-fetch)
  946. (uri (string-append "https://git.zx2c4.com/wireguard-linux-compat/"
  947. "snapshot/wireguard-linux-compat-" version
  948. ".tar.xz"))
  949. (sha256
  950. (base32
  951. "0ci13in0fqq32n5qamch4qhjgbdq86ygrgmfhc9szsh2nsl8jlkf"))))
  952. (build-system linux-module-build-system)
  953. (outputs '("out"
  954. "kernel-patch"))
  955. (arguments
  956. `(#:linux ,linux-libre-5.4 ; mustn't have WG built-in
  957. #:tests? #f ; no test suite
  958. #:modules ((guix build linux-module-build-system)
  959. (guix build utils)
  960. (ice-9 popen)
  961. (ice-9 textual-ports))
  962. #:phases
  963. (modify-phases %standard-phases
  964. (add-before 'build 'change-directory
  965. (lambda _
  966. (chdir "./src")
  967. #t))
  968. (add-after 'build 'build-patch
  969. (lambda* (#:key outputs #:allow-other-keys)
  970. (let* ((patch-builder "../kernel-tree-scripts/create-patch.sh")
  971. (port (open-input-pipe patch-builder))
  972. (str (get-string-all port)))
  973. (close-pipe port)
  974. (call-with-output-file "wireguard.patch"
  975. (lambda (port)
  976. (format port "~a" str))))
  977. #t))
  978. (add-after 'install 'install-patch
  979. (lambda* (#:key outputs #:allow-other-keys)
  980. (install-file "wireguard.patch"
  981. (assoc-ref %outputs "kernel-patch"))
  982. #t))
  983. ;; So that 'install-license-files' works...
  984. (add-before 'install-license-files 'reset-cwd
  985. (lambda _
  986. (chdir "..")
  987. #t)))))
  988. (home-page "https://git.zx2c4.com/wireguard-linux-compat/")
  989. (synopsis "WireGuard kernel module for Linux 3.10 through 5.5")
  990. (description "This package contains an out-of-tree kernel patch and
  991. a loadable module adding WireGuard to Linux kernel versions 3.10 through 5.5.
  992. WireGuard was added to Linux 5.6.")
  993. (license license:gpl2)))
  994. (define-public wireguard-tools
  995. (package
  996. (name "wireguard-tools")
  997. (version "1.0.20210424")
  998. (source
  999. (origin
  1000. (method git-fetch)
  1001. (uri (git-reference
  1002. (url "https://git.zx2c4.com/wireguard-tools.git")
  1003. (commit (string-append "v" version))))
  1004. (file-name (git-file-name name version))
  1005. (sha256
  1006. (base32 "12v0ykaz7phv1gqin35wf6ndgb9819vai17ynjxssq00xwcbsq43"))))
  1007. (build-system gnu-build-system)
  1008. (arguments
  1009. `(#:make-flags
  1010. (list ,(string-append "CC=" (cc-for-target))
  1011. "--directory=src"
  1012. "WITH_BASHCOMPLETION=yes"
  1013. ;; Install the ‘simple and dirty’ helper script wg-quick(8).
  1014. "WITH_WGQUICK=yes"
  1015. (string-append "PREFIX=" (assoc-ref %outputs "out"))
  1016. ;; Currently used only to create an empty /etc/wireguard directory.
  1017. (string-append "SYSCONFDIR=no-thanks"))
  1018. ;; The test suite is meant to be run interactively. It runs Clang's
  1019. ;; scan-build static analyzer and then starts a web server to display the
  1020. ;; results.
  1021. #:tests? #f
  1022. #:phases
  1023. (modify-phases %standard-phases
  1024. ;; No configure script
  1025. (delete 'configure)
  1026. (add-after 'install 'install-contrib-docs
  1027. (lambda* (#:key outputs #:allow-other-keys)
  1028. (let ((out (assoc-ref outputs "out")))
  1029. (copy-recursively "contrib/"
  1030. (string-append out "/share/doc/wireguard-tools"))
  1031. #t)))
  1032. (add-after 'install 'wrap-wg-quick
  1033. (lambda* (#:key inputs outputs #:allow-other-keys)
  1034. (let* ((out (assoc-ref outputs "out"))
  1035. (inputs-sbin (map (lambda (input)
  1036. (string-append (assoc-ref inputs input) "/sbin"))
  1037. (list "resolvconf" "iproute" "procps"
  1038. "iptables")))
  1039. (coreutils (string-append (assoc-ref inputs "coreutils")
  1040. "/bin")))
  1041. (wrap-program (string-append out "/bin/wg-quick")
  1042. #:sh (search-input-file inputs "bin/bash")
  1043. `("PATH" ":" prefix ,(append inputs-sbin
  1044. (list coreutils))))
  1045. #t))))))
  1046. (inputs
  1047. `(("resolvconf" ,openresolv)
  1048. ("coreutils" ,coreutils)
  1049. ("bash" ,bash) ; for scripts using /dev/tcp
  1050. ("procps" ,procps)
  1051. ("iproute" ,iproute)
  1052. ("iptables" ,iptables)))
  1053. (home-page "https://www.wireguard.com/")
  1054. (synopsis "Tools for configuring WireGuard tunnels")
  1055. (description
  1056. "This package provides the user-space command-line tools for using and
  1057. configuring WireGuard tunnels.
  1058. WireGuard is a simple and fast general-purpose @acronym{VPN, Virtual Private
  1059. Network} that securely encapsulates IP packets over UDP. It aims to be as easy
  1060. to configure and deploy as SSH. VPN connections are made simply by exchanging
  1061. public keys and can roam across IP addresses.")
  1062. (license
  1063. (list license:lgpl2.1+ ; src/netlink.h & contrib/embeddable-wg-library
  1064. license:gpl2)))) ; everything else
  1065. (define-public wireguard
  1066. (deprecated-package "wireguard" wireguard-tools))
  1067. (define-public xl2tpd
  1068. (package
  1069. (name "xl2tpd")
  1070. (version "1.3.16")
  1071. (source (origin
  1072. (method git-fetch)
  1073. (uri (git-reference
  1074. (url "https://github.com/xelerance/xl2tpd")
  1075. (commit (string-append "v" version))))
  1076. (file-name (git-file-name name version))
  1077. (sha256
  1078. (base32
  1079. "0is5ccrvijz0pfm45pfrlbb9y8231yz3c4zqs8mkgakl9rxajy6l"))))
  1080. (build-system gnu-build-system)
  1081. (arguments
  1082. `(#:make-flags (list (string-append "PREFIX=" %output)
  1083. "CC=gcc")
  1084. #:phases (modify-phases %standard-phases
  1085. (delete 'configure) ;no configure script
  1086. (add-before 'build 'setup-environment
  1087. (lambda* (#:key inputs #:allow-other-keys)
  1088. (substitute* "l2tp.h"
  1089. (("/usr/sbin/pppd")
  1090. (search-input-file inputs "/sbin/pppd")))
  1091. (setenv "KERNELSRC"
  1092. (assoc-ref inputs "linux-libre-headers"))
  1093. #t)))
  1094. #:tests? #f)) ; no tests provided
  1095. (inputs `(("libpcap" ,libpcap)
  1096. ("linux-libre-headers" ,linux-libre-headers)
  1097. ("ppp" ,ppp)))
  1098. (home-page "https://www.xelerance.com/software/xl2tpd/")
  1099. (synopsis "Layer 2 Tunnelling Protocol Daemon (RFC 2661)")
  1100. (description
  1101. "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol (RFC 2661).
  1102. L2TP allows you to tunnel PPP over UDP.")
  1103. (license license:gpl2)))