howtoe.html 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. <ul>
  2. <li>3APA3A 3proxy tiny proxy server HowTo
  3. <br>Under construction, very incomplete
  4. <ul>
  5. <li><A HREF="#COMPILE">Compilation</A>
  6. <ul>
  7. <li><A HREF="#MSVC">How to compile 3proxy with Visual C++</A>
  8. <li><A HREF="#INTL">How to compile 3proxy with Intel C Compiler under Windows</A>
  9. <li><A HREF="#GCCWIN">How to compile 3proxy with GCC under Windows</A>
  10. <li><A HREF="#GCCUNIX">How to compile 3proxy with GCC under Unix/Linux</A>
  11. </ul>
  12. <li><A HREF="#INSTALL">Proxy server installation and removal</A>
  13. <ul>
  14. <li><A HREF="#INSTNT">How to install/remove 3proxy under Windows NT/2000/XP</A>
  15. <li><A HREF="#INST95">How to install/remove 3proxy under Windows 95/98/ME</A>
  16. <li><A HREF="#INSTUNIX">How to install/remove 3proxy under Unix/Linux</A>
  17. </ul>
  18. <li><A HREF="#SERVER">Server configuration</A>
  19. <ul>
  20. <li><a href="#NOTHING">How to make 3proxy start</a></li>
  21. <li><a href="#LIMITS">How to make limitation (access, bandwidth, traffic, connections) work</a></li>
  22. <li><a href="#SERVICE">How to make 3proxy to run as a service</a></li>
  23. <li><a href="#INTEXT">How to understand internal ¨ external</a></li>
  24. <li><a href="#ODBC">How to make ODBC logging work?</a></li>
  25. <li><a href="#IPV6">How to make IPv6 work</a></li>
  26. <li><a href="#CRASH">How to fix 3proxy crashes</a></li>
  27. <li><A HREF="#SAMPLE">Where to find configuration example</A>
  28. <li><A HREF="#LOGGING">How to set up logging</A>
  29. <li><A HREF="#LOGFORMAT">How to setup logging format</A>
  30. <li><A HREF="#LOGANALIZERS">How to use log analizers with 3proxy</A>
  31. <li><A HREF="#LAUNCH">How to start any of proxy services (HTTP, SOCKS etc)</A>
  32. <li><a href="#BIND">How to bind service to specific interface or port</a>
  33. <li><a href="#NAMES">How to resolve names through a parent proxy</a></li>
  34. <li><a href="#ISFTP">How to setup FTP proxy</a></li>
  35. <li><A HREF="#AUTH">How to limit service access</A>
  36. <li><A HREF="#USERS">How to create user list</A>
  37. <li><A HREF="#ACL">How to limit user access to resources</A>
  38. <li><A HREF="#REDIR">How to manage redirections</A>
  39. <li><a href="#SOCKSREDIR">How to manage local redirections</a>
  40. <li><A HREF="#ROUNDROBIN">How to balance traffic between few external channgels?</A>
  41. <li><A HREF="#CHAIN">How to manage proxy chains</A>
  42. <li><A HREF="#BANDLIM">How to limit bandwidth</A>
  43. <li><A HREF="#TRAFLIM">How to limit traffic amount</A>
  44. <li><a href="#TRAF">How to fix incorrect traffic accounting</a>
  45. <li><A HREF="#NETLIST">How to build network lists</A>
  46. <li><a href="#NSCACHING">How to configure name resolution and DNS caching</a>
  47. <li><a href="#IPV6">How to use IPv6</a>
  48. <li><a href="#CONNBACK">How to use connect back</a>
  49. </ul>
  50. <li><A HREF="#CLIENT">Client configuration</A>
  51. <li><A HREF="#ADMIN">Administering and information analisys</A>
  52. <ul>
  53. <li><A HREF="#NEWVERSION">How to obtain latest 3proxy version</A>
  54. <li><A HREF="#NTSERVICE">How to control 3proxy service under Windows NT/2000/XP</A>
  55. <li><A HREF="#ERRORS">Log error codes reference</A>
  56. </ul>
  57. <li><A HREF="#QUEST">How To ask quiestion not in How To?</A>
  58. </ul>
  59. <br>
  60. <ul>
  61. <hr>
  62. <li><A NAME="COMPILE">Compilation</A>
  63. <p>
  64. <ul>
  65. <li><A NAME="MSVC">How to compile 3proxy with Visual C++</A>
  66. <p>
  67. Extract source code files from 3proxy.tgz (with WinZip or another utility).
  68. Use nmake /f Makefile.msvc command
  69. </p>
  70. <li><A NAME="INTL">How to compile 3proxy with Intel C Compiler under Windows</A>
  71. <p>
  72. See <A HREF="#MSVC">How to compile 3proxy with Visual C++</A>
  73. Use Makefile.intl instead of Makefile.msvc
  74. </p>
  75. <li><A NAME="GCCWIN">How to compile 3proxy with GCC under Windows</A></li>
  76. <p>
  77. Extract source files from 3proxy.tgz (for example with tar -xzf 3proxy.tgz command if you have tar installed)
  78. Use make -f Makefile.win command.
  79. If you want to use POSIX emulation Cygwin library (normally you shouldn't) - use make -f Makefile.unix instead.
  80. Windows specific things (like installing as service) will not be available if compiled with Cygwin emulation.
  81. </p>
  82. <li><A NAME="GCCUNIX">How to compile 3proxy with GCC under Unix/Linux</A></li>
  83. <p>
  84. Use
  85. <pre>
  86. make -f Makefile.Linux
  87. </pre>
  88. for Linux or Cygwin, Makefile.Solaris* (depending on compiler version) for Solaris
  89. and Makefile.unix for different Unix-like OS. On BSD derivered systems make
  90. sure to use GNU make, sometimes it's called gmake instead of make.
  91. <br>Compilation is tested under FreeBSD/i386, NetBSD/i386, OpenBSD/i386,
  92. RH Linux/Alpha, Debian/i386, Gentoo/i386, Gentoo/PPC, Solaris/x86 but you
  93. shouldn't have problems under different Solaris, BSD or linux compatible systems.
  94. For different systems you may be required to patch Makefile or even source codes.
  95. If you want to use ODBC support, make sure to install ODBC for unix, remove -DNOODBC
  96. option from makefile compiler options and add ODBC library to linker variable.
  97. </p>
  98. </ul>
  99. <hr>
  100. <li><A NAME="INSTALL">Proxy server installation and removal</A>
  101. <p>
  102. <ul>
  103. <li><A NAME="INSTNT">How to install/remove 3proxy under Windows NT/2000/XP</A>
  104. <p>
  105. Unpack 3proxy.zip to any directory, for example
  106. c:\Program Files\3proxy. If needed, create directory for storing log files,
  107. ODBC sources, etc. Create 3proxy.cfg in the 3proxy installation directory (See <A HREF="#SERVER">Server configuration</A>).
  108. If you use 3proxy before 0.6 Add
  109. <pre>
  110. service
  111. </pre>
  112. string into 3proxy.cfg. Now, start command prompt (cmd.exe).
  113. Change directory to 3proxy installation and run 3proxy.exe --install:
  114. <pre>
  115. D:\>C:
  116. C:\>cd C:\Program Files\3proxy
  117. C:\Program Files\3proxy>3proxy.exe --install
  118. </pre>
  119. Now, you should have 3proxy service installed and running. If service is not
  120. started, remove "service" string from 3proxy.cfg, run 3proxy.exe manually
  121. and correct all errors.
  122. </p><p>
  123. To remove 3proxy run 3proxy --remove:
  124. <pre>
  125. D:\>C:
  126. C:\>cd C:\Program Files\3proxy
  127. C:\Program Files\3proxy>net stop 3proxy
  128. C:\Program Files\3proxy>3proxy.exe --remove
  129. </pre>
  130. Now you can simply remove 3proxy installation directory.
  131. </p>
  132. <li><A NAME="INST95">How to install/remove 3proxy under Windows 95/98/ME</A>
  133. <p>
  134. Unpack 3proxy.zip to any directory, for example
  135. c:\Program Files\3proxy. If needed, create directory for storing log files,
  136. ODBC sources, etc. Create 3proxy.cfg in the 3proxy installation directory (See <A HREF="#SERVER">Server configuration</A>).
  137. Remove string
  138. <pre>
  139. service
  140. </pre>
  141. from 3proxy.cfg and add
  142. <pre>
  143. daemon
  144. </pre>
  145. if you want 3proxy to run in background.
  146. Create shortcut for 3proxy.exe and place it in autostart or add
  147. to registry with regedit.exe:
  148. <br>HKLM\Software\Microsoft\Windows\CurrentVersion\Run</br>
  149. Type: String
  150. <br>3proxy = "c:\Program Files\3proxy.exe" "C:\Program Files\3proxy.cfg"<br>
  151. You must use quotes if path contains space. If neccessary, restart Windows.
  152. If service is not started, check log. Remove "daemon" command from 3proxy.cfg,
  153. start 3proxy.exe manually and correct all errors.
  154. </p>
  155. <li><A NAME="INSTUNIX">How to install/remove 3proxy under Unix/Linux</A>
  156. <p>
  157. Complie 3proxy (see <A HREF="#COMPILE">Compilation</A>). Copy
  158. executables to any appropriate location (for example /usr/local/3proxy/sbin
  159. for servers and /usr/local/3proxy/bin for utilities).
  160. Create /usr/local/etc/3proxy.cfg.
  161. (see <A HREF="#SERVER">Server configuration</A>).
  162. You can change default configuration file location by specifing configuration file
  163. in 3proxy command line.
  164. Add 3proxy to system startup scripts.
  165. </p>
  166. </ul>
  167. <hr>
  168. <li><A NAME="SERVER">Server configuration</A>
  169. <p>
  170. <ul>
  171. <li><a name="NOTHING">How to make 3proxy start</a>
  172. <p>Valid configuration file is required.
  173. <li><a name="IMITS">How to make limitation (access, bandwidth, traffic, connections) work</a>
  174. <p> Most probable reasons for non-working limitations: 'auth none' or no auth is used. For any ACL based feature one of 'iponly', 'nbname' or 'strong' auths required. Sequence of commands may be invalid. Commands are executed one-by-one and 'proxy', 'tcppm', 'socks' or another service commands must follow valid configuration. Invalid sequence of ACLs. First matching ACL is used (except of internal redirections, see below). If ACL contains at least one records last record is assumed to be 'deny *'.
  175. <li><a name="SERVICE">How to make 3proxy to run as a service</a>
  176. <p>Possible reasons for 3proxy starts manually but fails to start as a service:
  177. <ul>
  178. <li>there are relative paths in configuration file for included files,
  179. log files, etc. Always use absolute paths. For example
  180. $"c:\3proxy\networks.local" instead of $networks.local. For debugging remove
  181. 'service' and 'daemon', log to stdout an try to execute 3proxy from command
  182. line from some different directory (for example from disk root).
  183. <li>SYSTEM account doesn't have access to executable file, configuration files,
  184. log files, etc.
  185. <li>configuration files is not located in default path (3proxy.cfg in same
  186. location with 3proxy.exe). For alternative configuration file location use
  187. <pre>
  188. 3proxy --install full_path_to_configuration_file
  189. </pre>
  190. <li>user has no rights to install or start service
  191. <li>service is already installed and/or started
  192. </ul>
  193. <p><A NAME="INTEXT">How to understant internal and external</A>
  194. <p>
  195. Both internal and external IPs are IPs of the host running 3proxy itself.
  196. This configuration option is usefull in situation 3proxy is running on the
  197. border host with 2 (or more) connections: e.g. LAN and WAN with different IPs
  198. <pre>
  199. LAN connection +-------------+ Internet connection
  200. LAN <-------------->| 3proxy host |<-------------------> INTERNET
  201. ^+-------------+^
  202. | |
  203. Internal IP External IP
  204. </pre>
  205. If 3proxy is used on the host with single connection, both internal and
  206. external are usually same IP.
  207. <br>Internal should exist and be UP on the moment 3proxy is started and
  208. should never be disconnected/DOWN. If this interface is periodically
  209. disconnected (e.g. direct link between 2 hosts), do not specify internal
  210. address or use 0.0.0.0 instead. In this case, if you have 2 or more
  211. interfaces you must use firewall (preferably) or 3proxy ACLs to avoid open
  212. proxy situation.
  213. <br>
  214. External IP (if specified) must exist in the momet 3proxy
  215. serves client request. If external interface is no specified (or 0.0.0.0),
  216. system select external IP. It may be possible to access resources of internal
  217. network, to prevent this use ACLs. In addition, SOCKSv5 will not support BIND
  218. operation, required for incoming connections (this operation is quite rarely
  219. implemented in SOCKSv5 clients and usually is not required). In case of
  220. dynamic address, do not specify external or use external 0.0.0.0 or, if
  221. external address is required, create a script to determine current external
  222. IP and save it to file, and use external "$path_to_file" with "monitor" command
  223. to automatically reload configuration on address change.
  224. <li><a name="ODBC">How to make ODBC logging work?</a>
  225. <p>
  226. Check you use system DSN.
  227. Check SQL request is valid.
  228. The best way to check is to make file or stdout logging, get SQL request from log file or console and execute this request manually.
  229. Under Unix, you may also want to adjust 'stacksize' parameter.
  230. <li><a name="IPV6">How to make IPv6 work</a>
  231. <p> Proxy can not access destination directly over IPv6 if client requests IPv4 address.
  232. To access IPv6 destination, either IPv6 address or hostname must be used in request.
  233. Best solution is to enable option to resolve hostnames via proxy on client side.
  234. <li><a name="CRASH">How to fix 3proxy crashes</a>
  235. <p> default stacksize may be insufficient, if some non-default plugins
  236. are used (e.g. PAM and ODBC on Linux) or if compiled on some platforms with
  237. invalid system defined values (few versionds of FreeBSD on amd64).
  238. Problem can be resolved with 'stacksize' command or '-S' option starting 3proxy 0.8.4.
  239. <li><A NAME="SAMPLE">Where to find configuration example</A>
  240. <p>
  241. Server configuration example 3proxy.cfg.sample is in any 3proxy distribution.
  242. </p>
  243. <li><A NAME="LOGGING">How to set up logging</A>
  244. <p>
  245. 3proxy can log to stdout, file, ODBC datasource and
  246. syslog (Unix/Linux/Cygwin only). For using ODBC under Unix/Linux you must
  247. compile 3proxy with Unix ODBC libraries, see <A HREF="#COMPILE">Compilation</A>.
  248. You can control logging from 3proxy.cfg for all services or you can control
  249. logging of individual service, for example
  250. /usr/local/sbin/socks -l/var/log/socks.log starts SOCKS proxy with logging to file.
  251. For universal proxy (3proxy) log file rotation and archiving is supported.
  252. Log type is defined with "log" configuration file command or with
  253. -l switch on individual service invokation. log or -l is stdout logging.
  254. <pre>
  255. log filename
  256. </pre>
  257. and
  258. <pre>
  259. -lfilename
  260. </pre>
  261. specify filename for logging
  262. <pre>
  263. log @ident
  264. </pre>
  265. and
  266. <pre>
  267. -l@ident
  268. </pre>
  269. specify ident for syslog logging. If filename within "log" command contains
  270. '%' characters, it's processes as format specificator (see "logformat"). E.g.
  271. log c:\3proxy\logs\%y%m%d.log D creates file like c:\3proxy\logs\060729.log,
  272. date is generated based on local time.
  273. <pre>
  274. log &connstring
  275. </pre>
  276. specifies ODBC connection string, connstring is in format
  277. datasource,username,password (2 last are optional of
  278. datasource does not require or already has authentication information).
  279. Also, you must specify logformat to build SQL query, to insert recod into
  280. log, see <A HREF="#LOGFORMAT">How to setup logging format</A>
  281. </p>
  282. <p>
  283. Rotation and archiving may be set up with log, rotate ¨ archiver commands
  284. <pre>
  285. log filename LOGTYPE
  286. </pre>
  287. sets rotation type. LOGTYPE may be:
  288. <ul>
  289. <li>M, monthely
  290. <li>W, weekly
  291. <li>D, daily
  292. <li>H, hourly
  293. <li>C, minutely
  294. </ul>
  295. <pre>
  296. rotate NUMBER
  297. </pre>
  298. specifies number of files in rotation (that is how many files to keep).
  299. <pre>
  300. archiver EXT COMMAND PARAMETERS
  301. </pre>
  302. Sets external archiver. EXT is extention of archived files
  303. (for example zip, gz, Z, rar etc) COMMAND and PARAMETERS are command
  304. to execute and command line PARAMETERS. Originale file is not deleted by
  305. 3proxy, this work is left for archiver.
  306. You can pass original filename to archiver with %F macro and archive filename with %A.
  307. Examples are located in
  308. 3proxy.cfg.sample
  309. </p>
  310. <li><A NAME="LOGFORMAT">How to setup logging format</A>
  311. <p>
  312. Since 0.3 version log format may be set with "logformat" command.
  313. First symbol of log format specifies format of date and time and
  314. should be L (LOCAL) or G (GMT - Grinwitch Meridian Time). Format
  315. string may contains some macro substitutions:
  316. <ul>
  317. <li> %y - Year (2 digits)
  318. <li> %Y - Year (4 digits)
  319. <li> %m - Month (2 digits)
  320. <li> %o - mOnth (3 letter abbriviation)
  321. <li> %d - Day (2 digits)
  322. <li> %H - Hour (2 digits)
  323. <li> %M - Minute (2 digits)
  324. <li> %S - Second (2 digits)
  325. <li> %t - Timestamp (seconds since January, 1 1970 00:00:00 GMT)
  326. <li> %. - Milliseconds
  327. <li> %z - Timezone in mail format (from GMT, '+' east, '-' west HHMM), For example Moscow winter time is +0300.
  328. <li> %U - Username ('-' if unknown).
  329. <li> %N - Service name (PROXY, SOCKS, POP3P, etc)
  330. <li> %p - Service port
  331. <li> %E - Error code (see. <A HREF="#ERRORS">Log error codes reference</A>)
  332. <li> %C - client IP
  333. <li> %c - client port
  334. <li> %R - target IP
  335. <li> %r - target port
  336. <li> %e - external IP address used to establish connection
  337. <li> %Q - requested IP
  338. <li> %q - requested port
  339. <li> %I - bytes received from target
  340. <li> %O - bytes sent to target
  341. <li> %n - host name from request
  342. <li> %h - hops before target (if redirection or chaning is used).
  343. see <A HREF="#CHAIN">How to use chains and parent proxies</A>)
  344. <li> %T - service specific text (for example URL requested). %X-YT
  345. where X and Y are positive numbers, only displays fields
  346. (space delimited) X to Y of the text. An example is %1-2T.
  347. </ul>
  348. Example:
  349. <pre>
  350. logformat "L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
  351. </pre>
  352. generates something like
  353. <p><font face="courier">
  354. 1042454727.0296 SOCK4.1080 000 3APA3A 127.0.0.1:4739 195.122.226.28:4739 505 18735 1 GET http://3proxy.org/ HTTP/1.1
  355. </font>
  356. <br>(no line breaks)
  357. </p>
  358. <p>
  359. If ODBC used, logformat should specify SQL command,
  360. to insert record into log, for example
  361. <p><pre>
  362. logformat "-\'+_GINSERT INTO proxystat VALUES (%t, '%c', '%U', %I)"</pre>
  363. <br>(no line breaks)
  364. <br>-\'+_ instructs to replace characters \ and ' with _
  365. </p>
  366. <li><A NAME="LOGANALIZERS">How to use log analizers with 3proxy</A>
  367. <p>
  368. Just make format of 3proxy logs compatible with format supported by your
  369. favourite log analizer. Examples of compatible logformats are:
  370. <br>
  371. For Squid access.log:
  372. <p><font face="courier">
  373. &quot;- +_G%t.%. %D %C TCP_MISS/200 %I %1-1T %2-2T %U DIRECT/%R application/unknown&quot;
  374. </p>
  375. or, more compatible format without %D
  376. <pre>
  377. &quot;- +_G%t.%. 1 %C TCP_MISS/200 %I %1-1T %2-2T %U
  378. DIRECT/%R application/unknown&quot;
  379. </pre>
  380. ISA 2000 proxy WEBEXTD.LOG (fields are TAB-delimited):
  381. <pre>
  382. &quot;- + L%C %U Unknown Y %Y-%m-%d %H:%M:%S
  383. w3proxy 3PROXY - %n %R %r %D
  384. %O %I http TCP %1-1T %2-2T - -
  385. %E - - -&quot;
  386. </pre>
  387. ISA 2004 proxy WEB.w3c (fields are TAB-delimited):
  388. <pre>
  389. &quot;- + L%C %U Unknown %Y-%m-%d %H:%M:%S
  390. 3PROXY - %n %R %r %D %O
  391. %I http %1-1T %2-2T - %E -
  392. - Internal External 0x0 Allowed&quot;
  393. </pre>
  394. ISA 2000/2004 firewall FWSEXTD.log (fields are TAB-delimited):
  395. <pre>
  396. &quot;- + L%C %U unnknown:0:0.0 N %Y-%m-%d
  397. %H:%M:%S fwsrv 3PROXY - %n %R %r
  398. %D %O %I %r TCP Connect - -
  399. - %E - - - - -&quot;
  400. </pre>
  401. HTTPD standard log (Apache and others):
  402. <p><font face="courier">
  403. &quot;-&quot;&quot;+_L%C - %U [%d/%o/%Y:%H:%M:%S %z] &quot;&quot;%T&quot;&quot; %E %I&quot;
  404. </p>
  405. or more compatible without error code
  406. <p><font face="courier">
  407. &quot;-&quot;&quot;+_L%C - %U [%d/%o/%Y:%H:%M:%S %z] &quot;&quot;%T&quot;&quot; 200 %I&quot;
  408. </p>
  409. <li><A NAME="LAUNCH">How to start any of proxy services (HTTP, SOCKS etc)</A>
  410. <p>
  411. 3proxy is distributed in 2 variants: as a set of standalone modules (proxy,
  412. socks, pop3p, tcppm, udppm) and as universal proxy server. These services are
  413. absolutely independant, and if you use 3proxy you needn't any of standalone
  414. modules.
  415. <br>Standalone modules are only configurable via command line interface while
  416. 3proxy uses configuration file. Many functions, such as ODBC logging, log
  417. rotation, access control, etc are only available in 3proxy, not in standalone
  418. proxies.
  419. Standalone module may be started from command line, for example:
  420. <pre>
  421. $/sbin/socks -l/var/log/socks.log -i127.0.0.1
  422. </pre>
  423. Starts SOCKS server binded to localhost ip, port 1080 with logging to
  424. /var/log/socks.log.
  425. You can get help for any standalone service with -? command line option.
  426. </p><p>
  427. If 3proxy is used you should start all services in 3proxy.cfg file. 3proxy.cfg
  428. is executed by 3proxy as a batch file. Example of 3proxy.cfg and command syntaxys
  429. can be found in
  430. 3proxy.cfg.sample.
  431. <pre>
  432. log /var/log/3proxy.log D
  433. rotate 30
  434. internal 127.0.0.1
  435. external 192.168.1.1
  436. proxy
  437. socks -p3129
  438. pop3p
  439. </pre>
  440. Starts 3 services: HTTP PROXY, SOCKS and POP3 PROXY. Each listens localhost
  441. interface with default port (3128 for HTTP, 1080 for SOCKS and 110 for POP3P)
  442. except socks started with port 3129.
  443. All logs are in file /var/log/3proxy.log (with daily date modification and
  444. rotation). 30 last files are stored.
  445. </p>
  446. <li><A NAME="BIND">How to bind service to specific interface and port?</A>
  447. <p>
  448. -i options specifies internal interface, -p - listening port. No space are
  449. allowed. To bind 'proxy' service to port 8080 on interfaces 192.168.1.1
  450. and 192.168.2.1 use
  451. <pre>
  452. proxy -p8080 -i192.168.1.1
  453. proxy -p8080 -i192.168.2.1
  454. </pre>
  455. </p>
  456. <li><a name="NAMES">How to resolve names through a parent proxy</a></li>
  457. <p>
  458. <i>A:</i> Use one of proxy, connect+, socks4+ or socks5+ as a parent type. 3proxy
  459. itself still performs a name resolution, it's required e.g. to ACLs matching.
  460. So, if no name resolution must be performed by 3proxy itself add a command
  461. <pre>
  462. fakeresolve</pre>
  463. this command resolves any name to 127.0.0.2 address.
  464. </p>
  465. <li><a name="ISFTP"><i>How to setup FTP proxy</i></a></li>
  466. <p>
  467. There is FTP over HTTP (what is called FTP proxy in browsers) and FTP over FTP ¯à®ªá¨
  468. (what is called FTP proxy in file managers and FTP clients). For browsers, there is no need to start additional
  469. proxy service, 'proxy' supports FTP over HTTP, configure 'proxy' port as an FTP proxy. For ftp clients and file
  470. managers use ftppr. FTP proxy supports both active and passive mode with client, but always use passive mode with FTP servers.
  471. </p>
  472. <li><A NAME="AUTH">How to limit service access</A>
  473. <p>
  474. First, always specify internal interface to accept incoming connection with
  475. 'internal' configuration command or '-i' service command. (See
  476. <A HREF="#LAUNCH">How to start any of proxy services (HTTP, SOCKS etc)</A>). If
  477. no internal interface is specified your proxy will act as open one.
  478. <p>It's also important to specify external interface to prevent access to
  479. internal network with 'external' or -e.
  480. <p>3proxy with configuration files allows to use authentication and
  481. authorization for user's access. Authentication is possible by
  482. username/password or user's NetBIOS name. Authentication type is specified by
  483. 'auth' command.
  484. <pre>
  485. auth none
  486. </pre>
  487. Disables both authentication and authorization. You can not use ACLs.
  488. <pre>
  489. auth iponly
  490. </pre>
  491. Specifies no authentication, ACLs authorization is used.
  492. <pre>
  493. auth nbname
  494. </pre>
  495. Authentication by NetBIOS name + ACLs. NetBIOS name of 'messenger' service
  496. is obrained before ACL validation. If no name is obtained it's assumed to be
  497. empty. Messenger is started by default in Windows NT/2000/XP. For Win9x
  498. WinPopUP need to be launched. This type of authentication may be spoofed
  499. by privileged local user.
  500. <pre>
  501. auth strong
  502. </pre>
  503. Authentication by username/password. If user is not registered his
  504. access is denied regardless of ACLs.
  505. <p>
  506. Different services can have different authentication levels.
  507. <pre>
  508. auth none
  509. pop3p
  510. auth iponly
  511. proxy
  512. auth strong
  513. socks
  514. </pre>
  515. It's possible to authorize access by client IP address, IP address or requested resource,
  516. target port, time, etc after authentication.
  517. (See <A HREF="#ACL">How to limit resource access</A>).
  518. </p><p>Since 0.6 version double authentication is possible, e.g.
  519. <pre>
  520. auth iponly strong
  521. allow * * 192.168.0.0/16
  522. allow user1,user2
  523. proxy
  524. </pre>
  525. strong authentication will only be used if ACL requires username to deside if
  526. access must be granted. That is, in example, strong username authentication
  527. is not required to access 192.168.0.0/16
  528. </p><p>0.6 version introduces authentication (username) caching to increase
  529. productivity. It's recommended to use authentication caching with resource
  530. or time consuming authentication types, such as nbname or external plugins
  531. (WindowsAuthentication).
  532. Caching can be set with 'authcache' command with 2 parameters: caching type
  533. and caching time (in seconds). Caching type defines the type of cached access:
  534. 'ip' - after successful authentication all connections during caching time
  535. from same IP are assigned to the same user, username is not requested.
  536. "ip,user" - username is requested and all connections from the same IP are
  537. assigned to the same user without actual authentication. "user" - same as above,
  538. but IP is not checked. "user,password" - username and password are checked
  539. against cached ones. For authentication special authentication type 'cache'
  540. must be used.
  541. Example:
  542. <pre>
  543. authcache ip 60
  544. auth cache strong windows
  545. proxy -n
  546. </pre>
  547. </p>
  548. Please note, that caching affects security. Never use caching for access to
  549. critical resources, such as web administration.
  550. <p>authcache can be used to bind user's sessions to ip with 'limit' option, with
  551. <pre>
  552. autchcache ip,user,pass,limit 120
  553. auth cache strong</pre>
  554. user will not be able to use more than a single IP during cache time (120 sec).
  555. </p>
  556. <li><A NAME="USERS">How to create user list</A>
  557. <p>
  558. Userslist is created with 'users' command.
  559. <pre>
  560. users USERDESC ...
  561. </pre>
  562. With a single command it's possible to define few users, or you
  563. can use few 'users' commands. USERDESC is user description. Description
  564. consists of three semicolon delimited parts - login, password type and
  565. <pre>
  566. users admin:CL:bigsecret test:CL:password test1:CL:password1
  567. users "test2:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY49."
  568. users test3:NT:BD7DFBF29A93F93C63CB84790DA00E63
  569. </pre>
  570. Please note the usage of quotation sign: it's required to comment out $ sign
  571. overwise used as a file inclusion macro.
  572. Next password types are available:
  573. <ul>
  574. <li>No password type: use system authentication.
  575. <li>CL - cleartext password
  576. <li>CR - crypt password, only MD5 crypt passwords are supported
  577. <li>NT - NT-hashed (MD4) passwords in hex, as used in pwdump or SAMBA
  578. </ul>
  579. NT and crypt passwords can be used to import accounts from Windows/SAMBA or
  580. Unix. For Windows you can use pwdump family of utilities.
  581. It's convenient to store accounts apart and include account file with $ macro.
  582. Because for included files newlines are treated as a space, it's possible to
  583. use atandard passwd file format:
  584. <pre>
  585. users $/etc/.3proxypasswd
  586. </pre>
  587. or
  588. <pre>
  589. users $"c:\Program Files\3proxy\passwords"
  590. </pre>
  591. It's possible to create NT and crypt passwords with mycrypt utility included
  592. in distribution.
  593. <br>Userlist is system-wide. To manage user access to specific service use ACLs.
  594. </p>
  595. <li><A NAME="ACL">How to limit user access to resources</A>
  596. <p>
  597. Commands allow, deny and flush are used to manage ACLs:
  598. <p><font face="courier">
  599. allow &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt; &lt;weekdaylist&gt; &lt;timeperiodlist&gt;
  600. <br>deny &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;weekdaylist&gt; &lt;timeperiodlist&gt;
  601. <br>flush
  602. </font>
  603. </p>
  604. 'flush' command is used to finish with existing ACL and to start new one.
  605. It's required to have different ACLs for different services.
  606. 'allow' is used to allow connection and 'deny' to deny connection. 'allow'
  607. command can be extended by 'parent' command to manage redirections (see <A href="#REDIR">How to manage redirections</A>)). If ACL
  608. is empty it allow everything. If ACL is not empty, first matching ACL entry
  609. is searched for user request and ACL action (allow or deny) performed. If
  610. no matching record found, connection is denied and user will be asked to
  611. re-authenticate (requested for username/password). To prevent this request
  612. add 'deny *' to the end of list.
  613. <ul>
  614. <li>&lt;userlist&gt; - comma delimited list of users
  615. <li>&lt;sourcelist&gt; - comma delimited list of source (client) networks.
  616. Networks can be defined as single IP address or in CIDR form
  617. xxx.yyy.zzz.mmm/l, where l - is the length of network mask
  618. (a number of non-zero bits). 192.168.1.0/24
  619. means network with 255.255.255.0 mask.
  620. <li>&lt;targetlist&gt; - comma delimited list of target (server) networks.
  621. In 3proxy 0.6 and above it's allowed to use hostnames with wildmasks
  622. in targetlist. Wildmask may only present in the begginning or at the
  623. end of the hostname, e.g.
  624. 192.168.0.0/16,www.example.com,*wrongsite.com,*wrongcontent*.
  625. <li>&lt;targetportlist&gt; - comma delimited list of ports. I
  626. It's possible to define port ranges with -, e.g. 80,1024-65535
  627. means port 80 and all unprivileged ports.
  628. <li>&lt;commandlist&gt; - the list of allowed actions
  629. <br> CONNECT - establish outgoing TCP connection. e.g. POP3 or SOCKSv5
  630. <br> BIND - allow incoming TCP connection (SOCKSv5)
  631. <br> UDPASSOC - create UDP association (SOCKSv5)
  632. <br> ICMPASSOC - create ICMP association (not implemented)
  633. <br> HTTP_GET - HTTP GET request (HTTP proxy)
  634. <br> HTTP_PUT - HTTP PUT request (HTTP proxy)
  635. <br> HTTP_POST - HTTP POST request (HTTP proxy)
  636. <br> HTTP_HEAD - HTTP HEAD request (HTTP proxy)
  637. <br> HTTP_CONNECT - HTTP CONNECT, aka HTTPS request (HTTP proxy)
  638. <br> HTTP_OTHER - another HTTP request (HTTP proxy)
  639. <br> HTTP - any HTTP request except HTTP_CONNECT (HTTP proxy)
  640. <br> HTTPS - alias to HTTP_CONNECT (HTTP proxy)
  641. <br> FTP_GET - FTP get request (http, ftp proxy)
  642. <br> FTP_PUT - FTP put request (ftp proxy)
  643. <br> FTP_LIST - FTP list request (http, ftp proxy)
  644. <br> FTP - any FTP request
  645. <br> ADMIN - administration interface access
  646. <p>
  647. <li>&lt;weeksdays&gt; - week days numbers or periods (0 or 7 means Sunday, 1 is Monday, 1-5 means Monday through Friday).
  648. <li>&lt;timeperiodlists&gt; - a list of time periods in HH:MM:SS-HH:MM:SS format. For example,
  649. 00:00:00-08:00:00,17:00:00-24:00:00 lists non-working hours.
  650. </ul>
  651. * in ACL means &quot;any&quot;.
  652. Usage examples could be found in 3proxy.cfg.sample.
  653. </p>
  654. <li><A NAME="REDIR">How to manage redirections</A>
  655. <p>
  656. Redirections are usefull to e.g. forward requests from specific clients
  657. to different servers or proxy server. Additionally, redirections are usefull
  658. to convert proxy interface from ont format to another, e.g. requests from
  659. SOCKS proxy can be redirected to parent HTTP proxy, or SOCKSv5 client can be
  660. redirected to SOCKSv4 proxy.
  661. <br>Because 3proxy understand "transparent" web request, it can be used as an
  662. intermediate software between HTTP proxy and NAT server for transparent HTTP
  663. forwarding, because it can convert "Web server" request issued by client to
  664. "proxy request" required by proxy server. A simplest redirection is:
  665. <pre>
  666. auth iponly
  667. allow *
  668. parent 1000 http 192.168.1.1 3128
  669. proxy
  670. </pre>
  671. All trafiic of HTTP proxy is redirected to parent proxy 192.168.1.1 port 3128.
  672. <br>If port number is '0', IP address from 'parent' is used as external address
  673. for this connection (that is like -eIP, but only for connections matching
  674. 'allow').
  675. <br>Special case of redirection are local redirections. In this case both IP is
  676. 0.0.0.0 and port is 0. It's only usseful with SOCKS service. In this case no
  677. new connection is established, but request is parsed by corresponding local
  678. service. E.g.:
  679. <pre>
  680. auth iponly
  681. allow * * * 80
  682. parent 1000 http 0.0.0.0 0
  683. allow * * * 21
  684. parent 1000 ftp 0.0.0.0 0
  685. allow * * * 110
  686. parent 1000 pop3 0.0.0.0 0
  687. socks
  688. </pre>
  689. In this case all SOCKS traffic with destination port 80 is forwarded to local
  690. 'proxy' service, destination port 21 to 'ftppr' and 110 to 'pop3pr'. There is
  691. no need to run these services expicitly. Local redirections are usefull if
  692. you want to see and control via ACLs protocol specific parameters, e.g.
  693. filenames requests thorugh FTP while clients are using SOCKS.
  694. </p>
  695. <li><a name="SOCKSREDIR">Š ª ã¯à ¢«ïâì «®ª «ì­ë¬¨ ¯¥à¥­ ¯à ¢«¥­¨ï¬¨</a>
  696. <p>
  697. <p><i>Q: What is it for?</i></p>
  698. A: To have control based on request and to have URLs and another protocol specific parameters to be logged.
  699. <p><i>Q: What are restrictions?</i></p>
  700. A: It's hard to redirect services for non-default ports; Internet Explorer supports only SOCKSv4 with no password authentication (Internet Explorer sends username, but not password), for SOCKSv5 only cleartext password authentication is supported.
  701. <p><i>Q: What are advantages?</i></p>
  702. A: You need only to setup SOCKS proxy in browser settings. You can use socksifier, i.e. FreeCAP or SocksCAP with application which is not proxy aware.
  703. <p><i>Q: How to setup?</i></p>
  704. A: You should specify parent proxy with IP of 0.0.0.0 and port 0. Examples:
  705. <pre>
  706. auth iponly
  707. allow * * * 80,8080-8088
  708. parent 1000 http 0.0.0.0 0
  709. allow * * * 80,8080-8088
  710. #redirect ports 80 and 8080-8088 to local HTTP proxy
  711. #Second allow is required, because ACLs are checked
  712. #twice: first time by socks and second by http proxy.
  713. allow * * * 21,2121
  714. parent 1000 ftp 0.0.0.0 0
  715. allow * * * 21,2121
  716. #redirect ports 21 and 2121 to local
  717. #ftp proxy
  718. allow *
  719. #allow rest of connections directly
  720. socks
  721. #now let socks server to start
  722. </pre>
  723. <p><i>Q: How it affects different ACL rules</i></p>
  724. A: After local redirections rules are applied again to protocol-level request. Redirection rule itself is skipped. It makes it possible to redirect request again on the external proxy depending on request itself.
  725. <pre>
  726. allow * * * 80,8080-8088
  727. parent 1000 http 0.0.0.0 0
  728. #redirect http traffic to internal proxy
  729. allow * * $c:\3proxy\local.nets 80,8080-8088
  730. #allow direct access to local.nets networks
  731. allow * * * 80,8080-8088
  732. parent 1000 http proxy.3proxy.org 3128
  733. #use parent caching proxy for rest of the networks
  734. allow *
  735. #allow direct connections for rest of socks
  736. #requests
  737. </pre>
  738. <li><A NAME="ROUNDROBIN">How to balance traffic between few external channgels?</A>
  739. <p>
  740. Proxy itself doesn't manage network level routing. The only way to control
  741. outgoing channel is to select external interface. It's possible to make
  742. external interface (what is usually selected with 'external' command or
  743. '-e' option) random by using local redirection with external port 0.
  744. <pre>
  745. auth iponly
  746. allow *
  747. parent 500 http 10.1.1.101 0
  748. parent 500 http 10.2.1.102 0
  749. </pre>
  750. Now external interface is randomly selected with 0.5 probability between
  751. 10.1.1.101 and 10.2.1.102. To work as expected, different default routes
  752. must between 2 interfaces.
  753. used
  754. <p>
  755. If both interface addresses are in same network, e.g. 10.1.1.101 and 10.1.1.102
  756. and you want to select random gateway between 10.1.1.1 and 10.1.1.2, you must
  757. control it by using routing table, in case there is no default gateway route
  758. for Windows:
  759. <pre>
  760. route add -p 10.1.1.1 10.1.1.101
  761. route add -p 10.1.1.2 10.1.1.102
  762. route add -p 0.0.0.0 mask 0.0.0.0 192.168.1.1
  763. route add -p 0.0.0.0 mask 0.0.0.0 192.168.1.2
  764. </pre>
  765. If you have no second address yet, just add it. Under Linux/Unix it's better
  766. to use source routing.
  767. </p>
  768. <li><A NAME="CHAIN">How to manage proxy chains</A>
  769. <p>
  770. parent command may also be used to build a proxy chains. In this case
  771. few 'parent' commands are used for single 'allow' rule with different
  772. weights (first argument of parent command). Chain may contain any number
  773. of proxy servers, but it should be noted that every hope significantly
  774. reduces productivity. It's possible to mix different types of proxy within
  775. single chain: HTTPS (HTTP connect), SOCKS4, SOCKS5. Weight different from
  776. 1000 is used to build random chains. if weight W is below 1000, this proxy
  777. will be used as a next chain hop with probability of W/1000. That is, if
  778. the weight is 250 probability this proxy will be used for the next hope is
  779. 25%. 'parent' records with common weight of 1000 establish a group, one of
  780. these record will be used for the hop with probability according to weight.
  781. Warning: each group must have a weight even of 1000. As follows, common
  782. weight of all 'parent' records must also be even of 1000. If common weight
  783. of 'parent' records in te chain is 3000, chain has 3 hops and must be formed
  784. of 3 groups. Example:
  785. <pre>
  786. allow *
  787. parent 500 socks5 192.168.1.1 1080
  788. parent 500 connect 192.168.10.1 3128
  789. </pre>
  790. In this case we have 1 parent proxy (1 hop) which is randomely choosen between
  791. 2 hosts: 192.168.1.1 and 192.168.10.1. 2 records form a single group.
  792. <pre>
  793. allow * * * 80
  794. parent 1000 socks5 192.168.10.1 1080
  795. parent 1000 connect 192.168.20.1 3128
  796. parent 300 socks4 192.168.30.1 1080
  797. parent 700 socks5 192.168.40.1 1080
  798. </pre>
  799. In this case we have 3 groups (3 hops in the chain). First hop is 192.168.10.1,
  800. second hop is 192.168.20.1 and 3rd one is either 192.168.30.1 with probability
  801. of 30% or 192.168.40.1 with probability of 70%.
  802. </p>
  803. <li><A NAME="BANDLIM">How to limit bandwidth</A>
  804. <p>
  805. 3proxy supports bandwidth filters. To manage filters bandlimin/bandlimout and
  806. nobandlimin/nobandlimout. 'in' means incoming and 'out' - outgoing traffic.
  807. <p><font face="courier">
  808. bandlimin &lt;bitrate&gt; &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  809. <br>nobandlimin &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  810. </font>
  811. </p>
  812. Commands are applied to all services. Imagine bandwidth filters as a series of
  813. pipes. Bitrate is a pipe's width and ACLs controls the flow thorugh this pipe.
  814. <pre>
  815. bandlimin 57600 * 192.168.10.16
  816. bandlimin 57600 * 192.168.10.17
  817. bandlimin 57600 * 192.168.10.18
  818. bandlimin 57600 * 192.168.10.19
  819. </pre>
  820. Create 4 separete pipes for 4 client with emulation of modem connection.
  821. <pre>
  822. bandlimin 57600 * 192.168.10.16/30
  823. </pre>
  824. Create single pipe for all 4 clients. That is 4 clients share modem connection.
  825. In this example:
  826. <pre>
  827. nobandlimin * * * 110
  828. bandlimin 57600 * 192.168.10.16/32
  829. </pre>
  830. mail traffic from POP3 servers bypasses the pipe and has no bandwidth
  831. limitation.
  832. </p>
  833. <li><A NAME="TRAFLIM">How to limit traffic amount</A>
  834. <p>
  835. <p><font face="courier">
  836. counter &lt;filename&gt; &lt;type&gt; &lt;reportpath&gt;
  837. <br>countin &lt;number&gt; &lt;type&gt; &lt;amount&gt; &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  838. <br>nocountin &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  839. <br>countout &lt;number&gt; &lt;type&gt; &lt;amount&gt; &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  840. <br>nocountout &lt;userlist&gt; &lt;sourcelist&gt; &lt;targetlist&gt; &lt;targetportlist&gt; &lt;commandlist&gt;
  841. </font>
  842. </p>
  843. <p>
  844. You can set traffic limit per day (D), week (W), month (M), year (Y) or
  845. absolute ('N'), as specified by 'type' argument of counterin command.
  846. Traffic information is stored in binary file specified by 'filename' argument.
  847. countersutil utility can be used to manage this file.
  848. reportpath specifies location of text reports, type parameter of 'counter'
  849. command controls how often text reports are created. amount is amount of
  850. allowed traffic in Megabytes (MB). nocountin allows you to set exclusions.
  851. </p>
  852. <li><a name="TRAF"><i>How to fix incorrect traffic accounting</i></a>
  853. <p>3proxy accounts protocol level traffic. Provider counts channel or IP-level traffic with network and transport headers. In additions, 3proxy doesn't counts DNS resolutions, pings, floods, scans, etc. It makes approx. 10% of difference. That's why you should have 15% reserve if you use 3proxy to limit your traffic. If difference with your provider is significantly above 10% you should look for traffic avoiding proxy server, for example connections through NAT, traffic originated from the host with proxy installed, traffic from server applications, etc.
  854. <li><a name="NSCACHING"><i>How to configure name resolution and DNS caching</i></a>
  855. <p>
  856. For name resolution and caching use commands nserver, nscache / nscache6 and nsrecord.
  857. <pre>
  858. nserver 192.168.1.2
  859. nserver 192.168.1.3:5353/tcp</pre>
  860. sets DNS resolvers. 192.168.1.3 will be used via TCP/5353 (instead of default UDP/53)
  861. only if 192.168.1.2 fails. Up to 5 nservers may be specified.
  862. If no nserver is configured, default system name resolution functions are used.
  863. <pre>
  864. nscache 65535
  865. nscache6 65535</pre>
  866. sets name cache size for IPv4 and IPv6. Name cache must be large enouth, if presents.
  867. name cache is only used if nserver is configured.
  868. <pre>
  869. nsrecord server.mycompany.example.com 192.168.1.1
  870. nsrecord www.porno.com 127.0.0.2
  871. ...
  872. deny * * 127.0.0.2</pre>
  873. adds static nsrecords. Also, static nsrecords are used for dnspr, unless -s option is specified.
  874. Since 0.8 version, parent proxy may be configured for dnspr.
  875. </p>
  876. <li><a name="IPV6"><i>How to use IPv6</i></a>
  877. <p>
  878. IPv6 is supported since 0.8. Please note, some proxy protolos, e.g. SOCKSv4,
  879. do not support IPv6. SOCKSv5 supports IPv6 with special request type (must be
  880. implemented by client).
  881. <br>
  882. 3proxy supports proxying from IPv4 and IPv6 networks to IPv4,
  883. IPv6 and mixed networks. IPv6 address may be used in
  884. internal, external, parent commands, ACLs, -i and -e options,etc.
  885. external command and -e options may be given twice for each service - once with IPv4
  886. and once with IPv6 address. internal can be given only once, to bind to all IPv4 and
  887. IPv6 addresses use [0:0:0:0:0:0:0:0] or [::].
  888. <br>
  889. Any service may be configured with -4, -46, -64, -6 options to specify decied
  890. priority for name to IPv4/IPv6 address resolution (IPv4 only, IPv4 priority,
  891. IPv6 priority, IPv6 only).
  892. </p>
  893. <li><a name="CONNBACK"><i>How to use connect back</i></a>
  894. <p>
  895. In example, users needs access from external network to proxy server located
  896. on the host 192.168.1.2. This host can not be accessed from external network,
  897. but it has access to external network with with external address 1.1.1.1.
  898. Also, user has access to the host 2.2.2.2 (IP address may be dynamic) with
  899. hostname host.dyndns.example.org via external network. User needs 2 instances
  900. of 3proxy, first one on the host 192.168.1.2 with config
  901. <pre>
  902. users user:CL:password
  903. auth strong
  904. allow user
  905. proxy -rhost.dyndns.example.org:1234</pre>
  906. second one on the host.dyndns.example.org (2.2.2.2) with config
  907. <pre>
  908. auth iponly
  909. allow * * 1.1.1.1
  910. tcppm -R0.0.0.0:1234 3128 1.1.1.1 3128</pre>
  911. For browser settings proxy is host.dyndns.example.org:3128.
  912. </p>
  913. </ul>
  914. <hr>
  915. <li><A NAME="CLIENT">Client configuration</A>
  916. <p>
  917. <hr>
  918. <li><A NAME="ADMIN">Administering and information analisys</A>
  919. <p>
  920. <ul>
  921. <li><A NAME="NEWVERSION">How to obtain latest 3proxy version</A>
  922. <p>
  923. Latest version of 3proxy may be obtained
  924. <A HREF="http://3proxy.org/">here</A>.
  925. New version may have changes and incompatibilities with previous one in files
  926. format or commands. Please, read CHANGELOG file and another documentation
  927. before installing new version.
  928. </p>
  929. <li><A NAME="NTSERVICE">How to control 3proxy service under Windows NT/2000/XP</A>
  930. <p>
  931. If installed as system service, 3proxy understands Windows service commands
  932. for START, STOP, PAUSE and RESUME. If service is PAUSEd, no new connections
  933. are accepted while older connections are processed. Currently there is no
  934. support for dynamic configuration change, so, you have to restart service
  935. completely if you have changed any configuration.
  936. You can control 3proxy service via "Services" administration ot via "net" command:
  937. <pre>
  938. net start 3proxy
  939. net stop 3proxy
  940. net pause 3proxy
  941. net continue 3proxy
  942. </pre>
  943. </p>
  944. <li><A NAME="ERRORS">Log error codes reference</A>
  945. <p>
  946. <ul>
  947. <li>0 - Operation successfully complited (connection
  948. was closed by one of peers)
  949. <li>1-9 - AUTHENTICATION ERRORS
  950. <li>1 - Access denied by ACL (deny)
  951. <li>2 - Redirection (should not appear)
  952. <li>3 - No ACL found, denied by default
  953. <li>4 - auth=strong and no username in request
  954. <li>5 - auth=strong and no matching username in configuration
  955. <li>6 - User found, wrong password (cleartext)
  956. <li>7 - User found, wrong password (crypt)
  957. <li>8 - User found, wrong password (NT)
  958. <li>9 - Redirection data not found (should not appear)
  959. <li>10 - Traffic limit exceeded
  960. <li>11-19 - CONNECTION ERRORS
  961. <li>11 - failed to create socket()
  962. <li>12 - failed to bind()
  963. <li>13 - failed to connect()
  964. <li>14 - failed to getpeername()
  965. <li>20-29 - COMMON ERRORS
  966. <li>21 - memory allocation failed
  967. <li>30-39 - CONNECT PROXY REDIRECTION ERRORS
  968. <li>31 - failed to request HTTP CONNECT proxy
  969. <li>32 - CONNECT proxy connection timed out or wrong reply
  970. <li>33 - CONNECT proxy fails to establish connection
  971. <li>34 - CONNECT proxy timed out or closed connection
  972. <li>40-49 - SOCKS4 PROXY REDIRECTION ERRORS
  973. <li>50-69 - SOCKS5 PROXY REDIRECTION ERRORS
  974. <li>70-79 PARENT PROXY CONNECTION ERRORS (identical to 1x)
  975. <li>90-99 - established connection errors
  976. <li>since 0.9
  977. <li>90 - unexpected system error (should not happen)
  978. <li>91 - unexpected poll error (should not happen)
  979. <li>92 - connection terminated by timeout (see timeouts)
  980. <li>93 - connection terminated by ratelimit-related timeout or due to errors limit
  981. <li>94 - connection termination by server or client with unsent data
  982. <li>95 - dirty connection termination by client (or networking issue)
  983. <li>96 - dirty connection termination by server (or networking issue)
  984. <li>97 - dirty connection termination by both client and server (probably networking issue)
  985. <li>prior to 0.9:
  986. <li>90 - socket error or connection broken
  987. <li>91 - TCP/IP common failure
  988. <li>92 - connection timed out
  989. <li>93 - error on reading data from server
  990. <li>94 - error on reading data from client
  991. <li>95 - timeout from bandlimin/bandlimout limitations
  992. <li>96 - error on sending data to client
  993. <li>97 - error on sending data to server
  994. <li>98 - server data limit (should not appear)
  995. <li>99 - client data limit (should not appear)
  996. <li>100 - HOST NOT FOUND
  997. <li>200-299 - UDP portmapper specific bugs
  998. <li>300-399 - TCP portmapper specific bugs
  999. <li>400-499 - SOCKS proxy specific bugs
  1000. <li>500-599 - HTTP proxy specific bugs
  1001. <li>600-699 - POP3 proxy specific bugs
  1002. <li>999 - NOT IMPLEMENTED
  1003. </ul>
  1004. </p>
  1005. </ul>
  1006. <hr>
  1007. <li><A NAME="QUEST">How To ask quiestion not in How To?</A>
  1008. <p>
  1009. Ask it in <A HREF="https://github.com/z3APA3A/3proxy/issues">Github</A>.
  1010. Don't try to ask something before reading this document.
  1011. </ul>
  1012. </ul>