Debian Codegraph @

doc/manual-en.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>desproxy Manual</title>
5 </head>
6 <body>
7 <table><tbody><tr><td><br></td><td width="80%"><div align="justify">
8
9 NOTE: The most recent version of this document can be obtained
10 <A HREF="http://desproxy.sourceforge.net/manual-en.html">here</A>.
11 <HR>
12
13 <h1>Introduction: What is desproxy for?</h1>
14
15 Desproxy is a TCP tunnel for HTTP proxies.
16
17 <p>HTTP proxies are network servers that are used to give HTTP (web) access
18 to computers that are not connected to the Internet. This is a typical
19 scenario in corporate networks and recently in home networks too. HTTP
20 proxies connect to the Internet either directly or via a
21 <i>parent proxy</i> (which in fact connects to the Internet directly or
22 via another parent proxy, and so on...)
23
24 <p>HTTP clients (web browsers) use HTTP proxies to request web pages; the
25 HTTP server just forwards those request to the destination server. All the
26 negotiation is done via the HTTP protocol, which is designed just to carry
27 HTTP requests and no <i>generic</i> (TCP/IP) traffic. <b>That is why you
28 can't (normally) use Internet applications beside your web server if you
29 are behind a HTTP proxy</b>.
30
31 <p>That is what desproxy is good for. Desproxy is a TCP
32 tunnel, which means desproxy can forward TCP/IP traffic via a
33 HTTP proxy. Desproxy uses a HTTP/1.1 method (CONNECT) to
34 establish TCP/IP connections on demand. CONNECT is used for
35 SSL connections when accessing to secure sites, so if you can access
36 sites that support SSL (www.hotmail.com for example) you can use desproxy.
37
38 <p>Note I recall TCP/IP traffic.
39
40 <p>Not all IP (Internet) traffic is just TCP/IP. In fact there are two more
41 protocols widely used in the Internet not supported by desproxy: UDP
42 and ICMP:
43 <ul>
44
45 <li><p>ICMP is used to manage large IP networks. The only application
46 using ICMP you may miss is <b>ping</b>.</li>
47
48 <li><p>UDP is an unreliable connection-less fast transport protocol, mostly
49 used in network games and other applications that need low latency network
50 traffic. Notably <b>DNS</b> uses UDP packets for fast delivery.</li>
51 </ul>
52
53 <h1>Will desproxy work with my HTTP proxy?</h1>
54
55 Short answer: just give it a try<br>
56
57 <p>Long answer: desproxy should work with every HTTP proxy, with the
58 following exceptions:
59 <ul>
60 <li><p><b>MS Proxies with NTLM authentication</b>. NTLM is a proprietary
61 authentication method from Microsoft, not a standard authentication
62 method. Maybe in the future desproxy will support NTLM authentication, but
63 currently it doesn't.</li>
64
65 <li><p><b>HTTP/1.0 Proxies</b>. Desproxy needs the CONNECT method, which
66 is only available from HTTP/1.1 protocol version. It's very unlikely your
67 proxy doesn't accept HTTP/1.1 requests.</li>
68
69 <li><p><b>HTTP/1.1 Proxies without the CONNECT method</b>. Maybe your
70 network administrator deactivated CONNECT support in the proxy, or maybe
71 CONNECT is restricted to the HTTPS port (443).</li>
72 </ul>
73
74 <h1>Assumptions</h1>
75
76 Let's assume the following:
77 <ul>
78
79 <li><p>your HTTP proxy host name is "proxy" and its address is
80 "192.0.0.1"</li>
81
82 <li><p>your HTTP proxy port is "8080"</li>
83
84 <li><p>your HTTP proxy <b>doesn't need authentication</b>. It case
85 you need HTTP authentication, please read <a href="#AUTH">this</a>.
86
87 <li><p>your <b>system console</b> will be:
88 <ul>
89 <li><p><b>MS/DOS box</b> if you are running Windows 95, Windows 98,
90 or Windows ME</li>
91 <li><p><b>Windows NT command shell</b> if you are running Windows NT,
92 Windows 2000 or Windows XP</li>
93 <li><p>A <b>terminal</b> (xterm, the console or a virtual terminal) if
94 you are running Linux, *BSD or other UN*X</li>
95 </ul>
96 </li>
97 </ul>
98
99 <h1>About connections</h1>
100
101 Imagine you need a network application that uses only one TCP/IP
102 connection with just one server. That's the case of <b>IRC</b> in which you
103 connect to an IRC server or <b>ssh</b> where you tipically connect just to
104 one UNIX computer at a time. That's what I called a "static connection".
105
106 <p>Of course that's not the case of a <b>web browser</b> or a <b>file
107 sharing program</b>, both of them doing several connections at a time
108 to different computers. That's what I call "dynamic connections".
109
110 <h1>Static connections examples</h1>
111
112 How to use desproxy to...
113
114 <h2>...connect to IRC</h2>
115
116 Suppose you want to connect to IRC using <b>irc.undernet.org</b>
117 port <b>6667</b> as your IRC server. First you have to start a system
118 console (see <b>Assumptions</b> above for details) and type
119
120 <p><pre><code>desproxy irc.undernet.org 6667 proxy 8080 1080</code></pre>
121
122 <p>That should start desproxy, giving you the copyright notice along with
123 some information. The following is a screen capture from desproxy 0.0.23
124
125 <p><pre><code>-----------------------------------
126 desproxy 0.0.23
127
128 (c) Miguelanxo Otero Salgueiro 2001
129
130 This release brought to you patched
131 by Rutger Nijlunsig.
132
133 See RutgerWork.txt in documentation
134 for details about new features.
135
136 Great work guy!
137 -----------------------------------
138
139 TCP port 1080 Binded & Listening
140 Press ENTER to Quit</code></pre>
141
142 <p>Desproxy reports it is listening in local port 1080 ready for a
143 connection.
144
145 <p>Open your favourite IRC client (install it first ;D) and connect to
146 127.0.0.1 port 1080 as your irc server (127.0.0.1 is a virtual IP,
147 always referencing to your local machine). Then, your IRC client should
148 connect to desproxy. It looks like
149
150 <p><pre><code>Connection request from 127.0.0.1, port 1220
151 Connecting to http proxy (proxy:8080)
152 Bidirectional connection established</pre></code>
153
154 <p>Then you should be able to use your IRC client as if you were directly
155 connected to irc.undernet.org.
156
157 <h2>...log in a computer using ssh</h2>
158
159 Suppose you have a shell account in a computer that supports secure
160 connections via ssh. Let's assume it's called
161 <b>shell.corporate.com</b>. SSH uses port number <b>22</b> by default. So
162 start a new system console and type:
163 <p><pre><code>desproxy shell.corporate.com 22 proxy 8080 1080</pre></code>
164
165 <p>Then, tell your ssh client to connect to localhost (127.0.0.1) port 1080
166 and you should get a ssh password prompt!
167
168 <h2>...use other static clients</h2>
169
170 Let's assume you want to use network application X, which doesn't support
171 HTTP proxies but use one TCP/IP connection (like IRC and SSH). To make
172 X work with desproxy, you just have to do the following:
173 <ul>
174
175 <li><p>Search for the default port of that application:
176 <ul>
177
178 <li><p>ftp: 21</li>
179
180 <li><p>ssh: 22</li>
181
182 <li><p>telnet: 23</li>
183
184 <li><p>smtp: 25</li>
185
186 <li><p>...</li>
187 </ul>
188 </li>
189
190 <li><p>Search for the default server of that application (if there is one)
191 <ul>
192
193 <li><p>AIM: toc.oscar.aol.com (port 21)</li>
194
195 <li><p>ICQ: icq.mirabilis.com (port 4000)</li>
196
197 <li><p>Yahoo messenger: cs.yahoo.com (port 5050)</li>
198
199 <li><P>MSN Messenger: messenger.hotmail.com (port 1863)</li>
200
201 <li><p>...</li>
202 </ul>
203 </li>
204
205 <li><p>Start desproxy, passing that info as command line parameters. The
206 format is
207 <p><code><pre>desproxy remote_host remote_port proxy_host proxy_port local_port</pre></code>
208
209 <p>Just give a local_port of your desire, but always over 1023, cause
210 lower ports may need administrator privileges.
211 </li>
212 </ul>
213 </li>
214 </ul>
215
216 <h1>Using desproxy with dynamic connections</h1>
217
218 You can see that for every application that needs to be
219 un-proxyzed you have to start a desproxy program. That is OK if you
220 are using irc, ssh or other application that always connects to the
221 same server. But if you need to dynamically establish TCP connections
222 it's impossible to follow that path.
223
224 <p>That's why I wrote desproxy-socks5server. Desproxy-socks5server is
225 just a desproxy implementation of a Socks 5 Server. A Socks 5 Server is
226 like a "TCP proxy": you just request a TCP connection and the Socks 5
227 Server does the work for you.
228
229 <p>Of course, client applications need to have support for Socks 5 Server.
230 If your application lacks Socks 5 support, you can use
231 desproxy-socks4server instead, given it has Socks 4 support.
232
233 <p><b>If the application lacks any Socks support, and needs dynamic
234 connections, you can't do anything: it won't work behind the HTTP
235 proxy</b>.
236
237 <p>Using desproxy-socksXserver (X being 4 or 5) is very easy: you only
238 have to start a system console and type:
239
240 <p><code><pre>desproxy-socks4server proxy 8080 1080</pre></code>
241
242 <p>or
243
244 <p><code><pre>desproxy-socks5server proxy 8080 1080</pre></code>
245
246 <p>Here I'm assuming "proxy" and "8080" to be your proxy name and port.
247
248 <p>That should start the Socks server. Then you have to tell your
249 application to use Socks server "127.0.0.1" port "1080". Just see in the
250 proxy configuration and look for "Socks Server" adjustments.
251
252 <p>That is not all, unfortunately. Beside having your Socks server up you
253 need <b>DNS</b> access. Of course if you don't have DNS access, you just
254 have to use desproxy-dns.
255 So let's see the two scenarios
256
257 <h1>DNS for dynamic connections</h1>
258
259 <h2>Direct DNS access</h2>
260
261 If you have direct DNS access then you don't need to do anything else.
262 You know you have direct DNS access if you can resolve host names to
263 IP addresses. To test DNS just start a system console and type
264
265 <p><code><pre>ping www.hotmail.com</pre></code>
266
267 <p>Of course, you can't ping anything outside the proxy, but ping should
268 display the IP address of hotmail, if it can resolve it. Ping should
269 display something like
270
271 <p><code><pre>Pinging www.hotmail.com [64.4.43.7] with 32 bytes of data</pre></code>
272
273 <p>if you are using MS Windows, or
274
275 <p><code><pre>PING www.hotmail.com (64.4.43.7): 56 data bytes</pre></code>
276
277 <p>if you are running Linux, *BSD or UN*X.
278
279 <p>Ping should also complain about losing all the packets. OK, that's as it
280 should be. If ping displays "unknown host www.hotmail.com" try a different
281 one, like "www.yahoo.com" or "www.sun.com". It that three displayed "unknown
282 host" then you don't have DNS access.
283
284 <h2>No DNS access</h2>
285
286 If you don't have DNS access you have to do two things:
287 <ul>
288
289 <li><p>Search for a public accessible DNS server IP address
290
291 <p>Let's assume you find one (195.196.180.14).
292 </li>
293
294 <li><p>Start desproxy-dns
295 <p>Open another system console and type
296
297 <p><code><pre>desproxy-dns 195.196.180.14 proxy 8080</pre></code>
298 </li>
299 </ul>
300 <p>After that you will have a DNS server running in your computer.
301
302 <p><b>NOTE</b>: as desproxy-dns listens in port 53 (which is less than 1024)
303 you may need administrator privileges to exec desproxy-dns (in fact if you
304 are running UN*X, you actually have to run desproxy-dns as <b>root</b>).
305
306 <p>OK, so you have a dns server accessible now. But your computer doesn't
307 know anything about that. You must configure your network accordingly
308 (again, need to be root in UN*X).
309
310 <p>In <b>Windows</b> just go to Control Panel-&gt
311 Network-&gt TCP/IP -&gt Network Adapter-&gt Properties-&gt DNS
312 Configuration. Select "Activate DNS" and add "127.0.0.1" as a DNS server.
313 Then restart. Test the ping again. Works? OK!
314
315 <p>In <b>UN*X</b> just edit /etc/resolv.conf and add the line
316 "nameserver 127.0.0.1". You don't have to restart anything. Just test
317 ping and see if it works.
318
319 <h1>Dynamic connections examples</h1>
320
321 How to use desproxy to...
322
323 <h2>...instant message anyone</h2>
324
325 Just remember to get a DNS server (directly or using desproxy-dns)
326 see above. Then, start a socks4server
327
328 <p><code><pre>desproxy-socks4server proxy 8080 1080</pre></code>
329
330 <p>You could start desproxy-socks5server, but some applications refuse
331 to work with Socks 5 (MS Internet Explorer for example) and the
332 Socks 4 Version is faster.
333
334 <p>Remember to leave blank the username and password fields in the client
335 Socks configuration: desproxy does all the work, in case your HTTP proxy
336 needs authentication.
337
338 <p>Get your favourite Instant Messaging program and configure
339 it to use Socks 5 Server "127.0.0.1" port "1080". Then, log in and have fun!
340
341 <h2>...share files</h2>
342
343 Again, the same applies for DNS. Remember to start a desproxy-socks4server,
344 configure your program and go!
345
346 <a name="AUTH"></a><h1>About HTTP Authentication</h1>
347
348 Some HTTP proxies need for security reasons a method of checking client's
349 identity. That's called HTTP authentication (or HTTP authorization).
350
351 <p>Despoxy now supports Basic HTTP authentication. If your proxy needs other
352 kind of authentication (either Digest or NTLM) desproxy won't work.
353
354 <p>For desproxy to work with a HTTP proxy that needs authentication, you
355 have to tell desproxy which username and password to use. Desproxy reads
356 the environment variable PROXY_USER to get that info.
357
358 <p>Suppose your proxy username is "mayka" and your proxy password is
359 "007sgotLTK". Then, before using any of the desproxy programs you
360 should type:
361
362 <p><pre><code>set PROXY_USER=mayka:007sgotLTK</code></pre>
363
364 <p>in your system console.
365
366 <p>Beware passwords can include some characters that should be
367 escaped from the system console. For example, if your password is
368 "moon!=sun", and you are running Linux, you should type
369
370 <p><pre><code>export PROXY_USER=yourusername:moon\!\=sun</code></pre>
371
372 <p>Note characters "!" and "=" are escaped using the backslash "\".
373 If you are running MS Windows, as long as I know, you don't have to
374 escape any valid password character.
375
376 <h1>Troubleshooting</h1>
377
378 A normal <b>desproxy</b> session looks like this:
379
380 <p><pre><code>miguel@Kosmos3000$ desproxy 127.0.0.1 21 127.0.0.1 4480 2222
381
382 -----------------------------------
383 desproxy 0.0.8
384
385 HTTP/1.1
386 (c) Miguelanxo Otero Salgueiro 2001
387 -----------------------------------
388
389 Listening on port 2222
390 Connection request from 127.0.0.1, port 1227
391 Connecting to http proxy (127.0.0.1:4480)
392 Bidirectional connection stablished
393 (127.0.0.1:21) &lt;-&gt; (localhost)
394 End of connection.</code></pre>
395
396 <p>Here, I connected to my local ftp server (127.0.0.1:21)
397 using my local proxy (127.0.0.1:4480). You can see how, after the
398 connection is accepted, desproxy connected to the proxy, interchanged
399 some bytes (a FTP session) and terminates the connection.
400
401 <p>Desproxy is quite self explanatory about errors. Desproxy-inetd is
402 far more obscure, because the way inetd uses it (can't print error
403 messages) to the console.
404
405 <p>Basically there are two kind of errors:
406 <ul>
407
408 <li><p><b>Errors reported when connecting to the proxy</b>: the http
409 page showing the error is displayed.</li>
410
411 <li><p><b>Every other error</b>: a short error message is displayed.</li>
412 </ul>
413 Errors reported by proxy may be the worse... <br>
414
415 <h2>Some common HTTP errors (as reported by the proxy)</h2>
416
417 <ul>
418
419 <li><p><b>HTTP 400 Bad Request</b> - Some versions of desproxy
420 (0.0.21) cause this error (FATAL)</li>
421
422 <li><p><b>HTTP 403 Forbidden</b> - Forbidden to do that (FATAL)</li>
423
424 <li><p><b>HTTP 404 Not Found</b> - Page not found, or resource
425 not found (MINOR)</li>
426
427 <li><p><b>HTTP 405 Method not Allowed</b> - Can't do CONNECT method
428 (FATAL)</li>
429
430 <li><p><b>HTTP 500 Internal Server Error</b> - Maybe you're trying
431 to connect to a remote closed port (remote site reported connection
432 refused) (MINOR)</li>
433
434 <li><p><b>HTTP 503 Service Unavailable</b> -&gt; The proxy can't
435 reach the site (MINOR)</li>
436
437 <li><p><b>HTTP 505 HTTP Version Not Supported</b> - CONNECT method
438 not available (FATAL)</li>
439
440 <li><p><b>HTTP 502 Bad Gateway</b> - Stands for "DNS lookup error"
441 (MINOR)</li>
442 </ul>
443 <p>(FATAL) - Forget about using "desproxy", you can't surpass the proxy.<br>
444 (TODO) - To do, not yet implemented.<br>
445 (MINOR) - Temporary fault or maybe YOUR fault!.<br>
446 </div>
447 </td><td><br></td></tr></tbody></table>
448 </body>
449 </html>