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