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