gnu: Add TomsFastMath.
[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 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2016, 2017 Nils Gillmann <ng0@n0.is>
6 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
8 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
9 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
10 ;;;
11 ;;; This file is part of GNU Guix.
12 ;;;
13 ;;; GNU Guix is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
17 ;;;
18 ;;; GNU Guix is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
22 ;;;
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26 (define-module (gnu packages tor)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages libevent)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages check)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages pcre)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages python-web)
43 #:use-module (gnu packages qt)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages w3m))
47
48 (define-public tor
49 (package
50 (name "tor")
51 (version "0.3.4.9")
52 (source (origin
53 (method url-fetch)
54 (uri (string-append "https://dist.torproject.org/tor-"
55 version ".tar.gz"))
56 (sha256
57 (base32
58 "0jhnvnp08hsfrzgsvg5xnfxyaw3nzgg9h24cwbwnz6iby20i05qs"))))
59 (build-system gnu-build-system)
60 (arguments
61 `(#:configure-flags (list "--enable-gcc-hardening"
62 "--enable-linker-hardening")))
63 (native-inputs
64 `(("pkg-config" ,pkg-config)
65 ("python" ,python-2))) ; for tests
66 (inputs
67 `(("zlib" ,zlib)
68 ("openssl" ,openssl)
69 ("libevent" ,libevent)
70 ("libseccomp" ,libseccomp)
71 ("xz" ,xz)
72 ("zstd" ,zstd)))
73 (home-page "https://www.torproject.org/")
74 (synopsis "Anonymous network router to improve privacy on the Internet")
75 (description
76 "Tor protects you by bouncing your communications around a distributed
77 network of relays run by volunteers all around the world: it prevents
78 somebody watching your Internet connection from learning what sites you
79 visit, and it prevents the sites you visit from learning your physical
80 location. Tor works with many of your existing applications, including
81 web browsers, instant messaging clients, remote login, and other
82 applications based on the TCP protocol.
83
84 To @code{torify} applications (to take measures to ensure that an application,
85 which has not been designed for use with Tor such as ssh, will use only Tor for
86 internet connectivity, and also ensures that there are no leaks from DNS, UDP or
87 the application layer) you need to install @code{torsocks}.")
88 (license license:bsd-3)))
89
90 (define-public torsocks
91 (package
92 (name "torsocks")
93 (version "2.2.0")
94 (source (origin
95 (method url-fetch)
96 (uri (string-append "https://people.torproject.org/~dgoulet/"
97 name "/" name "-" version ".tar.xz"))
98 (sha256
99 (base32
100 "0byr9ga9w79qz4vp0m11sbmspad7fsal9wm67r4znzb7zb7cis19"))))
101 (build-system gnu-build-system)
102 (inputs
103 `(("which" ,which)
104 ("libcap" ,libcap)))
105 (arguments
106 `(#:phases (modify-phases %standard-phases
107 (add-after 'build 'absolutize
108 (lambda* (#:key inputs #:allow-other-keys)
109 (substitute* "src/bin/torsocks"
110 (("getcap=`.*`")
111 (string-append "getcap=" (which "getcap")))
112 (("`which")
113 (string-append "`" (which "which"))))
114 #t)))))
115 (home-page "https://www.torproject.org/")
116 (synopsis "Use socks-friendly applications with Tor")
117 (description
118 "Torsocks allows you to use most socks-friendly applications in a safe
119 way with Tor. It ensures that DNS requests are handled safely and explicitly
120 rejects UDP traffic from the application you're using.")
121
122 ;; All the files explicitly say "version 2 only".
123 (license license:gpl2)))
124
125 (define-public privoxy
126 (package
127 (name "privoxy")
128 (version "3.0.26")
129 (source (origin
130 (method url-fetch)
131 (uri (string-append "mirror://sourceforge/ijbswa/Sources/"
132 version "%20%28stable%29/privoxy-"
133 version "-stable-src.tar.gz"))
134 (sha256
135 (base32
136 "1n4wpxmahl8m2y3d1azxa8lrdbpaad007k458skxrpz57ss1br2p"))))
137 (build-system gnu-build-system)
138 (arguments
139 '(;; The default 'sysconfdir' is $out/etc; change that to
140 ;; $out/etc/privoxy.
141 #:configure-flags (list (string-append "--sysconfdir="
142 (assoc-ref %outputs "out")
143 "/etc/privoxy"))
144 #:tests? #f))
145 (inputs
146 `(("w3m" ,w3m)
147 ("pcre" ,pcre)
148 ("zlib" ,zlib)
149 ("autoconf" ,autoconf)
150 ("automake" ,automake)))
151 (home-page "https://www.privoxy.org")
152 (synopsis "Web proxy with advanced filtering capabilities for enhancing privacy")
153 (description
154 "Privoxy is a non-caching web proxy with advanced filtering capabilities
155 for enhancing privacy, modifying web page data and HTTP headers, controlling
156 access, and removing ads and other obnoxious Internet junk. Privoxy has a
157 flexible configuration and can be customized to suit individual needs and
158 tastes. It has application for both stand-alone systems and multi-user
159 networks.")
160 (license license:gpl2+)))
161
162 (define-public onionshare
163 (package
164 (name "onionshare")
165 (version "0.9.2")
166 (source
167 (origin
168 (method url-fetch)
169 (uri (string-append "https://github.com/micahflee/onionshare/archive/v"
170 version ".tar.gz"))
171 (file-name (string-append name "-" version ".tar.gz"))
172 (sha256
173 (base32
174 "02iv7dg15da57gy3zvfchnwwpr21n1gva7mqwpwr958ni2034smk"))))
175 (build-system python-build-system)
176 (arguments
177 `(#:phases
178 (modify-phases %standard-phases
179 (add-after 'unpack 'fix-install-path
180 (lambda* (#:key outputs #:allow-other-keys)
181 (let* ((out (assoc-ref outputs "out"))
182 (onionshare (string-append out "/share/onionshare")))
183 (substitute* "onionshare/strings.py"
184 ;; correct the locale directory
185 (("helpers.get_resource_path\\('locale'\\)")
186 (string-append "'" onionshare "/locale'")))
187 (substitute* "onionshare/helpers.py"
188 ;; correct the location of version.txt
189 (("get_resource_path\\('version.txt'\\)")
190 (string-append "'" onionshare "/version.txt'"))
191 (("get_resource_path\\('wordlist.txt'\\)")
192 (string-append "'" onionshare "/wordlist.txt'")))
193 (substitute* "onionshare/web.py"
194 ;; fix the location of the html files
195 (("helpers.get_resource_path\\('html/denied.html'\\)")
196 (string-append "'" onionshare "/html/denied.html'"))
197 (("helpers.get_resource_path\\('html/404.html'\\)")
198 (string-append "'" onionshare "/html/404.html'"))
199 (("helpers.get_resource_path\\('html/index.html'\\)")
200 (string-append "'" onionshare "/html/index.html'")))
201 (substitute* "onionshare_gui/file_selection.py"
202 ;; fancy box image in the GUI
203 (("helpers.get_resource_path\\('images/drop_files.png'\\)")
204 (string-append "'" onionshare "/images/drop_files.png'")))
205 (substitute* "onionshare_gui/server_status.py"
206 (("helpers.get_resource_path\\('images/server_stopped.png'\\)")
207 (string-append "'" onionshare "/images/server_stopped.png'"))
208 (("helpers.get_resource_path\\('images/server_working.png'\\)")
209 (string-append "'" onionshare "/images/server_working.png'"))
210 (("helpers.get_resource_path\\('images/server_started.png'\\)")
211 (string-append "'" onionshare "/images/server_started.png'")))
212 (substitute* "onionshare_gui/onionshare_gui.py"
213 ;; for the icon on the GUI
214 (("helpers.get_resource_path\\('images/logo.png'\\)")
215 (string-append "'" onionshare "/images/logo.png'")))
216 (substitute* '("setup.py" "onionshare/helpers.py")
217 (("sys.prefix,") (string-append "'" out "',")))
218 (substitute* "setup.py"
219 ;; for the nautilus plugin
220 (("/usr/share/nautilus") "share/nautilus"))
221 #t)))
222 (delete 'check)
223 (add-before 'strip 'tests
224 ;; After all the patching we run the tests after installing.
225 ;; This is also a known issue:
226 ;; https://github.com/micahflee/onionshare/issues/284
227 (lambda _
228 (invoke "nosetests" "test")
229 #t)))))
230 (native-inputs
231 `(("python-nose" ,python-nose)))
232 (inputs
233 `(("python-flask" ,python-flask)
234 ("python-nautilus" ,python-nautilus)
235 ("python-sip" ,python-sip)
236 ("python-stem" ,python-stem)
237 ("python-pyqt" ,python-pyqt)))
238 (home-page "https://onionshare.org/")
239 (synopsis "Securely and anonymously share files")
240 (description "OnionShare lets you securely and anonymously share files of
241 any size. It works by starting a web server, making it accessible as a Tor
242 hidden service, and generating an unguessable URL to access and download the
243 files. It doesn't require setting up a server on the internet somewhere or
244 using a third party filesharing service. You host the file on your own computer
245 and use a Tor hidden service to make it temporarily accessible over the
246 internet. The other user just needs to use Tor Browser to download the file
247 from you.")
248 (license (list license:gpl3+
249 license:bsd-3)))) ; onionshare/socks.py
250
251 (define-public nyx
252 (package
253 (name "nyx")
254 (version "2.0.4")
255 (source
256 (origin
257 (method url-fetch)
258 (uri (pypi-uri name version))
259 (patches
260 (search-patches "nyx-show-header-stats-with-python3.patch"))
261 (sha256
262 (base32
263 "0pm7vfcqr02pzqz4b2f6sw5prxxmgqwr1912am42xmy2i53n7nrq"))))
264 (build-system python-build-system)
265 (inputs
266 `(("python-stem" ,python-stem)))
267 (arguments
268 `(#:phases
269 (modify-phases %standard-phases
270 (add-after 'install 'install-man-page
271 (lambda* (#:key outputs #:allow-other-keys)
272 (let* ((out (assoc-ref outputs "out"))
273 (man (string-append out "/share/man")))
274 (install-file "nyx.1" (string-append man "/man1"))
275 #t)))
276 (add-after 'install 'install-sample-configuration
277 (lambda* (#:key outputs #:allow-other-keys)
278 (let* ((out (assoc-ref outputs "out"))
279 (doc (string-append out "/share/doc/" ,name "-" ,version)))
280 (install-file "web/nyxrc.sample" doc)
281 #t))))
282 ;; XXX The tests seem to require more of a real terminal than the build
283 ;; environment provides:
284 ;; _curses.error: setupterm: could not find terminal
285 ;; With TERM=linux, the tests try to move the cursor and still fail:
286 ;; _curses.error: cbreak() returned ERR
287 #:tests? #f))
288 (home-page "https://nyx.torproject.org/")
289 (synopsis "Tor relay status monitor")
290 (description
291 "Nyx monitors the performance of relays participating in the
292 @uref{https://www.torproject.org/, Tor anonymity network}. It displays this
293 information visually and in real time, using a curses-based terminal interface.
294 This makes Nyx well-suited for remote shell connections and servers without a
295 graphical display. It's like @command{top} for Tor, providing detailed
296 statistics and status reports on:
297
298 @enumerate
299 @item connections (with IP address, hostname, fingerprint, and consensus data),
300 @item bandwidth, processor, and memory usage,
301 @item the relay's current configuration,
302 @item logged events,
303 @item and much more.
304 @end enumerate
305
306 Potential client and exit connections are scrubbed of sensitive information.")
307 (license license:gpl3+)))