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