tor-hidden-service.html 12 KB

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