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