tor-hidden-service.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  2. "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4. <head>
  5. <title>Tor Hidden Service Configuration Instructions</title>
  6. <meta name="Author" content="Roger Dingledine" />
  7. <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
  8. <link rel="stylesheet" type="text/css" href="stylesheet.css" />
  9. <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
  10. </head>
  11. <body>
  12. <!-- TITLE BAR & NAVIGATION -->
  13. <table class="banner" border="0" cellpadding="0" cellspacing="0">
  14. <tr>
  15. <td class="banner-left"></td>
  16. <td class="banner-middle">
  17. <a href="/">Home</a>
  18. <a href="/overview">Overview</a>
  19. <a href="/download">Download</a>
  20. <a href="/documentation">Docs</a>
  21. <a href="/volunteer">Volunteer</a>
  22. <a href="/people">People</a>
  23. <a href="/donate">Donate!</a>
  24. </td>
  25. <td class="banner-right"></td>
  26. </tr>
  27. </table>
  28. <!-- END TITLE BAR & NAVIGATION -->
  29. <div class="center">
  30. <div class="main-column">
  31. <p>
  32. This document is obsolete. See the new <a
  33. href="http://tor.eff.org/documentation">Tor documentation</a> page.
  34. </p>
  35. <h1>Configuring Hidden Services for <a href="http://tor.eff.org/">Tor</a></h1>
  36. <hr />
  37. <p>Tor allows clients and servers to offer hidden services. That is,
  38. you can offer a web server, SSH server, etc., without revealing your
  39. IP to its users. In fact, because you don't use any public address,
  40. you can run a hidden service from behind your firewall.
  41. </p>
  42. <p>If you have Tor and Privoxy installed, you can see hidden services
  43. in action by visiting <a href="http://6sxoyfb3h2nvok2d.onion/">the
  44. hidden wiki</a>.
  45. </p>
  46. <p>This howto describes the steps for setting up your own hidden service
  47. website.
  48. </p>
  49. <hr />
  50. <a id="zero"></a>
  51. <h2><a class="anchor" href="#zero">Step Zero: Get Tor and Privoxy working</a></h2>
  52. <br />
  53. <p>Before you start, you need to make sure 1) Tor is up and running,
  54. 2) Privoxy is up and running, 3) Privoxy is configured to point
  55. to Tor, and 4) You actually set it up correctly.</p>
  56. <p>Windows users should follow the <a
  57. href="http://tor.eff.org/doc/tor-doc-win32.html">Windows
  58. howto</a>, OS X users should follow the <a
  59. href="http://tor.eff.org/doc/tor-doc-osx.html">OS
  60. X howto</a>, and Linux/BSD/Unix users should follow the <a
  61. href="http://tor.eff.org/doc/tor-doc-unix.html">Unix howto</a>.
  62. </p>
  63. <p>Once you've got Tor and Privoxy installed and configured,
  64. you can see hidden services in action by following this link to <a
  65. href="http://6sxoyfb3h2nvok2d.onion/">the hidden wiki</a>.
  66. It will typically take 10-60 seconds to load
  67. (or to decide that it is currently unreachable). If it fails
  68. immediately and your browser pops up an alert saying that
  69. "www.6sxoyfb3h2nvok2d.onion could not be found, please check the name and
  70. try again" then you haven't configured Tor and Privoxy correctly; see <a
  71. href="http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#ItDoesntWork">this
  72. FAQ entry</a> for some help.
  73. </p>
  74. <hr />
  75. <a id="one"></a>
  76. <h2><a class="anchor" href="#one">Step One: Configure an example hidden service</a></h2>
  77. <br />
  78. <p>In this step, you're going to configure a hidden service that points
  79. to www.google.com. This way we can make sure you have this step
  80. working before we start thinking about setting up a web server locally.
  81. </p>
  82. <p>First, open your torrc file in your favorite text editor. (See <a
  83. href="http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#torrc">this
  84. FAQ entry</a> to learn what this means.) Go to the middle section and
  85. look for the line</p>
  86. <pre>
  87. ############### This section is just for location-hidden services ###
  88. </pre>
  89. <p>
  90. This section of the file consists of groups of lines, each representing
  91. one hidden service. Right now they are all commented out (the lines
  92. start with #), so hidden services are disabled. Each group of lines
  93. consists of one HiddenServiceDir line, and one or more HiddenServicePort
  94. lines:</p>
  95. <ul>
  96. <li><b>HiddenServiceDir</b> is a directory where Tor will store information
  97. about that hidden service. In particular, Tor will create a file here named
  98. <i>hostname</i> which will tell you the onion URL. You don't need to add any
  99. files to this directory.</li>
  100. <li><b>HiddenServicePort</b> lets you specify a virtual port (that is, what
  101. port people accessing the hidden service will think they're using) and an
  102. IP address and port for redirecting connections to this virtual port.</li>
  103. </ul>
  104. <p>In this example, we're going to set up a hidden service that points to
  105. Google. So add the following lines to your torrc:
  106. </p>
  107. <pre>
  108. HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
  109. HiddenServicePort 80 www.google.com:80
  110. </pre>
  111. <p>You're going to want to change the HiddenServiceDir line, so it points
  112. to an actual directory that is readable/writeable by the user that will
  113. be running Tor. The above line should work if you're using the OS X Tor
  114. package. On Unix, try "/home/username/hidserv/" and fill in your own
  115. username in place of "username". On Windows you might pick:</p>
  116. <pre>
  117. HiddenServiceDir C:\Documents and Settings\username\Application Data\hidden_service\
  118. HiddenServicePort 80 www.google.com:80
  119. </pre>
  120. <p>Now save the torrc, shut down
  121. your Tor, and then start it again. (See <a
  122. href="http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#Restarting">this
  123. FAQ entry</a> for tips on restarting Tor.)
  124. </p>
  125. <p>If Tor starts up again, great. Otherwise, something is wrong. Look
  126. at your torrc for obvious mistakes like typos. Then double-check
  127. that the directory you picked is writeable by you. If it's still
  128. not working, you should look at the Tor logs for hints. (See <a
  129. href="http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#Logs">this
  130. FAQ entry</a> if you don't know how to enable or find your log file.)
  131. </p>
  132. <p>When Tor starts, it will automatically create the HiddenServiceDir
  133. that you specified (if necessary), and it will create two files there.
  134. First, it will generate a new
  135. public/private keypair for your hidden service, and write it into a
  136. file called "private_key". Don't share this key with others -- if you
  137. do they will be able to impersonate your hidden service.
  138. </p>
  139. <p>The other file it will create is called "hostname". This contains
  140. a short summary of your public key -- it will look something like
  141. <tt>6sxoyfb3h2nvok2d.onion</tt>. This is the public name for your service,
  142. and you can tell it to people, publish it on websites, put it on business
  143. cards, etc. (If Tor runs as a different user than you, for example on
  144. OS X, Debian, or Red Hat, then you may need to become root to be able
  145. to view these files.)
  146. </p>
  147. <p>Now that you've restarted Tor, it is busy picking introduction points
  148. in the Tor network, and generating what's called a "hidden service
  149. descriptor", which is a signed list of introduction points along with
  150. the service's full public key. It anonymously publishes this descriptor
  151. to the directory servers, and other people anonymously fetch it from the
  152. directory servers when they're trying to access your service.
  153. </p>
  154. <p>Try it now: paste the contents of the hostname file into your web
  155. browser. If it works, you'll get the google frontpage, but the URL in your
  156. browser's window will be your hidden service hostname. If it doesn't work,
  157. look in your logs for some hints, and keep playing with it until it works.
  158. </p>
  159. <hr />
  160. <a id="two"></a>
  161. <h2><a class="anchor" href="#two">Step Two: Now install a web server locally</a></h2>
  162. <br />
  163. <p>Now that you have hidden services working on Tor, you need to
  164. set up your web server locally. Setting up a web server is tricky,
  165. so we're just going to go over a few basics here. If you get stuck
  166. or want to do more, find a friend who can help you. We recommend you
  167. install a new separate web server for your hidden service, since even
  168. if you already have one installed, you may be using it (or want to use
  169. it later) for an actual website.
  170. </p>
  171. <p>If you're on Unix or OS X and you're comfortable with
  172. the command-line, by far the best way to go is to install <a
  173. href="http://www.acme.com/software/thttpd/">thttpd</a>. Just grab the
  174. latest tarball, untar it (it will create its own directory), and run
  175. ./configure &amp;&amp; make. Then mkdir hidserv, cd hidserv, and run
  176. "../thttpd -p 5222 -h localhost". It will give you back your prompt,
  177. and now you're running a webserver on port 5222. You can put files to
  178. serve in the hidserv directory.
  179. </p>
  180. <p>If you're on Windows, ...what should we suggest here? Is there
  181. a good simple <a href="http://www.fsf.org/">free software</a> (not
  182. just "freeware") web server for Windows? Please
  183. let me know what we should say here. In the meantime,
  184. check out <a href="http://httpd.apache.org/">apache</a>,
  185. and be sure to
  186. configure it to bind only to localhost. You should also figure out
  187. what port you're listening on, because you'll use it below.
  188. </p>
  189. <p>(The reason we bind the web server only to localhost is to make
  190. sure it isn't publically accessible. If people could get to it directly,
  191. they could confirm that your computer is the one offering the hidden
  192. service.)
  193. </p>
  194. <p>Once you've got your web server set up, make sure it works: open your
  195. browser and go to <a
  196. href="http://localhost:5222/">http://localhost:5222/</a>. Then
  197. try putting a file
  198. in the main html directory, and make sure it shows up when you access
  199. the site.
  200. </p>
  201. <hr />
  202. <a id="three"></a>
  203. <h2><a class="anchor" href="#three">Step Three: Connect your web server to your hidden service</a></h2>
  204. <br />
  205. <p>This part is very simple. Open up your torrc again, and change the
  206. HiddenServicePort line from "www.google.com:80" to "localhost:5222".
  207. Then <a
  208. href="http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#Restarting">restart
  209. Tor</a>. Make sure that it's working by reloading your hidden
  210. service hostname in your browser.
  211. </p>
  212. <hr />
  213. <a id="four"></a>
  214. <h2><a class="anchor" href="#four">Step Four: More advanced tips</a></h2>
  215. <br />
  216. <p>If you plan to keep your service available for a long time, you might
  217. want to make a backup copy of the private_key file somewhere.
  218. </p>
  219. <p>We avoided recommending Apache above, a) because many people might
  220. already be running it for a public web server on their computer, and b)
  221. because it's big
  222. and has lots of places where it might reveal your IP address or other
  223. identifying information, for example in 404 pages. For people who need
  224. more functionality, though, Apache may be the right answer. Can
  225. somebody make us a checklist of ways to lock down your Apache when you're
  226. using it as a hidden service?
  227. </p>
  228. <p>If you want to forward multiple virtual ports for a single hidden
  229. service, just add more HiddenServicePort lines.
  230. If you want to run multiple hidden services from the same Tor
  231. client, just add another HiddenServiceDir line. All the following
  232. HiddenServicePort lines refer to this HiddenServiceDir line, until
  233. you add another HiddenServiceDir line:
  234. </p>
  235. <pre>
  236. HiddenServiceDir /usr/local/etc/tor/hidden_service/
  237. HiddenServicePort 80 127.0.0.1:8080
  238. HiddenServiceDir /usr/local/etc/tor/other_hidden_service/
  239. HiddenServicePort 6667 127.0.0.1:6667
  240. HiddenServicePort 22 127.0.0.1:22
  241. </pre>
  242. <p>There are some anonymity issues you should keep in mind too:
  243. </p>
  244. <ul>
  245. <li>As mentioned above, be careful of letting your web server reveal
  246. identifying information about you, your computer, or your location.
  247. For example, readers can probably determine whether it's thttpd or
  248. Apache, and learn something about your operating system.</li>
  249. <li>If your computer isn't online all the time, your hidden service
  250. won't be either. This leaks information to an observant adversary.</li>
  251. <!-- increased risks over time -->
  252. </ul>
  253. <hr />
  254. <p>If you have suggestions for improving this document, please <a
  255. href="/contact">send them to us</a>. Thanks!</p>
  256. </div><!-- #main -->
  257. </div>
  258. <div class="bottom" id="bottom">
  259. <i><a href="/contact"
  260. class="smalllink">Webmaster</a></i> - $Id$
  261. </div>
  262. </body>
  263. </html>