3proxy.cfg.3 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  1. .TH 3proxy.cfg "8" "January 2019" "3proxy 0.9" "Universal proxy server"
  2. .SH NAME
  3. .B 3proxy.cfg
  4. 3proxy configuration file
  5. .SH DESCRIPTION
  6. Common structure:
  7. .br
  8. Configuration file is a text file 3proxy reads configuration from. Each line
  9. of the file is a command executed immediately, as it was given from
  10. console. Sequence of commands is important. Configuration file as actually a
  11. script for 3proxy executable.
  12. Each line of the file is treated as a blank (space or tab) separated
  13. command line. Additional space characters are ignored.
  14. Think about 3proxy as "application level router" with console interface.
  15. .br
  16. Comments:
  17. .br
  18. Any string beginning with space character or \'#\' character is comment. It\'s
  19. ignored. <LF>s are ignored. <CR> is end of command.
  20. .br
  21. Quotation:
  22. .br
  23. Quotation character is " (double quote). Quotation must be used to quote
  24. spaces or another special characters. To use quotation character inside
  25. quotation character must be dubbed (BASIC convention). For example to use
  26. HELLO "WORLD" as an argument you should use it as "HELLO ""WORLD""".
  27. Good practice is to quote any argument you use.
  28. .br
  29. File inclusion:
  30. .br
  31. You can include file by using $FILENAME macro (replace FILENAME with a path
  32. to file, for example $/usr/local/etc/3proxy/conf.incl or
  33. $"c:\\\\Program Files\\3proxy\\include.cfg" Quotation is
  34. required in last example because path contains space character.
  35. For included file <CR> (end of line characters) is treated as space character
  36. (arguments delimiter instead of end of command delimiter).
  37. Thus, include files are only useful to store long signle-line commands
  38. (like userlist, network lists, etc).
  39. To use dollar sign somewhere in argument it must be quoted.
  40. Recursion is not allowed.
  41. .br
  42. Next commands start gateway services:
  43. .br
  44. .B proxy
  45. [options]
  46. .br
  47. .B socks
  48. [options]
  49. .br
  50. .B pop3p
  51. [options]
  52. .br
  53. .B ftppr
  54. [options]
  55. .br
  56. .B admin
  57. [options]
  58. .br
  59. .B dnspr
  60. [options]
  61. .br
  62. .B tcppm
  63. [options]
  64. <SRCPORT> <DSTADDR> <DSTPORT>
  65. .br
  66. .B udppm
  67. [options]
  68. <SRCPORT> <DSTADDR> <DSTPORT>
  69. .br
  70. Descriptions:
  71. .br
  72. .B proxy
  73. HTTP/HTTPS proxy (default port 3128)
  74. .br
  75. .B socks
  76. SOCKS 4/4.5/5 proxy (default port 1080)
  77. .br
  78. .B pop3p
  79. POP3 proxy (default port 110)
  80. .br
  81. .B ftppr
  82. FTP proxy (default port 21)
  83. .br
  84. .B admin
  85. Web interface (default port 80)
  86. .br
  87. .B dnspr
  88. caching DNS proxy (default port 53)
  89. .br
  90. .B tcppm
  91. TCP portmapper
  92. .br
  93. .B udppm
  94. UDP portmapper
  95. .br
  96. Options:
  97. .br
  98. .B -pNUMBER
  99. change default server port to NUMBER
  100. .br
  101. .B -n
  102. disable NTLM authentication (required if passwords are stored in Unix crypt format).
  103. .br
  104. .B -n1
  105. enable NTLMv1 authentication.
  106. .br
  107. .B -s
  108. (for admin) secure, allow only secure operations, currently only traffic counters
  109. view without ability to reset.
  110. .br
  111. (for dnspr) simple, do not use resolver and 3proxy cache, always use external DNS server.
  112. .br
  113. (for udppm) singlepacket, expect only one packet from both client and server
  114. .br
  115. .B -u
  116. Never ask for username/password
  117. .br
  118. .B -u2
  119. (for socks) require username/password in authentication methods
  120. .br
  121. .B -a
  122. (for proxy) anonymous proxy (no information about client reported)
  123. .br
  124. .B -a1
  125. (for proxy) anonymous proxy (random client information reported)
  126. .br
  127. .B -a2
  128. (for proxy) generate Via: and X-Forwared-For: instead of Forwarded:
  129. .br
  130. .B -6
  131. Only resolve IPv6 addresses. IPv4 addresses are packed in IPv6 in IPV6_V6ONLY compatible way.
  132. .br
  133. .B -4
  134. Only resolve IPv4 addresses
  135. .br
  136. .B -46
  137. Resolve IPv6 addresses if IPv4 address is not resolvable
  138. .br
  139. .B -64
  140. Resolve IPv4 addresses if IPv6 address is not resolvable
  141. .br
  142. .B -RHOST:port
  143. listen on given local HOST:port for incoming connections instead of making remote outgoing connection. Can be used with another 3proxy service running -r option for connect back functionality. Most commonly used with tcppm. HOST can be given as IP or hostname, useful in case of dynamic DNS.
  144. .br
  145. .B -rHOST:port
  146. connect to given remote HOST:port instead of listening local connection on -p or default port. Can be used with another 3proxy service running -R option for connect back functionality. Most commonly used with proxy or socks. HOST can be given as IP or hostname, useful in case of dynamic DNS.
  147. .br
  148. .B -ocOPTIONS, -osOPTIONS, -olOPTIONS, -orOPTIONS, -oROPTIONS
  149. options for proxy-to-client (oc), proxy-to-server (os), proxy listening (ol), connect back client (or), connect back listening (oR) sockets.
  150. Options like TCP_CORK, TCP_NODELAY, TCP_DEFER_ACCEPT, TCP_QUICKACK, TCP_TIMESTAMPS, USE_TCP_FASTOPEN, SO_REUSEADDR, SO_REUSEPORT, SO_PORT_SCALABILITY, SO_REUSE_UNICASTPORT, SO_KEEPALIVE, SO_DONTROUTE may be supported depending on OS.
  151. .br
  152. .B -DiINTERFACE, -DeINTERFACE
  153. bind internal interface / external inteface to given INTERFACE (e.g. eth0) if SO_BINDTODEVICE supported by system. You may need to run as root or to have CAP_NET_RAW capability in order to bind to interface, depending on system, so this option may require root privileges and can be incompatible with some configuraton commands like chroot and setuid (and daemon if setcap is used).
  154. .br
  155. .B -e
  156. External address. IP address of interface proxy should initiate connections
  157. from. External IP must be specified if you need incoming connections.
  158. By default system will deside which address to use in accordance
  159. with routing table.
  160. .br
  161. .B -i
  162. Internal address. IP address proxy accepts connections to.
  163. By default connection to any interface is accepted.
  164. .br
  165. .B -N
  166. (for socks) External NAT address 3proxy reports to client for BIND and UDPASSOC
  167. By default external address is reported. It's only useful in the case
  168. of IP-IP NAT (will not work for PAT)
  169. .br
  170. Also, all options mentioned for
  171. .BR proxy (8)
  172. .BR socks (8)
  173. .BR pop3p (8)
  174. .BR tcppm (8)
  175. .BR udppm (8)
  176. .BR ftppr (8)
  177. are also supported.
  178. .br
  179. Portmapping services listen at SRCPORT and connect to DSTADDR:DSTPORT
  180. HTTP and SOCKS proxies are standard.
  181. .br
  182. POP3 proxy must be configured as POP3 server and requires username in the form of:
  183. pop3username@pop3server. If POP3 proxy access must be authenticated, you can
  184. specify username as proxy_username:proxy_password:POP3_username@pop3server
  185. .br
  186. DNS proxy resolves any types of records but only hostnames are cached. It
  187. requires nserver/nscache to be configured. If nserver is configured as TCP,
  188. redirections are applied on connection, so parent proxy may be used to resolve
  189. names to IP.
  190. .br
  191. FTP proxy can be used as FTP server in any FTP client or configured as FTP
  192. proxy on a client with FTP proxy support. Username format is one of
  193. .br
  194. FTPuser@FTPServer
  195. .br
  196. FTPuser:FTPpassword@FTPserver
  197. .br
  198. proxyuser:proxypassword:FTPuser:FTPpassword@FTPserver
  199. .br
  200. Please note, if you use FTP client interface for FTP proxy do not add FTPpassword and FTPServer to username, because FTP client does it for you. That is, if you use 3proxy with authentication use proxyuser:proxypassword:FTPuser as FTP username, otherwise do not change original FTP user name
  201. .br
  202. .B include
  203. <path>
  204. .br
  205. Include config file
  206. .br
  207. .B config
  208. <path>
  209. .br
  210. Path to configuration file to use on 3proxy restart or to save configuration.
  211. .br
  212. .B writable
  213. .br
  214. ReOpens configuration file for write access via Web interface,
  215. and rereads it. Usually should be first command on config file
  216. but in combination with config
  217. it can be used anywhere to open
  218. alternate config file. Think twice before using it.
  219. .br
  220. .B end
  221. .br
  222. End of configuration
  223. .br
  224. .B log
  225. [[@|&]logfile] [<LOGTYPE>]
  226. .br
  227. sets logfile for all gateways
  228. .br
  229. @ (for Unix) use syslog, filename is used as ident name
  230. .br
  231. & use ODBC, filename consists of comma-delimited datasource,username,password (username and password are optional)
  232. .br
  233. radius - use RADIUS for logging
  234. .br
  235. LOGTYPE is one of:
  236. .br
  237. M Monthly
  238. .br
  239. W Weekly (starting from Sunday)
  240. .br
  241. D Daily
  242. .br
  243. H Hourly
  244. .br
  245. if logfile is not specified logging goes to stdout. You can specify individual logging options for gateway by using -l
  246. option in gateway configuration.
  247. .br
  248. log command supports same format specifications for filename template
  249. as "logformat" (if filename contains \'%\' sign it\'s believed to be template).
  250. As with "logformat" filename must begin with \'L\' or \'G\' to specify Local or
  251. Grinwitch time zone for all time-based format specificators.
  252. .br
  253. .B rotate
  254. <n>
  255. how many archived log files to keep
  256. .br
  257. .B logformat
  258. <format>
  259. .br
  260. Format for log record. First symbol in format must be L (local time)
  261. or G (absolute Grinwitch time).
  262. It can be preceeded with -XXX+Y where XXX is list of characters to be
  263. filtered in user input (any non-printable characters are filtered too
  264. in this case) and Y is replacement character. For example, "-,%+ L" in
  265. the beginning of logformat means comma and percent are replaced
  266. with space and all time based elemnts are in local time zone.
  267. .br
  268. You can use:
  269. .br
  270. %y Year in 2 digit format
  271. .br
  272. %Y Year in 4 digit format
  273. .br
  274. %m Month number
  275. .br
  276. %o Month abbriviature
  277. .br
  278. %d Day
  279. .br
  280. %H Hour
  281. .br
  282. %M Minute
  283. .br
  284. %S Second
  285. .br
  286. %t Timstamp (in seconds since 01-Jan-1970)
  287. .br
  288. %. milliseconds
  289. .br
  290. %z timeZone (from Grinvitch)
  291. .br
  292. %D request duration (in milliseconds)
  293. .br
  294. %b average send rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager.
  295. .br
  296. %B average receive rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager.
  297. .br
  298. %U Username
  299. .br
  300. %N service Name
  301. .br
  302. %p service Port
  303. .br
  304. %E Error code
  305. .br
  306. %C Client IP
  307. .br
  308. %c Client port
  309. .br
  310. %R Remote IP
  311. .br
  312. %r Remote port
  313. .br
  314. %i Internal IP used to accept client connection
  315. .br
  316. %e External IP used to establish connection
  317. .br
  318. %Q Requested IP
  319. .br
  320. %q Requested port
  321. .br
  322. %n requested hostname
  323. .br
  324. %I bytes In
  325. .br
  326. %O bytes Out
  327. .br
  328. %h Hops (redirections) count
  329. .br
  330. %T service specific Text
  331. .br
  332. %N1-N2T (N1 and N2 are positive numbers) log only fields from N1 thorugh N2 of service specific text
  333. .br
  334. in the case of ODBC logging logformat specifies SQL statement, for exmample:
  335. .br
  336. logformat "-\'+_Linsert into log (l_date, l_user, l_service, l_in, l_out, l_descr) values (\'%d-%m-%Y %H:%M:%S\', \'%U\', \'%N\', %I, %O, \'%T\')"
  337. .br
  338. .B logdump
  339. <in_traffic_limit> <out_traffic_limit>
  340. .br
  341. Immediately creates additional log records if given amount of incoming/outgoing
  342. traffic is achieved for connection, without waiting for connection to finish.
  343. It may be useful to prevent information about long-lasting downloads on server
  344. shutdown.
  345. .br
  346. .B archiver
  347. <ext> <commandline>
  348. .br
  349. Archiver to use for log files. <ext> is file extension produced by
  350. archiver. Filename will be last argument to archiver, optionally you
  351. can use %A as produced archive name and %F as filename.
  352. .br
  353. .B timeouts
  354. <BYTE_SHORT> <BYTE_LONG> <STRING_SHORT> <STRING_LONG> <CONNECTION_SHORT> <CONNECTION_LONG> <DNS> <CHAIN> <CONNECT> <CONNECTBACK>
  355. .br
  356. Sets timeout values, defaults 1, 5, 30, 60, 180, 1800, 15, 60, 15, 5.
  357. .br
  358. BYTE_SHORT short timeout for single byte, is usually used for receiving single byte from stream.
  359. .br
  360. BYTE_LONG long timeout for single byte, is usually used for receiving first byte in frame (for example first byte in socks request).
  361. .br
  362. STRING_SHORT short timeout, for character string within stream (for example to wait between 2 HTTP headers)
  363. .br
  364. STRING_LONG long timeout, for first string in stream (for example to wait for HTTP request).
  365. .br
  366. CONNECTION_SHORT inactivity timeout for short connections (HTTP, POP3, etc).
  367. .br
  368. CONNECTION_LONG inactivity timeout for long connection (SOCKS, portmappers, etc).
  369. .br
  370. DNS timeout for DNS request before requesting next server
  371. .br
  372. CHAIN timeout for reading data from chained connection
  373. .br
  374. default timeouts 1 5 30 60 180 1800 15 60 15 5
  375. .br
  376. .B radius
  377. <NAS_SECRET> <radius_server_1[:port][/local_address_1]> <radius_server_2[:port][/local_address_2]>
  378. .br
  379. Configures RADIUS servers to be used for logging and authentication (log and auth types
  380. must be set to radius). port and local address to use with given server may be specified.
  381. .br
  382. Attributes within request: User-Name, Password: (username and password if presented by client),
  383. Service Type: Authenticate-Only,
  384. NAS-Port-Type: NAS-Port-Virtual,
  385. NAS-Port-ID: (proxy service port, e.g. 1080),
  386. NAS-IPv6-Address / NAS-IP-Address: (proxy interface accessed by client),
  387. NAS-Identifier: (text identifing proxy, e.g. PROXY or SOCKSv5),
  388. Framed-IPv6-Address / Framed-IP-Address: (IP address of the client),
  389. Called-Station-ID: (requested Hostname, if presents),
  390. Login-Service: (type of request, e.g. 1001 - SOCKS CONNECT, 1010 - HTTP GET, 1013 - HTTP CONNECT),
  391. Login-TCP-Port: (requested port),
  392. Login-IPv6-Host / Login-IP-Host: (requested IP).
  393. .br
  394. Supported reply attributes for authentication:
  395. Framed-IP-Address / Framed-IPv6-Address (IP to assign to user), Reply-Message.
  396. Use authcache to speedup authentication. RADIUS feature is currently experimental.
  397. .br
  398. .B nserver
  399. <ipaddr>[:port][/tcp]
  400. .br
  401. Nameserver to use for name resolutions. If none specified
  402. system routines for name resolution is
  403. used. Optional port number may be specified.
  404. If optional /tcp is added to IP address, name resolution is
  405. performed over TCP.
  406. .br
  407. .B nscache
  408. <cachesize>
  409. .B nscache6
  410. <cachesize>
  411. .br
  412. Cache <cachesize> records for name resolution (nscache for IPv4,
  413. nscache6 for IPv6). Cachesize usually should be large enougth
  414. (for example 65536).
  415. .br
  416. .B nsrecord
  417. <hostname> <hostaddr>
  418. .br
  419. Adds static record to nscache. nscache must be enabled. If 0.0.0.0
  420. is used as a hostaddr host will never resolve, it can be used to
  421. blacklist something or together with
  422. .B dialer
  423. command to set up UDL for dialing.
  424. .br
  425. .B fakeresolve
  426. .br
  427. All names are resolved to 127.0.0.2 address. Usefull if all requests are
  428. redirected to parent proxy with http, socks4+, connect+ or socks5+.
  429. .br
  430. .B dialer
  431. <progname>
  432. .br
  433. Execute progname if external name can\'t be resolved.
  434. Hint: if you use nscache, dialer may not work, because names will
  435. be resolved through cache. In this case you can use something like
  436. http://dial.right.now/ from browser to set up connection.
  437. .br
  438. .B internal
  439. <ipaddr>
  440. .br
  441. sets ip address of internal interface. This IP address will be used
  442. to bind gateways. Alternatively you can use -i option for individual
  443. gateways. Since 0.8 version, IPv6 address may be used.
  444. .br
  445. .B external
  446. <ipaddr>
  447. .br
  448. sets ip address of external interface. This IP address will be source
  449. address for all connections made by proxy. Alternatively you can use -e
  450. option to specify individual address for gateway. Since 0.8 version
  451. External or -e can be given twice: once with IPv4 and once with IPv6 address.
  452. .br
  453. .B maxconn
  454. <number>
  455. .br
  456. sets maximum number of simulationeous connections to each services
  457. started after this command. Default is 100.
  458. .br
  459. .B service
  460. .br
  461. (depricated). Indicates 3proxy to behave as Windows 95/98/NT/2000/XP
  462. service, no effect for Unix. Not required for 3proxy 0.6 and above. If
  463. you upgraded from previous version of 3proxy use --remove and --install
  464. to reinstall service.
  465. .br
  466. .B daemon
  467. .br
  468. Should be specified to close console. Do not use \'daemon\' with \'service\'.
  469. At least under FreeBSD \'daemon\' should preceed any proxy service
  470. and log commands to avoid sockets problem. Always place it in the beginning
  471. of the configuration file.
  472. .br
  473. .B auth
  474. <authtype> [...]
  475. .br
  476. Type of user authorization. Currently supported:
  477. .br
  478. none - no authentication or authorization required.
  479. .br
  480. Note: is auth is none any ip based limitation, redirection, etc will not work.
  481. This is default authentication type
  482. .br
  483. iponly - authentication by access control list with username ignored.
  484. Appropriate for most cases
  485. .br
  486. useronly - authentication by username without checking for any password with
  487. authorization by ACLs. Useful for e.g. SOCKSv4 proxy and icqpr (icqpr set UIN /
  488. AOL screen name as a username)
  489. .br
  490. dnsname - authentication by DNS hostnname with authorization by ACLs.
  491. DNS hostname is resolved via PTR (reverse) record and validated (resolved
  492. name must resolve to same IP address). It\'s recommended to use authcache by
  493. ip for this authentication.
  494. NB: there is no any password check, name may be spoofed.
  495. .br
  496. strong - username/password authentication required. It will work with
  497. SOCKSv5, FTP, POP3 and HTTP proxy.
  498. .br
  499. cache - cached authentication, may be used with \'authcache\'.
  500. .br
  501. radius - authentication with RADIUS.
  502. .br
  503. Plugins may add additional authentication types.
  504. .br
  505. It\'s possible to use few authentication types in the same commands. E.g.
  506. .br
  507. auth iponly strong
  508. .br
  509. In this case \'strong\' authentication will be used only in case resource
  510. access can not be performed with \'iponly\' authentication, that is username is
  511. required in ACL. It\'s usefull to protect access to some resources with
  512. password allowing passwordless access to another resources, or to use
  513. IP-based authentication for dedicated laptops and request username/password for
  514. shared ones.
  515. .br
  516. .B authcache
  517. <cachtype> <cachtime>
  518. .br
  519. Cache authentication information to given amount of time (cachetime) in seconds.
  520. Cahtype is one of:
  521. .br
  522. ip - after successful authentication all connections during caching time
  523. from same IP are assigned to the same user, username is not requested.
  524. .br
  525. ip,user username is requested and all connections from the same IP are
  526. assigned to the same user without actual authentication.
  527. .br
  528. user - same as above, but IP is not checked.
  529. .br
  530. user,password - both username and password are checked against cached ones.
  531. .br
  532. limit - limit user to use only one ip, \'ip\' and \'user\' are required
  533. .br
  534. acl - only use cached auth if user access service with same ACL
  535. .br
  536. ext - cache external IP
  537. .br
  538. Use auth type \'cache\' for cached authentication
  539. .br
  540. .B allow
  541. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  542. <weekdayslist> <timeperiodslist>
  543. .br
  544. .B deny
  545. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  546. <weekdayslist> <timeperiodslist>
  547. .br
  548. Access control entries. All lists are comma-separated, no spaces are
  549. allowed. Usernames are case sensitive (if used with authtype nbname
  550. username must be in uppercase). Source and target lists may contain
  551. IP addresses (W.X.Y.Z), ranges A.B.C.D - W.X.Y.Z (since 0.8) or CIDRs (W.X.Y.Z/L).
  552. Since 0.6, targetlist may also contain host names,
  553. instead of addresses. It\'s possible to use wildmask in
  554. the begginning and in the the end of hostname, e.g. *badsite.com or *badcontent*.
  555. Hostname is only checked if hostname presents in request.
  556. Targetportlist may contain ports (X) or port ranges lists (X-Y). For any field *
  557. sign means ANY. If access list is empty it\'s assumed to be
  558. .br
  559. allow *
  560. .br
  561. If access list is not empty last item in access list is assumed to be
  562. .br
  563. deny *
  564. .br
  565. You may want explicitly add deny * to the end of access list to prevent
  566. HTTP proxy from requesting user\'s password.
  567. Access lists are checked after user have requested any resource.
  568. If you want 3proxy to reject connections from specific addresses
  569. immediately without any conditions you should either bind proxy
  570. to appropriate interface only or to use ip filters.
  571. .br
  572. Operation is one of:
  573. .br
  574. CONNECT establish outgoing TCP connection
  575. .br
  576. BIND bind TCP port for listening
  577. .br
  578. UDPASSOC make UDP association
  579. .br
  580. ICMPASSOC make ICMP association (for future use)
  581. .br
  582. HTTP_GET HTTP GET request
  583. .br
  584. HTTP_PUT HTTP PUT request
  585. .br
  586. HTTP_POST HTTP POST request
  587. .br
  588. HTTP_HEAD HTTP HEAD request
  589. .br
  590. HTTP_CONNECT HTTP CONNECT request
  591. .br
  592. HTTP_OTHER over HTTP request
  593. .br
  594. HTTP matches any HTTP request except HTTP_CONNECT
  595. .br
  596. HTTPS same as HTTP_CONNECT
  597. .br
  598. FTP_GET FTP get request
  599. .br
  600. FTP_PUT FTP put request
  601. .br
  602. FTP_LIST FTP list request
  603. .br
  604. FTP_DATA FTP data connection. Note: FTP_DATA requires access to dynamic
  605. non-ptivileged (1024-65535) ports on remote side.
  606. .br
  607. FTP matches any FTP/FTP Data request
  608. .br
  609. ADMIN access to administration interface
  610. .br
  611. Weeksdays are week days numbers or periods, 0 or 7 means Sunday, 1 is Monday, 1-5 means Monday through Friday.
  612. .br
  613. Timeperiodlists is a list of time
  614. periods in HH:MM:SS-HH:MM:SS format. For example, 00:00:00-08:00:00,17:00:00-24:00:00 lists non-working hours.
  615. .br
  616. .B parent
  617. <weight> <type> <ip> <port> <username> <password>
  618. .br
  619. this command must follow "allow" rule. It extends last allow rule to
  620. build proxy chain. Proxies may be grouped. Proxy inside the
  621. group is selected randomly. If few groups are specified one proxy
  622. is randomly picked from each group and chain of proxies is created
  623. (that is second proxy connected through first one and so on).
  624. Weight is used to group proxies. Weigt is a number between 1 and 1000.
  625. Weights are summed and proxies are grouped together untill weight of
  626. group is 1000. That is:
  627. .br
  628. allow *
  629. .br
  630. parent 500 socks5 192.168.10.1 1080
  631. .br
  632. parent 500 connect 192.168.10.1 3128
  633. .br
  634. makes 3proxy to randomly choose between 2 proxies for all outgoing
  635. connections. These 2 proxies form 1 group (summarized weight is 1000).
  636. .br
  637. allow * * * 80
  638. .br
  639. parent 1000 socks5 192.168.10.1 1080
  640. .br
  641. parent 1000 connect 192.168.20.1 3128
  642. .br
  643. parent 300 socks4 192.168.30.1 1080
  644. .br
  645. parent 700 socks5 192.168.40.1 1080
  646. .br
  647. creates chain of 3 proxies: 192.168.10.1, 192.168.20.1 and third
  648. is (192.168.30.1 with probability of 0.3 or 192.168.40.1
  649. with probability of 0.7) for outgoing web connections. Chains are only applied to new connections, pipelined (keep-alive) requests in the same connection use the same chain.
  650. .br
  651. type is one of:
  652. .br
  653. extip does not actully redirect request, it sets external address for this request to <ip>. It can be chained with another parent types. It's usefaul to set external IP based on ACL or make it random.
  654. .br
  655. tcp simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication.
  656. .br
  657. http redirect to HTTP proxy. HTTP is always the last chain. It should only be used with http (proxy) service,
  658. if used with different service, it works as tcp redirection.
  659. .br
  660. pop3 redirect to POP3 proxy (only local redirection is supported, can only be used as a first hop in chaining)
  661. .br
  662. ftp redirect to FTP proxy (only local redirection is supported, can only be used as a first hop in chaining)
  663. .br
  664. connect parent is HTTP CONNECT method proxy
  665. .br
  666. connect+ parent is HTTP CONNECT proxy with name resolution (hostname is used instead of IP if available)
  667. .br
  668. socks4 parent is SOCKSv4 proxy
  669. .br
  670. socks4+ parent is SOCKSv4 proxy with name resolution (SOCKSv4a)
  671. .br
  672. socks5 parent is SOCKSv5 proxy
  673. .br
  674. socks5+ parent is SOCKSv5 proxy with name resolution
  675. .br
  676. socks4b parent is SOCKS4b (broken SOCKSv4 implementation with shortened
  677. server reply. I never saw this kind ofservers byt they say there are).
  678. Normally you should not use this option. Do not mess this option with
  679. SOCKSv4a (socks4+).
  680. .br
  681. socks5b parent is SOCKS5b (broken SOCKSv5 implementation with shortened
  682. server reply. I think you will never find it useful). Never use this option
  683. unless you know exactly you need it.
  684. .br
  685. admin redirect request to local \'admin\' service (with -s parameter).
  686. .br
  687. Use "+" proxy only with "fakeresolve" option
  688. .br
  689. IP and port are ip addres and port of parent proxy server.
  690. If IP is zero, ip is taken from original request, only port is changed.
  691. If port is zero, it\'s taken from original request, only IP is changed.
  692. If both IP and port are zero - it\'s a special case of local redirection,
  693. it works only with
  694. .B socks
  695. proxy. In case of local redirection request is redirected to different service,
  696. .B ftp
  697. locally redirects to
  698. .B ftppr
  699. .B pop3
  700. locally redirects to
  701. .B pop3p
  702. .B http
  703. locally redurects to
  704. .B proxy
  705. .B admin
  706. locally redirects to admin -s service.
  707. .br
  708. Main purpose of local redirections is to have requested resource
  709. (URL or POP3 username) logged and protocol-specific filters to be applied.
  710. In case of local redirection ACLs are revied twice: first, by SOCKS proxy up to \'parent\'
  711. command and then with gateway service connection is
  712. redirected (HTTP, FTP or POP3) after \'parent\' command. It means,
  713. additional \'allow\' command is required for redirected requests, for
  714. example:
  715. .br
  716. allow * * * 80
  717. .br
  718. parent 1000 http 0.0.0.0 0
  719. .br
  720. allow * * * 80 HTTP_GET,HTTP_POST
  721. .br
  722. socks
  723. .br
  724. redirects all SOCKS requests with target port 80 to local HTTP proxy,
  725. local HTTP proxy parses requests and allows only GET and POST requests.
  726. .br
  727. parent 1000 http 1.2.3.4 0
  728. .br
  729. Changes external address for given connection to 1.2.3.4 (an equivalent to -e1.2.3.4)
  730. .br
  731. Optional username and password are used to authenticate on parent
  732. proxy. Username of \'*\' means username must be supplied by user.
  733. .br
  734. .B nolog
  735. <n>
  736. .br
  737. extends last allow or deny command to prevent logging, e.g.
  738. .br
  739. allow * * 192.168.1.1
  740. .br
  741. nolog
  742. .br
  743. .B weight
  744. <n>
  745. .br
  746. extends last allow or deny command to set weight for this request
  747. .br
  748. allow * * 192.168.1.1
  749. .br
  750. weight 100
  751. .br
  752. Weight may be used for different purposes.
  753. .br
  754. .B force
  755. .br
  756. .B noforce
  757. .br
  758. If force is specified for service, configuration reload will require all current
  759. sessions of this service to be re-authenticated. If ACL is changed or user account
  760. is removed, old connections which do not match current are closed.
  761. noforce allows to keep previously authenticated connections.
  762. .br
  763. .B bandlimin
  764. <rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  765. <weekdayslist> <timeperiodslist>
  766. .br
  767. .B nobandlimin
  768. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  769. <weekdayslist> <timeperiodslist>
  770. .br
  771. .B bandlimout
  772. <rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  773. <weekdayslist> <timeperiodslist>
  774. .br
  775. .B nobandlimout
  776. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  777. <weekdayslist> <timeperiodslist>
  778. .br
  779. bandlim sets bandwith limitation filter to <rate> bps (bits per second)
  780. If you want to specife bytes per second - multiply your value to 8.
  781. bandlim rules act in a same manner as allow/deny rules except
  782. one thing: bandwidth limiting is applied to all services, not to some
  783. specific service.
  784. bandlimin and nobandlimin applies to incoming traffic
  785. bandlimout and nobandlimout applies to outgoing traffic
  786. If tou want to ratelimit your clients with IPs 192.168.10.16/30 (4
  787. addresses) to 57600 bps you have to specify 4 rules like
  788. .br
  789. bandlimin 57600 * 192.168.10.16
  790. .br
  791. bandlimin 57600 * 192.168.10.17
  792. .br
  793. bandlimin 57600 * 192.168.10.18
  794. .br
  795. bandlimin 57600 * 192.168.10.19
  796. .br
  797. and every of you clients will have 56K channel. If you specify
  798. .br
  799. bandlimin 57600 * 192.168.10.16/30
  800. .br
  801. you will have 56K channel shared between all clients.
  802. if you want, for example, to limit all speed ecept access to POP3 you can use
  803. .br
  804. nobandlimin * * * 110
  805. .br
  806. before the rest of bandlim rules.
  807. .br
  808. .B connlim
  809. <rate> <period> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  810. <weekdayslist> <timeperiodslist>
  811. .br
  812. .B noconnlim
  813. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  814. <weekdayslist> <timeperiodslist>
  815. .br
  816. connlim sets connections rate limit per time period for traffic
  817. pattern controlled by ACL. Period is in seconds. If period is 0,
  818. connlim limits a number of parallel connections.
  819. .br
  820. connlim 100 60 * 127.0.0.1
  821. .br
  822. allows 100 connections per minute for 127.0.0.1.
  823. .br
  824. connlim 20 0 * 127.0.0.1
  825. .br
  826. allows 20 simulationeous connections for 127.0.0.1.
  827. .br
  828. Like with bandlimin, if individual limit is required per client, separate
  829. rule mustbe added for every client. Like with nobanlimin, noconnlim adds an
  830. exception.
  831. .br
  832. .B counter
  833. <filename> <reporttype> <repotname>
  834. .br
  835. .B countin
  836. <number> <type> <limit> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  837. <weekdayslist> <timeperiodslist>
  838. .br
  839. .B nocountin
  840. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  841. <weekdayslist> <timeperiodslist>
  842. .br
  843. .B countout
  844. <number> <type> <limit> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  845. <weekdayslist> <timeperiodslist>
  846. .br
  847. .B nocountout
  848. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  849. <weekdayslist> <timeperiodslist>
  850. .br
  851. .B countall
  852. <number> <type> <limit> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  853. <weekdayslist> <timeperiodslist>
  854. .br
  855. .B nocountall
  856. <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
  857. <weekdayslist> <timeperiodslist>
  858. .br
  859. counter, countin, nocountin, countout, noucountout, countall,
  860. nocountall commands are used to set traffic limit
  861. in MB for period of time (day, week or month). Filename is a path
  862. to a special file where traffic information is permanently stored.
  863. number is sequential number of record in this file. If number is 0
  864. this counter is not preserved in counter file (that is
  865. if proxy restarted all counters with 0 are flushed) overwise it
  866. should be unique sequential number which points to position of
  867. the couter within the file.
  868. Type specifies a type of counter. Type is one of:
  869. .br
  870. H - counter is resetted hourly
  871. .br
  872. D - counter is resetted daily
  873. .br
  874. W - counter is resetted weekly
  875. .br
  876. M - counter is resetted monthely
  877. .br
  878. reporttype/repotname may be used to generate traffic reports.
  879. Reporttype is one of D,W,M,H(hourly) and repotname specifies filename
  880. template for reports. Report is text file with counter values in
  881. format:
  882. .br
  883. <COUNTERNUMBER> <TRAF>
  884. .br
  885. The rest of parameters is identical to bandlim/nobandlim.
  886. .br
  887. .B users
  888. username[:pwtype:password] ...
  889. .br
  890. pwtype is one of:
  891. .br
  892. none (empty) - use system authentication
  893. .br
  894. CL - password is cleartext
  895. .br
  896. CR - password is crypt-style password
  897. .br
  898. NT - password is NT password (in hex)
  899. .br
  900. example:
  901. .br
  902. users test1:CL:password1 "test2:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY49."
  903. .br
  904. users test3:NT:BD7DFBF29A93F93C63CB84790DA00E63
  905. .br
  906. Note: double quotes are requiered because password contains $ sign.
  907. .br
  908. .B flush
  909. .br
  910. empty active access list. Access list must be flushed avery time you creating
  911. new access list for new service. For example:
  912. .br
  913. allow *
  914. .br
  915. pop3p
  916. .br
  917. flush
  918. .br
  919. allow * 192.168.1.0/24
  920. .br
  921. socks
  922. .br
  923. sets different ACLs for
  924. .B pop3p
  925. and
  926. .B socks
  927. .br
  928. .B system
  929. <command>
  930. .br
  931. execute system command
  932. .br
  933. .B pidfile
  934. <filename>
  935. .br
  936. write pid of current process to file. It can be used to manipulate
  937. 3proxy with signals under Unix. Currently next signals are available:
  938. .br
  939. .B monitor
  940. <filename>
  941. .br
  942. If file monitored changes in modification time or size, 3proxy reloads
  943. configuration within one minute. Any number of files may be monitored.
  944. .br
  945. .B setuid
  946. <uid>
  947. .br
  948. calls setuid(uid), uid can be numeric or since 0.9 username. Unix only. Warning: under some Linux
  949. kernels setuid() works for current thread only. It makes it impossible to suid
  950. for all threads.
  951. .br
  952. .B setgid
  953. <gid>
  954. .br
  955. calls setgid(gid), gid can be numeric or since 0.9 groupname. Unix only.
  956. .br
  957. .B chroot
  958. <path> [<uid>] [<gid>]
  959. .br
  960. calls chroot(path) and sets gid/uid. Unix only. uid/gid supported since 0.9, can be numeric or username/groupname
  961. .br
  962. .B stacksize
  963. <value_to_add_to_default_stack_size>
  964. .br
  965. Change default size for threads stack. May be required in some situation,
  966. e.g. with non-default plugins, on on some platforms (some FreeBSD version
  967. may require adjusting stack size due to invalid defined value in system
  968. header files, this value is also oftent reqruied to be changed for ODBC and
  969. PAM support on Linux. If you experience 3proxy
  970. crash on request processing, try to set some positive value. You may start with
  971. stacksize 65536
  972. and then find the minimal value for service to work. If you experience
  973. memory shortage, you can try to experiment with negative values.
  974. .SH PLUGINS
  975. .br
  976. .B plugin
  977. <path_to_shared_library> <function_to_call> [<arg1> ...]
  978. .br
  979. Loads specified library and calls given export function with given arguments,
  980. as
  981. .br
  982. int functions_to_call(struct pluginlink * pl, int argc, char * argv[]);
  983. .br
  984. function_to_call must return 0 in case of success, value > 0 to indicate error.
  985. .br
  986. .B filtermaxsize
  987. <max_size_of_data_to_filter>
  988. .br
  989. If Content-length (or another data length) is greater than given value, no
  990. data filtering will be performed thorugh filtering plugins to avoid data
  991. corruption and/or Content-Length chaging. Default is 1MB (1048576).
  992. .SH BUGS
  993. Report all bugs to
  994. .BR 3proxy@3proxy.ru
  995. .SH SEE ALSO
  996. 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8),
  997. .br
  998. https://3proxy.org/
  999. .SH TRIVIA
  1000. 3APA3A is pronounced as \`\`zaraza\'\'.
  1001. .SH AUTHORS
  1002. 3proxy is designed by Vladimir 3APA3A Dubrovin
  1003. .RI ( 3proxy@3proxy.ru )