Change hidden -> onion. (Se...
kat authored 7 years ago
|
1) ## translation metadata
2) # Revision: $Revision$
3) # Translation-Priority: 3-low
4)
5) #include "head.wmi" TITLE="Tor Project: Onion Service Configuration Instructions" CHARSET="UTF-8"
6) <div id="content" class="clearfix">
7) <div id="breadcrumbs">
8) <a href="<page index>">Home » </a>
9) <a href="<page docs/documentation>">Documentation » </a>
10) <a href="<page docs/tor-onion-service>">Tor Onion Service</a>
11) </div>
12) <div id="maincol">
13) <h1>Configuring Onion Services for <a href="<page index>">Tor</a></h1>
14) <hr>
15)
16) <p>Tor allows clients and relays to offer onion services. That is,
17) you can offer a web server, SSH server, etc., without revealing your
18) IP address to its users. In fact, because you don't use any public address,
19) you can run an onion service from behind your firewall.
20) </p>
21)
22) <p>If you have Tor installed, you can see onion services in action
23) by visiting this <a href="http://duskgytldkxiuqc6.onion/">sample
24) site</a>.
25) </p>
26)
27) <p>
28) This page describes the steps for setting up your own onion service
29) website. For the technical details of how the onion service protocol
30) works, see our <a href="<page docs/onion-services>">onion service
31) protocol</a> page.
32) </p>
33)
34) <hr>
35) <a id="zero"></a>
36) <h2><a class="anchor" href="#zero">Step Zero: Get Tor working</a></h2>
37) <br>
38)
39) <p>Before you start, you need to make sure:</p>
40) <ol>
41) <li>Tor is up and running,</li>
42) <li>You actually set it up correctly.</li>
43) </ol>
44)
45) <p>Windows users should follow the <a
46) href="<page docs/tor-doc-windows>">Windows
47) howto</a>, OS X users should follow the <a
48) href="<page docs/tor-doc-osx>">OS
49) X howto</a>, and Linux/BSD/Unix users should follow the <a
50) href="<page docs/tor-doc-unix>">Unix howto</a>.
51) </p>
52)
53) <hr>
54) <a id="one"></a>
55) <h2><a class="anchor" href="#one">Step One: Install a web server locally</a></h2>
56) <br>
57)
58) <p>
|
onion services: mention web...
traumschule authored 6 years ago
|
59) First, you need to set up a web server locally, for example nginx or
60) lighttpd (apache is not the best option for anomymity, see
61) <a href="#three">Step Three</a> below).
62) Setting up a web server can be complex. We're not going to cover how to set
63) up a web server here. If you get stuck or want to do more, find a friend who
|
Change hidden -> onion. (Se...
kat authored 7 years ago
|
64) can help you. We recommend you install a new separate web server for
65) your onion service, since even if you already have one installed,
66) you may be using it (or want to use it later) for a normal website.
67) </p>
68)
69) <p>
70) You need to configure your web server so it doesn't give away any
71) information about you, your computer, or your location. Be sure to
72) bind the web server only to localhost (if people could get to it
73) directly, they could confirm that your computer is the one offering
74) the onion service). Be sure that its error messages don't list
75) your hostname or other hints. Consider putting the web server in a
76) sandbox or VM to limit the damage from code vulnerabilities.
77) </p>
78)
79) <p>
80) Once your web server is set up, make
81) sure it works: open your browser and go to <a
82) href="http://localhost:8080/">http://localhost:8080/</a>, where
83) 8080 is the webserver port you chose during setup (you can choose any
84) port, 8080 is just an example). Then try putting a file in the main
85) html directory, and make sure it shows up when you access the site.
86) </p>
87)
88) <hr>
89) <a id="two"></a>
90) <h2><a class="anchor" href="#two">Step Two: Configure your onion service</a></h2>
91) <br>
92)
93) <p>Next, you need to configure your onion service to point to your
94) local web server.
95) </p>
96)
97) <p>First, open your torrc file in your favorite text editor. (See
98) <a href="<page docs/faq>#torrc">the torrc FAQ entry</a> to learn
99) what this means.) Go to the middle section and look for the line</p>
100)
101) <pre>
102) \############### This section is just for location-hidden services ###
103) </pre>
104)
105) <p>
106) This section of the file consists of groups of lines, each representing
107) one onion service. Right now they are all commented out (the lines
108) start with #), so onion services are disabled. Each group of lines
109) consists of one <var>HiddenServiceDir</var> line, and one or more
110) <var>HiddenServicePort</var> lines:</p>
111) <ul>
112) <li><var>HiddenServiceDir</var> is a directory where Tor will store
113) information about that onion service. In particular, Tor will create a
114) file here named <var>hostname</var> which will tell you the onion URL. You
115) don't need to add any files to this directory. Make sure this is not the
116) same directory as the hidserv directory you created when setting up thttpd,
117) as your HiddenServiceDir contains secret information!</li>
118) <li><var>HiddenServicePort</var> lets you specify a virtual port (that is,
119) what port people accessing the onion service will think they're using) and
120) an IP address and port for redirecting connections to this virtual
121) port.</li> </ul>
122)
123) <p>Add the following lines to your torrc:
124) </p>
125)
126) <pre>
127) HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
128) HiddenServicePort 80 127.0.0.1:8080
129) </pre>
130)
131) <p>You're going to want to change the <var>HiddenServiceDir</var> line, so
132) it points to an actual directory that is readable/writeable by the user
133) that will be running Tor. The above line should work if you're using the OS
134) X Tor package. On Unix, try "/home/username/hidden_service/" and fill in
135) your own username in place of "username". On Windows you might pick:</p>
136) <pre> HiddenServiceDir C:\Users\username\Documents\tor\hidden_service
137) HiddenServicePort 80 127.0.0.1:8080 </pre>
138)
|
onion services: add v3 manu...
traumschule authored 6 years ago
|
139) <p>Note that since 0.2.6, both <var>SocksPort</var> and <var>HiddenServicePort</var>
140) support Unix sockets. This means that you can point the <var>HiddenServicePort</var>
141) to a Unix socket:</p>
|
Change hidden -> onion. (Se...
kat authored 7 years ago
|
142) <pre>
143) HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
144) HiddenServicePort 80 unix:/path/to/socket
145) </pre>
146)
147) <p>Now save the torrc and restart your tor.</p>
148)
149) <p>If Tor starts up again, great. Otherwise, something is wrong. First look
150) at your logfiles for hints. It will print some warnings or error messages.
151) That should give you an idea what went wrong. Typically there are typos in
152) the torrc or wrong directory permissions (See <a href="<page
153) docs/faq>#Logs">the logging FAQ entry</a> if you don't know how to enable
154) or find your log file.) </p>
155)
156) <p>When Tor starts, it will automatically create the
157) <var>HiddenServiceDir</var> that you specified (if necessary), and it will
158) create two files there.</p>
159)
160) <dl>
161) <dt><var>private_key</var></dt>
162) <dd>First, Tor will generate a new public/private keypair for your onion
163) service. It is written into a file called "private_key". Don't share this key
164) with others -- if you do they will be able to impersonate your onion
165) service.</dd>
166) <dt><var>hostname</var></dt>
167) <dd>The other file Tor will create is called "hostname". This contains
168) a short summary of your public key -- it will look something like
169) <tt>duskgytldkxiuqc6.onion</tt>. This is the public name for your service,
170) and you can tell it to people, publish it on websites, put it on business
171) cards, etc.</dd>
172) </dl>
173)
174) <p>If Tor runs as a different user than you, for example on
175) OS X, Debian, or Red Hat, then you may need to become root to be able
176) to view these files.</p>
177)
178) <p>Now that you've restarted Tor, it is busy picking introduction points
179) in the Tor network, and generating an <em>onion service
180) descriptor</em>. This is a signed list of introduction points along with
181) the service's full public key. It anonymously publishes this descriptor
182) to the directory servers, and other people anonymously fetch it from the
183) directory servers when they're trying to access your service.
184) </p>
185)
186) <p>Try it now: paste the contents of the hostname file into your web
187) browser. If it works, you'll get the html page you set up in step one.
188) If it doesn't work, look in your logs for some hints, and keep playing
189) with it until it works.
190) </p>
191)
192) <hr>
193) <a id="three"></a>
194) <h2><a class="anchor" href="#three">Step Three: More advanced tips</a></h2>
195) <br>
196)
197) <p>If you plan to keep your service available for a long time, you might
198) want to make a backup copy of the <var>private_key</var> file somewhere.
199) </p>
200)
201) <p>If you want to forward multiple virtual ports for a single onion
202) service, just add more <var>HiddenServicePort</var> lines.
203) If you want to run multiple onion services from the same Tor
204) client, just add another <var>HiddenServiceDir</var> line. All the following
|
onion services: add v3 manu...
traumschule authored 6 years ago
|
205) <var>HiddenServicePort</var> lines refer to this <var>HiddenServiceDir</var>
206) line, until you add another <var>HiddenServiceDir</var> line:
|
Change hidden -> onion. (Se...
kat authored 7 years ago
|
207) </p>
208)
209) <pre>
210) HiddenServiceDir /usr/local/etc/tor/hidden_service/
211) HiddenServicePort 80 127.0.0.1:8080
212)
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)
|
onion services: add v3 manu...
traumschule authored 6 years ago
|
218) <p>Onion services operators need to practice proper
219) <a href="https://trac.torproject.org/projects/tor/wiki/doc/OperationalSecurity">
220) operational security</a> and system administration to maintain security.
221) For some security suggestions please make sure you read over Riseup's
222) <a href="https://help.riseup.net/en/security/network-security/tor/onionservices-best-practices">
223) "Tor Hidden (Onion) Services Best Practices" document</a>.
224) Also, here are some more anonymity issues you should keep in mind:
|
Change hidden -> onion. (Se...
kat authored 7 years ago
|
225) </p>
226) <ul>
227) <li>As mentioned above, be careful of letting your web server reveal
228) identifying information about you, your computer, or your location.
229) For example, readers can probably determine whether it's thttpd or
230) Apache, and learn something about your operating system.</li>
231) <li>If your computer isn't online all the time, your onion service
232) won't be either. This leaks information to an observant adversary.</li>
233) <li>It is generally a better idea to host onion services on a Tor client
234) rather than a Tor relay, since relay uptime and other properties are
235) publicly visible.</li>
236) <li>The longer an onion service is online, the higher the risk that its
237) location is discovered. The most prominent attacks are building a
238) profile of the onion service's availability and matching induced
239) traffic patterns.</li>
240) </ul>
241)
242) <p>Another common issue is whether to use HTTPS on your relay or
243) not. Have a look at this <a
|
onion services: add v3 manu...
traumschule authored 6 years ago
|
244) href="https://blog.torproject.org/blog/facebook-hidden-services-and-https-certs">post</a>
245) on the Tor Blog to learn more about these issues.
246) </p>
247)
248) <p>You can use <a href="https://stem.torproject.org">stem</a> to
249) <a href="https://stem.torproject.org/tutorials/over_the_river.html">
250) automate the management of your onion services</a>.
|
Change hidden -> onion. (Se...
kat authored 7 years ago
|
251) </p>
252)
253) <p>Finally, feel free to use the <a
254) href="https://lists.torproject.org/pipermail/tor-onions/">[tor-onions]
255) mailing list</a> to discuss the secure administration and operation of
256) Tor onion services.</p>
257)
|
onion services: add v3 manu...
traumschule authored 6 years ago
|
258) <hr>
259) <a id="four"></a>
260) <h2><a class="anchor" href="#four">Step Four: Set up next-gen (v3) onions</a></h2>
261) <br>
262)
263) <p>Since Tor 0.3.2 and
264) <a href="https://blog.torproject.org/tor-browser-75a5-released">Tor Browser
265) 7.5.a5</a> 56 bit long v3 onion addresses are supported and should be used
266) instead. This newer version of onion services ("v3") features many
267) improvements over the legacy system:
268) </p>
269) <ul>
270) <li>Better crypto (replaced SHA1/DH/RSA1024 with SHA3/ed25519/curve25519)</li>
271) <li>Improved directory protocol, leaking much less information to directory servers.</li>
272) <li>Improved directory protocol, with smaller surface for targeted attacks.</li>
273) <li>Better onion address security against impersonation.</li>
274) <li>More extensible introduction/rendezvous protocol.</li>
275) <li>A cleaner and more modular codebase.</li>
276) </ul>
277) <p>For details see
278) <a href="https://trac.torproject.org/projects/tor/wiki/doc/HiddenServiceNames">
279) Why are v3 onions better?</a>. You can identify a next-generation onion
280) address by its length: they are 56 characters long, as in
281) <var>4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion</a>.
282)
283) The specification for next gen onion services can be found
284) <a href="https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt">
285) here</a>.
286) </p>
287)
288) <h3>How to setup your own prop224 service</h3>
289)
290) <p>It's easy! Just use your <a href"#two">regular onion service</a> torrc
291) and add <var>HiddenServiceVersion 3</var> in your onion service torrc block.
292) Here is an example torrc designed for testing:
293) </p>
294) <pre>
295) SocksPort auto
296)
297) HiddenServiceDir /home/user/tmp/hsv3
298) HiddenServiceVersion 3
299) HiddenServicePort 6667 127.0.0.1:6667
300) </pre>
301) <p>Then your onion address is in <var>/home/user/tmp/hsv3/hostname</var>.
302) To host both a v2 and a v3 service using two onion service torrc blocks:
303) </p>
304) <pre>
305) HiddenServiceDir /home/user/tmp/hsv2
306) HiddenServicePort 6667 127.0.0.1:6667
307)
308) HiddenServiceDir /home/user/tmp/hsv3
309) HiddenServiceVersion 3
310) HiddenServicePort 6668 127.0.0.1:6667
311) </pre>
312)
313) <p>Please note that tor is strict about directory permissions and does not
314) like to share its files. Make sure to restrict read and write access to the
315) onion services directory before restarting tor. For most linux based systems you can use:
316) </p>
317) <pre>chmod 700 -R /var/lib/tor</pre>
318)
319) <p>To restart tor it's safer to not use SIGHUP directly (see bug
320) <a href="https://trac.torproject.org/projects/tor/ticket/21818">#21818</a>),
321) but to check the validity of the config first. On Debian based systems the
322) services management tool does this for you:</p>
323) <pre>
324) service tor restart
325) </pre>
326)
327) <h3>How to help the next-gen onion development</h3>
328)
329) <p>Please let us know if you find any bugs!
330) We are still in testing & development stage so things are very liquid and
331) in active development. If you want to help with development, check out the list of
332) <a href="https://trac.torproject.org/projects/tor/query?status=!closed&keywords=~prop224&order=priority">
333) open prop224 bugs</a>.
334) </p>
335)
336) <p>For researchers our wiki page
337) <a href="https://trac.torproject.org/projects/tor/wiki/doc/OnionServiceNamingSystems">
338) Onion Service Naming Systems</a> could be of value. If you are more of the bug
339) hunting type, please check our code and spec for errors and inaccuracies.
340) We would be thrilled to know about them!
341) </p>
342)
343) <p>For debugging and to send us more helpful log files, turn on info logging:
344) </p>
345) <pre>
346) SafeLogging 0
347) Log notice file /home/user/tmp/hs/hs.log
348) Log info file /home/user/tmp/hs/hsinfo.log
349) </pre>
350)
|