gnu: Add amtk.
[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 ng0 <ng0@n0.is>
6 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017, 2018 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 python-xyz)
44 #:use-module (gnu packages qt)
45 #:use-module (gnu packages autotools)
46 #:use-module (gnu packages tls)
47 #:use-module (gnu packages w3m))
48
49 (define-public tor
50 (package
51 (name "tor")
52 (version "0.4.0.5")
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "https://dist.torproject.org/tor-"
56 version ".tar.gz"))
57 (sha256
58 (base32
59 "0vk9j3ybz5dwwbmqrdj1bjcsxy76pc8frmfvflkdzwfkvkqcp8mm"))))
60 (build-system gnu-build-system)
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.3.0")
92 (source (origin
93 (method url-fetch)
94 (uri (string-append "https://people.torproject.org/~dgoulet/"
95 "torsocks/torsocks-" version ".tar.xz"))
96 (sha256
97 (base32
98 "08inrkap29gikb6sdmb58z43hw4abwrfw7ny40c4xzdkss0vkwdr"))))
99 (build-system gnu-build-system)
100 (inputs
101 `(("libcap" ,libcap)))
102 (arguments
103 `(#:phases (modify-phases %standard-phases
104 (add-after 'build 'absolutize
105 (lambda* (#:key inputs #:allow-other-keys)
106 (substitute* "src/bin/torsocks"
107 (("getcap=.*")
108 (string-append "getcap=" (which "getcap") "\n")))
109 #t)))))
110 (home-page "https://www.torproject.org/")
111 (synopsis "Use socks-friendly applications with Tor")
112 (description
113 "Torsocks allows you to use most socks-friendly applications in a safe
114 way with Tor. It ensures that DNS requests are handled safely and explicitly
115 rejects UDP traffic from the application you're using.")
116
117 ;; All the files explicitly say "version 2 only".
118 (license license:gpl2)))
119
120 (define-public privoxy
121 (package
122 (name "privoxy")
123 (version "3.0.28")
124 (source (origin
125 (method url-fetch)
126 (uri (string-append "mirror://sourceforge/ijbswa/Sources/"
127 version "%20%28stable%29/privoxy-"
128 version "-stable-src.tar.gz"))
129 (sha256
130 (base32
131 "0jl2yav1qzqnaqnnx8i6i53ayckkimcrs3l6ryvv7bda6v08rmxm"))))
132 (build-system gnu-build-system)
133 (arguments
134 '(;; The default 'sysconfdir' is $out/etc; change that to
135 ;; $out/etc/privoxy.
136 #:configure-flags (list (string-append "--sysconfdir="
137 (assoc-ref %outputs "out")
138 "/etc/privoxy"))
139 #:tests? #f))
140 (inputs
141 `(("w3m" ,w3m)
142 ("pcre" ,pcre)
143 ("zlib" ,zlib)
144 ("autoconf" ,autoconf)
145 ("automake" ,automake)))
146 (home-page "https://www.privoxy.org")
147 (synopsis "Web proxy with advanced filtering capabilities for enhancing privacy")
148 (description
149 "Privoxy is a non-caching web proxy with advanced filtering capabilities
150 for enhancing privacy, modifying web page data and HTTP headers, controlling
151 access, and removing ads and other obnoxious Internet junk. Privoxy has a
152 flexible configuration and can be customized to suit individual needs and
153 tastes. It has application for both stand-alone systems and multi-user
154 networks.")
155 (license license:gpl2+)))
156
157 (define-public onionshare
158 (package
159 (name "onionshare")
160 (version "1.3.2")
161 (source
162 (origin
163 (method git-fetch)
164 (uri (git-reference
165 (url "https://github.com/micahflee/onionshare.git")
166 (commit (string-append "v" version))))
167 (file-name (git-file-name name version))
168 (sha256
169 (base32 "19zrz9kh7k4pdk4lh3cm0kv02ngdqkrggwma1xdskrrmp2rjkgz7"))))
170 (build-system python-build-system)
171 (arguments
172 `(#:phases
173 (modify-phases %standard-phases
174 (add-after 'unpack 'fix-install-path
175 (lambda* (#:key outputs #:allow-other-keys)
176 (let* ((out (assoc-ref outputs "out"))
177 (onionshare (string-append out "/share/onionshare")))
178 (substitute* '("setup.py" "onionshare/common.py")
179 (("sys.prefix,") (string-append "'" out "',")))
180 (substitute* "setup.py"
181 ;; For the nautilus plugin.
182 (("/usr/share/nautilus") "share/nautilus"))
183 (substitute* "install/onionshare.desktop"
184 (("/usr") out))
185 #t)))
186 (delete 'check)
187 (add-before 'strip 'tests
188 ;; After all the patching we run the tests after installing.
189 ;; This is also a known issue:
190 ;; https://github.com/micahflee/onionshare/issues/284
191 (lambda _
192 (invoke "pytest" "test")
193 #t)))))
194 (native-inputs
195 `(("python-pytest" ,python-pytest)))
196 (inputs
197 `(("python-flask" ,python-flask)
198 ("python-nautilus" ,python-nautilus)
199 ("python-sip" ,python-sip)
200 ("python-stem" ,python-stem)
201 ("python-pyqt" ,python-pyqt)))
202 (home-page "https://onionshare.org/")
203 (synopsis "Securely and anonymously share files")
204 (description "OnionShare lets you securely and anonymously share files of
205 any size. It works by starting a web server, making it accessible as a Tor
206 hidden service, and generating an unguessable URL to access and download the
207 files. It doesn't require setting up a server on the internet somewhere or
208 using a third party filesharing service. You host the file on your own computer
209 and use a Tor hidden service to make it temporarily accessible over the
210 internet. The other user just needs to use Tor Browser to download the file
211 from you.")
212 (license (list license:gpl3+
213 license:bsd-3)))) ; onionshare/socks.py
214
215 (define-public nyx
216 (package
217 (name "nyx")
218 (version "2.1.0")
219 (source
220 (origin
221 (method url-fetch)
222 (uri (pypi-uri name version))
223 (sha256
224 (base32
225 "02rrlllz2ci6i6cs3iddyfns7ang9a54jrlygd2jw1f9s6418ll8"))))
226 (build-system python-build-system)
227 (inputs
228 `(("python-stem" ,python-stem)))
229 (arguments
230 `(#:phases
231 (modify-phases %standard-phases
232 (add-after 'install 'install-man-page
233 (lambda* (#:key outputs #:allow-other-keys)
234 (let* ((out (assoc-ref outputs "out"))
235 (man (string-append out "/share/man")))
236 (install-file "nyx.1" (string-append man "/man1"))
237 #t)))
238 (add-after 'install 'install-sample-configuration
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let* ((out (assoc-ref outputs "out"))
241 (doc (string-append out "/share/doc/" ,name "-" ,version)))
242 (install-file "web/nyxrc.sample" doc)
243 #t))))
244 ;; XXX The tests seem to require more of a real terminal than the build
245 ;; environment provides:
246 ;; _curses.error: setupterm: could not find terminal
247 ;; With TERM=linux, the tests try to move the cursor and still fail:
248 ;; _curses.error: cbreak() returned ERR
249 #:tests? #f))
250 (home-page "https://nyx.torproject.org/")
251 (synopsis "Tor relay status monitor")
252 (description
253 "Nyx monitors the performance of relays participating in the
254 @uref{https://www.torproject.org/, Tor anonymity network}. It displays this
255 information visually and in real time, using a curses-based terminal interface.
256 This makes Nyx well-suited for remote shell connections and servers without a
257 graphical display. It's like @command{top} for Tor, providing detailed
258 statistics and status reports on:
259
260 @enumerate
261 @item connections (with IP address, hostname, fingerprint, and consensus data),
262 @item bandwidth, processor, and memory usage,
263 @item the relay's current configuration,
264 @item logged events,
265 @item and much more.
266 @end enumerate
267
268 Potential client and exit connections are scrubbed of sensitive information.")
269 (license license:gpl3+)))