tor.scm 11 KB

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