d52ef8ebd4f4ad9514abfaebd99d8f01083adde9
kat Change hidden -> onion. (Se...

kat authored 6 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 &raquo; </a>
9)     <a href="<page docs/documentation>">Documentation &raquo; </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>
59)     First, you need to set up a web server locally. Setting up a web
60)     server can be complex. We're not going to cover how to set up a web
61)     server here. If you get stuck or want to do more, find a friend who
62)     can help you. We recommend you install a new separate web server for
63)     your onion service, since even if you already have one installed,
64)     you may be using it (or want to use it later) for a normal website.
65)     </p>
66) 
67)     <p>
68)     You need to configure your web server so it doesn't give away any
69)     information about you, your computer, or your location. Be sure to
70)     bind the web server only to localhost (if people could get to it
71)     directly, they could confirm that your computer is the one offering
72)     the onion service). Be sure that its error messages don't list
73)     your hostname or other hints. Consider putting the web server in a
74)     sandbox or VM to limit the damage from code vulnerabilities.
75)     </p>
76) 
77)     <p>
78)     Once your web server is set up, make
79)     sure it works: open your browser and go to <a
80)     href="http://localhost:8080/">http://localhost:8080/</a>, where
81)     8080 is the webserver port you chose during setup (you can choose any
82)     port, 8080 is just an example). Then try putting a file in the main
83)     html directory, and make sure it shows up when you access the site.
84)     </p>
85) 
86)     <hr>
87)     <a id="two"></a>
88)     <h2><a class="anchor" href="#two">Step Two: Configure your onion service</a></h2>
89)     <br>
90) 
91)     <p>Next, you need to configure your onion service to point to your
92)     local web server.
93)     </p>
94) 
95)     <p>First, open your torrc file in your favorite text editor. (See
96)     <a href="<page docs/faq>#torrc">the torrc FAQ entry</a> to learn
97)     what this means.) Go to the middle section and look for the line</p>
98) 
99)     <pre>
100)     \############### This section is just for location-hidden services ###
101)     </pre>
102) 
103)     <p>
104)     This section of the file consists of groups of lines, each representing
105)     one onion service. Right now they are all commented out (the lines
106)     start with #), so onion services are disabled. Each group of lines
107)     consists of one <var>HiddenServiceDir</var> line, and one or more
108)     <var>HiddenServicePort</var> lines:</p>
109)     <ul>
110) 	<li><var>HiddenServiceDir</var> is a directory where Tor will store
111) 	information about that onion service.  In particular, Tor will create a
112) 	file here named <var>hostname</var> which will tell you the onion URL.  You
113) 	don't need to add any files to this directory. Make sure this is not the
114) 	same directory as the hidserv directory you created when setting up thttpd,
115) 	as your HiddenServiceDir contains secret information!</li>
116) 	<li><var>HiddenServicePort</var> lets you specify a virtual port (that is,
117) 	what port people accessing the onion service will think they're using) and
118) 	an IP address and port for redirecting connections to this virtual
119) 	port.</li> </ul>
120) 
121)     <p>Add the following lines to your torrc:
122)     </p>
123) 
124)     <pre>
125)     HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
126)     HiddenServicePort 80 127.0.0.1:8080
127)     </pre>
128) 
129) 	<p>You're going to want to change the <var>HiddenServiceDir</var> line, so
130) 	it points to an actual directory that is readable/writeable by the user
131) 	that will be running Tor. The above line should work if you're using the OS
132) 	X Tor package. On Unix, try "/home/username/hidden_service/" and fill in
133) 	your own username in place of "username". On Windows you might pick:</p>
134) 	<pre> HiddenServiceDir C:\Users\username\Documents\tor\hidden_service
135) 	HiddenServicePort 80 127.0.0.1:8080 </pre>
136) 
traumschule onion services: add v3 manu...

traumschule authored 5 years ago

