projects/guix·blob java-team · refs

571 lines · 23.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014, 2015, 2021 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2015 Mark H Weaver <[email protected]>
4;;; Copyright © 2016-2018, 2020-2023, 2025 Efraim Flashner <[email protected]>
5;;; Copyright © 2016, 2017 Nikita <[email protected]>
6;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2017, 2018, 2019, 2021, 2023 Eric Bavier <[email protected]>
8;;; Copyright © 2017 Rutger Helling <[email protected]>
9;;; Copyright © 2018, 2022 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2020 Vincent Legoll <[email protected]>
11;;; Copyright © 2020 Brice Waegeneire <[email protected]>
12;;; Copyright © 2020 André Batista <[email protected]>
13;;; Copyright © 2021-2023 Danial Behzadi <[email protected]>
14;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
15;;; Copyright © 2022 Jim Newsome <[email protected]>
16;;; Copyright © 2025 Danial Behzadi <[email protected]>
17;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
18;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
19;;; Copyright © 2025 iamawacko <[email protected]>
20;;;
21;;; This file is part of GNU Guix.
22;;;
23;;; GNU Guix is free software; you can redistribute it and/or modify it
24;;; under the terms of the GNU General Public License as published by
25;;; the Free Software Foundation; either version 3 of the License, or (at
26;;; your option) any later version.
27;;;
28;;; GNU Guix is distributed in the hope that it will be useful, but
29;;; WITHOUT ANY WARRANTY; without even the implied warranty of
30;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31;;; GNU General Public License for more details.
32;;;
33;;; You should have received a copy of the GNU General Public License
34;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35
36(define-module (gnu packages tor)
37 #:use-module (guix gexp)
38 #:use-module ((guix licenses) #:prefix license:)
39 #:use-module (guix packages)
40 #:use-module (guix utils)
41 #:use-module (guix download)
42 #:use-module (guix git-download)
43 #:use-module (guix build-system cargo)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system pyproject)
46 #:use-module (gnu packages)
47 #:use-module (gnu packages base)
48 #:use-module (gnu packages gnupg)
49 #:use-module (gnu packages libevent)
50 #:use-module (gnu packages libffi)
51 #:use-module (gnu packages linux)
52 #:use-module (gnu packages check)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages pcre)
55 #:use-module (gnu packages freedesktop)
56 #:use-module (gnu packages glib)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages python)
59 #:use-module (gnu packages python-build)
60 #:use-module (gnu packages python-check)
61 #:use-module (gnu packages python-crypto)
62 #:use-module (gnu packages python-web)
63 #:use-module (gnu packages python-xyz)
64 #:use-module (gnu packages qt)
65 #:use-module (gnu packages autotools)
66 #:use-module (gnu packages tls)
67 #:use-module (gnu packages w3m)
68 #:use-module (gnu packages xorg))
69
70(define-public tor
71 (package
72 (name "tor")
73 (version "0.4.9.12")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "https://dist.torproject.org/tor-"
77 version ".tar.gz"))
78 (sha256
79 (base32
80 "0nsza73dzg8g1dwi5gih9wz854pcqkbfjlyam144ivnsvk4hgly0"))))
81 (build-system gnu-build-system)
82 (arguments
83 (list #:configure-flags
84 #~(list "--enable-gpl"
85 "--enable-lzma"
86 "--enable-zstd")
87 #:phases
88 #~(modify-phases %standard-phases
89 (add-before 'build 'adjust-torify
90 (lambda* (#:key inputs #:allow-other-keys)
91 ;; Record in 'torify' the absolute file name of 'torsocks'.
92 (let ((torsocks (search-input-file
93 inputs "/bin/torsocks")))
94 (substitute* "contrib/client-tools/torify"
95 (("pathfind torsocks")
96 "true")
97 (("exec torsocks")
98 (string-append "exec " torsocks))))))
99 (add-before 'check 'skip-practracker
100 ;; This is a style linter. It doesn't get to throw fatal errors.
101 (lambda _
102 (setenv "TOR_DISABLE_PRACTRACKER" "set")))
103 #$@(if (or (target-x86-64?)
104 (target-x86-32?))
105 '()
106 ;; Work around upstream issues relating to libseccomp,
107 ;; sandboxing and glibc-2.33. This is similar to the issue
108 ;; the tor-sandbox-i686 patch fixes but for other architectures.
109 ;; https://gitlab.torproject.org/tpo/core/tor/-/issues/40381
110 ;; https://gitlab.torproject.org/tpo/core/tor/-/issues/40599
111 ;; https://gitlab.torproject.org/tpo/core/tor/-/merge_requests/446
112 `((add-before 'check 'adjust-test-suite
113 (lambda _
114 (substitute* "src/test/test_include.sh"
115 ((".*Sandbox 1.*") ""))
116 (substitute* "src/test/test.c"
117 ((".*sandbox_tests.*") "")))))))))
118 (native-inputs
119 (list pkg-config python)) ; for tests
120 (inputs
121 (list libevent
122 libseccomp
123 openssl
124 torsocks
125 xz
126 zlib
127 `(,zstd "lib")))
128 (home-page "https://www.torproject.org/")
129 (synopsis "Anonymous network router to improve privacy on the Internet")
130 (description
131 "Tor protects you by bouncing your communications around a distributed
132network of relays run by volunteers all around the world: it prevents
133somebody watching your Internet connection from learning what sites you
134visit, and it prevents the sites you visit from learning your physical
135location. Tor works with many of your existing applications, including
136web browsers, instant messaging clients, remote login, and other
137applications based on the TCP protocol.
138
139This package is the full featured @code{tor} which is needed for running
140relays, bridges or directory authorities. If you just want to access the Tor
141network or to setup an onion service you may install @code{tor-client}
142instead.")
143 (license license:bsd-3)))
144
145(define-public tor-client
146 (package
147 (inherit tor)
148 (name "tor-client")
149 (arguments
150 (substitute-keyword-arguments arguments
151 ((#:configure-flags flags #~'())
152 #~(append #$flags
153 (list "--disable-module-relay")))))
154 (synopsis "Client to the anonymous Tor network")
155 (description
156 "Tor protects you by bouncing your communications around a distributed
157network of relays run by volunteers all around the world: it prevents
158somebody watching your Internet connection from learning what sites you
159visit, and it prevents the sites you visit from learning your physical
160location. Tor works with many of your existing applications, including
161web browsers, instant messaging clients, remote login, and other
162applications based on the TCP protocol.
163
164To @code{torify} applications (to take measures to ensure that an application,
165which has not been designed for use with Tor such as ssh, will use only Tor for
166internet connectivity, and also ensures that there are no leaks from DNS, UDP or
167the application layer) you need to install @code{torsocks}.
168
169This package only provides a client to the Tor Network.")))
170
171(define-public torsocks
172 (package
173 (name "torsocks")
174 (version "2.4.0")
175 (source
176 (origin
177 (method url-fetch)
178 (uri (string-append
179 "https://gitlab.torproject.org/tpo/core/torsocks/-/archive/v"
180 version "/torsocks-v" version ".tar.bz2"))
181 (sha256
182 (base32
183 "1a7k3njdhp7dz603knhisna1zvxw35j3g213p6dvczv9bcjy7cjl"))))
184 (build-system gnu-build-system)
185 (inputs
186 (list libcap))
187 (native-inputs
188 (list autoconf automake libtool))
189 (arguments
190 (list
191 #:configure-flags
192 #~'("CFLAGS=-g -O2 -Wno-error=implicit-function-declaration")
193 #:phases #~(modify-phases %standard-phases
194 (add-after 'build 'absolutize
195 (lambda* (#:key inputs #:allow-other-keys)
196 (substitute* "src/bin/torsocks"
197 (("getcap=.*")
198 (string-append "getcap=" (which "getcap") "\n"))))))))
199 (home-page "https://www.torproject.org/")
200 (synopsis "Transparently route an application's traffic through Tor")
201 (description
202 "Torsocks allows you to use most applications in a safe way with Tor. It
203ensures that DNS requests are handled safely and explicitly rejects UDP
204traffic from the application you're using.")
205 (properties
206 '((release-monitoring-url
207 . "https://gitlab.torproject.org/tpo/core/torsocks/-/tags")))
208 ;; All the files explicitly say "version 2 only".
209 (license license:gpl2)))
210
211(define-public privoxy
212 (package
213 (name "privoxy")
214 (version "3.0.34")
215 (source (origin
216 (method url-fetch)
217 (uri (string-append "mirror://sourceforge/ijbswa/Sources/"
218 version "%20%28stable%29/privoxy-"
219 version "-stable-src.tar.gz"))
220 (sha256
221 (base32
222 "0b2x7hm34fbqaxb46afpx6bnc3x76d753y2p8rmn2kkgcnhvrk76"))))
223 (build-system gnu-build-system)
224 (arguments
225 '(;; The default 'sysconfdir' is $out/etc; change that to
226 ;; $out/etc/privoxy.
227 #:configure-flags (list (string-append "--sysconfdir="
228 (assoc-ref %outputs "out")
229 "/etc/privoxy")
230 "--localstatedir=/var"
231 "--with-brotli"
232 "--with-openssl")
233 #:tests? #f ; no test suite
234 #:phases
235 (modify-phases %standard-phases
236 (add-after 'unpack 'patch-default-logging
237 (lambda _
238 (with-fluids ((%default-port-encoding "ISO-8859-1"))
239 ;; Do not create /var/run nor /var/log/privoxy/logfile.
240 (substitute* "GNUmakefile.in"
241 (("(logfile \\|\\| exit )1" _ match)
242 (string-append match "0"))
243 (("(\\$\\(DESTDIR\\)\\$\\(SHARE_DEST\\)) \\\\" _ match)
244 match)
245 ((".*\\$\\(LOG_DEST\\) \\$\\(DESTDIR\\)\\$\\(PID_DEST\\).*")
246 ""))
247 ;; Disable logging in the default configuration to allow for
248 ;; non-root users using it as is.
249 (substitute* "config"
250 (("^logdir") "#logdir")
251 (("^logfile") "#logfile"))))))))
252 (inputs
253 (list brotli openssl pcre w3m zlib))
254 (native-inputs
255 (list autoconf automake))
256 (home-page "https://www.privoxy.org")
257 (synopsis "Web proxy with advanced filtering capabilities for enhancing privacy")
258 (description
259 "Privoxy is a non-caching web proxy with advanced filtering capabilities
260for enhancing privacy, modifying web page data and HTTP headers, controlling
261access, and removing ads and other obnoxious Internet junk. Privoxy has a
262flexible configuration and can be customized to suit individual needs and
263tastes. It has application for both stand-alone systems and multi-user
264networks.")
265 (license license:gpl2+)))
266
267(define-public oniongen-rs
268 (package
269 (name "oniongen-rs")
270 (version "0.6.6")
271 (source
272 (origin
273 (method url-fetch)
274 (uri (crate-uri "oniongen-rs" version))
275 (file-name (string-append name "-" version ".tar.gz"))
276 (sha256
277 (base32 "17jr1k2ga0wpama87hr9xdnhz8nj12cmhzvpvm42yrgfckkampbz"))))
278 (build-system cargo-build-system)
279 (arguments
280 (list #:install-source? #f))
281 (inputs (cargo-inputs 'oniongen-rs))
282 (home-page "https://gitlab.com/iamawacko-oss/oniongen-rs")
283 (synopsis "V3 .onion vanity URL generator")
284 (description
285 "This package provides a v3 .onion vanity URL generator written in Rust.
286Regex can be used to filter URLs. The thread count and output directory can be
287specified. If the address generated matches your prefix, the hostname, public
288key, and private key are written to a new directory.")
289 (license license:expat)))
290
291(define-public onionshare-cli
292 (package
293 (name "onionshare-cli")
294 (version "2.6.5")
295 (source
296 (origin
297 (method git-fetch)
298 (uri (git-reference
299 (url "https://github.com/onionshare/onionshare")
300 (commit (string-append "v" version))))
301 (file-name (git-file-name name version))
302 (sha256
303 (base32 "1pb4glbz8kz30kv36pm3m4qiyansvavjzm8jv66h7xrn8l2i61a4"))
304 (modules '((guix build utils)))
305 (snippet
306 #~(begin
307 (for-each delete-file-recursively
308 (list "docs"
309 "flatpak"
310 "snap"
311 "security"
312 "desktop/screenshots"))
313 (for-each delete-file
314 (append
315 (find-files "." "poetry\\.lock")
316 (find-files "desktop/scripts" ".*macos.*")
317 (list "desktop/scripts/build-windows.py")))))))
318 (build-system pyproject-build-system)
319 (native-inputs
320 (list python-cython
321 python-poetry-core
322 python-pytest
323 python-setuptools))
324 (inputs
325 (list python-click
326 python-cffi
327 python-colorama
328 python-eventlet
329 python-flask
330 python-flask-compress
331 python-flask-socketio
332 python-gevent
333 python-gevent-websocket
334 python-packaging
335 python-pkgconfig
336 python-psutil
337 python-pynacl
338 python-pysocks
339 python-qrcode
340 python-requests
341 python-setuptools
342 python-stem
343 python-unidecode
344 python-urllib3
345 python-waitress
346 python-werkzeug
347 tor))
348 (arguments
349 (list
350 #:phases
351 #~(modify-phases %standard-phases
352 (add-after 'unpack 'relax-requirements
353 (lambda _
354 ;; All tests passed, and the CLI is working in runtime, relax
355 ;; Poetry way too strict requirements.
356 (substitute* (list "cli/pyproject.toml"
357 "desktop/pyproject.toml")
358 (("^wheel = .*")
359 "\n")
360 (("^pynacl = .*")
361 (format #f "pynacl = \"^~a\"~%"
362 #$(package-version
363 (this-package-input "python-pynacl"))))
364 (("^stem = .*")
365 (format #f "stem = \"^~a\"~%"
366 #$(package-version
367 (this-package-input "python-stem"))))
368 (("^qrcode = .*")
369 (format #f "qrcode = \"^~a\"~%"
370 #$(package-version
371 (this-package-input "python-qrcode"))))
372 (("^gevent = .*")
373 (format #f "gevent = \"^~a\"~%"
374 #$(package-version
375 (this-package-input "python-gevent"))))
376 (("^cffi = .*")
377 (format #f "cffi = \"^~a\"~%"
378 #$(package-version
379 (this-package-input "python-cffi")))))))
380 (add-after 'unpack 'bake-tor
381 (lambda* (#:key inputs #:allow-other-keys)
382 (substitute* (list "cli/onionshare_cli/common.py"
383 "desktop/onionshare/gui_common.py")
384 (("shutil\\.which\\(\\\"tor\\\"\\)")
385 (format #f "~s" (search-input-file inputs "bin/tor"))))
386 (substitute* "cli/tests/test_cli_common.py"
387 (("/usr/share/tor")
388 (search-input-directory inputs "share/tor")))))
389 (add-before 'build 'change-directory
390 (lambda _ (chdir "cli")))
391 (add-before 'check 'pre-check
392 (lambda* (#:key tests? #:allow-other-keys)
393 (when tests?
394 (setenv "HOME" "/tmp")))))))
395 (home-page "https://onionshare.org/")
396 (synopsis "Securely and anonymously share files")
397 (description "OnionShare lets you securely and anonymously share files,
398host websites, and chat with friends using the Tor network.
399
400This package contains @code{onionshare-cli}, a command-line interface to
401OnionShare.")
402 ;; Bundled, minified jquery and socket.io are expat licensed.
403 ;; TODO Unbundle them.
404 (license (list license:gpl3+ license:expat))))
405
406(define-public onionshare
407 (package
408 (inherit onionshare-cli)
409 (name "onionshare")
410 (arguments
411 (substitute-keyword-arguments arguments
412 ((#:phases phases)
413 #~(modify-phases #$phases
414 (add-after 'relax-requirements 'relax-more-requirements
415 (lambda _
416 (substitute* "desktop/pyproject.toml"
417 (("^PySide6 = .*")
418 (format #f "PySide6 = \"^~a\"~%"
419 #$(package-version
420 (this-package-input "python-pyside-6")))))))
421 (add-after 'unpack 'absolutize
422 (lambda* (#:key inputs #:allow-other-keys)
423 (substitute* "desktop/onionshare/tab/mode/history.py"
424 (("Popen\\(\\[\"xdg-open\"")
425 (string-append "Popen([\"" (which "xdg-open") "\"")))))
426 (replace 'change-directory
427 (lambda _ (chdir "desktop/")))
428 (add-after 'install 'install-data
429 (lambda _
430 (install-file "org.onionshare.OnionShare.svg"
431 (string-append #$output
432 "/share/icons/hicolor/scalable/apps"))
433 (install-file "org.onionshare.OnionShare.desktop"
434 (string-append #$output
435 "/share/applications"))))
436 (replace 'check
437 (lambda* (#:key tests? #:allow-other-keys)
438 (when tests?
439 ;; Remove multiline load-path adjustment, so that
440 ;; onionshare-cli modules are loaded from input
441 (substitute* "tests/conftest.py"
442 (("\"cli\",")
443 "\"/nonexistent\""))
444 ;; Make Qt render "offscreen":
445 (setenv "QT_QPA_PLATFORM" "offscreen")
446 (setenv "HOME" "/tmp")
447 (apply invoke "xvfb-run" "pytest" "-vv"
448 (find-files "tests" "^test_gui.*\\.py$")))))))))
449 (native-inputs
450 (modify-inputs native-inputs
451 (prepend xvfb-run)))
452 (inputs
453 ;; The desktop client uses onionshare-cli like a python module. But
454 ;; propagating onionshare-cli's inputs is not great, since a user would
455 ;; not expect to have those installed when using onionshare-cli as a
456 ;; standalone utility. So add onionshare-cli's inputs here.
457 (modify-inputs inputs
458 (prepend onionshare-cli ;TODO: package obfs4proxy
459 python-gnupg
460 python-pyside-6
461 python-qrcode
462 python-shiboken-6
463 xdg-utils)))
464 (description "OnionShare lets you securely and anonymously share files,
465host websites, and chat with friends using the Tor network.")))
466
467(define-public nyx
468 (package
469 (name "nyx")
470 (version "2.1.0")
471 (source
472 (origin
473 (method url-fetch)
474 (uri (pypi-uri name version))
475 (sha256
476 (base32 "02rrlllz2ci6i6cs3iddyfns7ang9a54jrlygd2jw1f9s6418ll8"))))
477 (build-system pyproject-build-system)
478 (arguments
479 (list
480 #:test-backend #~'unittest
481 #:phases
482 #~(modify-phases %standard-phases
483 (add-after 'install 'install-man-page
484 (lambda _
485 (install-file "nyx.1"
486 (string-append #$output "/share/man/man1"))))
487 (add-after 'install 'install-sample-configuration
488 (lambda _
489 (install-file "web/nyxrc.sample"
490 (string-append #$output "/share/doc/"
491 #$name "-" #$version)))))))
492 (native-inputs (list python-setuptools))
493 (inputs (list python-stem))
494 (home-page "https://nyx.torproject.org/")
495 (synopsis "Tor relay status monitor")
496 (description
497 "Nyx monitors the performance of relays participating in the
498@uref{https://www.torproject.org/, Tor anonymity network}. It displays this
499information visually and in real time, using a curses-based terminal interface.
500This makes Nyx well-suited for remote shell connections and servers without a
501graphical display. It's like @command{top} for Tor, providing detailed
502statistics and status reports on:
503
504@enumerate
505@item connections (with IP address, hostname, fingerprint, and consensus data),
506@item bandwidth, processor, and memory usage,
507@item the relay's current configuration,
508@item logged events,
509@item and much more.
510@end enumerate
511
512Potential client and exit connections are scrubbed of sensitive information.")
513 (license license:gpl3+)))
514
515(define-public tractor
516 (package
517 (name "tractor")
518 (version "5.0.0")
519 (source
520 (origin
521 (method url-fetch)
522 (uri (pypi-uri "traxtor" version))
523 (sha256
524 (base32
525 "0is50z3v0mw9am31zizblq5ai30vz83qp6qsdingbn7f7cqzldmh"))))
526 (build-system pyproject-build-system)
527 (native-inputs
528 (list python-pytest
529 python-setuptools
530 python-wheel
531 (list glib "bin"))) ; for glib-compile-schemas.
532 (inputs
533 (list python-fire
534 python-pygobject
535 python-pysocks
536 python-requests
537 python-stem
538 python-termcolor))
539 (arguments
540 (list
541 #:test-flags
542 #~(list "-k" (string-join
543 (list "not test_local"
544 "test_network"
545 "test_obfs"
546 "test_stop_do")
547 " and not "))
548 #:phases
549 #~(modify-phases %standard-phases
550 (add-after 'install 'install-man-page
551 (lambda _
552 (let ((man1 (string-append #$output "/share/man/man1")))
553 (install-file "data/tractor.1" man1))))
554 (add-after 'install 'install-bash-completion
555 (lambda _
556 (let ((bash-completion
557 (string-append #$output "/share/bash-completion/completions")))
558 (install-file "data/completion/bash/tractor" bash-completion))))
559 (add-after 'install 'install-gschema
560 (lambda _
561 (let ((schemas (string-append #$output "/share/glib-2.0/schemas")))
562 (install-file "src/tractor/tractor.gschema.xml" schemas)
563 ;; The following line is needed for packages having tractor as input.
564 (invoke "glib-compile-schemas" schemas)))))))
565 (home-page "https://framagit.org/tractor")
566 (synopsis "Setup an onion routing proxy")
567 (description
568 "This package uses Python stem library to provide a connection through
569the onion proxy and sets up proxy in user session, so you don't have to mess
570up with TOR on your system anymore.")
571 (license license:gpl3+)))