tor.scm 13 KB

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