137)     <p>Note that since 0.2.6, both <var>SocksPort</var> and <var>HiddenServicePort</var>
138)     support Unix sockets. This means that you can point the <var>HiddenServicePort</var>
139)     to a Unix socket:</p>
kat Change hidden -> onion. (Se...

kat authored 6 years ago

140)     <pre>
141)     HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
142)     HiddenServicePort 80 unix:/path/to/socket
143)     </pre>
144) 
145)     <p>Now save the torrc and restart your tor.</p>
146) 
147) 	<p>If Tor starts up again, great. Otherwise, something is wrong. First look
148) 	at your logfiles for hints. It will print some warnings or error messages.
149) 	That should give you an idea what went wrong. Typically there are typos in
150) 	the torrc or wrong directory permissions (See <a href="<page
151) 	docs/faq>#Logs">the logging FAQ entry</a> if you don't know how to enable
152) 	or find your log file.) </p>
153) 
154) 	<p>When Tor starts, it will automatically create the
155) 	<var>HiddenServiceDir</var> that you specified (if necessary), and it will
156) 	create two files there.</p>
157) 
158)     <dl>
159)     <dt><var>private_key</var></dt>
160)     <dd>First, Tor will generate a new public/private keypair for your onion
161)     service. It is written into a file called "private_key". Don't share this key
162)     with others -- if you do they will be able to impersonate your onion
163)     service.</dd>
164)     <dt><var>hostname</var></dt>
165)     <dd>The other file Tor will create is called "hostname". This contains
166)     a short summary of your public key -- it will look something like
167)     <tt>duskgytldkxiuqc6.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.</dd>
170)     </dl>
171) 
172)     <p>If Tor runs as a different user than you, for example on
173)     OS X, Debian, or Red Hat, then you may need to become root to be able
174)     to view these files.</p>
175) 
176)     <p>Now that you've restarted Tor, it is busy picking introduction points
177)     in the Tor network, and generating an <em>onion service
178)     descriptor</em>. This is a signed list of introduction points along with
179)     the service's full public key. It anonymously publishes this descriptor
180)     to the directory servers, and other people anonymously fetch it from the
181)     directory servers when they're trying to access your service.
182)     </p>
183) 
184)     <p>Try it now: paste the contents of the hostname file into your web
185)     browser. If it works, you'll get the html page you set up in step one.
186)     If it doesn't work, look in your logs for some hints, and keep playing
187)     with it until it works.
188)     </p>
189) 
190)     <hr>
191)     <a id="three"></a>
192)     <h2><a class="anchor" href="#three">Step Three: More advanced tips</a></h2>
193)     <br>
194) 
195)     <p>If you plan to keep your service available for a long time, you might
196)     want to make a backup copy of the <var>private_key</var> file somewhere.
197)     </p>
198) 
199)     <p>If you want to forward multiple virtual ports for a single onion
200)     service, just add more <var>HiddenServicePort</var> lines.
201)     If you want to run multiple onion services from the same Tor
202)     client, just add another <var>HiddenServiceDir</var> line. All the following
traumschule onion services: add v3 manu...

traumschule authored 5 years ago

203)     <var>HiddenServicePort</var> lines refer to this <var>HiddenServiceDir</var>
204)     line, until you add another <var>HiddenServiceDir</var> line:
kat Change hidden -> onion. (Se...

kat authored 6 years ago

205)     </p>
206) 
207)     <pre>
208)     HiddenServiceDir /usr/local/etc/tor/hidden_service/
209)     HiddenServicePort 80 127.0.0.1:8080
210) 
211)     HiddenServiceDir /usr/local/etc/tor/other_hidden_service/
212)     HiddenServicePort 6667 127.0.0.1:6667
213)     HiddenServicePort 22 127.0.0.1:22
214)     </pre>
215) 
traumschule onion services: add v3 manu...

traumschule authored 5 years ago

216)     <p>Onion services operators need to practice proper
217)     <a href="https://trac.torproject.org/projects/tor/wiki/doc/OperationalSecurity">
218)     operational security</a> and system administration to maintain security.
219)     For some security suggestions please make sure you read over Riseup's
220)     <a href="https://help.riseup.net/en/security/network-security/tor/onionservices-best-practices">
221)     "Tor Hidden (Onion) Services Best Practices" document</a>.
222)     Also, here are some more anonymity issues you should keep in mind:
kat Change hidden -> onion. (Se...

kat authored 6 years ago

223)     </p>
224)     <ul>
225)     <li>As mentioned above, be careful of letting your web server reveal
226)     identifying information about you, your computer, or your location.
227)     For example, readers can probably determine whether it's thttpd or
228)     Apache, and learn something about your operating system.</li>
229)     <li>If your computer isn't online all the time, your onion service
230)     won't be either. This leaks information to an observant adversary.</li>
231)     <li>It is generally a better idea to host onion services on a Tor client
232)     rather than a Tor relay, since relay uptime and other properties are
233)     publicly visible.</li>
234)     <li>The longer an onion service is online, the higher the risk that its
235)     location is discovered. The most prominent attacks are building a
236)     profile of the onion service's availability and matching induced
237)     traffic patterns.</li>
238)     </ul>
239) 
240)     <p>Another common issue is whether to use HTTPS on your relay or
241)     not. Have a look at this <a
traumschule onion services: add v3 manu...

traumschule authored 5 years ago

