gnu: Remove ".git" from "https://github/…/….git".
[jackhill/guix/guix.git] / gnu / packages / tor.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
6 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017, 2018, 2019 Eric Bavier <bavier@member.fsf.org>
8 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
9 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
10 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
11 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
12 ;;; Copyright © 2020 André Batista <nandre@riseup.net>
13 ;;;
14 ;;; This file is part of GNU Guix.
15 ;;;
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
20 ;;;
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
25 ;;;
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29 (define-module (gnu packages tor)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (guix packages)
32 #:use-module (guix utils)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system python)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages libevent)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages pcre)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-crypto)
47 #:use-module (gnu packages python-web)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages qt)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages tls)
52 #:use-module (gnu packages w3m))
53
54 (define-public tor
55 (package
56 (name "tor")
57 (version "0.4.3.6")
58 (source (origin
59 (method url-fetch)
60 (uri (string-append "https://dist.torproject.org/tor-"
61 version ".tar.gz"))
62 (sha256
63 (base32
64 "0qmcrkjip0ywq77232m73pjwqiaj0q2klwklqlpbw575shvhcbba"))))
65 (build-system gnu-build-system)
66 (arguments
67 `(#:configure-flags
68 (list "--enable-lzma"
69 "--enable-zstd")))
70 (native-inputs
71 `(("pkg-config" ,pkg-config)
72 ("python" ,python))) ; for tests
73 (inputs
74 `(("libevent" ,libevent)
75 ("libseccomp" ,libseccomp)
76 ("openssl" ,openssl)
77 ("xz" ,xz)
78 ("zlib" ,zlib)
79 ("zstd" ,zstd "lib")))
80 (home-page "https://www.torproject.org/")
81 (synopsis "Anonymous network router to improve privacy on the Internet")
82 (description
83 "Tor protects you by bouncing your communications around a distributed
84 network of relays run by volunteers all around the world: it prevents
85 somebody watching your Internet connection from learning what sites you
86 visit, and it prevents the sites you visit from learning your physical
87 location. Tor works with many of your existing applications, including
88 web browsers, instant messaging clients, remote login, and other
89 applications based on the TCP protocol.
90
91 This package is the full featured @code{tor} which is needed for running
92 relays, bridges or directory authorities. If you just want to access the Tor
93 network or to setup an onion service you may install @code{tor-client}
94 instead.")
95 (license license:bsd-3)))
96
97 (define-public tor-client
98 (package
99 (inherit tor)
100 (name "tor-client")
101 (arguments
102 (substitute-keyword-arguments (package-arguments tor)
103 ((#:configure-flags flags)
104 (append flags
105 '("--disable-module-relay")))))
106 (synopsis "Client to the anonymous Tor network")
107 (description
108 "Tor protects you by bouncing your communications around a distributed
109 network of relays run by volunteers all around the world: it prevents
110 somebody watching your Internet connection from learning what sites you
111 visit, and it prevents the sites you visit from learning your physical
112 location. Tor works with many of your existing applications, including
113 web browsers, instant messaging clients, remote login, and other
114 applications based on the TCP protocol.
115
116 To @code{torify} applications (to take measures to ensure that an application,
117 which has not been designed for use with Tor such as ssh, will use only Tor for
118 internet connectivity, and also ensures that there are no leaks from DNS, UDP or
119 the application layer) you need to install @code{torsocks}.
120
121 This package only provides a client to the Tor Network.")))
122
123 (define-public torsocks
124 (package
125 (name "torsocks")
126 (version "2.3.0")
127 (source (origin
128 (method url-fetch)
129 (uri (string-append "https://people.torproject.org/~dgoulet/"
130 "torsocks/torsocks-" version ".tar.xz"))
131 (sha256
132 (base32
133 "08inrkap29gikb6sdmb58z43hw4abwrfw7ny40c4xzdkss0vkwdr"))))
134 (build-system gnu-build-system)
135 (inputs
136 `(("libcap" ,libcap)))
137 (arguments
138 `(#:phases (modify-phases %standard-phases
139 (add-after 'build 'absolutize
140 (lambda* (#:key inputs #:allow-other-keys)
141 (substitute* "src/bin/torsocks"
142 (("getcap=.*")
143 (string-append "getcap=" (which "getcap") "\n")))
144 #t)))))
145 (home-page "https://www.torproject.org/")
146 (synopsis "Use socks-friendly applications with Tor")
147 (description
148 "Torsocks allows you to use most socks-friendly applications in a safe
149 way with Tor. It ensures that DNS requests are handled safely and explicitly
150 rejects UDP traffic from the application you're using.")
151
152 ;; All the files explicitly say "version 2 only".
153 (license license:gpl2)))
154
155 (define-public privoxy
156 (package
157 (name "privoxy")
158 (version "3.0.28")
159 (source (origin
160 (method url-fetch)
161 (uri (string-append "mirror://sourceforge/ijbswa/Sources/"
162 version "%20%28stable%29/privoxy-"
163 version "-stable-src.tar.gz"))
164 (sha256
165 (base32
166 "0jl2yav1qzqnaqnnx8i6i53ayckkimcrs3l6ryvv7bda6v08rmxm"))))
167 (build-system gnu-build-system)
168 (arguments
169 '(;; The default 'sysconfdir' is $out/etc; change that to
170 ;; $out/etc/privoxy.
171 #:configure-flags (list (string-append "--sysconfdir="
172 (assoc-ref %outputs "out")
173 "/etc/privoxy")
174 "--localstatedir=/var")
175 #:tests? #f ; no test suite
176 #:phases
177 (modify-phases %standard-phases
178 (add-after 'unpack 'patch-default-logging
179 (lambda _
180 (with-fluids ((%default-port-encoding "ISO-8859-1"))
181 ;; Do not create /var/run nor /var/log/privoxy/logfile.
182 (substitute* "GNUmakefile.in"
183 (("(logfile \\|\\| exit )1" _ match)
184 (string-append match "0"))
185 (("(\\$\\(DESTDIR\\)\\$\\(SHARE_DEST\\)) \\\\" _ match)
186 match)
187 ((".*\\$\\(LOG_DEST\\) \\$\\(DESTDIR\\)\\$\\(PID_DEST\\).*")
188 ""))
189 ;; Disable logging in the default configuration to allow for
190 ;; non-root users using it as is.
191 (substitute* "config"
192 (("^logdir") "#logdir")
193 (("^logfile") "#logfile")))
194 #t)))))
195 (inputs
196 `(("w3m" ,w3m)
197 ("pcre" ,pcre)
198 ("zlib" ,zlib)))
199 (native-inputs
200 `(("autoconf" ,autoconf)
201 ("automake" ,automake)))
202 (home-page "https://www.privoxy.org")
203 (synopsis "Web proxy with advanced filtering capabilities for enhancing privacy")
204 (description
205 "Privoxy is a non-caching web proxy with advanced filtering capabilities
206 for enhancing privacy, modifying web page data and HTTP headers, controlling
207 access, and removing ads and other obnoxious Internet junk. Privoxy has a
208 flexible configuration and can be customized to suit individual needs and
209 tastes. It has application for both stand-alone systems and multi-user
210 networks.")
211 (license license:gpl2+)))
212
213 (define-public onionshare
214 (package
215 (name "onionshare")
216 (version "2.2")
217 (source
218 (origin
219 (method git-fetch)
220 (uri (git-reference
221 (url "https://github.com/micahflee/onionshare")
222 (commit (string-append "v" version))))
223 (file-name (git-file-name name version))
224 (sha256
225 (base32 "0m8ygxcyp3nfzzhxs2dfnpqwh1vx0aws44lszpnnczz4fks3a5j4"))))
226 (build-system python-build-system)
227 (arguments
228 `(#:phases
229 (modify-phases %standard-phases
230 (add-after 'unpack 'fix-install-path
231 (lambda* (#:key outputs #:allow-other-keys)
232 (let* ((out (assoc-ref outputs "out"))
233 (onionshare (string-append out "/share/onionshare")))
234 (substitute* '("setup.py" "onionshare/common.py")
235 (("sys.prefix,") (string-append "'" out "',")))
236 (substitute* "setup.py"
237 ;; For the nautilus plugin.
238 (("/usr/share/nautilus") "share/nautilus"))
239 (substitute* "install/org.onionshare.OnionShare.desktop"
240 (("/usr") out))
241 #t)))
242 (delete 'check)
243 (add-before 'strip 'check
244 ;; After all the patching we run the tests after installing.
245 (lambda _
246 (setenv "HOME" "/tmp") ; Some tests need a writable homedir
247 (invoke "pytest" "tests/")
248 #t)))))
249 (native-inputs
250 `(("python-pytest" ,python-pytest)))
251 (inputs
252 `(("python-pycrypto" ,python-pycrypto)
253 ("python-flask" ,python-flask)
254 ("python-flask-httpauth" ,python-flask-httpauth)
255 ("python-nautilus" ,python-nautilus)
256 ("python-sip" ,python-sip)
257 ("python-stem" ,python-stem)
258 ("python-pysocks" ,python-pysocks)
259 ("python-pyqt" ,python-pyqt)))
260 (home-page "https://onionshare.org/")
261 (synopsis "Securely and anonymously share files")
262 (description "OnionShare is a tool for securely and anonymously sending
263 and receiving files using Tor onion services. It works by starting a web
264 server directly on your computer and making it accessible as an unguessable
265 Tor web address that others can load in a Tor-enabled web browser to download
266 files from you, or upload files to you. It doesn't require setting up a
267 separate server, using a third party file-sharing service, or even logging
268 into an account.")
269 ;; Bundled, minified jquery is expat licensed.
270 (license (list license:gpl3+ license:expat))))
271
272 (define-public nyx
273 (package
274 (name "nyx")
275 (version "2.1.0")
276 (source
277 (origin
278 (method url-fetch)
279 (uri (pypi-uri name version))
280 (sha256
281 (base32
282 "02rrlllz2ci6i6cs3iddyfns7ang9a54jrlygd2jw1f9s6418ll8"))))
283 (build-system python-build-system)
284 (inputs
285 `(("python-stem" ,python-stem)))
286 (arguments
287 `(#:phases
288 (modify-phases %standard-phases
289 (add-after 'install 'install-man-page
290 (lambda* (#:key outputs #:allow-other-keys)
291 (let* ((out (assoc-ref outputs "out"))
292 (man (string-append out "/share/man")))
293 (install-file "nyx.1" (string-append man "/man1"))
294 #t)))
295 (add-after 'install 'install-sample-configuration
296 (lambda* (#:key outputs #:allow-other-keys)
297 (let* ((out (assoc-ref outputs "out"))
298 (doc (string-append out "/share/doc/" ,name "-" ,version)))
299 (install-file "web/nyxrc.sample" doc)
300 #t))))
301 ;; XXX The tests seem to require more of a real terminal than the build
302 ;; environment provides:
303 ;; _curses.error: setupterm: could not find terminal
304 ;; With TERM=linux, the tests try to move the cursor and still fail:
305 ;; _curses.error: cbreak() returned ERR
306 #:tests? #f))
307 (home-page "https://nyx.torproject.org/")
308 (synopsis "Tor relay status monitor")
309 (description
310 "Nyx monitors the performance of relays participating in the
311 @uref{https://www.torproject.org/, Tor anonymity network}. It displays this
312 information visually and in real time, using a curses-based terminal interface.
313 This makes Nyx well-suited for remote shell connections and servers without a
314 graphical display. It's like @command{top} for Tor, providing detailed
315 statistics and status reports on:
316
317 @enumerate
318 @item connections (with IP address, hostname, fingerprint, and consensus data),
319 @item bandwidth, processor, and memory usage,
320 @item the relay's current configuration,
321 @item logged events,
322 @item and much more.
323 @end enumerate
324
325 Potential client and exit connections are scrubbed of sensitive information.")
326 (license license:gpl3+)))