tor-hidden-service.html 11 KB

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