242)     href="https://blog.torproject.org/blog/facebook-hidden-services-and-https-certs">post</a>
243)     on the Tor Blog to learn more about these issues.
244)     </p>
245) 
246)     <p>You can use <a href="https://stem.torproject.org">stem</a> to
247)     <a href="https://stem.torproject.org/tutorials/over_the_river.html">
248)     automate the management of your onion services</a>.
kat Change hidden -> onion. (Se...

kat authored 6 years ago

249)     </p>
250) 
251)     <p>Finally, feel free to use the <a
252)     href="https://lists.torproject.org/pipermail/tor-onions/">[tor-onions]
253)     mailing list</a> to discuss the secure administration and operation of
254)     Tor onion services.</p>
255) 
traumschule onion services: add v3 manu...

traumschule authored 5 years ago

256)     <hr>
257)     <a id="four"></a>
258)     <h2><a class="anchor" href="#four">Step Four: Set up next-gen (v3) onions</a></h2>
259)     <br>
260) 
261) ​    <p>Since Tor 0.3.2 and
262)     <a href="https://blog.torproject.org/tor-browser-75a5-released">Tor Browser
263)     7.5.a5</a> 56 bit long v3 onion addresses are supported and should be used
264)     instead. This newer version of onion services ("v3") features many
265)     improvements over the legacy system:
266)     </p>
267)     <ul>
268)       <li>Better crypto (replaced SHA1/DH/RSA1024 with SHA3/ed25519/curve25519)</li>
269)       <li>Improved directory protocol, leaking much less information to directory servers.</li>
270)       <li>Improved directory protocol, with smaller surface for targeted attacks.</li>
271)       <li>Better onion address security against impersonation.</li>
272)       <li>More extensible introduction/rendezvous protocol.</li>
273)       <li>A cleaner and more modular codebase.</li>
274)     </ul>
275)     <p>For details see
276)     <a href="https://trac.torproject.org/projects/tor/wiki/doc/HiddenServiceNames">
277)     Why are v3 onions better?</a>. You can identify a next-generation onion
278)     address by its length: they are 56 characters long, as in
279)     <var>4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion</a>.
280)     
281)     The specification for next gen onion services can be found
282)     <a href="https://gitweb.torproject.org/torspec.git/tree/rend-spec-v3.txt">
283)     here</a>.
284)     </p>
285) 
286)     <h3>How to setup your own prop224 service</h3>
287) 
288)     <p>It's easy! Just use your ​<a href"#two">regular onion service</a> torrc
289)     and add <var>HiddenServiceVersion 3</var> in your onion service torrc block.
290)     Here is an example torrc designed for testing:
291)     </p>
292)     <pre>
293) SocksPort auto
294) 
295) HiddenServiceDir /home/user/tmp/hsv3
296) HiddenServiceVersion 3
297) HiddenServicePort 6667 127.0.0.1:6667
298)     </pre>
299)     <p>Then your onion address is in <var>/home/user/tmp/hsv3/hostname</var>.
300)     To host both a v2 and a v3 service using two onion service torrc blocks:
301)     </p>
302)     <pre>
303) HiddenServiceDir /home/user/tmp/hsv2
304) HiddenServicePort 6667 127.0.0.1:6667
305) 
306) HiddenServiceDir /home/user/tmp/hsv3
307) HiddenServiceVersion 3
308) HiddenServicePort 6668 127.0.0.1:6667
309)     </pre>
310) 
311)     <p>Please note that tor is strict about directory permissions and does not
312)     like to share its files. Make sure to restrict read and write access to the
313)     onion services directory before restarting tor. For most linux based systems you can use:
314)     </p>
315)     <pre>chmod 700 -R /var/lib/tor</pre>
316) 
317)     <p>To restart tor it's safer to not use SIGHUP directly (see bug
318)     <a href="https://trac.torproject.org/projects/tor/ticket/21818">#21818</a>),
319)     but to check the validity of the config first. On Debian based systems the
320)     services management tool does this for you:</p>
321)     <pre>
322)     service tor restart
323)     </pre>
324) 
325)     <h3>How to help the next-gen onion development</h3>
326) 
327)     <p>Please let us know if you find any bugs!
328)     We are still in testing & development stage so things are very liquid and
329)     in active development. If you want to help with development, check out the list of
330)     <a href="https://trac.torproject.org/projects/tor/query?status=!closed&keywords=~prop224&order=priority">
331)     open prop224 bugs</a>.
332)     </p>
333) 
334)     <p>For researchers our wiki page
335)     <a href="https://trac.torproject.org/projects/tor/wiki/doc/OnionServiceNamingSystems">
336)     Onion Service Naming Systems</a> could be of value. If you are more of the bug
337)     hunting type, please check our code and spec for errors and inaccuracies.
338)     We would be thrilled to know about them!
339)     </p>
340) 
341)     <p>For debugging and to send us more helpful log files, turn on info logging:
342)     </p>
343)     <pre>
344) SafeLogging 0
345) Log notice file /home/user/tmp/hs/hs.log
346) Log info file /home/user/tmp/hs/hsinfo.log
347)     </pre>
348)