gnu: Add external-program.
[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, 2019 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-crypto)
43 #:use-module (gnu packages python-web)
44 #:use-module (gnu packages python-xyz)
45 #:use-module (gnu packages qt)
46 #:use-module (gnu packages autotools)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages w3m))
49
50 (define-public tor
51 (package
52 (name "tor")
53 (version "0.4.2.5")
54 (source (origin
55 (method url-fetch)
56 (uri (string-append "https://dist.torproject.org/tor-"
57 version ".tar.gz"))
58 (sha256
59 (base32
60 "1hnqg6psf7shcmlvfk44mkpaz7v66mify3cnx7mzl23q5s37anad"))))
61 (build-system gnu-build-system)
62 (native-inputs
63 `(("pkg-config" ,pkg-config)
64 ("python" ,python-2))) ; for tests
65 (inputs
66 `(("zlib" ,zlib)
67 ("openssl" ,openssl)
68 ("libevent" ,libevent)
69 ("libseccomp" ,libseccomp)
70 ("xz" ,xz)
71 ("zstd" ,zstd "lib")))
72 (home-page "https://www.torproject.org/")
73 (synopsis "Anonymous network router to improve privacy on the Internet")
74 (description
75 "Tor protects you by bouncing your communications around a distributed
76 network of relays run by volunteers all around the world: it prevents
77 somebody watching your Internet connection from learning what sites you
78 visit, and it prevents the sites you visit from learning your physical
79 location. Tor works with many of your existing applications, including
80 web browsers, instant messaging clients, remote login, and other
81 applications based on the TCP protocol.
82
83 To @code{torify} applications (to take measures to ensure that an application,
84 which has not been designed for use with Tor such as ssh, will use only Tor for
85 internet connectivity, and also ensures that there are no leaks from DNS, UDP or
86 the application layer) you need to install @code{torsocks}.")
87 (license license:bsd-3)))
88
89 (define-public torsocks
90 (package
91 (name "torsocks")
92 (version "2.3.0")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append "https://people.torproject.org/~dgoulet/"
96 "torsocks/torsocks-" version ".tar.xz"))
97 (sha256
98 (base32
99 "08inrkap29gikb6sdmb58z43hw4abwrfw7ny40c4xzdkss0vkwdr"))))
100 (build-system gnu-build-system)
101 (inputs
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") "\n")))
110 #t)))))
111 (home-page "https://www.torproject.org/")
112 (synopsis "Use socks-friendly applications with Tor")
113 (description
114 "Torsocks allows you to use most socks-friendly applications in a safe
115 way with Tor. It ensures that DNS requests are handled safely and explicitly
116 rejects UDP traffic from the application you're using.")
117
118 ;; All the files explicitly say "version 2 only".
119 (license license:gpl2)))
120
121 (define-public privoxy
122 (package
123 (name "privoxy")
124 (version "3.0.28")
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "mirror://sourceforge/ijbswa/Sources/"
128 version "%20%28stable%29/privoxy-"
129 version "-stable-src.tar.gz"))
130 (sha256
131 (base32
132 "0jl2yav1qzqnaqnnx8i6i53ayckkimcrs3l6ryvv7bda6v08rmxm"))))
133 (build-system gnu-build-system)
134 (arguments
135 '(;; The default 'sysconfdir' is $out/etc; change that to
136 ;; $out/etc/privoxy.
137 #:configure-flags (list (string-append "--sysconfdir="
138 (assoc-ref %outputs "out")
139 "/etc/privoxy"))
140 #:tests? #f))
141 (inputs
142 `(("w3m" ,w3m)
143 ("pcre" ,pcre)
144 ("zlib" ,zlib)
145 ("autoconf" ,autoconf)
146 ("automake" ,automake)))
147 (home-page "https://www.privoxy.org")
148 (synopsis "Web proxy with advanced filtering capabilities for enhancing privacy")
149 (description
150 "Privoxy is a non-caching web proxy with advanced filtering capabilities
151 for enhancing privacy, modifying web page data and HTTP headers, controlling
152 access, and removing ads and other obnoxious Internet junk. Privoxy has a
153 flexible configuration and can be customized to suit individual needs and
154 tastes. It has application for both stand-alone systems and multi-user
155 networks.")
156 (license license:gpl2+)))
157
158 (define-public onionshare
159 (package
160 (name "onionshare")
161 (version "2.2")
162 (source
163 (origin
164 (method git-fetch)
165 (uri (git-reference
166 (url "https://github.com/micahflee/onionshare.git")
167 (commit (string-append "v" version))))
168 (file-name (git-file-name name version))
169 (sha256
170 (base32 "0m8ygxcyp3nfzzhxs2dfnpqwh1vx0aws44lszpnnczz4fks3a5j4"))))
171 (build-system python-build-system)
172 (arguments
173 `(#:phases
174 (modify-phases %standard-phases
175 (add-after 'unpack 'fix-install-path
176 (lambda* (#:key outputs #:allow-other-keys)
177 (let* ((out (assoc-ref outputs "out"))
178 (onionshare (string-append out "/share/onionshare")))
179 (substitute* '("setup.py" "onionshare/common.py")
180 (("sys.prefix,") (string-append "'" out "',")))
181 (substitute* "setup.py"
182 ;; For the nautilus plugin.
183 (("/usr/share/nautilus") "share/nautilus"))
184 (substitute* "install/org.onionshare.OnionShare.desktop"
185 (("/usr") out))
186 #t)))
187 (delete 'check)
188 (add-before 'strip 'check
189 ;; After all the patching we run the tests after installing.
190 (lambda _
191 (setenv "HOME" "/tmp") ; Some tests need a writable homedir
192 (invoke "pytest" "tests/")
193 #t)))))
194 (native-inputs
195 `(("python-pytest" ,python-pytest)))
196 (inputs
197 `(("python-pycrypto" ,python-pycrypto)
198 ("python-flask" ,python-flask)
199 ("python-flask-httpauth" ,python-flask-httpauth)
200 ("python-nautilus" ,python-nautilus)
201 ("python-sip" ,python-sip)
202 ("python-stem" ,python-stem)
203 ("python-pysocks" ,python-pysocks)
204 ("python-pyqt" ,python-pyqt)))
205 (home-page "https://onionshare.org/")
206 (synopsis "Securely and anonymously share files")
207 (description "OnionShare is a tool for securely and anonymously sending
208 and receiving files using Tor onion services. It works by starting a web
209 server directly on your computer and making it accessible as an unguessable
210 Tor web address that others can load in a Tor-enabled web browser to download
211 files from you, or upload files to you. It doesn't require setting up a
212 separate server, using a third party file-sharing service, or even logging
213 into an account.")
214 ;; Bundled, minified jquery is expat licensed.
215 (license (list license:gpl3+ license:expat))))
216
217 (define-public nyx
218 (package
219 (name "nyx")
220 (version "2.1.0")
221 (source
222 (origin
223 (method url-fetch)
224 (uri (pypi-uri name version))
225 (sha256
226 (base32
227 "02rrlllz2ci6i6cs3iddyfns7ang9a54jrlygd2jw1f9s6418ll8"))))
228 (build-system python-build-system)
229 (inputs
230 `(("python-stem" ,python-stem)))
231 (arguments
232 `(#:phases
233 (modify-phases %standard-phases
234 (add-after 'install 'install-man-page
235 (lambda* (#:key outputs #:allow-other-keys)
236 (let* ((out (assoc-ref outputs "out"))
237 (man (string-append out "/share/man")))
238 (install-file "nyx.1" (string-append man "/man1"))
239 #t)))
240 (add-after 'install 'install-sample-configuration
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let* ((out (assoc-ref outputs "out"))
243 (doc (string-append out "/share/doc/" ,name "-" ,version)))
244 (install-file "web/nyxrc.sample" doc)
245 #t))))
246 ;; XXX The tests seem to require more of a real terminal than the build
247 ;; environment provides:
248 ;; _curses.error: setupterm: could not find terminal
249 ;; With TERM=linux, the tests try to move the cursor and still fail:
250 ;; _curses.error: cbreak() returned ERR
251 #:tests? #f))
252 (home-page "https://nyx.torproject.org/")
253 (synopsis "Tor relay status monitor")
254 (description
255 "Nyx monitors the performance of relays participating in the
256 @uref{https://www.torproject.org/, Tor anonymity network}. It displays this
257 information visually and in real time, using a curses-based terminal interface.
258 This makes Nyx well-suited for remote shell connections and servers without a
259 graphical display. It's like @command{top} for Tor, providing detailed
260 statistics and status reports on:
261
262 @enumerate
263 @item connections (with IP address, hostname, fingerprint, and consensus data),
264 @item bandwidth, processor, and memory usage,
265 @item the relay's current configuration,
266 @item logged events,
267 @item and much more.
268 @end enumerate
269
270 Potential client and exit connections are scrubbed of sensitive information.")
271 (license license:gpl3+)))