Compare commits

..
Author SHA1 Message Date
z3APA3A 0b2afa1ba7 switch to 0.8.7 2016-09-04 16:30:40 +03:00
z3APA3A 80b9e18588 Commit as 0.8.7 2016-09-04 16:19:53 +03:00
z3APA3A 63bafa5a62 Merge remote-tracking branch 'refs/remotes/origin/devel'
# Conflicts:
#	src/version.h
2016-09-04 16:16:29 +03:00
z3APA3A fd29e887c3 add optimization to watcom makefile 2016-09-04 15:49:04 +03:00
z3APA3A ec9d556707 Add makefile for OpenWatcom 2.0 2016-09-04 15:33:38 +03:00
z3APA3A 9890823664 fix signess warning 2016-09-04 15:33:20 +03:00
z3APA3A 880255093a minor compilers compatibility issues 2016-09-04 15:11:15 +03:00
z3APA3A 4e96a66093 fix authentication via reverse name 2016-09-04 15:10:45 +03:00
z3APA3A e2b406f27b Addition al fix for Linux (glibc?) specific daemon problem 2016-08-23 18:36:18 +03:00
z3APA3A b242d6df8c Fix daemonize in *nix 2016-08-23 14:19:27 +03:00
z3APA3A 4e4f71712d Fix: 'extip' may fail with 9 error code 2016-08-16 15:21:02 +03:00
z3APA3A 6426ed0c1a fix %i logging 2016-06-07 15:39:14 +03:00
z3APA3A cdc4210a0a Fix '%i' logging 2016-06-07 14:16:55 +03:00
z3APA3A 7742b08ec5 Revert "Delay service exit until new configuration is loaded"
This reverts commit 05f39246bf.
2016-06-07 14:16:17 +03:00
z3APA3A 05f39246bf Delay service exit until new configuration is loaded 2016-06-06 18:01:51 +03:00
z3APA3A 84664a203b support %i in loformat 2016-06-06 17:54:23 +03:00
z3APA3A cd35215532 support -u2 for proxy 2016-05-28 00:24:26 +03:00
z3APA3A f347b37770 support port number in 'nserver' / 'authnserver' 2016-05-18 00:05:23 +03:00
z3APA3A fbcdcf3d7b Correct IP matching in cache auth 2016-05-17 23:27:10 +03:00
z3APA3A 8cdf341d0e workaround for broken getsockname() in FTP proxy 2016-05-14 00:09:51 +03:00
z3APA3A ccbc94e06b Revert "pam_auth; lock only pam_start"
This reverts commit 556fea670e.
2016-05-11 22:05:45 +03:00
z3APA3A 556fea670e pam_auth; lock only pam_start 2016-05-11 20:51:14 +03:00
z3APA3A 32ff114787 Revert "pam_auth: Authenticate all users in single session"
This reverts commit 438a5bac9b.
2016-05-11 20:49:39 +03:00
z3APA3A 438a5bac9b pam_auth: Authenticate all users in single session 2016-05-11 19:56:40 +03:00
z3APA3A 4cb43b438f Use mutex with pam auth, because pam is not thread safe 2016-05-11 19:03:16 +03:00
z3APA3A 8e820b28c0 Documentation correction 2016-05-11 19:02:51 +03:00
z3APA3A cfa4d11027 Do not fail connection with 333 error on configuration reload 2016-04-26 18:50:57 +03:00
z3APA3A 8b1c12005f avoid type mismatch in ?: operator 2016-04-08 15:08:18 +03:00
z3APA3A 3c8c866ac1 Fix counters time check for different platforms 2016-04-08 14:53:15 +03:00
z3APA3A d3f9d80b65 Resolve races on log buffer without mutex 2016-04-05 19:12:18 +03:00
z3APA3A 1d162abec3 Merge branch 'devel' of https://github.com/z3APA3A/3proxy into devel 2016-04-04 13:43:30 +03:00
z3APA3A d6f72a51fe fix race condition on 'log' command processing 2016-04-04 13:43:08 +03:00
Vladimir Dubrovin e210f24194 fix for noforce 2016-04-02 12:00:53 +03:00
Vladimir Dubrovin 9bfae5faaa force / no force commands added 2016-04-02 11:43:25 +03:00
Vladimir Dubrovin 2fed299b9d warning fix 2016-04-02 11:22:33 +03:00
z3APA3A 6cac541e33 fix broken extip functionality 2016-03-30 19:16:12 +03:00
z3APA3A 938b1d1aab re-authenticate connection on configuration change 2016-03-28 17:57:37 +03:00
z3APA3A eeb2d78fb1 re-authenticate user on 2016-03-28 17:49:27 +03:00
z3APA3A dcec2cadaa support external username / password up to 128 octets 2016-03-10 17:05:56 +03:00
z3APA3A f67c9a39f1 Use setreuid/setregid instead of setuid / setgid 2016-03-09 18:28:52 +03:00
z3APA3A a44a32c484 Do not fail for zero address on SOCKSv5 BIND/UDPASSOC 2016-03-08 13:28:29 +03:00
z3APA3A b513584fdb More distinct error codes for SOCKS 2016-03-08 12:43:07 +03:00
z3APA3A ac13a75721 publish as 0.8.6 2016-03-07 16:54:55 +03:00
z3APA3A f74da31fb3 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-03-04 13:45:46 +03:00
z3APA3A 5d0504cd33 Always reset bind sa on connect 2016-03-04 13:44:53 +03:00
z3APA3A cbe3d0cde9 publish as 0.8.5 2016-03-02 23:12:32 +03:00
z3APA3A 5e850b54c3 Merge remote-tracking branch 'refs/remotes/origin/devel'
# Conflicts:
#	src/version.h
2016-03-02 22:57:05 +03:00
z3APA3A 58a64924dd log_mutex used prior to initialization 2016-03-02 19:00:28 +03:00
z3APA3A 75a7d5bb9e Remove SSLPlugin and PamAuth from default Linux makefile 2016-03-02 19:00:01 +03:00
z3APA3A 10a79faa32 publish as devel 2016-02-28 15:10:38 +03:00
z3APA3A 394ada524a publish as 0.8.4 2016-02-28 13:52:53 +03:00
z3APA3A 1404c63e10 add index.html to repro 2016-02-28 13:40:25 +03:00
z3APA3A 3c751f4b75 add index.html to repro 2016-02-28 13:38:43 +03:00
z3APA3A 09cfc076e2 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-02-28 13:24:48 +03:00
z3APA3A 5d9c1af5ca Build PamAuth plugin by default in *nix 2016-02-26 13:17:15 +03:00
z3APA3A 6db42f70e9 fix compilation warnings in PamAuth 2016-02-26 13:15:34 +03:00
z3APA3A 99781ceb23 ignore more binary files 2016-02-26 11:44:10 +03:00
z3APA3A 22524d7876 ignore some files under *nix / Mac OS 2016-02-26 11:41:43 +03:00
z3APA3A 9d85bf75ba Ignore *nix binaries 2016-02-23 19:10:32 +03:00
z3APA3A 19643f0d66 Documentation update + add SQL example to git 2016-02-22 23:08:31 +03:00
z3APA3A 68e8530f85 remove contrib because of outdated content 2016-02-22 22:53:50 +03:00
z3APA3A 6a8fee9847 minor 3ps file modification 2016-02-22 22:48:02 +03:00
z3APA3A 364fe22bbb add rus.3ps to git 2016-02-22 22:44:59 +03:00
z3APA3A e2351034e6 Change encoding to utf-8 in strings 2016-02-22 22:43:22 +03:00
z3APA3A 49d382c7db Build PamAuth in Linux by default 2016-02-22 22:41:52 +03:00
z3APA3A 89fd5a95ae minor gitignore modifications 2016-02-22 22:18:15 +03:00
z3APA3A 57f1140734 Changes in makefiles to support LDAP plugin compilation 2016-02-22 21:46:32 +03:00
z3APA3A aa38dd2ad2 Merge remote-tracking branch 'refs/remotes/origin/master' into devel 2016-02-22 21:16:18 +03:00
z3APA3A c96d415020 Defer SSL init to first command in ssl_plugin 2016-02-22 21:14:17 +03:00
z3APA3A 604cc22d16 mark as 0.8.4 2016-02-22 00:53:10 +03:00
z3APA3A 01857354c8 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-02-22 00:22:01 +03:00
z3APA3A 021a8928bf Avoid windows compilation warnings 2016-02-22 00:18:45 +03:00
z3APA3A cf3bae0f6b Revert "additional memset for hint on retry"
This reverts commit bb206869de.
2016-02-22 00:14:54 +03:00
z3APA3A bb206869de additional memset for hint on retry 2016-02-20 15:45:44 +03:00
z3APA3A 5c5f4e258f Increase default stack size for *nix 2016-02-20 09:11:03 +03:00
z3APA3A f8a7266bdf Handle malformed HTTP headers without \r 2016-02-19 20:47:56 +03:00
z3APA3A ad9b0046d9 Fix thread init bug introduced 2016-02-19 20:21:16 +03:00
z3APA3A b40e8fae4c increase stack size for FreeBSD 2016-02-19 19:44:38 +03:00
z3APA3A 6fcd12cb08 TransparentPlugin - remove debug output 2016-02-19 17:10:15 +03:00
Vladimir Dubrovin 9ddc1fb874 fix *nix warnings 2016-02-18 17:01:18 +03:00
z3APA3A 43a36ec813 Warnings cleanup 2016-02-18 16:43:37 +03:00
z3APA3A 0d02989cce minor man updates 2016-02-17 18:23:29 +03:00
z3APA3A 33e0eb5495 Documentation update for stacksize / -S 2016-02-17 17:52:18 +03:00
z3APA3A 3b8e7741b3 Compilation warnings cleanup 2016-02-16 15:29:51 +03:00
z3APA3A f70a8c0019 Makefile for Windows llvm build 2016-02-16 01:03:15 +03:00
z3APA3A 5fc1d81e5c add stack size configuration
'stacksize' command and -S configuration option added
2016-02-11 16:16:44 +03:00
z3APA3A 3680f2d3b1 Do not negotiate handshake for extip redirection 2016-02-08 14:39:29 +03:00
z3APA3A 6713530fda log_mutex init moved to proxymain 2016-02-05 19:04:16 +03:00
z3APA3A 13a7d6be11 Replace memcpy with assignment where appropriate 2016-02-05 18:31:17 +03:00
z3APA3A 3cc9796583 Support for 'extip' and 'smtp' parent types added 2016-02-05 01:52:45 +03:00
z3APA3A 9db88313c7 minor documentation correction 2016-01-31 23:22:45 +03:00
z3APA3A 0263574655 minor documentation correction 2016-01-31 23:22:02 +03:00
z3APA3A 0e168f17f9 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-31 15:08:21 +03:00
z3APA3A 4f7a82ed92 Update rc for 0.8.4 2016-01-31 15:07:08 +03:00
z3APA3A 4202cee566 Merge remote-tracking branch 'refs/remotes/origin/devel'
# Conflicts:
#	src/version.h
2016-01-31 15:04:22 +03:00
z3APA3A faf7f665c3 do memset for 'external' sockaddr structures 2016-01-31 15:01:17 +03:00
z3APA3A 852f1abecb Documentation for TransparentPlugin added 2016-01-30 00:00:00 +03:00
z3APA3A 485ccb3ab4 publish as devel 2016-01-28 01:21:13 +03:00
z3APA3A e23dd7b746 minor logging changes 2016-01-28 01:18:16 +03:00
z3APA3A 95efeb8a93 Handle accept() errors more accurate 2016-01-28 01:07:09 +03:00
z3APA3A 43da6cc32b remove premake from makefile 2016-01-28 01:04:25 +03:00
z3APA3A 0473e1b2f7 publish as devel 2016-01-27 23:08:17 +03:00
z3APA3A 975b4ac445 Remove date from copyright notice in proxy.h 2016-01-27 17:56:01 +03:00
z3APA3A 48361db51c Add versioning information only to 3proxy.exe 2016-01-27 17:55:40 +03:00
z3APA3A ade0df0956 Add builddate to rc file for devel version 2016-01-27 17:55:11 +03:00
z3APA3A c61533aa54 .rc file updated 2016-01-27 17:30:54 +03:00
z3APA3A 0883fb6e34 Show traffic limit in MBs 2016-01-27 15:38:47 +03:00
z3APA3A 79170af2bc publish as 0.8.3 2016-01-26 12:10:55 +03:00
z3APA3A 331c933508 publish as 0.8.3 2016-01-25 22:55:08 +03:00
z3APA3A 2de3f0c380 publish as devel 2016-01-25 22:48:09 +03:00
z3APA3A d1334e5157 Merge remote-tracking branch 'refs/remotes/origin/devel'
# Conflicts:
#	src/version.h
2016-01-25 15:06:42 +03:00
z3APA3A fec0da52af fixed: use SASIZE() instead of sizeof() in connect() for FreeBSD compatibility 2016-01-25 14:49:17 +03:00
z3APA3A 7a7cd9bc25 README updated 2016-01-23 20:44:01 +03:00
z3APA3A bb8e5832eb update README 2016-01-23 20:38:10 +03:00
z3APA3A c2a7fdc2a2 release as devel 2016-01-23 19:26:20 +03:00
z3APA3A 3cbbe1aef7 publish as 0.8.2 2016-01-23 19:17:36 +03:00
z3APA3A 69cb310481 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-23 18:48:28 +03:00
z3APA3A 375a2c9f6e Do not use SO_REUSEADDR by default
to avoid misbehavior in some glibc versions
2016-01-23 18:43:30 +03:00
z3APA3A 1ed5229a54 Do not use SO_REUSEADDR by default
to avoid misbehavior in some glibc versions
2016-01-23 18:41:20 +03:00
z3APA3A d6f29ac6df reset transparent flag on keep-alive connection 2016-01-23 17:16:49 +03:00
z3APA3A 82e76d1d2a Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-22 16:20:12 +03:00
z3APA3A 4af5f2fde7 Use SASIZE() instead of sizeof() in bind() for FreeBSD compatibility 2016-01-22 15:59:40 +03:00
z3APA3A 95a07c1b46 minor documentation update 2016-01-21 16:53:38 +03:00
z3APA3A 3a4f3b5cd1 publish as 0.8.1 2016-01-21 16:26:08 +03:00
z3APA3A a6383bbd10 Merge remote-tracking branch 'refs/remotes/origin/devel'
# Conflicts:
#	src/version.h
2016-01-21 15:50:17 +03:00
z3APA3A 359026cb5f !!Fix: destination IP may be not checked against ACL 2016-01-21 15:45:39 +03:00
z3APA3A 244be50405 publish as 0.8.0
only version number is changed
2016-01-20 01:20:05 +03:00
z3APA3A e3fb268b64 publish as 0.8 2016-01-20 01:08:48 +03:00
z3APA3A 5e440b4482 publish as 0.9-devel 2016-01-20 01:04:03 +03:00
z3APA3A 94f3b1fe30 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-19 17:04:56 +03:00
z3APA3A ee407adf42 update man for -6 2016-01-19 16:41:04 +03:00
z3APA3A e5dd28003c Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-17 02:14:16 +03:00
z3APA3A fcbccf39ef Use configured timeouts for DNS operations instead static ones 2016-01-17 02:13:17 +03:00
z3APA3A 928f67aed1 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-16 00:39:58 +03:00
z3APA3A e59ccd22b1 typo corrected in last update 2016-01-16 00:38:53 +03:00
z3APA3A 75c63d2de6 add support for -u2 in socks 2016-01-15 15:29:57 +03:00
z3APA3A 999f9e856b Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-15 03:07:59 +03:00
z3APA3A 08be6b9f98 minor documentations updates 2016-01-15 03:06:06 +03:00
z3APA3A 0be4ee932b Merge remote-tracking branch 'refs/remotes/origin/master' into devel 2016-01-15 02:41:55 +03:00
z3APA3A 08aa876ecd minor man changes 2016-01-15 02:41:14 +03:00
z3APA3A 87c947987c Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-15 02:27:40 +03:00
z3APA3A 1ef7308cbf Update documentation for connect back 2016-01-15 02:26:56 +03:00
z3APA3A d1f8180eab IPv6 and name resolution documentation updated for 0.8 2016-01-15 01:24:08 +03:00
z3APA3A 1000d80fc0 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-13 23:54:57 +03:00
z3APA3A 27a190cd04 Russian plugin documentation added 2016-01-13 23:53:18 +03:00
z3APA3A e78d9f8327 plugins documentation added 2016-01-13 23:35:35 +03:00
z3APA3A ae25aac635 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-13 02:15:59 +03:00
z3APA3A b6dadc1954 Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-13 02:14:15 +03:00
z3APA3A 8b7c95ff93 Update man pages 2016-01-13 02:13:49 +03:00
z3APA3A 5a89997d6e convert russian documentation to UTF-8 2016-01-13 01:53:22 +03:00
z3APA3A c2d012bf71 Merge remote-tracking branch 'refs/remotes/origin/master' into devel 2016-01-13 01:46:07 +03:00
z3APA3A b3923593ed Convert russian documentation to utf-8 2016-01-13 01:41:51 +03:00
z3APA3A 9dd2170d6f publish as 0.8-pre 2016-01-13 00:42:48 +03:00
z3APA3A bf934201bb Merge remote-tracking branch 'refs/remotes/origin/devel' 2016-01-13 00:23:24 +03:00
z3APA3A 5287278fa5 Copy to master from devel - ready for 0.8 2016-01-13 00:20:50 +03:00
z3APA3A 41f21485c7 Update README 2016-01-09 21:09:16 +03:00
z3APA3A 93967af747 publishing as devel 2016-01-09 21:09:00 +03:00
z3APA3A bef5b6f473 minor logging correction 2016-01-06 22:06:33 +03:00
z3APA3A 7f90b6eae2 fixed parent IPv6 connect proxy 2016-01-06 21:09:17 +03:00
z3APA3A 9dda666d8d minor changes in clientnegotiate()
1. Use [] for hostname in form of IPv6 address
2. Remove large buffer from stack
2016-01-04 01:30:49 +03:00
z3APA3A 4c3f19cd20 publish as devel 2016-01-03 20:03:17 +03:00
z3APA3A 889c5caa1f typo in logsyslog() 2016-01-03 19:57:51 +03:00
z3APA3A 0e9cc9e330 http connect parent proxy fixed 2016-01-03 19:44:48 +03:00
z3APA3A 47e8ba2e8d minor documentation fixes 2016-01-03 19:43:43 +03:00
z3APA3A d49a19cb29 invalid source port selection in socls 2016-01-03 19:43:16 +03:00
z3APA3A e312a1aa11 Fileplugin: commands added
file_cachedir /path/to/cache/
h_preview 32768
2015-12-28 17:11:07 +03:00
z3APA3A 22e7d9cdae SSL plugin commands renamed
plugin /path/to/SslPlugin.dll ssl_plugin
ssl_certcache /path/to/cache/
ssl_mitm
proxy -p3128
ssl_nomitm
proxy -p3129
2015-12-28 16:28:26 +03:00
z3APA3A 347d7736c7 ssl_plugin: configuration commands added
plugin /path_to/SslPlugin.dll ssl_plugin
ssl_certpath /path_to/certificates/
ssl_strip
proxy -p3128
ssl_nostrip
proxy -p3129
2015-12-28 15:57:47 +03:00
z3APA3A d9271bfec8 + Increase static buffer size 2015-12-27 19:45:15 +03:00
z3APA3A b56702e670 Increase static bufer 2015-12-27 19:44:21 +03:00
z3APA3A 9876172e0b Reduce stack usage for threads
Reduce stack usage, because large logging buffers are removed from
stack.
2015-12-27 19:43:04 +03:00
z3APA3A 7df2461a26 Unify logging (make it always blocking in exchange for memory) 2015-12-27 19:27:17 +03:00
z3APA3A 0487084161 Publish as devel 2015-12-21 21:23:47 +03:00
z3APA3A a4e0f1fb9a NULL pointer deferefence (depends on libc) if no "log" in config 2015-12-21 13:41:35 +03:00
z3APA3A fa2679555e print IPv6 address in [] 2015-12-21 13:40:30 +03:00
z3APA3A c263428cf6 published as devel 2015-12-11 02:28:14 +03:00
z3APA3A 1be800c334 Fixed: request by host name in SOCKSv5 2015-12-11 02:20:22 +03:00
z3APA3A 658e9b3a8a README updated
msnpr and countersutil removed
2015-12-09 22:21:00 +03:00
z3APA3A f1ab0771a9 remove unused defines 2015-12-08 01:45:17 +03:00
z3APA3A fdb1fad9f7 publish as devel 2015-12-07 23:01:21 +03:00
z3APA3A 40f9430623 Force use of IPv6 translated address instead of IPv4 with -6 2015-12-07 22:58:31 +03:00
z3APA3A d6df311ba7 remove -Wall from compiler options 2015-12-07 19:12:41 +03:00
z3APA3A da52669995 NULL pointer dereference fixed in configuration load
introduced with latest commits
2015-12-07 19:06:16 +03:00
z3APA3A 55fb037b48 Avoid overflow in external
Use sockaddr_in6 for extsa if compiled with IPv6 support to be uniform
and avoid overflows.
2015-12-04 01:23:19 +03:00
z3APA3A bd37ffa2f7 Race conditions fixed on config reload
Race conditions on logging and name resolution
2015-12-04 00:59:52 +03:00
z3APA3A 1220c504bd remove counterutils from makefiles 2015-12-03 14:12:06 +03:00
z3APA3A b2e415b8cb Code restructure
! configuration moved to config.c
- msnpr.c removed
- countersutil.c removed
2015-12-03 02:17:15 +03:00
z3APA3A 4709f7a7b9 Fixed race conditions with users on configuration reload 2015-12-03 01:13:34 +03:00
z3APA3A fcbb000b0e publish as devel 2015-11-30 22:51:18 +03:00
z3APA3A 74772de341 Fixed handling of [] IPv6 addresses in hostnames 2015-11-29 12:38:16 +03:00
z3APA3A 271d9bb91a memcpy() replaced with memmove() in bitmap alloc
not used by default
2015-11-29 12:20:35 +03:00
z3APA3A 62775da1d5 race condition fixed on configuration reload
Race condition on service free'ing
2015-11-29 00:01:41 +03:00
z3APA3A 0e4a507dd8 publish as devel 2015-11-28 23:02:26 +03:00
z3APA3A 355d31f8aa minor cleanups 2015-11-28 22:59:02 +03:00
z3APA3A 54bcff710c Fix for external connections
linger was used without init, set bind port to zero
2015-11-28 22:57:52 +03:00
z3APA3A 6c187d167b Memory safety issues on configuration reload
memcpy for potentially overlapped regions replaced with memmove
2015-11-28 22:56:20 +03:00
z3APA3A 4ab2da228b Typo with Forwarded: header corrected in proxy.c 2015-11-09 17:05:31 +03:00
z3APA3A a4e54079b5 Show internal interface on service startup 2015-10-16 18:04:00 +03:00
z3APA3A f1beddc85a optimize Forwarded: generation 2015-10-16 18:03:08 +03:00
z3APA3A 3c6eef6bb0 Add Forwarded: header instead of X-Forwarded-For and Via
Add Forwarded: header instead of X-Forwarded-For and Via in HTTP proxy.
proxy -a3 changes to old behavior.
2015-10-16 17:14:01 +03:00
z3APA3A 3e6b230128 better listen/connection accept errors handling 2015-09-24 01:17:50 +03:00
z3APA3A c538d0c2f8 Prevent too fast connections on connect back
Prevent to fast connections on connect back proxy if port is not
reachable
2015-09-20 22:46:35 +03:00
z3APA3A a9ec5a085c Fixes infinite loop in previous commit 2015-09-20 22:36:54 +03:00
z3APA3A a2b5af6dab Connect back proxy functionality added
-r and -R options added to support connect back functionality between
two instances of proxy
2015-09-20 21:01:50 +03:00
z3APA3A 6529b9cea1 3proxy.cfg manual pages updated to reflect 0.8 changes
Pv6 functionality
IP ranges in ACLs
DNS over TCP redirection functionality
dnspr -s
behavior for NTLM
2015-09-04 01:45:07 +03:00
z3APA3A d21f6b198d fix static memory free() attempt 2015-09-04 00:28:26 +03:00
z3APA3A f88ea518b9 Compile same plugins for Win64 version 2015-09-04 00:22:06 +03:00
z3APA3A 4ca8988831 Fix FTP over HTTP authentication request parsing 2015-09-01 16:24:40 +03:00
z3APA3A 3198f1614f Fix FTP over HTTP authentication
Send WWW-Authenticate instead of Proxy-Authenticate
2015-09-01 15:24:03 +03:00
z3APA3A 59cc68e8dd Move FTP login prompt in proxy to common section 2015-08-31 22:01:31 +03:00
z3APA3A ef67ef4072 infinite loop in admin interface fixed 2015-08-24 17:56:12 +03:00
z3APA3A 184eede38a Typo in pamauth corrected 2015-07-05 14:51:30 +03:00
z3APA3A a93ffc825b bugfix: archiver doesn't add suffix on logname with macro 2015-06-05 15:56:49 +03:00
z3APA3A 2d6b43f488 3proxy for dummies updated 2015-06-01 00:50:57 +03:00
z3APA3A 1ab94fa002 SSLPlugin: add SNI to server request 2015-05-16 18:14:35 +03:00
z3APA3A d4f4e4a807 Deadlock in SSLPlugin corrected
deadlock due to typo in previous SSL patch
2015-05-04 18:12:46 +03:00
z3APA3A bc725189e3 bit more thread safety
One more potential race condition in hashtables
2015-05-04 18:06:07 +03:00
z3APA3A aa4125a6f0 Avoid some potential hashtables race conditions 2015-05-04 17:39:24 +03:00
z3APA3A 8e6d8b3314 increase max address length in X-Forwarded-For 2015-05-04 17:33:30 +03:00
z3APA3A 252d481299 allow larger request size in HTTP proxy
allow larger request size in HTTP proxy & correctly nullify request
buffer
2015-05-04 17:27:24 +03:00
Vladimir Dubrovin f287b94236 Merge pull request #3 from qwertydzen/devel
increasing a length of proxy's username specified in config till 128 chars
2015-05-04 17:26:54 +03:00
User 5787633665 increasing length of proxy username specified in config 2015-03-29 14:29:50 +03:00
z3APA3A 522e6732fe SSLPlugin race condition fix
+ minor corrections to PCREPlugin
2015-03-02 21:05:29 +03:00
z3APA3A 7951de875a Move icon compilations to makefiles 2015-02-17 16:05:55 +03:00
z3APA3A bf8522321f nscache bug fixed
nscache caused crash
2014-12-17 00:20:21 +03:00
z3APA3A 5844e165b5 nscache6 command support + nsrecord with IPv6
nscache6 - new command for IPv6 addresses cache
nsrecord supports IPv6 addresses
dnsauth should work with IPv6 servers and clients
+ caching is now more accurate
2014-12-14 05:33:08 +03:00
z3APA3A 7fc43e3fbd add some entropy to DNS hashtable 2014-12-14 00:46:03 +03:00
z3APA3A e37a7f48d7 Older CVS comments removed 2014-12-13 23:20:00 +03:00
z3APA3A 50db0015d3 IPv6 support for authnserver 2014-12-13 22:56:31 +03:00
z3APA3A 8a6632f0d1 Support IPv6 for parent proxy
Parent proxy can be on IPv6 network (except SOCKS4).
2014-12-13 22:38:03 +03:00
z3APA3A d2437975b7 Fail IPv6 client in dnsauth
before IPv6 for dnsauth is implemented
2014-12-13 20:30:20 +03:00
z3APA3A e39f4638cf Corrected ACLs handling + network ranges in ACLS
ACL handling corrected (affected all ACL-based operations like
allow/deny/banlimin/etc).
Network ranges like
10.0.0.0-10.0.0.1.64
are winally supported in ACLS.
2014-12-13 19:48:41 +03:00
z3APA3A 042fc2afde nserver address may be given as IPv6 2014-12-13 03:56:01 +03:00
z3APA3A a4cb2f36b5 -s switch support for dnspr
dnspr -s switch to act as a simple DNS proxy and do not use 3proxy's
resolver and DNS cache.
2014-12-12 23:51:47 +03:00
z3APA3A efdbaee29f return more random serial generation 2014-12-11 03:49:26 +03:00
z3APA3A 8c95f4efcf unused variables removed 2014-12-11 03:13:16 +03:00
z3APA3A 15f9f24f04 Name resolution via TCP support
Supports _real_ name resolution via parent proxy over TCP in nserver /
dnspr.
Can be used to create UDP->TCP name proxy, e.g.

nserver 127.0.0.1/tcp
nscache 65535
auth none
dnspr
auth iponly
tcppm 53 77.88.8.8 53

now, all names are resolved via TCP connection to 77.88.8.8
(dns.yandex.ru).
2014-12-11 03:06:34 +03:00
z3APA3A e3645ee971 ftppr and -h option handling fixed 2014-12-10 19:00:35 +03:00
z3APA3A f82d1e296b Redirection fixes 2014-11-26 01:50:14 +03:00
z3APA3A b5bcb44e27 Fixes for NOIPV6
Fixes to compile without IPv6 support
2014-11-09 21:59:58 +03:00
z3APA3A 278955deef getip46 corrected 2014-11-09 20:56:26 +03:00
z3APA3A 7acf3cc4ed name resolution bugfixes 2014-11-03 22:17:22 +03:00
z3APA3A f70e4adf47 IPv6 bugfixes 2014-11-03 21:25:06 +03:00
z3APA3A db5c4b1255 more changes for IPv6 client support 2014-10-21 06:00:56 +04:00
z3APA3A 10bc0db2a8 add IPv4/IPv6 selection for outgoing connections 2014-10-19 22:02:15 +04:00
z3APA3A c7310a2060 initial partial patches for IPv6 client support 2014-10-19 21:54:24 +04:00
z3APA3A f1e017394d Added IPv6 support for 'external' command and -e
Now, 2 external addresses can be specified: one for IPv4 and one for
IPv6
2014-10-19 04:32:18 +04:00
z3APA3A a425dc40b3 Correct error handling for thread creation
Error handling corrected for thread creation in case of e.g.
insufficient system resources.
2014-08-15 18:52:16 +04:00
z3APA3A 085b47d64e Fix compatibility issues
! avoid errno usage due to compatibility issues (and never use errno as
a lvalue). socks changed to use internal error codes instead.
! NOIPV6 compilation issues solved
! -lite version is switched to NOIPV6
2014-07-03 03:40:16 +04:00
Lubomir Rintel f8cefb989c Try to use stdint.h with gcc <= 4.4
There's no way to tell whether the architecture has its stdint.h, as
__UINT_FAST64_TYPE__ built in define didn't exist yet. Redefining the
types would break the build, and chances are we're not on some exotic
architecture where stdint would be missing, so let's assume it exists.
2014-07-01 21:52:24 +04:00
Lubomir Rintel ce6c2a069c Don't pad the text address with the binary form
The buf gets copied to hostname and is present verbatim in logs looking
like pure random garbage. Moreover you can't really strlen() it.

This was likely some silly typo in inet_ntoa -> inet_ntop conversion for
ipv6, since it used to be correct before.
2014-07-01 21:37:16 +04:00
z3APA3A 1f5198a238 Keep 2-digit error codes for socket operations
2 digit codes are common for all modules, should not be changed
2014-07-01 21:31:57 +04:00
Lubomir Rintel 6b579b8190 Communicate SOCKS error states properly
This used to look pretty random :(

Try to keep the last decimal digits of internal errors sensible for v5
error codes. For most cases we can't really do much better than using the
value of one.

One specific code paths where we can return something more useful is the
authentication, where we not communicate the underlying error code or
signal an ACL denial.

As for v4, there's not really much space to be too smart as only the code
of 91 is meaningful. Therefore we limit the last digit to zero and one now.
2014-07-01 21:29:15 +04:00
Lubomir Rintel 9416012a01 Fix some awkward NOIPV6 typoes and ommissions 2014-07-01 21:22:52 +04:00
z3APA3A 5cccf7cbdd Do not ignore version.h
version.h is required to build from sources

Conflicts:
	.gitignore
2014-06-28 17:37:57 +04:00
z3APA3A 8975b00cce better EINTR handling 2014-06-11 01:54:25 +04:00
z3APA3A 7bae6c4525 resolving compilation issues for *nix 2014-06-11 01:26:07 +04:00
z3APA3A 7ca32fc940 overlapped memcpy replaced with memmove 2014-06-11 00:57:18 +04:00
z3APA3A 4fef3a1df0 More changes for IPv6 suppot +nbname auth removed 2014-05-12 01:11:04 +04:00
Vladimir Dubrovin a30d5d51a5 IPv6 server side code
+ IPv6 server side support
!!! Auth need to be fixed
2014-05-12 01:10:58 +04:00
Vladimir Dubrovin ccf606fd9e ntoa changed to ntop 2014-05-12 01:10:53 +04:00
Vladimir Dubrovin 7897b009a1 intport removed, SA macro added 2014-05-12 01:10:47 +04:00
Vladimir Dubrovin bc7ca3af09 intip changed to intsa
intip changed to intsa for IPv6 use
2014-05-12 01:10:42 +04:00
Vladimir Dubrovin cce3a94f04 proxy.h getip46() description fixed 2014-05-12 01:10:36 +04:00
Vladimir Dubrovin 6b99de69c4 getip46() added
int getip46(int family, unsigned char *name,  struct sockaddr_storage
*sa)
family: IPv4/IPv6 preference order 4, 6, 46, 64 or 0 for getip()
compatibility.
name - hostname,
sa - destination sockaddr (must be large enougth)
returns:
0 fo failed resolution
IP address for family = 0
AF_INET/AF_INET6 overwise.
2014-05-12 01:10:31 +04:00
Vladimir Dubrovin aad2559004 FTP proxy debugging output removed, bind to same IP with control connection for active FTP
FTP proxy debugging output removed, bind to same IP with control
connection for active FTP
2014-05-07 01:42:22 +04:00
Vladimir Dubrovin e3144dc61b ldapauth memory leak fixed
Привет !
Исправил старую багу по утечки памяти в плагине .. теперь вообще не
течет ,
глупая ошибка.. Вот так 3,5  года не попрограммируеш , срузу ошибку
найдеш :)

--
Kirill Lopuchov
2014-05-04 23:10:14 +04:00
Vladimir Dubrovin 9ab9c2524b Merge remote-tracking branch 'origin/master' into devel 2014-04-21 01:27:28 +04:00
z3APA3A cb590049b3 More legacy code removed 2014-04-16 15:39:38 +04:00
Vladimir Dubrovin faf5b4b124 Removing Changelog from git 2014-04-15 02:41:39 +04:00
Vladimir Dubrovin cb7d48c9c5 Merge remote-tracking branch 'origin/master' into devel 2014-04-15 02:15:08 +04:00
Vladimir Dubrovin 2eee9d2e98 Changelogs 2014-04-15 00:13:42 +04:00
Vladimir Dubrovin 17835c4d66 resolving compilation issues 2014-04-14 23:58:11 +04:00
z3APA3A 1b5fb4e8d4 Merge remote-tracking branch 'origin/master' into devel 2014-04-14 02:15:39 +04:00
z3APA3A f4c6c9d962 legacy counters code removed 2014-04-14 02:14:34 +04:00
Vladimir Dubrovin 5543b3052d Moving icons compilation to Makefiles 2014-04-13 19:21:18 +04:00
Vladimir Dubrovin 6a0b78268f Adding icons, resolving MinGW compilation 2014-04-13 18:41:25 +04:00
Vladimir Dubrovin c411e03126 logging to changelog 2014-04-10 04:16:25 +04:00
Vladimir Dubrovin 90ca18b3c1 Revert "temp debugging"
This reverts commit 97d811fbfd.
2014-04-10 04:11:55 +04:00
Vladimir Dubrovin 97d811fbfd temp debugging 2014-04-10 04:11:48 +04:00
Vladimir Dubrovin 2890f06488 traffic counters are changed to 64-bit
traffic counters are changed to 64-bit using pstdint.h
2014-04-10 03:34:59 +04:00
Vladimir Dubrovin 467650bbbf ICO file added 2014-04-10 03:33:46 +04:00
114 changed files with 7951 additions and 6998 deletions

No files matched your search

+16 -3
View File
@@ -15,12 +15,26 @@ tmp/
*.swp *.swp
*.o *.o
*.idb *.idb
src/res *.err
res
version.c version.c
3proxy.res 3proxy.res
src/3proxy
src/proxy
src/socks
src/tcppm
src/udppm
src/pop3p
src/smtpp
src/ftppr
src/icqpr
src/mycrypt
src/dighosts
*.ld.so
*.dSYM
doc/html/man3/ doc/html/man3/
doc/html/man8/ doc/html/man8/
doc/html/index.html
*.var *.var
verfile.sh verfile.sh
Makefile Makefile
@@ -156,7 +170,6 @@ csx
AppPackages/ AppPackages/
# Others # Others
sql/
*.Cache *.Cache
ClientBin/ ClientBin/
[Ss]tyle[Cc]op.* [Ss]tyle[Cc]op.*
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

+15 -16
View File
@@ -1,26 +1,25 @@
#include "src/version.h" #include "src/version.h"
LANGUAGE 0x09, 0x01
VS_VERSION_INFO VERSIONINFO 1 VERSIONINFO
FILEVERSION 0,7,0,0 FILEVERSION 0,8,7,0
PRODUCTVERSION 0,7,0,0 PRODUCTVERSION 0,8,7,0
FILETYPE 0x1L FILETYPE 1
FILESUBTYPE 0x0L FILESUBTYPE 0x0L
BEGIN BEGIN
BLOCK "StringFileInfo" BLOCK "StringFileInfo"
BEGIN BEGIN
BLOCK "000004b0" BLOCK "040904E4"
BEGIN BEGIN
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.ru/" VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.ru/\0"
VALUE "CompanyName", "Vladimir Dubrovin" VALUE "CompanyName", "Vladimir Dubrovin\0"
VALUE "FileDescription", "3proxy - tiny proxy server" VALUE "FileDescription", "3proxy - tiny proxy server\0"
VALUE "FileVersion", VERSION "-" BUILDDATE VALUE "FileVersion", "0.8.7\0"
VALUE "InternalName", "3proxy" VALUE "InternalName", "3proxy\0"
VALUE "LegalCopyright", "Copyright (C) 2002-2014 Vladimir Dubrovin" VALUE "LegalCopyright", "Copyright (C) 2002-2016 Vladimir Dubrovin\0"
VALUE "OriginalFilename", "3proxy.exe" VALUE "OriginalFilename", "3proxy.exe\0"
VALUE "ProductName", "3proxy - tiny proxy server" VALUE "ProductName", "3proxy\0"
VALUE "ProductVersion", VERSION VALUE "ProductVersion", "0.8.7\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
+9 -9
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.Linux,v 1.24 2014-04-07 20:34:57 vlad Exp $
# #
# 3 proxy Makefile for GCC/Linux/Cygwin # 3 proxy Makefile for GCC/Linux/Cygwin
# #
@@ -11,17 +10,16 @@
BUILDDIR = BUILDDIR =
CC = gcc CC = gcc
CFLAGS = -Wall -g -O2 -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -g -O2 -c -pthread -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o COUT = -o
LN = gcc LN = gcc
DCFLAGS = -fpic DCFLAGS = -fpic
LDFLAGS = -Wall -O2 -pthread LDFLAGS = -O2 -pthread
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .ld.so DLSUFFICS = .ld.so
# -lpthreads may be reuqired on some platforms instead of -pthreads # -lpthreads may be reuqired on some platforms instead of -pthreads
#LIBS = -lcrypto -lssl -ldl LIBSPREFIX = -l
# libcrypto and libssl are required for SSLPlugin LIBSSUFFIX =
LIBS = -ldl
LNOUT = -o LNOUT = -o
EXESUFFICS = EXESUFFICS =
OBJSUFFICS = .o OBJSUFFICS = .o
@@ -31,8 +29,11 @@ REMOVECOMMAND = rm -f
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.Linux MAKEFILE = Makefile.Linux
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin # PamAuth requires libpam, you may require pam-devel package to be installed
# SSLPlugin is not built by default because of external dependencies # SSLPlugin requires -lcrypto -lssl
#LIBS = -lcrypto -lssl -ldl
LIBS = -ldl
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PLUGINS = StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin
include Makefile.inc include Makefile.inc
@@ -49,7 +50,6 @@ INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755 INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DATA = $(INSTALL) -m 644
INSTALL_OBJS = src/3proxy \ INSTALL_OBJS = src/3proxy \
src/countersutil \
src/dighosts \ src/dighosts \
src/ftppr \ src/ftppr \
src/mycrypt \ src/mycrypt \
+2 -1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.Solaris,v 1.18 2008/09/30 13:58:44 vlad Exp $
# #
# 3 proxy Makefile for Solaris/SunCC # 3 proxy Makefile for Solaris/SunCC
# #
@@ -18,6 +17,8 @@ DCFLAGS = -fpic
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .ld.so DLSUFFICS = .ld.so
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o ./ LNOUT = -o ./
EXESUFFICS = EXESUFFICS =
OBJSUFFICS = .o OBJSUFFICS = .o
+2 -1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.Solaris-gcc,v 1.14 2008/09/30 13:58:44 vlad Exp $
# #
# 3 proxy Makefile for Solaris/gcc # 3 proxy Makefile for Solaris/gcc
# #
@@ -19,6 +18,8 @@ DCFLAGS = -fpic
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .ld.so DLSUFFICS = .ld.so
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o ./ LNOUT = -o ./
EXESUFFICS = EXESUFFICS =
OBJSUFFICS = .o OBJSUFFICS = .o
-35
View File
@@ -1,35 +0,0 @@
#$Id: Makefile.ccc,v 1.12 2007/04/10 16:29:25 vlad Exp $
#
# 3 proxy Makefile for Compaq C Compiler
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR =
CC = ccc
CFLAGS = -Wall -O2 -c -pthread -D_THREAD_SAFE -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -WITH_POLL
COUT = -o
LN = ccc
LDFLAGS = -Wall -O2 -pthread
DCFLAGS = -fpic
DLFLAGS = -shared
DLSUFFICS = .ld.so
LIBS =
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *~
REMOVECOMMAND = rm -f
TYPECOMMAND = cat
COMPATLIBS =
MAKEFILE = Makefile.ccc
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin
include Makefile.inc
allplugins:
@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
-1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.debug,v 1.7 2007/04/18 05:33:19 vlad Exp $
# #
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake) # 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
# #
-1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.inc,v 1.3 2007/01/23 16:00:26 vlad Exp $
# #
# 3 proxy common Makefile # 3 proxy common Makefile
# #
-1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.intl,v 1.8 2007/07/21 18:47:00 vlad Exp $
# #
# 3 proxy Makefile for Intel C compiler for Windows (for both make and nmake) # 3 proxy Makefile for Intel C compiler for Windows (for both make and nmake)
# #
+36
View File
@@ -0,0 +1,36 @@
#
# 3 proxy Makefile for GCC/windows
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
# remove -DNOODBC from CFLAGS and add -lodbc to LDFLAGS to compile with ODBC
# library support
BUILDDIR = ../bin/
CC = clang
CFLAGS = -O2 -c -pthread -static -DWITH_STD_MALLOC -DNOIPV6
COUT = -o
LN = clang
LDFLAGS = -O2 -static -s
DLFLAGS = -shared
DLSUFFICS = .dll
LIBS = -lws2_32 -lodbc32 -ladvapi32
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o
EXESUFFICS = .exe
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *.tmp
REMOVECOMMAND = rm -f
TYPECOMMAND = cat
COMPATLIBS =
MAKEFILE = Makefile.win
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin
include Makefile.inc
allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.o &&cd ..\..)
+7 -6
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.msvc,v 1.17 2010-11-11 14:44:11 v.dubrovin Exp $
# #
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake) # 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
# #
@@ -12,11 +11,13 @@ CC = cl
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
DLFLAGS = /DLL DLFLAGS = /DLL
DLSUFFICS = .dll DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
LIBSOLD = libeay32MT.lib ssleay32MT.lib LIBSOLD = libeay32MT.lib ssleay32MT.lib
LIBSPREFIX =
LIBSSUFFIX = .lib
LIBEXT = .lib LIBEXT = .lib
LNOUT = /out: LNOUT = /out:
EXESUFFICS = .exe EXESUFFICS = .exe
@@ -27,8 +28,8 @@ REMOVECOMMAND = del 2>NUL >NUL
TYPECOMMAND = type TYPECOMMAND = type
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.msvc MAKEFILE = Makefile.msvc
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin lastFripper FilePlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin
VERFILE = 3proxyres.obj $(VERFILE) VERFILE = $(VERFILE)
include Makefile.inc include Makefile.inc
@@ -36,7 +37,7 @@ include Makefile.inc
rc /fo../3proxy.res ../3proxy.rc rc /fo../3proxy.res ../3proxy.rc
3proxyres.obj: ../3proxy.res 3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /MACHINE:X86 ../3proxy.res cvtres /out:3proxyres.obj /MACHINE:I386 ../3proxy.res
allplugins: allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..) for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
+13 -5
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.msvc64,v 1.14 2007/07/21 18:47:05 vlad Exp $
# #
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake) # 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
# #
@@ -15,8 +14,10 @@ LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
DLFLAGS = /DLL DLFLAGS = /DLL
DLSUFFICS = .dll DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib libeay32MT.lib ssleay32MT.lib
LIBSOLD = libeay32MT.lib ssleay32MT.lib LIBSOLD = libeay32MT.lib ssleay32MT.lib
LIBSPREFIX =
LIBSSUFFIX = .lib
LIBEXT = .lib LIBEXT = .lib
LNOUT = /out: LNOUT = /out:
EXESUFFICS = .exe EXESUFFICS = .exe
@@ -27,8 +28,14 @@ REMOVECOMMAND = del 2>NUL >NUL
TYPECOMMAND = type TYPECOMMAND = type
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.msvc64 MAKEFILE = Makefile.msvc64
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin FilePlugin SSLPlugin
VERFILE = 3proxyres.obj $(VERFILE) VERFILE = $(VERFILE)
#../3proxy.res:
# rc /fo../3proxy.res ../3proxy.rc
#3proxyres.obj: ../3proxy.res
# cvtres /out:3proxyres.obj /MACHINE:X64 ../3proxy.res
include Makefile.inc include Makefile.inc
@@ -36,7 +43,8 @@ include Makefile.inc
rc /fo../3proxy.res ../3proxy.rc rc /fo../3proxy.res ../3proxy.rc
3proxyres.obj: ../3proxy.res 3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj /MACHINE:X64 ../3proxy.res cvtres /out:3proxyres.obj /machine:x64 ../3proxy.res
allplugins: allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..) for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)
-1
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.msvc,v 1.14 2007/07/21 18:47:02 vlad Exp $
# #
# 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake) # 3 proxy Makefile for Microsoft Visual C compiler (for both make and nmake)
# #
+5 -4
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.unix,v 1.20 2007/04/10 16:29:25 vlad Exp $
# #
# 3 proxy Makefile for GCC/Unix # 3 proxy Makefile for GCC/Unix
# #
@@ -12,16 +11,18 @@ BUILDDIR =
CC = gcc CC = gcc
# you may need -L/usr/pkg/lib for older NetBSD versions # you may need -L/usr/pkg/lib for older NetBSD versions
CFLAGS = -Wall -g -O2 -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL CFLAGS = -g -O2 -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o COUT = -o
LN = gcc LN = gcc
LDFLAGS = -Wall -O2 -pthread LDFLAGS = -O2 -pthread
# -lpthreads may be reuqired on some platforms instead of -pthreads # -lpthreads may be reuqired on some platforms instead of -pthreads
# -ldl or -lld may be required for some platforms # -ldl or -lld may be required for some platforms
DCFLAGS = -fpic DCFLAGS = -fpic
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .ld.so DLSUFFICS = .ld.so
LIBS = LIBS =
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o LNOUT = -o
EXESUFFICS = EXESUFFICS =
OBJSUFFICS = .o OBJSUFFICS = .o
@@ -31,7 +32,7 @@ REMOVECOMMAND = rm -f
TYPECOMMAND = cat TYPECOMMAND = cat
COMPATLIBS = COMPATLIBS =
MAKEFILE = Makefile.unix MAKEFILE = Makefile.unix
PLUGINS = StringsPlugin TrafficPlugin PCREPlugin PLUGINS = StringsPlugin TrafficPlugin PCREPlugin PamAuth
include Makefile.inc include Makefile.inc
-1
View File
@@ -7,7 +7,6 @@ INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755 INSTALL_BIN = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644 INSTALL_DATA = $(INSTALL) -m 644
INSTALL_OBJS = src/3proxy \ INSTALL_OBJS = src/3proxy \
src/countersutil \
src/dighosts \ src/dighosts \
src/ftppr \ src/ftppr \
src/mycrypt \ src/mycrypt \
+43
View File
@@ -0,0 +1,43 @@
#
# 3 proxy Makefile for Open Watcom 2
#
# You can try to remove -DWITH_STD_MALLOC to CFLAGS to use optimized malloc
# libraries
#
# Add /DSAFESQL to CFLAGS if you are using poorely written/tested ODBC driver
BUILDDIR = ../bin/
CC = cl
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /c
COUT = /Fo
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no
DLFLAGS = /DLL
DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib user32.lib kernel32.lib
LIBSOLD = libeay32MT.lib ssleay32MT.lib
LIBSPREFIX =
LIBSSUFFIX = .lib
LIBEXT = .lib
LNOUT = /out:
EXESUFFICS = .exe
OBJSUFFICS = .obj
DEFINEOPTION = /D
COMPFILES = *.pch *.idb *.err
REMOVECOMMAND = del 2>NUL >NUL
TYPECOMMAND = type
COMPATLIBS =
MAKEFILE = Makefile.watcom
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin PCREPlugin
VERFILE = $(VERFILE)
include Makefile.inc
../3proxy.res:
rc /fo../3proxy.res ../3proxy.rc
3proxyres.obj: ../3proxy.res
cvtres /out:3proxyres.obj ../3proxy.res
allplugins:
call ../makeplugins.bat
+4 -3
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.win,v 1.9 2007/08/20 15:26:27 vlad Exp $
# #
# 3 proxy Makefile for GCC/windows # 3 proxy Makefile for GCC/windows
# #
@@ -11,13 +10,15 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = gcc CC = gcc
CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC -DNOIPV6
COUT = -o COUT = -o
LN = gcc LN = gcc
LDFLAGS = -O2 -s -mthreads LDFLAGS = -O2 -s -mthreads
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .dll DLSUFFICS = .dll
LIBS = -lws2_32 -lodbc32 -ladvapi32 LIBS = -lws2_32 -lodbc32 -ladvapi32
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o LNOUT = -o
EXESUFFICS = .exe EXESUFFICS = .exe
OBJSUFFICS = .o OBJSUFFICS = .o
+2 -3
View File
@@ -1,4 +1,3 @@
#$Id: Makefile.win,v 1.9 2007/08/20 15:26:27 vlad Exp $
# #
# 3 proxy Makefile for GCC/windows # 3 proxy Makefile for GCC/windows
# #
@@ -11,10 +10,10 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = /opt/cegcc/arm-wince-cegcc/bin/gcc CC = /opt/cegcc/arm-wince-cegcc/bin/gcc
CFLAGS = -Wall -O2 -s -c -mthreads -DWITH_STD_MALLOC -DNOODBC -D_WINCE -D_WIN32 -D__USE_W32_SOCKETS CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC -DNOODBC -D_WINCE -D_WIN32 -D__USE_W32_SOCKETS
COUT = -o COUT = -o
LN = /opt/cegcc/arm-wince-cegcc/bin/gcc LN = /opt/cegcc/arm-wince-cegcc/bin/gcc
LDFLAGS = -Wall -O2 -s -mthreads LDFLAGS = -O2 -s -mthreads
DLFLAGS = -shared DLFLAGS = -shared
DLSUFFICS = .dll DLSUFFICS = .dll
LIBS = -lws2 LIBS = -lws2
+109 -6
View File
@@ -1,21 +1,124 @@
/* /*
3APA3A 3proxy tiny proxy server 3APA3A 3proxy tiny proxy server
(c) 2002-2014 by Vladimir '3APA3A' Dubrovin <3proxy@3proxy.ru> (c) 2002-2016 by Vladimir '3APA3A' Dubrovin <3proxy@3proxy.ru>
please read License Agreement please read License Agreement
*/ */
Please read doc/html/index.html and man pages. Please read doc/html/index.html and man pages.
Features:
1. General
+ HTTP/1.1 Proxy with keep-alive client and server support,
transparent proxy support.
+ Anonymous and random client emulation HTTP proxy mode
+ FTP over HTTP support.
+ DNS caching with built-in resolver
+ HTTPS (CONNECT) proxy
+ SOCKSv4/4.5 Proxy
+ SOCKSv5 Proxy
+ UDP and bind support for SOCKSv5 (fully compatible with
SocksCAP/FreeCAP for UDP)
+ Transparent SOCKS redirection for HTTP, POP3, FTP, SMTP, ICQ
+ POP3 Proxy
+ FTP proxy
+ DNS proxy
+ TCP port mapper
+ UDP port mapper
+ SMTP proxy
+ ICQ/AOL proxy
+ Threaded application (no child process).
+ Web administration and statistics
+ Plugins for functionality extension
+ Native 64 bit application for 64 bit OS, including 64-bit editions of
Windows.
+ IPv6 support
2. Proxy chaining and network connections
+ Connect back proxy support to bypass firewalls
+ Parent proxy support for any type of incoming connection
+ Username/password authentication for parent proxy(s).
+ HTTPS/SOCKS4/SOCKS5 and redirection parent support
+ Random parent selection
+ Chain building (multihop proxing)
+ Load balancing between few network connections by choosing network
interface
3. Logging
+ turnable log format compatible with any log parser
+ stdout logging
+ file logging
+ syslog logging (Unix)
+ ODBC logging
+ log file rotation (hourly, daily, weekly, monthly)
+ automatic log file comperssion with external archiver (for files)
+ automatic removal of older log files
+ Character filtering for log files
+ different log files for different servces are supported
4. Access control
+ ACL-driven (user/source/destination/protocol/weekday/daytime or
combined) bandwith limitation for incoming and (!)outgoing trafic.
+ ACL-driven (user/source/destination/protocol/weekday/daytime or
combined) traffic limitation per day, week or month for incoming and
(!) outgoing traffic
+ User authentication by DNS hostname
+ User authentication by username / password
+ Access control by username, source IP, destination IP, destination
port and destination action (POST, PUT, GET, etc), weekday and daytime.
+ Access control by username/password for SOCKSv5 and HTTP/HTTPS/FTP
+ Cleartext or encrypted (crypt/MD5 or NT) passwords.
+ Connection redirection
+ Access control by requested action (CONNECT/BIND,
HTTP GET/POST/PUT/HEAD/OTHER).
+ NTLM (v1 only) authentication for HTTP proxy access
+ All access control entries now support weekday and time limitations
+ Hostnames and * templates are supported instead of IP address
5. Extensions
+ Regular expression filtering (with PCRE) via PCREPlugin
currently HTTP traffic only for URLs, HTTP headers and HTTP data.
+ Authentication with Windows username/password (cleartext only!)
+ SSL/TLS decryptions with certificate spoofing
+ NAT support under Linux
6. Configuration
+ support for configuration files
+ support for includes in configuration files
+ interface binding
+ running as daemon process
+ utility for automated networks list building
+ configuration reload on any file change
Unix
+ support for chroot
+ support for setgid
+ support for setuid
+ support for signals
Windows
+ support --install as service
+ support --remove as service
+ support for service START, STOP, PAUSE and CONTINUE commands (on
PAUSE no new connection accepted, but active connections still in
progress, on CONTINUE configuration is reloaded)
Windows 95/98/ME
+ support --install as service
+ support --remove as service
6. Compilation
+ MSVC (static)
+ Intel Windows Compiler (msvcrt.dll)
+ Windows/gcc (msvcrt.dll)
+ Cygwin/gcc (cygwin.dll)
+ Unix/gcc
+ Unix/ccc
+ Solaris
+ Mac OS X, iPhone OS
+ Linux and derivered systems
+ Lite version for Windows 95/98/NT/2000/XP/2003
+ 32 bit and 64 bit versions for Windows Vista and above, Windows 2008 server and above
3proxy Combined proxy server may be used as 3proxy Combined proxy server may be used as
Windows 95/98/NT/2000/XP/2003/Vista
executable or service (supports installation and removal). executable or service (supports installation and removal).
It uses config file to read it's configuration (see It uses config file to read it's configuration (see
3proxy.cfg.sample for details). 3proxy.cfg.sample for details).
--install installs and starts proxy as NT/2000/XP service --install installs and starts proxy as Windows service
(config file should be located in the same directory) (config file should be located in the same directory)
--remove removes the service (should be stopped before via --remove removes the service (should be stopped before via
net stop 3proxy). 'net stop 3proxy').
3proxy.exe is all-in-one, it doesn't require all others .exe 3proxy.exe is all-in-one, it doesn't require all others .exe
to work. to work.
See 3proxy.cfg.sample for examples, see man 3proxy.cfg See 3proxy.cfg.sample for examples, see man 3proxy.cfg
@@ -39,7 +142,6 @@ smtpp SMTP proxy server, binds to port 25. You must specify
icqpr ICQ/AIM proxy. Maps some TCP port to TCP port of ICQ icqpr ICQ/AIM proxy. Maps some TCP port to TCP port of ICQ
server and performs packets translation. Example: server and performs packets translation. Example:
icqpr 5190 login.icq.com 5190 icqpr 5190 login.icq.com 5190
msnpr MSN proxy (beta)
tcppm TCP port mapping. Maps some TCP port on local machine to tcppm TCP port mapping. Maps some TCP port on local machine to
TCP port on remote host. TCP port on remote host.
udppm UDP port mapping. Maps some UDP port on local machine to udppm UDP port mapping. Maps some UDP port on local machine to
@@ -56,9 +158,10 @@ mycrypt Program to obtain crypted password fro cleartext. Supports
mycrypt salt password mycrypt salt password
produces MD5/crypt password with salt "salt". produces MD5/crypt password with salt "salt".
dighosts Utility for building networks list from web page. dighosts Utility for building networks list from web page.
countersutil Utility to manage counters file
Run utility with --help option for command line reference. Run utility with --help option for command line reference.
Latest version is available from http://3proxy.ru/ Latest version is available from http://3proxy.ru/
Want to donate the project? http://3proxy.ru/donations/
-1
View File
@@ -104,4 +104,3 @@
- Addon antiviral, HTTP cache filters modules, authentication - Addon antiviral, HTTP cache filters modules, authentication
modules for different protocols (RADIUS, PAM etc). modules for different protocols (RADIUS, PAM etc).
$Id: Release.notes,v 1.9 2014-04-07 21:24:42 vlad Exp $
-1
View File
@@ -15,4 +15,3 @@ on the provider's Web server.
Provider has proxy server 10.1.2.5. Traffic from proxy server is not free, but Provider has proxy server 10.1.2.5. Traffic from proxy server is not free, but
is cheaper than traffic from non-free networks. is cheaper than traffic from non-free networks.
$Id: 0.scenario.txt,v 1.2 2004/07/23 13:33:39 vlad Exp $
-1
View File
@@ -199,4 +199,3 @@ admin
# now we needn't any root rights. We can chroot and setgid/setuid. # now we needn't any root rights. We can chroot and setgid/setuid.
###$Id: 3proxy.cfg.sample,v 1.7 2006/11/18 14:37:06 vlad Exp $#######
-1
View File
@@ -50,4 +50,3 @@ internal 127.0.0.1
allow user1 allow user1
admin admin
#$Id: counters.sample,v 1.2 2004/07/23 13:33:39 vlad Exp $
+53
View File
@@ -0,0 +1,53 @@
# By Mark Dreuband
nserver 10.1.2.1
nscache 65536
# we can grab wpad file from provider and feed it to dighosts
# to build list of free networks
# system "c:\3proxy\dighosts.exe -m http://wpad.security.nnov.ru/wpad.dat c:\3proxy\freenetworks.net"
service
internal 192.168.1.1
external 10.1.1.1
dnspr
log &3proxylog,root
#log c:\3proxy\logs\proxy.log D
#logformat "Linsert into log (timestamp, username, service, clientip, remoteip, remoteport, bytesin, bytesout,request,error) values (
#logformat "%t '%U' '%N' '%C' '%R' %r %I %O '%T' %E"
logformat "-\'+_Linsert into log (time, bytesin, bytesout, username, url, host, port, service) values ('%Y-%m-%d %H:%M:%S', %I, %O, '%U', '%T', '%n', %r, '%N');"
archiver zip c:\3proxy\zip.exe -m -qq %A %F
rotate 50
auth strong
users temp:CL:password root:CL:password
# access free networks directly
allow * * $c:\3proxy\freenetworks.net
# redirect web traffic for non-free networks to provider's proxy
allow * * * 80
parent 1000 http 10.1.2.5 3128
# allow rest of traffic
allow *
proxy
flush
auth iponly
allow *
pop3p
tcppm 25 mail.security.nnov.ru 25
flush
# redirect port 80 traffic via SOCKS server to local HTTP proxy to
# have URLs logged
allow * * * 80
parent 1000 http 0.0.0.0 0
allow *
socks
#daemon
+56
View File
@@ -0,0 +1,56 @@
# Connection: localhost
# Host: 127.0.0.1
# Saved: 2004-04-09 18:53:52
#
# Host: 127.0.0.1
# Database: 3proxy
# Table: 'log'
#
CREATE TABLE `log` (
`time` datetime NOT NULL default '0000-00-00 00:00:00',
`bytesin` int(11) NOT NULL default '0',
`bytesout` int(11) NOT NULL default '0',
`username` varchar(20) NOT NULL default '',
`service` varchar(7) NOT NULL default '',
`host` varchar(100) NOT NULL default '',
`port` int(11) NOT NULL default '0',
`url` varchar(255) NOT NULL default ''
) TYPE=MyISAM;
CREATE TABLE `services` (
`startport` int(11) NOT NULL default '0',
`endport` int(11) NOT NULL default '0',
`service` varchar(100) NOT NULL default '',
`description` varchar(100) NOT NULL default ''
) TYPE=MyISAM;
CREATE TABLE `timelimit` (
`datefrom` datetime NOT NULL default '0000-00-00 00:00:00',
`dateto` datetime NOT NULL default '0000-00-00 00:00:00'
) TYPE=MyISAM;
INSERT INTO services (80, 80, NULL, 'Access to Web Server');
INSERT INTO services (443, 443, NULL, 'Secure Access to Web Server');
INSERT INTO services (3128, 3128, NULL, 'Access to Web server via external Proxy');
INSERT INTO services (1080, 1080, NULL, 'Access to external SOCKS server');
INSERT INTO services (5190, 5190, NULL, 'Access to ICQ');
INSERT INTO services (6666, 6668, NULL, 'Access to IRC');
INSERT INTO services (119, 119, NULL, 'Access to news server');
INSERT INTO services (25, 25, NULL, 'Sent Mail');
INSERT INTO services (0, 0, 'POP3P', 'Received Mail');
INSERT INTO services (0, 0, 'SMTPP', 'Sent Mail');
INSERT INTO services (0, 0, 'TCPPM', 'Access to external server via TCP');
INSERT INTO services (0, 0, 'UDPPM', 'Access to external server via UDP');
INSERT INTO services (0, 0, 'PROXY', 'Access to external server via Proxy');
INSERT INTO services (0, 0, 'FTPPR', 'Access to external server via FTP Proxy');
INSERT INTO services (0, 0, 'ICQPR', 'Access to external server via ICQ Proxy');
INSERT INTO services (0, 0, 'SOCKS4', 'Access to external server via Socks v4');
INSERT INTO services (0, 0, 'SOCKS5', 'Access to external server via Socks v5');
INSERT INTO services (0, 0, 'DNSPR', 'Name resolution');
INSERT INTO services (0, 0, NULL, 'Unknown');
Binary file not shown.
-6
View File
@@ -1,6 +0,0 @@
all: isqlodbc$(EXESUFFICS)
clean:
@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES)
isqlodbc$(EXESUFFICS): isqlodbc$(OBJSUFFICS)
$(LN) $(LNOUT)isqlodbc$(EXESUFFICS) $(LDFLAGS) $(VERFILE) isqlodbc$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
-15
View File
@@ -1,15 +0,0 @@
CC = gcc
CFLAGS = -I /usr/local/include -DUNIX
COUT = -o
LN = gcc
LDFLAGS =
LIBS =-L /usr/local/lib -lodbc
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *~
REMOVECOMMAND = rm -f
COMPATLIBS =
include Makefile.inc
-15
View File
@@ -1,15 +0,0 @@
CC = gcc
CFLAGS = -DWIN32
COUT = -o
LN = gcc
LDFLAGS =
LIBS = -lodbc32
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o
DEFINEOPTION = -D
COMPFILES = *~
REMOVECOMMAND = rm -f
COMPATLIBS =
include Makefile.inc
-191
View File
@@ -1,191 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <io.h>
#include <windows.h>
#endif
#ifdef UNIX
#include <sqltypes.h>
#endif
#include <sql.h>
#include <sqlext.h>
#define BUF_LENGTH 65000
/* environment variable */
SQLHENV env=NULL;
SQLHDBC dbc=NULL;
SQLHSTMT stmt=NULL;
SQLHSTMT cstmt=NULL;
unsigned char *dsn;
unsigned char *user;
unsigned char *pass;
RETCODE retcod;
/*description a columns of result of request */
SQLSMALLINT ColumnCount;
unsigned int ColNumber;
unsigned char ColName[SQL_MAX_COLUMN_NAME_LEN];
unsigned int Length;
unsigned int Type;
unsigned int Size;
unsigned int Digits;
unsigned int Nullable;
unsigned char data_buf[BUF_LENGTH];
unsigned long OutData;
/* function print error message*/
void PrintError(HENV env,HDBC dbc,HSTMT stmt,RETCODE retcod)
{
SQLINTEGER nError;
SQLSMALLINT TextLength;
unsigned char BufErrMsg[SQL_MAX_MESSAGE_LENGTH+1];
unsigned char SqlState[128];
SQLError(env,dbc,stmt,SqlState,&nError,BufErrMsg,512, &TextLength);
printf("%s\n" ,BufErrMsg);
}
void sqlquery(SQLHDBC dbc,SQLHSTMT stmt, unsigned char *strquery)
{
retcod=SQLAllocStmt(dbc, &stmt);
retcod=SQLExecDirect(stmt,strquery,SQL_NTS);
if(retcod!=SQL_SUCCESS)
{ PrintError(env,dbc,stmt,retcod);}
SQLNumResultCols(stmt,&ColumnCount);
while(SQLFetch(stmt)==SQL_SUCCESS)
{
for(ColNumber=1; ColNumber<=ColumnCount ; ColNumber++)
{
SQLGetData(stmt,ColNumber,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
printf("%s|",data_buf);
}
printf("\n",data_buf);
strcpy(data_buf,"");
}
SQLFreeStmt( stmt, SQL_DROP );
}
/* isqlodbc dsn[[,user][,pass]] ["SQLCMD"] */
int main(int argc, char *argv[])
{
unsigned char qbuf[64000];
unsigned char *ptr=NULL;
/* Allocate environment and database connection handles */
retcod=SQLAllocEnv( &env );
if(retcod!=SQL_SUCCESS)
{
PrintError(env,dbc,stmt,retcod);
SQLFreeEnv(env);
return (-1);
}
retcod = SQLAllocConnect( env, &dbc );
if(retcod!=SQL_SUCCESS)
{
PrintError(env,dbc,stmt,retcod);
SQLFreeConnect( dbc );
return (-1);
}
if(argc > 1 )
{
/* parsing command line and get parametrs */
dsn = strtok(argv[1],",");
user = strtok(NULL, ",");
pass = strtok(NULL, ",");
/* Connect from DSN */
retcod=SQLConnect(dbc,dsn,SQL_NTS,user,SQL_NTS,pass,SQL_NTS);
if(retcod!=SQL_SUCCESS)
{ PrintError(env,dbc,stmt,retcod); }
else
{
if (argc > 2)
{
/*sql cmd from command line*/
sqlquery(dbc,stmt,argv[2]);
}
else
{
/*sql cmd from stdin */
if( isatty(0) ){ printf(".tables - list table\n.q - exit\nsql>"); }
while(fgets(qbuf,63000,stdin) != NULL )
{
ptr=strrchr(qbuf,';');
if (ptr!=NULL)
{
sqlquery(dbc,stmt,qbuf);
}
else
{
/*cmd exit*/
if (strstr(qbuf,".q")){ break; };
/*cmd table list*/
if (strstr(qbuf,".tables"))
{
retcod=SQLAllocStmt(dbc, &stmt);
if(retcod!=SQL_SUCCESS){ PrintError(env,dbc,stmt,retcod); }
else
{
retcod=SQLTables(stmt,NULL,0,NULL,0,NULL,0,NULL,0);
if(retcod !=SQL_SUCCESS) { PrintError(env,dbc,stmt,retcod);}
while(SQLFetch(stmt)==SQL_SUCCESS)
{
SQLGetData(stmt,3,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
printf("%s|",data_buf);
/*list columns */
retcod=SQLAllocStmt(dbc, &cstmt);
retcod=SQLColumns(cstmt,NULL,0,NULL,0,data_buf,strlen(data_buf),NULL,0);
if(retcod !=SQL_SUCCESS) { PrintError(env,dbc,stmt,retcod);}
else
{
printf("create table %s (",data_buf);
while(SQLFetch(cstmt)==SQL_SUCCESS)
{
SQLGetData(cstmt,4,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
printf("%s ",data_buf);
SQLGetData(cstmt,6,SQL_CHAR,data_buf,BUF_LENGTH,&OutData);
printf("%s, ",data_buf);
}
printf(");\n");
SQLFreeStmt( cstmt, SQL_DROP );
}/*end list columns*/
}/*end while SQLFetch */
SQLFreeStmt( stmt, SQL_DROP );
}
}/*end if (strstr(qbuf,".tables")) */
} /*end else cmd*/
if( isatty(0) ){ printf("sql>"); }
} /*end while*/
}
}
SQLDisconnect(dbc);
} /* if (argc > 2) */
else
{
printf("isqlodbc dsn[[,user][,pass]] [\"SQLCMD\"]\n");
}
SQLFreeConnect( dbc );
SQLFreeEnv( env );
return 0;
}
-22
View File
@@ -1,22 +0,0 @@
create table log (ldate date,ltime time,username char (30),userip char (16),bytein integer (10),byteout integer (10),service char (8), host char(255), hostport integer (10), url char (255) );
create index idate on log (ldate);
create index iusername on log (username);
create index iuserip on log (userip);
create index ihost on log (host);
create table services (port integer(10),service char(100),description char (100));
INSERT INTO services values (80,'PROXY', 'Access to Web Server');
INSERT INTO services values (21,'PROXY', 'Access to Ftp Server via HTTP proxy');
INSERT INTO services values (5190,'PROXY', 'Access to ICQ via HTTP proxy');
INSERT INTO services values (0, 'POP3P', 'Received Mail via POP3');
INSERT INTO services values (0,'FTPPR', 'Access to Ftp server via FTP proxy');
INSERT INTO services values (0,'SOCKS4', 'Access to external server via Socks v4');
INSERT INTO services values (0,'SOCKS5', 'Access to external server via Socks v5');
INSERT INTO services values (0,'TCPPM', 'Access to external server via TCP mapping');
INSERT INTO services values (0,'UDPPM', 'Access to external server via UDP mapping');
INSERT INTO services values (0, 0, NULL, 'Unknown');
-63
View File
@@ -1,63 +0,0 @@
------------------------------ KOI8-R ------------------------------------
Этот архив содержит набор CGI cкриптов и программ для получения
статистики работы пользователей прокси сервера "3proxy", посредством анализа
лога расположенного в ODBC источнике(базе), через Web интерфейс.
stat.awk - основной CGI скрипт (Для его испольнения под Win9X/2000 необходима
программа awk.exe ,в linux/freebsd она как правило входит в сиситему
по умолчанию).
isqlodbc - программа для выполнения SQL запросов к базам ODBC
(вызывается из stat.awk). компилируется gcc и работает как в
win9X/2000 так и в linux/freebsd. (Так же может
использоваться независимо от stat.awk как отдельная
программа..)
log.sql - SQL скрипт создания базы для лога сервера.
awk.exe - awk интерпретатор под Win9X/2000.
Настройка скриптов статистики .
Для работы вам потребуется:
1) любой http сервер подерживающий CGI
2) odbc менеджер (под win32 ) или iodbc менеджер (под unix)
любая база данных например : sqlite, mysql, postgress или любые другие
имеющие ODBC драйвера.(Как настраивать iODBC под linux/freebsd смотрите в
файле iodbc.txt в каталоге /doc/ru архива 3proxy.)
Шаг настройки N1:
Создаем базу данных и DSN для хранения лога. ( в нашем случае DSN будет
называться "sqlite".) далее выполняя скрипт log.sql создаем необходимые
таблицы и индексы:
isqlodbc sqlite < log.sql
Шаг настройки N2:
Устанавливаем DSN и формат таблицы с логом в файле 3proxy.cfg следующего вида:
-----------
# create table log (
# ldate date,
# ltime time,
# username char (30),
# userip char (16),
# bytein integer (10),
# byteout integer (10),
# service char (8),
# host char(255),
# hostport integer (10),
# url char (255)
# );
log &sqlite
logformat "Linsert into log values ('%Y-%m-%d','%H:%M:%S','%U','%C','%I','%O','%N','%n','%r','%T');"
-----------
Шаг настройки N3:
Копируем файлы isqlodbc и stat.awk в каталог с CGI скриптами http сервера
и меняем в stat.awk путь вызова и DSN на свои значения , например:
isql="./isqlodbc.exe sqlite "
Шаг настройки N4:
Пробуем вызвать скрипт из web браузера , например
http://localhost/cgi/stat.awk?
------------------------------ KOI8-R ------------------------------------
-129
View File
@@ -1,129 +0,0 @@
#!/usr/bin/awk -f
BEGIN {
scriptname = ENVIRON["SCRIPT_NAME"]
#for win32
isql=".\\isqlodbc.exe sqlite "
#for unix
#isql="./isqlodbc sqlite "
print "Content-Type: text/html; charset=koi8-r \n\n"
print "<HTML>\n<BODY>\n";
# query parse
query_str = ENVIRON["QUERY_STRING"]
n = split(query_str, querys, "&")
for (i=1; i<=n; i++)
{
split(querys[i], data, "=")
qr[data[1]] = data[2]
}
printf "<FORM METHOD=PUT action=\"" scriptname "?rep=1\">"
printf "datefrom:<INPUT name=\"datefrom\" value=\"2004-06-01\"> "
printf "dateto:<INPUT name=\"dateto\" value=\"2004-07-30\"> <br>"
printf "<INPUT type=\"radio\" name=\"userid\" value=\"username\" checked> LOGIN user <br>"
printf "<INPUT type=\"radio\" name=\"userid\" value=\"userip\"> IP user <br>"
printf "<INPUT type=\"hidden\" name=\"rep\" value=\"user\">"
printf "<INPUT type=\"submit\" value=\"Report\">"
printf "</FORM>"
#printf "query_str=%s\n<br>",query_str
#print qr["rep"]
if(qr["rep"]=="user")
{
cmd = isql " \"select " qr["userid"] ",sum(bytein),sum(byteout),sum(bytein+byteout) from log \
where ldate > '" qr["datefrom"] "' AND ldate < '" qr["dateto"] \
"' group by " qr["userid"] " order by sum(bytein+byteout) desc;\""
printf " <table WIDTH=100%% BORDER=1><tr><td><b>user</b></td> <td><b>bytein</b></td> <td><b>byteout</b> </td> <td> <b>bytesum</b></td></tr>"
while( (cmd|getline result)>0)
{
split(result, rt, "|")
printf "<tr> <td><a href=\"%s?rep=host&datefrom=%s&dateto=%s&userid=%s&selectid=%s\"> %s <\/a></td><td>%d</td><td>%d</td><td>%d</td></tr>",
scriptname,qr["datefrom"],qr["dateto"],qr["userid"],rt[1],rt[1],rt[2],rt[3],rt[4]
totalbytein=totalbytein+rt[2];
totalbyteout=totalbyteout+rt[3];
totalbytesum=totalbytesum+rt[4];
}
printf "<tr> <td><br>Total users</td> <td><br>%d</td> <td><br>%d</td> \
<td><br>%d</td></tr> </table> ",totalbytein,totalbyteout, totalbytesum
close(cmd)
}
if(qr["rep"]=="host")
{
cmd = isql "\"select sum(bytein+byteout), sum(bytein), sum(byteout),host from log \
where ldate > '" qr["datefrom"] "' AND ldate < '"qr["dateto"] \
"' AND " qr["userid"] " = '" qr["selectid"] \
"' group by host order by sum(bytein+byteout) desc;\""
printf "<center><b>Detail statistic for user: %s</b></center>",qr["selectid"]
printf " <table WIDTH=100%% BORDER=1> <tr><td><b>sum byte</b></td> <td><b>bytein</b></td> <td><b>byteout</b></td><td><b>host</b></td></tr>"
while( (cmd|getline result)>0)
{
split(result, rt, "|")
printf "<tr><td>%d</td><td>%d</td><td>%d</td><td>%s</td></tr>",rt[1],rt[2],rt[3],rt[4]
totalbytein=totalbytein+rt[1];
totalbyteout=totalbyteout+rt[2];
totalbytesum=totalbytesum+rt[3];
}
printf "<tr> <td><br>%d</td> <td><br>%d</td> \
<td><br>%d</td><td><br>Total host</td></tr> </table> ",totalbytein,totalbyteout, totalbytesum
printf " </table> "
close(cmd)
}
printf " </BODY> </HTML>";
} # end BEGIN
# decode urlencoded string
function decode(text, hex, i, hextab, decoded, len, c, c1, c2, code) {
split("0 1 2 3 4 5 6 7 8 9 a b c d e f", hex, " ")
for (i=0; i<16; i++) hextab[hex[i+1]] = i
# urldecode function from Heiner Steven
# http://www.shelldorado.com/scripts/cmds/urldecode
# decode %xx to ASCII char
decoded = ""
i = 1
len = length(text)
while ( i <= len ) {
c = substr (text, i, 1)
if ( c == "%" )
{
if ( i+2 <= len )
{
c1 = tolower(substr(text, i+1, 1))
c2 = tolower(substr(text, i+2, 1))
if ( hextab [c1] != "" || hextab [c2] != "" ) {
if ( (c1 >= 2 && (c1 != 7 && c2 != "F")) || (c1 == 0 && c2 ~ "[9acd]") )
{
code = 0 + hextab [c1] * 16 + hextab [c2] + 0
c = sprintf ("%c", code)
}
else { c = " " }
i = i + 2
}
}
} else if ( c == "+" ) { # special handling: "+" means " "
c = " "
}
decoded = decoded c
++i
}
# change linebreaks to \n
gsub(/\r\n/, "\n", decoded)
# remove last linebreak
sub(/[\n\r]*$/,"",decoded)
return decoded
}
-185
View File
@@ -1,185 +0,0 @@
#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
# process any FOO=bar switches
$[ = 1; # set array base to 1
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
$scriptname = $ENVIRON{'SCRIPT_NAME'};
#for win32
$isql = ".\\isqlodbc.exe sqlite ";
#for unix
#isql="./isqlodbc sqlite "
print "Content-Type: text/html; charset=koi8-r \n\n";
print "<HTML>\n<BODY>\n";
# query parse
$query_str = $ENVIRON{'QUERY_STRING'};
$n = (@querys = split(/&/, $query_str, 9999));
for ($i = 1; $i <= $n; $i++) {
@data = split(/=/, $querys[$i], 9999);
$qr{$data[1]} = $data[2];
}
printf "<FORM METHOD=PUT action=\"" . $scriptname . "?rep=1\">";
printf "datefrom:<INPUT name=\"datefrom\" value=\"2004-06-01\"> ";
printf "dateto:<INPUT name=\"dateto\" value=\"2004-07-30\"> <br>";
printf
"<INPUT type=\"radio\" name=\"userid\" value=\"username\" checked> LOGIN user <br>";
printf
"<INPUT type=\"radio\" name=\"userid\" value=\"userip\"> IP user <br>";
printf "<INPUT type=\"hidden\" name=\"rep\" value=\"user\">";
printf "<INPUT type=\"submit\" value=\"Report\">";
printf '</FORM>';
#printf "query_str=%s\n<br>",query_str
#print qr["rep"]
if ($qr{'rep'} eq 'user') {
$cmd = $isql . " \"select " . $qr{'userid'} .
",sum(bytein),sum(byteout),sum(bytein+byteout) from log where ldate > '"
. $qr{'datefrom'} . "' AND ldate < '" . $qr{'dateto'} . "' group by " .
$qr{'userid'} . " order by sum(bytein+byteout) desc;\"";
printf
' <table WIDTH=100%% BORDER=1><tr><td><b>user</b></td> <td><b>bytein</b></td> <td><b>byteout</b> </td> <td> <b>bytesum</b></td></tr>';
while ((($result = &Getline3($cmd, '|'),$getline_ok)) > 0) {
@rt = split(/\|/, $result, 9999);
printf
"<tr> <td><a href=\"%s?rep=host&datefrom=%s&dateto=%s&userid=%s&selectid=%s\"> %s <\\/a></td><td>%d</td><td>%d</td><td>%d</td></tr>",
$scriptname, $qr{'datefrom'}, $qr{'dateto'}, $qr{'userid'}, $rt[1],
$rt[1], $rt[2], $rt[3], $rt[4];
$totalbytein = $totalbytein + $rt[2];
$totalbyteout = $totalbyteout + $rt[3];
$totalbytesum = $totalbytesum + $rt[4];
}
printf
'<tr> <td><br>Total users</td> <td><br>%d</td> <td><br>%d</td> <td><br>%d</td></tr> </table> ',
$totalbytein, $totalbyteout, $totalbytesum;
delete $opened{$cmd} && close($cmd);
}
if ($qr{'rep'} eq 'host') {
$cmd = $isql .
"\"select sum(bytein+byteout), sum(bytein), sum(byteout),host from log where ldate > '"
. $qr{'datefrom'} . "' AND ldate < '" . $qr{'dateto'} . "' AND " .
$qr{'userid'} . " = '" . $qr{'selectid'} .
"' group by host order by sum(bytein+byteout) desc;\"";
printf '<center><b>Detail statistic for user: %s</b></center>',
$qr{'selectid'};
printf
' <table WIDTH=100%% BORDER=1> <tr><td><b>sum byte</b></td> <td><b>bytein</b></td> <td><b>byteout</b></td><td><b>host</b></td></tr>';
while ((($result = &Getline3($cmd, '|'),$getline_ok)) > 0) {
@rt = split(/\|/, $result, 9999);
printf '<tr><td>%d</td><td>%d</td><td>%d</td><td>%s</td></tr>',
$rt[1], $rt[2], $rt[3], $rt[4];
$totalbytein = $totalbytein + $rt[1];
$totalbyteout = $totalbyteout + $rt[2];
$totalbytesum = $totalbytesum + $rt[3];
}
printf
'<tr> <td><br>%d</td> <td><br>%d</td> <td><br>%d</td><td><br>Total host</td></tr> </table> ',
$totalbytein, $totalbyteout, $totalbytesum;
printf ' </table> ';
delete $opened{$cmd} && close($cmd);
}
printf ' </BODY> </HTML>';
# end BEGIN
# decode urlencoded string
sub decode {
local($text, *Hex, $i, *hextab, $decoded, $len, $c, $c1, $c2, $code) = @_;
@Hex = split(' ', '0 1 2 3 4 5 6 7 8 9 a b c d e f', 9999);
for ($i = 0; $i < 16; $i++) {
$hextab{$Hex[$i + 1]} = $i;
# urldecode function from Heiner Steven
# http://www.shelldorado.com/scripts/cmds/urldecode
# decode %xx to ASCII char
;
}
$decoded = '';
$i = 1;
$len = length($text);
while ($i <= $len) { #???
$c = substr($text, $i, 1);
if ($c eq '%') {
if ($i + 2 <= $len) {
$c1 = &tolower(substr($text, $i + 1, 1));
$c2 = &tolower(substr($text, $i + 2, 1));
if ($hextab{$c1} ne '' || $hextab{$c2} ne '') {
if (($c1 >= 2 && ($c1 != 7 && $c2 ne 'F')) ||
($c1 == 0 && $c2 =~ '[9acd]')) {
$code = 0 + $hextab{$c1} * 16 + $hextab{$c2} + 0;
$c = sprintf('%c', $code);
}
else {
$c = ' ';
}
$i = $i + 2;
}
}
}
elsif ($c eq '+') {
# special handling: "+" means " "
$c = ' ';
}
$decoded = $decoded . $c;
++$i;
}
# change linebreaks to \n
$decoded =~ s/\r\n/\n/g;
# remove last linebreak
$decoded =~ s/[\n\r]*$//;
$decoded;
}
sub Getline3 {
&Pick('',@_);
local($_);
if ($getline_ok = (($_ = <$fh>) ne '')) {
;
}
$_;
}
sub Pick {
local($mode,$name,$pipe) = @_;
$fh = $name;
open($name,$mode.$name.$pipe) unless $opened{$name}++;
}
-1
View File
@@ -59,4 +59,3 @@ terms of compatible license, including:
http://www.gnu.org/licenses/lgpl.txt http://www.gnu.org/licenses/lgpl.txt
$Id: License,v 1.3 2007/04/05 11:59:47 vlad Exp $
+9 -4
View File
@@ -64,6 +64,14 @@ to automatically reload configuration on address change.
A: Check you use system DSN. A: Check you use system DSN.
Check SQL request is valid. Check SQL request is valid.
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. 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.
Under Unix, you may also want to adjust 'stacksize' parameter.
<p><i>Q: Why proxy crash on request processing?</a></i></p>
<i>A:</i> default stacksize may be insufficient, if some non-default plugins
are used (e.g. PAM and ODBC on Linux) or if compiled on some platforms with
invalid system defined values (few versionds of FreeBSD on amd64).
Problem can be resolved with 'stacksize' command or '-S' option starting 3proxy 0.8.4.
<p><i>Q: Why doesn't APOP/CRAM-MD5 authentication work with POP3 proxy?</i></p> <p><i>Q: Why doesn't APOP/CRAM-MD5 authentication work with POP3 proxy?</i></p>
A: Any Challenge-response authentication require challenge to be transmitted from server. Pop3p doesn't know which server to use before authentication, it makes it impossible to obtain challenge. You can encrypt your POP3 communications with TLS (i.e. stunnel) or IPSec. A: Any Challenge-response authentication require challenge to be transmitted from server. Pop3p doesn't know which server to use before authentication, it makes it impossible to obtain challenge. You can encrypt your POP3 communications with TLS (i.e. stunnel) or IPSec.
@@ -114,7 +122,7 @@ parent 1000 http 0.0.0.0 0
allow * * $c:\3proxy\local.nets 80,8080-8088 allow * * $c:\3proxy\local.nets 80,8080-8088
#allow direct access to local.nets networks #allow direct access to local.nets networks
allow * * * 80,8080-8088 allow * * * 80,8080-8088
parent 1000 http proxy.sandy.ru 3128 parent 1000 http proxy.3proxy.ru 3128
#use parent caching proxy for rest of the networks #use parent caching proxy for rest of the networks
allow * allow *
@@ -153,6 +161,3 @@ A: First, I'm not programmer. Second, 3proxy was 'proof of concept' in reply for
<p><i>Q: Why do you use insecure strcpy, sprintf, etc?</i></p> <p><i>Q: Why do you use insecure strcpy, sprintf, etc?</i></p>
A: Why not? I try to use insecure function in secure manner. You're welcome to look for vulnerabilities. A: Why not? I try to use insecure function in secure manner. You're welcome to look for vulnerabilities.
<pre>
$Id: faqe.html,v 1.10 2007/07/31 08:42:38 vlad Exp $
</pre>
+192 -187
View File
@@ -1,283 +1,288 @@
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3APA3A 3proxy tiny proxy server Frequently Asked Questions (FAQ) 3APA3A 3proxy tiny proxy server Frequently Asked Questions (FAQ)
<ul> <ul>
<li><a href="#TROUBLE">Почему не работает...</a></li> <li><a href="#TROUBLE">Почему не работает...</a></li>
<ul> <ul>
<li><a href="#NOTHING">Q: Почему ничего не работает?</a></li> <li><a href="#NOTHING">Q: Почему ничего не работает?</a></li>
<li><a href="#LIMITS">Q: Почему не работают ограничения доступа (перенаправления, ограничения по скорости, трафику и т.д.)?</a></li> <li><a href="#LIMITS">Q: Почему не работают ограничения доступа (перенаправления, ограничения по скорости, трафику и т.д.)?</a></li>
<li><a href="#SERVICE">Q: Почему 3proxy не запускается как служба?</a></li> <li><a href="#SERVICE">Q: Почему 3proxy не запускается как служба?</a></li>
<li><a href="#INTEXT">Q: Почему не получается указать internal и external?</a></li> <li><a href="#INTEXT">Q: Почему не получается указать internal и external?</a></li>
<li><a href="#ODBC">Q: Почему не работает ведение журналов в ODBC?</a></li> <li><a href="#ODBC">Q: Почему не работает ведение журналов в ODBC?</a></li>
<li><a href="#CHAP">Q: Почему не поддерживаются APOP и CRAM-MD5 в POP3 прокси?</a></li> <li><a href="#CHAP">Q: Почему не поддерживаются APOP и CRAM-MD5 в POP3 прокси?</a></li>
<li><a href="#CRASH">Q: Почему прокси крэшится при обработке запроса?</a></li>
</ul> </ul>
<li><a href="#SOCKSREDIR">Перенаправление socks соединений в локальный прокси</a></li> <li><a href="#SOCKSREDIR">Перенаправление socks соединений в локальный прокси</a></li>
<ul> <ul>
<li><a href="#REDIR">Q: Для чего это надо?</a></li> <li><a href="#REDIR">Q: Для чего это надо?</a></li>
<li><a href="#REDIRLIMIT">Q: Какие недостатки?</a></li> <li><a href="#REDIRLIMIT">Q: Какие недостатки?</a></li>
<li><a href="#REDIRADV">Q: Какие преимущества?</a></li> <li><a href="#REDIRADV">Q: Какие преимущества?</a></li>
<li><a href="#REDIRHOW">Q: Как настраивается?</a></li> <li><a href="#REDIRHOW">Q: Как настраивается?</a></li>
<li><a href="#REDIINTER">Q: Как взаимодействует с другими правилами в ACL?</a></li> <li><a href="#REDIINTER">Q: Как взаимодействует с другими правилами в ACL?</a></li>
</ul> </ul>
<li><a href="#ISIT">А есть ли...</a></li> <li><a href="#ISIT">А есть ли...</a></li>
<ul> <ul>
<li><a href="#NAMES">Можно ли разрешать имена на родительском прокси?</a></li> <li><a href="#NAMES">Можно ли разрешать имена на родительском прокси?</a></li>
<li><a href="#ISFTP">Существует ли сейчас поддержка FTP прокси в продукте?</a></li> <li><a href="#ISFTP">Существует ли сейчас поддержка FTP прокси в продукте?</a></li>
<li><a href="#PORT">Каким образом можно прибиндить сервисы на свой порт, к примеру, HTTP прокси к 8080, а не 3128 как по-умолчанию?</a></li> <li><a href="#PORT">Каким образом можно прибиндить сервисы на свой порт, к примеру, HTTP прокси к 8080, а не 3128 как по-умолчанию?</a></li>
<li><a href="#BANDLIM">Как ограничить ширину канала?</a></li> <li><a href="#BANDLIM">Как ограничить ширину канала?</a></li>
</ul> </ul>
<li><a href="#BRRR">Почему так криво...</a></li> <li><a href="#BRRR">Почему так криво...</a></li>
<ul> <ul>
<li><a href="#TRAF">Почему так криво считается трафик? Не совпадает с ...</a></li> <li><a href="#TRAF">Почему так криво считается трафик? Не совпадает с ...</a></li>
<li><a href="#CONFIG">Почему такая кривая конфигурация и ничерта не понятно?</a></li> <li><a href="#CONFIG">Почему такая кривая конфигурация и ничерта не понятно?</a></li>
<li><a href="#CODE">Почему так криво написан код?</a> <li><a href="#CODE">Почему так криво написан код?</a>
<li><a href="#UNSAFE">Почему так много strcpy, sprintf и т.д., это ж дыры!</a> <li><a href="#UNSAFE">Почему так много strcpy, sprintf и т.д., это ж дыры!</a>
</ul> </ul>
</ul> </ul>
<hr> <hr>
<li><b><a name="TROUBLE">Почему не работает...<a></b></li> <li><b><a name="TROUBLE">Почему не работает...<a></b></li>
<ul> <ul>
<li><a name="NOTHING"><i>Q: Почему ничего не работает?</i></a></li> <li><a name="NOTHING"><i>Q: Почему ничего не работает?</i></a></li>
<p> <p>
<i>A:</i> Потому что для работы нужен правильный файл конфигурации. <i>A:</i> Потому что для работы нужен правильный файл конфигурации.
</p> </p>
<li><a name="LIMITS"><i>Q: Почему не работают ограничения доступа (перенаправления, ограничения по скорости, <li><a name="LIMITS"><i>Q: Почему не работают ограничения доступа (перенаправления, ограничения по скорости,
трафику и т.д.)?</i></a></li> трафику и т.д.)?</i></a></li>
<p> <p>
<i>A:</i> Обычные ошибки - использование auth none (для работы любых <i>A:</i> Обычные ошибки - использование auth none (для работы любых
функций, основанных на ACL, требуется auth iponly, nbname или strong), функций, основанных на ACL, требуется auth iponly, nbname или strong),
нарушение порядка ввода команд (команды выполняются последовательно, нарушение порядка ввода команд (команды выполняются последовательно,
запуск сервиса proxy, socks, tcppm и т.д. должен осуществляться после запуск сервиса proxy, socks, tcppm и т.д. должен осуществляться после
того, как указана его конфигурация), неправильный порядок записей в ACL того, как указана его конфигурация), неправильный порядок записей в ACL
(записи просматриваются последовательно до первой, удовлетворяющей (записи просматриваются последовательно до первой, удовлетворяющей
критериям). Если в ACL имеется хотя бы одна запись, то считается, что критериям). Если в ACL имеется хотя бы одна запись, то считается, что
последняя запись в ACL - это неявная deny *. последняя запись в ACL - это неявная deny *.
</p> </p>
<li><a name="SERVICE"><i>Q: Почему 3proxy не запускается как служба?</i></a></li> <li><a name="SERVICE"><i>Q: Почему 3proxy не запускается как служба?</i></a></li>
<p> <p>
<i>A:</i> Наиболее вероятные причины: <i>A:</i> Наиболее вероятные причины:
<ul> <ul>
<li>Отсутствие команды service в файле конфигурации - команда необходима в 3proxy 0.5.2 и более ранних, чтобы 3proxy вел себя как системная служба Windows <li>Отсутствие команды service в файле конфигурации - команда необходима в 3proxy 0.5.2 и более ранних, чтобы 3proxy вел себя как системная служба Windows
<li>Использование относительных (неполных) путей файлов в файле конфигурации <li>Использование относительных (неполных) путей файлов в файле конфигурации
При использовании файлов журналов, файлов вставок ($filename) используйте При использовании файлов журналов, файлов вставок ($filename) используйте
полные пути, например, $"c:\3proxy\include files\networks.local". Тоже самое полные пути, например, $"c:\3proxy\include files\networks.local". Тоже самое
относится к файлам журналов и любым другим. относится к файлам журналов и любым другим.
Для отладки лучше запускать 3proxy с ведением журнала на стандартный вывод. Для отладки лучше запускать 3proxy с ведением журнала на стандартный вывод.
Не забудьте в таком случае отключить daemon и service в файле конфигурации. Не забудьте в таком случае отключить daemon и service в файле конфигурации.
Для чистоты эксперимента запускать 3proxy из коммандной строки в таком случае Для чистоты эксперимента запускать 3proxy из коммандной строки в таком случае
следует, находясь в другой папке. следует, находясь в другой папке.
<li>Отсутствие у системной записи прав на доступ к исполняемому файлу, каким-либо файлам конфигурации, журнала и т.п. <li>Отсутствие у системной записи прав на доступ к исполняемому файлу, каким-либо файлам конфигурации, журнала и т.п.
<li>Отсутствие файла конфигурации по стандартному расположению - <li>Отсутствие файла конфигурации по стандартному расположению -
3proxy.cfg в одном каталоге с исполняемым файлом. Если файл расположен по 3proxy.cfg в одном каталоге с исполняемым файлом. Если файл расположен по
другому пути, необходимо использовать команду другому пути, необходимо использовать команду
<pre> <pre>
3proxy --install path_to_configuration_file</pre> 3proxy --install path_to_configuration_file</pre>
<li>Отсутствие у пользователя прав на установку или запуск службы <li>Отсутствие у пользователя прав на установку или запуск службы
<li>Служба уже установлена или запущена <li>Служба уже установлена или запущена
</ul> </ul>
</p> </p>
<li><a name="INTEXT"><i>Q: Почему не получается указать internal и external?</i></a></li></li> <li><a name="INTEXT"><i>Q: Почему не получается указать internal и external?</i></a></li></li>
<p> <p>
<i>A:</i> Убедитесь, что выправильно понимаете что такое internal и external адреса. <i>A:</i> Убедитесь, что выправильно понимаете что такое internal и external адреса.
Оба адреса - это адреса, принадлежищие хосту, на котором установлен 3proxy. Оба адреса - это адреса, принадлежищие хосту, на котором установлен 3proxy.
Эта опция конфигурации необходима в классической ситуации, когда 3proxy Эта опция конфигурации необходима в классической ситуации, когда 3proxy
установлен на граничном компьютере с двумя (или более) подключениями: установлен на граничном компьютере с двумя (или более) подключениями:
<pre> <pre>
LAN connection +-------------+ Internet connection LAN connection +-------------+ Internet connection
LAN <-------------->| 3proxy host |<-------------------> INTERNET LAN <-------------->| 3proxy host |<-------------------> INTERNET
^+-------------+^ ^+-------------+^
| | | |
Internal IP External IP</pre> Internal IP External IP</pre>
Если 3proxy работает на хосте с одним интерфейсом, то его адрес будет и Если 3proxy работает на хосте с одним интерфейсом, то его адрес будет и
internal и external. internal и external.
<br>Интерфейс с адресом internal должен существовать и быть рабочим на момент <br>Интерфейс с адресом internal должен существовать и быть рабочим на момент
запуска 3proxy, и не должен отключаться. Если internal интерфейс запуска 3proxy, и не должен отключаться. Если internal интерфейс
периодически отключается, то не следует его указывать, или можно указать адрес периодически отключается, то не следует его указывать, или можно указать адрес
0.0.0.0. При этом прокси будет принимать запросы на всех интерфейсах, поэтому 0.0.0.0. При этом прокси будет принимать запросы на всех интерфейсах, поэтому
при наличии нескольких интерфейсов для ограничения доступа следует использовать при наличии нескольких интерфейсов для ограничения доступа следует использовать
фаервол или хотя бы ACL. фаервол или хотя бы ACL.
</p> </p>
<p> <p>
Интерфейс с адресом external, если он указан, должен быть рабочим на момент Интерфейс с адресом external, если он указан, должен быть рабочим на момент
получения запроса клиента. При отсутствии external или адресе 0.0.0.0 внешний получения запроса клиента. При отсутствии external или адресе 0.0.0.0 внешний
адрес будет выбираться системой при установке соединения. При этом, может быть адрес будет выбираться системой при установке соединения. При этом, может быть
возможность доступа через прокси к ресурсам локальной сети, поэтому для возможность доступа через прокси к ресурсам локальной сети, поэтому для
предотвращения несанкционированного доступа следует использовать ACL. Кроме предотвращения несанкционированного доступа следует использовать ACL. Кроме
того, могут быть проблемы с приемом входящих соединений через SOCKSv5 того, могут быть проблемы с приемом входящих соединений через SOCKSv5
(SOCKSv5 используется в клиентах исключительно редко). (SOCKSv5 используется в клиентах исключительно редко).
В случае, если адрес динамический, можно либо не В случае, если адрес динамический, можно либо не
указывать external, либо использовать адрес 0.0.0.0, либо, если необходима указывать external, либо использовать адрес 0.0.0.0, либо, если необходима
поддержка входящих соединений в SOCKSv5, использовать скрипт, поддержка входящих соединений в SOCKSv5, использовать скрипт,
который будет получать текущий адрес и сохранять его в файл, который будет который будет получать текущий адрес и сохранять его в файл, который будет
отслуживаться через команду monitor. отслуживаться через команду monitor.
</p> </p>
<li><a name="ODBC"><i>Q: Почему не работает ведение журналов в ODBC?</i></a></li> <li><a name="ODBC"><i>Q: Почему не работает ведение журналов в ODBC?</i></a></li>
<p> <p>
<i>A:</i> Убедитесь, что используется системный, а не <i>A:</i> Убедитесь, что используется системный, а не
пользовательский DSN. Убедитесь, что выполняется правильный SQL запрос. Наиболее пользовательский DSN. Убедитесь, что выполняется правильный SQL запрос. Наиболее
распространенная проблема связана с отсутствием кавычек или неправильным распространенная проблема связана с отсутствием кавычек или неправильным
форматом данных. Самый простой способ - сделать ведение журнала в файл или форматом данных. Самый простой способ - сделать ведение журнала в файл или
на стандартный вывод, просмотреть выдаваемые SQL запросы и попробовать на стандартный вывод, просмотреть выдаваемые SQL запросы и попробовать
дать такой запрос вручную. дать такой запрос вручную.
</p> </p>
<li><a name="CHAP"><i>Q: Почему не поддерживаются APOP и CRAM-MD5 в POP3 прокси?</i></a></li> <li><a name="CHAP"><i>Q: Почему не поддерживаются APOP и CRAM-MD5 в POP3 прокси?</i></a></li>
<p> <p>
<i>A:</i> Любая challenge-response аутентификация, к которым относятся APOP <i>A:</i> Любая challenge-response аутентификация, к которым относятся APOP
и CRAM-MD5, требует, чтобы со стороны сервера был передан уникальный challenge. и CRAM-MD5, требует, чтобы со стороны сервера был передан уникальный challenge.
До начала аутентификации POP3 прокси не знает, к какому серверу следует До начала аутентификации POP3 прокси не знает, к какому серверу следует
подключаться для получения Challenge, поэтому challenge-response в принципе подключаться для получения Challenge, поэтому challenge-response в принципе
невозможен. Защитить соединение можно с помощью TLS (например, stunnel) или невозможен. Защитить соединение можно с помощью TLS (например, stunnel) или
IPSec. IPSec.
</p> </p>
<li><a name="CRASH"><i>Q: Почему прокси крэшится при обработке запроса?</a></i></li>
<p>
<i>A:</i> Возможно, недостаточен размер стека потока по-умолчанию, это может
быть при использовани каких-либо сторонних плагинов (PAM, ODBC) или на
некоторых платформах (некоторые версии FreeBSD на amd64). Можно решить
проблему с помощью опции 'stacksize' или '-S', поддерживаемых в 0.8.4 и выше.
</p>
</ul> </ul>
<hr> <hr>
<li><b><a name="SOCKSREDIR">Перенаправление socks соединений в локальный прокси</a></b></li> <li><b><a name="SOCKSREDIR">Перенаправление socks соединений в локальный прокси</a></b></li>
<ul> <ul>
<li><a name="REDIR"><i>Q: Для чего это надо?</i></a></li> <li><a name="REDIR"><i>Q: Для чего это надо?</i></a></li>
<p> <p>
<i>A:</i> Чтобы иметь в логах URL запросов, если пользователь SOCKS пользуется <i>A:</i> Чтобы иметь в логах URL запросов, если пользователь SOCKS пользуется
Web, FTP или POP3. Web, FTP или POP3.
</p> </p>
<li><a name="REDIRLIMIT"><i>Q: Какие недостатки?</i></a></li> <li><a name="REDIRLIMIT"><i>Q: Какие недостатки?</i></a></li>
<p> <p>
<i>A:</i> Перенапраление невозможно для web-серверов или FTP, висящих на <i>A:</i> Перенапраление невозможно для web-серверов или FTP, висящих на
нестандартных портах, для SOCKSv4 не поддрживается авторизация с нестандартных портах, для SOCKSv4 не поддрживается авторизация с
паролем (IE поддерживает только SOCKSv4), но при этом IE передает паролем (IE поддерживает только SOCKSv4), но при этом IE передает
имя пользователя по SOCKSv4 (имя, с которым пользователь вошел в систему). имя пользователя по SOCKSv4 (имя, с которым пользователь вошел в систему).
Для SOCKSv5 не поддерживается NTLM авторизация, пароли передаются в открытом Для SOCKSv5 не поддерживается NTLM авторизация, пароли передаются в открытом
тексте. тексте.
</p> </p>
<li><a name="REDIRADV"><i>Q: Какие преимущества?</i></a></li> <li><a name="REDIRADV"><i>Q: Какие преимущества?</i></a></li>
<p> <p>
<i>A:</i> Достаточно в настройках IE только указать адрес SOCKS прокси. В <i>A:</i> Достаточно в настройках IE только указать адрес SOCKS прокси. В
больших сетях можно для этого использовать WPAD (автоматическое больших сетях можно для этого использовать WPAD (автоматическое
обнаружение прокси). В 3proxy достаточно запускать только одну службу обнаружение прокси). В 3proxy достаточно запускать только одну службу
(socks). Если используется только Internet Explorer, то можно (socks). Если используется только Internet Explorer, то можно
автоматически получать имя пользователя в логах, не запрашивая автоматически получать имя пользователя в логах, не запрашивая
логин/пароль. логин/пароль.
</p> </p>
<li><a name="REDIRHOW"><i>Q: Как настраивается?</i></a></li> <li><a name="REDIRHOW"><i>Q: Как настраивается?</i></a></li>
<p> <p>
<i>A:</i> Указывается parent http proxy со специальным адресом 0.0.0.0 и портом <i>A:</i> Указывается parent http proxy со специальным адресом 0.0.0.0 и портом
0. Пример: 0. Пример:
<pre> <pre>
allow * * * 80,8080-8088 allow * * * 80,8080-8088
parent 1000 http 0.0.0.0 0 parent 1000 http 0.0.0.0 0
allow * * * 80,8080-8088 allow * * * 80,8080-8088
#перенаправить соединения по портам 80 и 8080-8088 в локальный #перенаправить соединения по портам 80 и 8080-8088 в локальный
#http прокси. Вторая команда allow необходима, т.к. контроль доступа #http прокси. Вторая команда allow необходима, т.к. контроль доступа
#осуществляется 2 раза - на уровне socks и на уровне HTTP прокси #осуществляется 2 раза - на уровне socks и на уровне HTTP прокси
allow * * * 21,2121 allow * * * 21,2121
parent 1000 ftp 0.0.0.0 0 parent 1000 ftp 0.0.0.0 0
allow * * * 21,2121 allow * * * 21,2121
#перенаправить соединения по портам 21 и 2121 в локальный #перенаправить соединения по портам 21 и 2121 в локальный
#ftp прокси #ftp прокси
allow * allow *
#пустить все соединения напрямую #пустить все соединения напрямую
socks</pre> socks</pre>
</p> </p>
<li><a name="REDIINTER"><i>Q: Как взаимодействует с другими правилами в ACL?</i></a></li> <li><a name="REDIINTER"><i>Q: Как взаимодействует с другими правилами в ACL?</i></a></li>
<p> <p>
<i>A:</i> После внутреннего перенаправления правила рассматриваются еще раз за <i>A:</i> После внутреннего перенаправления правила рассматриваются еще раз за
исключением самого правила с перенаправлением (т.е. обработка правил не исключением самого правила с перенаправлением (т.е. обработка правил не
прекращается). Это позволяет сделать дальнейшие перенаправления на прекращается). Это позволяет сделать дальнейшие перенаправления на
внешний прокси. По этой же причине локальное перенаправление не должно внешний прокси. По этой же причине локальное перенаправление не должно
быть последним правилом (т.е. должно быть еще хотя бы правило allow, быть последним правилом (т.е. должно быть еще хотя бы правило allow,
чтобы разрешить внешние соединения через HTTP прокси). чтобы разрешить внешние соединения через HTTP прокси).
Например, Например,
<pre> <pre>
allow * * * 80,8080-8088 allow * * * 80,8080-8088
parent 1000 http 0.0.0.0 0 parent 1000 http 0.0.0.0 0
#перенаправить во внутренний прокси #перенаправить во внутренний прокси
allow * * $c:\3proxy\local.nets 80,8080-8088 allow * * $c:\3proxy\local.nets 80,8080-8088
#разрешить прямой web-доступ к сетям из local.nets #разрешить прямой web-доступ к сетям из local.nets
allow * * * 80,8080-8088 allow * * * 80,8080-8088
parent 1000 http proxy.sandy.ru 3128 parent 1000 http proxy.3proxy.ru 3128
#все остальные веб-запросы перенаправить на внешний прокси-сервер #все остальные веб-запросы перенаправить на внешний прокси-сервер
allow * allow *
#разрешить socks-запросы по другим портам</pre> #разрешить socks-запросы по другим портам</pre>
</p> </p>
</ul> </ul>
<hr> <hr>
<li><b><a name="ISIT">А есть ли...</a></b></li> <li><b><a name="ISIT">А есть ли...</a></b></li>
<ul> <ul>
<li><a name="NAMES"><i>Q: Можно ли разрешать имена на родительском прокси?</i></a></li> <li><a name="NAMES"><i>Q: Можно ли разрешать имена на родительском прокси?</i></a></li>
<p> <p>
<i>A:</i> Можно. Для этого надо использовать тип родительского прокси http, <i>A:</i> Можно. Для этого надо использовать тип родительского прокси http,
connect+, socks4+ и socks5+. Однако, при это надо помнить, что самому 3proxy connect+, socks4+ и socks5+. Однако, при это надо помнить, что самому 3proxy
требуется разрешение имени для управления ACL. Поэтому, если с прокси-хоста требуется разрешение имени для управления ACL. Поэтому, если с прокси-хоста
не работают разрешения имени, необходимо в конфигурации дать команду не работают разрешения имени, необходимо в конфигурации дать команду
<pre> <pre>
fakeresolve</pre> fakeresolve</pre>
которая разрешает любое имя в адрес 127.0.0.2. которая разрешает любое имя в адрес 127.0.0.2.
</p> </p>
<li><a name="ISFTP"><i>Q: Существует ли сейчас поддержка FTP прокси в продукте?</i></a></li> <li><a name="ISFTP"><i>Q: Существует ли сейчас поддержка FTP прокси в продукте?</i></a></li>
<p> <p>
Есть поддержка как FTP через HTTP (то, что называется FTP прокси в Internet Есть поддержка как FTP через HTTP (то, что называется FTP прокси в Internet
Explorer, Netscape, Opera) так и настоящего FTP прокси (то, что называется Explorer, Netscape, Opera) так и настоящего FTP прокси (то, что называется
FTP proxy в FAR и FTP клиентах). FTP proxy в FAR и FTP клиентах).
</p> </p>
<li><a name="PORT"><i>Q: Каким образом можно прибиндить сервисы на свой порт, к примеру, HTTP прокси к 8080, а не 3128 как по-умолчанию?</i></a></li> <li><a name="PORT"><i>Q: Каким образом можно прибиндить сервисы на свой порт, к примеру, HTTP прокси к 8080, а не 3128 как по-умолчанию?</i></a></li>
<p> <p>
А: А:
<pre> <pre>
proxy -p8080</pre> proxy -p8080</pre>
</p> </p>
<li><a name="BANDLIM"><i>Q: Как ограничить ширину канала?</i></a></li> <li><a name="BANDLIM"><i>Q: Как ограничить ширину канала?</i></a></li>
<p> <p>
<i>A:</i> Читайте HowTo <a href="http://3proxy.ru/howtor.asp#BANDLIM">http://3proxy.ru/howtor.asp#BANDLIM</a> <i>A:</i> Читайте HowTo <a href="http://3proxy.ru/howtor.asp#BANDLIM">http://3proxy.ru/howtor.asp#BANDLIM</a>
</p> </p>
</ul> </ul>
<hr> <hr>
<li><b><a name="BRRR">Почему так криво...</a></b></li> <li><b><a name="BRRR">Почему так криво...</a></b></li>
<ul> <ul>
<li><a name="TRAF"><i>Q: Почему так криво считается трафик? Не совпадает с ...</i></a></li> <li><a name="TRAF"><i>Q: Почему так криво считается трафик? Не совпадает с ...</i></a></li>
<p> <p>
<i>A:</i> Следует учитывать, что 3proxy считает трафик только на прикладном уровне и <i>A:</i> Следует учитывать, что 3proxy считает трафик только на прикладном уровне и
только проходящий через прокси-сервер. Провайдеры и другие средства учета только проходящий через прокси-сервер. Провайдеры и другие средства учета
трафика считают трафик на сетевом уровне, что уже дает расхождение порядка 10% трафика считают трафик на сетевом уровне, что уже дает расхождение порядка 10%
за счет информации из заголовков пакетов. Кроме того, часть трафика, как за счет информации из заголовков пакетов. Кроме того, часть трафика, как
минимум DNS-разрешения, различный флудовый трафик и т.д. идут мимо прокси. минимум DNS-разрешения, различный флудовый трафик и т.д. идут мимо прокси.
Уровень "шумового" трафика в Internet сейчас составляет порядка 50KB/день на Уровень "шумового" трафика в Internet сейчас составляет порядка 50KB/день на
каждый реальный IP адрес, но может сильно варьироваться в зависимости от сети, каждый реальный IP адрес, но может сильно варьироваться в зависимости от сети,
наличия открытых портов, реакции на ping-запросы и текущего уровня вирусной наличия открытых портов, реакции на ping-запросы и текущего уровня вирусной
активности. По этим причинам, если 3proxy используется чтобы не "выжрать" активности. По этим причинам, если 3proxy используется чтобы не "выжрать"
трафик, выделенный провайдером, всегда следует делать некий запас порядка трафик, выделенный провайдером, всегда следует делать некий запас порядка
15%. 15%.
</p> </p>
<p> <p>
Если на одной с 3proxy машине имеются какие-либо сервисы или Если на одной с 3proxy машине имеются какие-либо сервисы или
работает пользователь, то их трафик не проходит через proxy-сервер и так же работает пользователь, то их трафик не проходит через proxy-сервер и так же
не будет учтен. Если где-то есть NAT, то клиенты, выходящие через NAT мимо не будет учтен. Если где-то есть NAT, то клиенты, выходящие через NAT мимо
прокси, так же останутся неучтенными. Если расхождение с провайдером превышает прокси, так же останутся неучтенными. Если расхождение с провайдером превышает
10% - нужно искать причину именно в этом. 10% - нужно искать причину именно в этом.
</p> </p>
<li><a name="CONFIG"><i>Q: Почему такая кривая конфигурация и ничерта не понятно?</i></a></li> <li><a name="CONFIG"><i>Q: Почему такая кривая конфигурация и ничерта не понятно?</i></a></li>
<p> <p>
<i>A:</i> Есть несколько причин. Во-первых, до выхода релиза (т.е. версии 1.0) я буду изо <i>A:</i> Есть несколько причин. Во-первых, до выхода релиза (т.е. версии 1.0) я буду изо
всех сил добиваться совместимости конфигурации между версиями. Во-вторых, всех сил добиваться совместимости конфигурации между версиями. Во-вторых,
конфигурация сделана так, чтобы ее можно было легко разбирать программно. конфигурация сделана так, чтобы ее можно было легко разбирать программно.
В-третьих, все там понятно. При желании. Если знать как все работает. В-третьих, все там понятно. При желании. Если знать как все работает.
</p> </p>
<li><a name="CODE"><i>Q: Почему так криво написан код?</i></a></li> <li><a name="CODE"><i>Q: Почему так криво написан код?</i></a></li>
<p> <p>
<i>A:</i> Есть несколько причин. Во-первых, я не программист. Во-вторых, 3proxy изначально <i>A:</i> Есть несколько причин. Во-первых, я не программист. Во-вторых, 3proxy изначально
писался на коленке (в отет на &quot;слабо&quot; в одной из конференций). Никто писался на коленке (в отет на &quot;слабо&quot; в одной из конференций). Никто
не мог предположить, что им кто-то реально будет пользоваться. В-третьих, у многих не мог предположить, что им кто-то реально будет пользоваться. В-третьих, у многих
возникает желание разобраться в коде 3proxy чтобы внедрить его в какой-нибудь возникает желание разобраться в коде 3proxy чтобы внедрить его в какой-нибудь
троян. Очень не хочется облегчать эту задачу. В-четвертых, мне надо добиться троян. Очень не хочется облегчать эту задачу. В-четвертых, мне надо добиться
компиляции кода в как можно большем числе систем. Замечено, что чем кривее код в компиляции кода в как можно большем числе систем. Замечено, что чем кривее код в
C, тем он лучше переносится. C, тем он лучше переносится.
</p> </p>
<li><a name="UNSAFE"><i>Q: Почему так много strcpy, sprintf и т.д., это ж дыры!</i></a><li> <li><a name="UNSAFE"><i>Q: Почему так много strcpy, sprintf и т.д., это ж дыры!</i></a><li>
<p> <p>
<i>A:</i> Есть несколько причин. Во-первых, несмотря на дурной тон использования этих <i>A:</i> Есть несколько причин. Во-первых, несмотря на дурной тон использования этих
функций, они наиболее совместимы между разными системами и компиляторами. функций, они наиболее совместимы между разными системами и компиляторами.
Во-вторых, само по себе их использование не означает присутствие дыры, если их Во-вторых, само по себе их использование не означает присутствие дыры, если их
параметры должным образом контролируются. Найдете дыру - обязательно сообщите. параметры должным образом контролируются. Найдете дыру - обязательно сообщите.
В третьих, может быть я уберу их перед конечным релизом, чтобы никого не В третьих, может быть я уберу их перед конечным релизом, чтобы никого не
пугать. пугать.
</p> </p>
</ul> </ul>
<pre>
$Id: faqr.html,v 1.28 2007/09/25 09:47:13 vlad Exp $
</pre>
+65 -4
View File
@@ -33,6 +33,9 @@
<li><A HREF="#BANDLIM">How to limit bandwidth</A> <li><A HREF="#BANDLIM">How to limit bandwidth</A>
<li><A HREF="#TRAFLIM">How to limit traffic amount</A> <li><A HREF="#TRAFLIM">How to limit traffic amount</A>
<li><A HREF="#NETLIST">How to build network lists</A> <li><A HREF="#NETLIST">How to build network lists</A>
<li><a href="#NSCACHING">How to configure name resolution and DNS caching</a>
<li><a href="#IPV6">How to use IPv6</a>
<li><a href="#CONNBACK">How to use connect back</a>
</ul> </ul>
<li><A HREF="#CLIENT">Client configuration</A> <li><A HREF="#CLIENT">Client configuration</A>
<li><A HREF="#ADMIN">Administering and information analisys</A> <li><A HREF="#ADMIN">Administering and information analisys</A>
@@ -284,10 +287,10 @@ logformat "L%t.%. %N.%p %E %U %C:%c %R:%r %O %I %h %T"
<p> <p>
If ODBC used, logformat should specify SQL command, If ODBC used, logformat should specify SQL command,
to insert record into log, for example to insert record into log, for example
<p><font face="courier"> <p><pre>
logformat "GINSERT INTO proxystat VALUES (%t, '%c', '%U', %I)" logformat "-\'+_GINSERT INTO proxystat VALUES (%t, '%c', '%U', %I)"</pre>
</font>
<br>(no line breaks) <br>(no line breaks)
<br>-\'+_ instructs to replace characters \ and ' with _
</p> </p>
<li><A NAME="LOGANALIZERS">How to use log analizers with 3proxy</A> <li><A NAME="LOGANALIZERS">How to use log analizers with 3proxy</A>
<p> <p>
@@ -738,6 +741,65 @@ In this example we obtain list of local networks from provider's page to
local.networks file, allow direct access to these networks and redirect all local.networks file, allow direct access to these networks and redirect all
connection to external networks to provider's proxy. connection to external networks to provider's proxy.
</p> </p>
<li><a name="NSCACHING"><i>How to configure name resolution and DNS caching</i></a>
<p>
For name resolution and caching use commands nserver, nscache / nscache6 and nsrecord.
<pre>
nserver 192.168.1.2
nserver 192.168.1.3:5353/tcp</pre>
sets DNS resolvers. 192.168.1.3 will be used via TCP/5353 (instead of default UDP/53)
only if 192.168.1.2 fails. Up to 5 nservers may be specified.
If no nserver is configured, default system name resolution functions are used.
<pre>
nscache 65535
nscache6 65535</pre>
sets name cache size for IPv4 and IPv6. Name cache must be large enouth, if presents.
name cache is only used if nserver is configured.
<pre>
nsrecord server.mycompany.example.com 192.168.1.1
nsrecord www.porno.com 127.0.0.2
...
deny * * 127.0.0.2</pre>
adds static nsrecords. Also, static nsrecords are used for dnspr, unless -s option is specified.
Since 0.8 version, parent proxy may be configured for dnspr.
</p>
<li><a name="IPV6"><i>How to use IPv6</i></a>
<p>
IPv6 is supported since 0.8. Please note, some proxy protolos, e.g. SOCKSv4,
do not support IPv6. SOCKSv5 supports IPv6 with special request type (must be
implemented by client).
<br>
3proxy supports proxying from IPv4 and IPv6 networks to IPv4,
IPv6 and mixed networks. IPv6 address may be used in
internal, external, parent commands, ACLs, -i and -e options,etc.
external command and -e options may be given twice for each service - once with IPv4
and once with IPv6 address. internal can be given only once, to bind to all IPv4 and
IPv6 addresses use [0:0:0:0:0:0:0:0] or [::].
<br>
Any service may be configured with -4, -46, -64, -6 options to specify decied
priority for name to IPv4/IPv6 address resolution (IPv4 only, IPv4 priority,
IPv6 priority, IPv6 only).
</p>
<li><a name="CONNBACK"><i>How to use connect back</i></a>
<p>
In example, users needs access from external network to proxy server located
on the host 192.168.1.2. This host can not be accessed from external network,
but it has access to external network with with external address 1.1.1.1.
Also, user has access to the host 2.2.2.2 (IP address may be dynamic) with
hostname host.dyndns.example.org via external network. User needs 2 instances
of 3proxy, first one on the host 192.168.1.2 with config
<pre>
users user:CL:password
auth strong
allow user
proxy -rhost.dyndns.example.org:1234</pre>
second one on the host.dyndns.example.org (2.2.2.2) with config
<pre>
auth iponly
allow * * 1.1.1.1
tcppm -R0.0.0.0:1234 3128 1.1.1.1 3128</pre>
For browser settings proxy is host.dyndns.example.org:3128.
</p>
</ul> </ul>
<hr> <hr>
@@ -832,4 +894,3 @@ You can control 3proxy service via "Services" administration ot via "net" comman
</ul> </ul>
<pre>$Id: howtoe.html,v 1.41 2009/02/02 10:04:49 vlad Exp $</pre>
+719 -682
View File
File diff suppressed because it is too large. Load diff
+18
View File
@@ -0,0 +1,18 @@
<html><title>3proxy documentation</title><body><h2>3proxy documentation</h2>
<a href="securityen.html">Security recommendations</a><br>
<a href="howtoe.html">How To (English, very incomplete)</a><br>
<a href="howtor.html">How To (Russian)</a><br>
<a href="faqe.html">FAQ (English)</a><br>
<a href="faqr.html">FAQ (Russian)</a>
<h3>Man pages:</h>
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
<br><A HREF="man8/icqpr.8.html">icqpr.8</A>
<br><A HREF="man8/pop3p.8.html">pop3p.8</A>
<br><A HREF="man8/proxy.8.html">proxy.8</A>
<br><A HREF="man8/smtpp.8.html">smtpp.8</A>
<br><A HREF="man8/socks.8.html">socks.8</A>
<br><A HREF="man8/tcppm.8.html">tcppm.8</A>
<br><A HREF="man8/udppm.8.html">udppm.8</A>
<br><A HREF="man3/3proxy.cfg.3.html">3proxy.cfg.3</A>
</body></html>
+94
View File
@@ -0,0 +1,94 @@
<h3>3proxy Perl Compatible Regular Expressions (PCRE) plugin</h3>
This filtering plugin can be used to create matching and replace
rules with regular expressions for client's request, client and
servers header and client and server data. It adds 3 additional
configuration commands:
<pre>
pcre TYPE FILTER_ACTION REGEXP [ACE]
pcre_rewrite TYPE FILTER_ACTION REGEXP REWRITE_EXPRESSION [ACE]
pcre_extend FILTER_ACTION [ACE]
pcre_options OPTION1 [...]
</pre>
pcre - allows to apply some rule for matching
<br>pcre_rewrite - in addition to 'pcre' allows to substitute substrings
<br>pcre_extend - extends ACL of the last pcre or pcre_rewrite comand by
adding additional ACE (like with allow/deny configuration commands).
<br>pcre_options - allows to set matching options. Awailable options are:
PCRE_CASELESS,
PCRE_MULTILINE,
PCRE_DOTALL,
PCRE_EXTENDED,
PCRE_ANCHORED,
PCRE_DOLLAR_ENDONLY,
PCRE_EXTRA,
PCRE_NOTBOL,
PCRE_NOTEOL,
PCRE_UNGREEDY,
PCRE_NOTEMPTY,
PCRE_UTF8,
PCRE_NO_AUTO_CAPTURE,
PCRE_NO_UTF8_CHECK,
PCRE_AUTO_CALLOUT,
PCRE_PARTIAL,
PCRE_DFA_SHORTEST,
PCRE_DFA_RESTART,
PCRE_FIRSTLINE,
PCRE_DUPNAMES,
PCRE_NEWLINE_CR,
PCRE_NEWLINE_LF,
PCRE_NEWLINE_CRLF,
PCRE_NEWLINE_ANY,
PCRE_NEWLINE_ANYCRLF,
PCRE_BSR_ANYCRLF,
PCRE_BSR_UNICODE
<ul>
<li>TYPE - type of filtered data. May contain one or more
(comma delimited list) values:
<ul>
<li>request - content of client's request e.g. HTTP GET request string.
(known problem: changing request string doesn't change IP of the host to connect)
<li>cliheader - content of client request headers, e.g. HTTP request header.
<li>srvheader - content of server's reply headers, e.g. HTTP status and headers.
<li>clidata - data received from client, e.g. HTTP POST request data
<li>srvdata - data received from server, e.g. HTML page
</ul>
<li>FILTER_ACTION - action on match
<ul>allow - allow this request without checking rest of the given type
of the rules
<li>deny - deny this request without checking rest of the rules
<li>dunno - continue with the rest of rules (useful with pcre_rewrite)
</ul>
<li>REGEXP - PCRE (perl) regular expression. Use * if no regexp matching
required.
<li>REWRITE_EXPRESSION - substitution string. May contain perl-style
substrings
(not tested) $1, $2. $0 - means whole matched string. \r and \n may be used
to insert new strings, string may be empty ("").
<li>ACE - access control entry (user names, source IPs, destination IPs,
ports, etc), absolutely identical to allow/deny/bandlimin commands.
Regular expression is only matched if ACL matches connection data.
Warning:
reqular expression doesn't require authentication and can not replace
authentication and/or allow/deny ACLs.
</ul>
<h4>Example:</h4>
<pre>
plugin PCREPlugin.dll pcre_plugin
pcre request deny "porn|sex" user1,user2,user3 192.168.0.0/16
pcre srvheader deny "Content-type: application"
pcre_rewrite clidata,srvdata dunno "porn|sex|pussy" "***" baduser
pcre_extend deny * 192.168.0.1/16
</pre>
<h4>Download:</h4>
<ul>
<li>Plugin is included into 3proxy 0.6 binary and source distribution
<li>Example configuration (by Dennis Garber): <A HREF="NoPornLitest.cfg.txt">NoPornLitest.cfg</A>
</ul>
+90
View File
@@ -0,0 +1,90 @@
<h3>Плагин регулярных выражений совместимых с Perl (PCRE) для 3proxy</h3>
Фильтрующий плагин используется для создания правил поиска и замены
регулярных выражений в запросе, заголовков запроса и ответа и данных.
Добавляет поддержку 3х новых команд в файле конфигурации:
<pre>
pcre TYPE FILTER_ACTION REGEXP [ACE]
pcre_rewrite TYPE FILTER_ACTION REGEXP REWRITE_EXPRESSION [ACE]
pcre_extend FILTER_ACTION [ACE]
pcre_options OPTION1 [...]
</pre>
pcre - позволяет искать совпадения
<br>pcre_rewrite - дополнительно позволяет производить замену подстрок
<br>pcre_extend - расширяет ACL последней команды pcre или pcre_rewrite путем
добавления еще одной ACE (аналогично списку правил allow/deny).
<br>pcre_options - позволяет устанавливать опции поиска, доступны следующие опции:
PCRE_CASELESS,
PCRE_MULTILINE,
PCRE_DOTALL,
PCRE_EXTENDED,
PCRE_ANCHORED,
PCRE_DOLLAR_ENDONLY,
PCRE_EXTRA,
PCRE_NOTBOL,
PCRE_NOTEOL,
PCRE_UNGREEDY,
PCRE_NOTEMPTY,
PCRE_UTF8,
PCRE_NO_AUTO_CAPTURE,
PCRE_NO_UTF8_CHECK,
PCRE_AUTO_CALLOUT,
PCRE_PARTIAL,
PCRE_DFA_SHORTEST,
PCRE_DFA_RESTART,
PCRE_FIRSTLINE,
PCRE_DUPNAMES,
PCRE_NEWLINE_CR,
PCRE_NEWLINE_LF,
PCRE_NEWLINE_CRLF,
PCRE_NEWLINE_ANY,
PCRE_NEWLINE_ANYCRLF,
PCRE_BSR_ANYCRLF,
PCRE_BSR_UNICODE
<ul>
<li>TYPE - тип фильтруемых данных. Может содержать одно или
несколько (список через запятую) значений:
<ul>
<li>request - содержимое запроса клиента (например строка HTTP GET-запроса).
(в настоящий момент изменение запроса не приводит к изменению адреса запрашиваемого хоста)
<li>cliheader - содержимое заголовков запроса клиента, например заголовки HTTP
<li>srvheader - содержимое заголовков ответа сервера, например заголовки HTTP
<li>clidata - данные полученные от клиента, например данные POST-запроса
<li>srvdata - данные полученные от сервера, например содержимое HTML-страницы
</ul>
<li>FILTER_ACTION - действие при совпадении. Может принимать значение
<ul>allow - разрешить данный запрос без просмотра дальнейших правил
<li>deny - запретить данный запрос без просмотра дальнейших правил
<li>dunno - продолжить анализ правил (полезно для pcre_rewrite)
</ul>
<li>REGEXP - регулярное выражение в формате PCRE (perl). Используйте * если не
требуется проерка регулярного выражения.
<li>REWRITE_EXPRESSION - строка замены. Может содержать макроподстановки
(не тестировалось) $1, $2 и т.д. аналогично perl. $0 - полная найденная
подстрока. В строке замены можно использовать сочетания \r, \n для вставки
новых строк. Строка может быть пустой ("").
<li>ACE - Список контроля доступа (имя пользователя, IP источника, IP назначения, порт и т.д.),
полностью аналогичный ACE в командах allow, deny, bandlimin и т.п. Регулярное
выражение проверяется только при совпадении ACE с запросом. ВНИМАНИЕ:
использование регулярных выражений не требует авторизации и не заменяет ее.
Авторизацию необходимо конфигурировать отдельно.
</ul>
<h4>Пример:</h4>
<pre>
plugin PCREPlugin.dll pcre_plugin
pcre request deny "porn|sex" user1,user2,user3 192.168.0.0/16
pcre srvheader deny "Content-type: application"
pcre_rewrite clidata,srvdata dunno "porn|sex|pussy" "***" baduser
pcre_extend deny * 192.168.0.1/16
</pre>
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.6
<li>Пример конфигурации (by Dennis Garber): <A HREF="NoPornLitest.cfg.txt">NoPornLitest.cfg</A>
</ul>
+34
View File
@@ -0,0 +1,34 @@
<h3>3proxy SSL/TLS plugin</h3>
Plugin can be used to transparently decypher SSL/TLS data. Plugin should never be used in production environment due to
potential securiy reasons.
<pre>
ssl_certcache PATH_TO_CACHE
ssl_mitm
ssl_nomitm
</pre>
ssl_certcache - path to certificates cache. For transparent spoofing cache must contain 3 files: 3proxy.pem - public
self-signed certificates, 3proxy.key - key for public certificates, server.key - this key will be used to generates
spoofed certificates.
Generated certificates will be placed to the same path.
<br>ssl_mitm - spoof certificates for services started below
<br>ssl_nomitm - do not spoof certificates for services started below
<h4>Example:</h4>
<pre>
plugin /path/to/SslPlugin.dll ssl_plugin
ssl_certcache /path/to/cache/
ssl_mitm
proxy -p3128
ssl_nomitm
proxy -p3129
</pre>
<h4>Download:</h4>
<ul>
<li>Plugin included into 3proxy 0.8
</ul>
&copy; Vladimir Dubrovin, License: BSD style
+32
View File
@@ -0,0 +1,32 @@
<h3>Плагин SSL/TLS для 3proxy</h3>
Плагин используется для транспарентной дешифровки SSL-трафика с подменой сертификата.
Плагин не должен использоваться в рабочем окружении, т.к. его использование дает возможность обхода проверок SSL.
<pre>
ssl_certcache PATH_TO_CACHE
ssl_mitm
ssl_nomitm
</pre>
ssl_certcache - путь к кэшу сертификатов. Для транспорентной подмены сертификатов в кэше должно находиться 3 файла: 3proxy.pem - публичный
самоподписанный сертификат, 3proxy.key - ключ от этого сертификата, server.key - ключ с которым будут генерироваться подменные сертификаты.
Сгенерированные сертификаты будут помещаться в этот же каталог.
<br>ssl_mitm - подменять сертитфикаты для запущенных ниже сервисов
<br>ssl_nomitm - не подменять сертитфикаты для запущенных ниже сервисов
<h4>Пример:</h4>
<pre>
plugin /path/to/SslPlugin.dll ssl_plugin
ssl_certcache /path/to/cache/
ssl_mitm
proxy -p3128
ssl_nomitm
proxy -p3129
</pre>
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.8
</ul>
+16
View File
@@ -0,0 +1,16 @@
<h3>3proxy strings substitution plugin</h3>
May be used to make interface more pretty or to translate proxy server
messages to different language. All messages are taken from proxy.c and
moved to external text file (e.g. rus.3ps). On the moment of
writing there are 15 sections. Sections are delimited with "[end]".
<h4>Example:</h4>
<pre>plugin "StringsPlugin.dll" start c:\3proxy\bin\rus.3ps
</pre>
<h4>Download:</h4>
<ul>
<li>Plugin is included into 3proxy 0.6 binary and source distribution
</li></ul>
©Kirill Lopuchov
+18
View File
@@ -0,0 +1,18 @@
<h3>Плагин подмены строк 3proxy</h3>
Используется, в частности, для руссификации сообщений выдаваемых 3proxy.
Для корректной работы требуется 0.6 версия 3proxy.
Все сообщения были взяты из proxy.c
и вынесенны в отдельный файл. Пример файла rus-win1251.3ps.
Всего 15 секций на момент написания плагина в файле rus-win1251.3ps каждая секция отделяется строкой "[end]"
новая строка определяется строкой "\n"
<h4>Пример:</h4>
<pre>
plugin "StringsPlugin.dll" start c:\3proxy\bin\rus-win1251.3ps
</pre>
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.6
</ul>
+52
View File
@@ -0,0 +1,52 @@
<h3>3proxy traffic correction plugin</h3>
3proxy logs and counts traffic on application level, while provider usually does
it on network or link level. It's significant if you use 3proxy for billing,
especially in case where network packets are small, e.g. network games.
<p>
This plugin attempts to correct 3proxy computations to approximate network or
link level traffic by using either fixed coefficients by port number or
attempting to predict number and sizes of network packets.
</p><h4>Usage:</h4>
<ol>
<li>Extract TrafficPlugin.dll to the same folder with 3proxy executable.
</li><li>Start plugin in 3proxy.cfg with
<pre>plugin TrafficPlugin.dll start
</pre>
</li><li>Add correction rules:
<br>
FOR FIXED COEFFICIENTS MODE:
<pre>trafcorrect m &lt;service&gt; &lt;target port&gt; &lt;coefficient&gt;
</pre>
where &lt;service&gt; - one of proxy, socks4, socks45, socks5, tcppm, udppm, pop3p, * matches "any".
<br> &lt;target port&gt; - target port, * matches any
<br> &lt;coefficient&gt; - coefficient to multiply traffic for this port.
<br>
FOR PACKET HEADER PREDICTION MODE
<pre>trafcorrect p &lt;service&gt; &lt;tcp/udp&gt; &lt;target port&gt; [empty packet size]
</pre>
tcp ot udp - transport level protocol to apply rule
<br>
empty packet size - average size of "empty" packet, that is sum of average network/transport headers.
You can use network sniffer, such is Ethereal to discover it. Usually packet size
is 42 for UDP and
<br>Modes can be mixed.
<br>Plugin creates a list of rules, first matching rule will be applied.
</li></ol>
For any mode plugin approximates traffic, logged or counted amount is not exact.
<h4>Example:</h4>
<pre>plugin "TrafficPlugin.dll" start
trafcorrect m socks5 6112 4.5
trafcorrect m socks5 * 1.1
</pre>
wrong usage:
<pre>trafcorrect m socks5 * 1.1
trafcorrect m socks5 6112 4.5
</pre>
second rule will never be applied.
<h4>Download:</h4>
<ul>
<li>Plugin is included into 3proxy 0.6 binary and source distribution
</li></ul>
©Maslov Michael aka Flexx(rus)
+69
View File
@@ -0,0 +1,69 @@
<h3>Плагин коррекции траффика 3proxy</h3>
Как известно, 3proxy считает траффик не сетевой, а прикладной.
Обычно прикладной траффик немного меньше (примерно на 10%) чем сетевой,
однако в некоторых случаях, например когда пользователи сети играют в
игры, сетевой траффик может превысить прикладной в 4-5 раз. Это довольно неприятно,
так как получается, что они за это не платят.
<p>
Происходит это потому, что в каждом посланом пакете есть заголовок+данные. Заголовок
весит порядка 50-60 байт а количество данных может меняться от 15-20 байт (что характерно для игр)
до 800-900 байт (у IE). Также количество данных в пакете зависит от загрузки сети,
удалённости сервера и прочих причин.
<p>
Данный плагин может исправить такую ситуацию. Он может умножать счётчик траффика
при окончании соединения на некоторый коэффициент либо добавлять к данным размеры заголовков пакетов,
которые прошли по сети.
<h4>Использование</h4>
<ol>
<li>Извлечь TrafficPlugin.dll в каталог с 3proxy.exe
<li>Стартовать плагин в 3proxy.cfg
<pre>
plugin TrafficPlugin.dll start
</pre>
<li>Добавить правила:
<br>
ДЛЯ РЕЖИМА ДОМНОЖЕНИЯ ТРАФФИКА НА ЧИСЛО:
<pre>
trafcorrect m &lt;сервис&gt; &lt;исходящий порт&gt; &lt;коэффициент&gt;
</pre>
где: &lt;сервис&gt; может быть proxy, socks4, socks45, socks5, tcppm, udppm, pop3p
если сервис указан неверно то считается, что это может быть любой сервис.
можно использовать *, тогда правило будет считаться для любого сервиса.
<br> &lt;исходящий порт&gt; - порт, к которому подключается прокси сервер. * - любой
&lt;коэффициент&gt; - число на каоторое домнажается траффик. Обязательный параметр.
Должен быть от больше 0 и меньше 100
<br>
ДЛЯ РЕЖИМА С УЧЁТОМ РАЗМЕРА ЗАГОЛОВКОВ ПАКЕТОВ:
<pre>
trafcorrect p &lt;сервис&gt; &lt;tcp/udp&gt; &lt;исходящий порт&gt; [размер пустого пакета]
</pre>
&lt;tcp/udp&gt; - протокол, по которому осуществляется соединение.
[размер пакета] - средний размер пустого пакета. Можно определить захватив
данные при помощи такой утилиты как Ethereal. Параметр необязателен. Если отсутствует,
то размер пакета будет считаться равным 66 байт.
<br>Режимы можно смешивать.
Следует учитывать, что плугин создаёт список всех правил изменения траффика.
Когда происходит окончание соединения выполняется первое подходящее правило.
</ol>
Подсчет трафика в любом режиме не является точным, это некоторая аппроксимация
позволяющаяподсчитать трафик с точностью до нескольких процентов.
<h4>Пример:</h4>
<pre>
plugin "TrafficPlugin.dll" start
trafcorrect m socks5 6112 4.5
trafcorrect m socks5 * 1.1
</pre>
следующее неверно:
<pre>
plugin "TrafficPlugin.dll" start
trafcorrect m socks5 * 1.1
trafcorrect m socks5 6112 4.5
</pre>
Вторая строчка выполнена никогда не будет, т.к. правило 1 содержит *.
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.6
</ul>
+28
View File
@@ -0,0 +1,28 @@
<h3>3proxy TransparentPlugin plugin (Linux only)</h3>
Plugin can turn 3proxy into transparent proxy for virtually any TCP-based protocol
and use all 3proxy features - redirections, parent proxies, ACLs, traffic limitations,
etc. TransparentPlugin plugin takes destination IP:port from Linux and uses this
information as a target IP in proxy. An example of usage:
<pre>
plugin /path/to/TransparentPlugin.ld.so transparent_plugin
log /path/to/log
auth iponly
allow * * * 80
parent 1000 http 0.0.0.0 0
allow *
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
</pre>
Now, any TCP traffic transparently redirected to port 12345 will be routed via
parent SOCKSv5 proxy and logged, all URLs for web requests are visible in logs.
Paremeters '127.0.0.1 11111' in this case are not used and are overwritten by
destination IP:port for each transparent connection.
<h4>Download:</h4>
<ul>
<li>Plugin included into 3proxy 0.8
</ul>
&copy; Vladimir Dubrovin, License: BSD style
@@ -0,0 +1,30 @@
<h3>Плагин TransparentPlugin 3proxy (только для Linux)</h3>
Плагин превращает 3proxy в транспарентный прокси для практически любых TCP-соединений
и позволяет прозрачно для клиентов использовать весь фунционал прокси - редиректоры,
родительские прокси, ACLи, ограничения трафика. TransparentPlugin получает IP:port
назначения от Linux и использует эту информацию в качестве конечного адреса назначения.
<br>
Пример использования:
<pre>
plugin /path/to/TransparentPlugin.ld.so transparent_plugin
log /path/to/log
auth iponly
allow * * * 80
parent 1000 http 0.0.0.0 0
allow *
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
</pre>
Теперь любые TCP-соединения транспарентно перенаправленные в локальный порт 12345
будут прологгированы и перенаправлены в родительский SOCKSv5 proxy, при этом для
HTTP-запросов по порту TCP/80 будут видны параметры HTTP-запроса.
Параметры '127.0.0.1 11111' в данном случае не оказывают влияния, т.к.
будут перезаписываться IP и портом назначения для каждого TCP-соединения соответственно.
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.8
</ul>
&copy; Vladimir Dubrovin, License: BSD style
@@ -0,0 +1,33 @@
<h3>3proxy Windows Authentication plugin</h3>
Support for cleartext authentication against Windows domain or local Windows account.
<h4>Usage:</h4>
<ol>
<li>Extract WindowsAuthentication.dll to the same folder with 3proxy executable.
<li>Create 3ProxyAllowedGroup - Windows system group allowed to use proxy.
You can choose different group name. Group can be either local or
Active Directory. Every account allowed to use 3proxy must be included in this
group either directly or through group nesting.
<li>Configure plugin with 'plugin' command in 3proxy.cfg, e.g.:
<pre><code>
plugin &quot;WindowsAuthentication.dll&quot; WindowsAuthentication &quot;3ProxyAllowedGroup&quot;
</code></pre>
<br>WindowsAuthentication.dll - location of DLL, if DLL is located in different folder
from 3proxy.exe you must specify complete path to DLL here. 3ProxyAllowedGroup - Windows
system group allowed to use 3proxy.
After plugin is loaded, 'windows' authentication type is supported.
<li>Configure 'auth windows' for services that require Windows authentication.
<li>It's recommended you also configure authentication caching (see 'authcache'),
to prevent excessive workload for domain controller. Example:
<pre>
authcache user,pass 900
auth cache windows
</pre>
<li>NTLM authentication is not currently supported for plugins, you should use proxy -n key to disable it.
</ol>
<h4>Download:</h4>
<ul>
<li>Plugin is included into 3proxy 0.6 binary and source distribution
</ul>
@@ -0,0 +1,35 @@
<h3>Плагин аутентификации Windows для 3proxy</h3>
Поддерживается только аутентификация открытым текстом в домене или на локальной машине Windows.
<h4>Использование</h4>
<ol>
<li>Извлечь WindowsAuthentication.dll в каталог с 3proxy.exe
<li>Создать 3ProxyAllowedGroup - системная группа Windows, которой разрешено использование прокси. Ее необходимо создать (можно
использовать группу с другим именем, см. ниже). Учетные записи пользователей, которым разрешен доступ к прокси
должны быть включены в группу непосредственно или посредством включения их групп. Группа может быть как локальной, так и в
ActiveDirectory.
<li>В файле конфигурации загрузить dll с помощью команды plugin:
<br>plugin &quot;WindowsAuthentication.dll&quot; WindowsAuthentication &quot;3ProxyAllowedGroup&quot;
<br>Если DLL находится в другом каталоге, то вместо &quot;WindowsAuthentication.dll&quot;
необходимо указать полный путь к DLL. 3ProxyAllowedGroup - название системной группы,
которой разрешен доступ к прокси.
<li>Плагин добавляет новый тип аутентификации - windows. Т.е. для использования
Windows-аутентификации надо дать команду
<pre>
auth windows
</pre>
<li>Не рекомендуется использовать данный плагин без кэширования
аутентификации (authcache), т.к. это приведет к увеличению нагрузки на
сервер/контроллер домена. Пример:
<pre>
authcache user,pass 900
auth cache windows
</pre>
<li>В настоящее время не поддерживается NTLM-аутентификация для плагинов,
поэтому необходимо запускать proxy с ключиком -n.
</ol>
<h4>Загрузить:</h4>
<ul>
<li>Плагин включен в дистрибутив 3proxy 0.6
</ul>
+4 -6
View File
@@ -1,10 +1,10 @@
<h3>3proxy security considirations</h3> <h3>3proxy security considirations</h3>
</ul> </ul>
<ol> <ul>
<li>Never install 3proxy suid. If you need it to run suid write some <li>Never install 3proxy suid. If you need it to run suid write some
wrapper with fixed configuration file. wrapper with fixed configuration file.
<li>Make configuration file only available to account 3proxy starts with. <li>Make configuration file only available to account 3proxy starts with.
<li>Under Windows NT/2000/XP/2003 if 3proxy is used as service create new <li>Under Windows if 3proxy is used as service create new
unprivileged local account without "logon locally" right. Assign this account unprivileged local account without "logon locally" right. Assign this account
to 3proxy service. to 3proxy service.
<li>Under unix use chroot to jail 3proxy (make sure files included in <li>Under unix use chroot to jail 3proxy (make sure files included in
@@ -20,9 +20,8 @@ authentication method is currently available.
<li>Always limit connections to internal network and localhost (to 127.0.0.1 and <li>Always limit connections to internal network and localhost (to 127.0.0.1 and
all interfaces) with ACLs. Be carefull, because BIND command in SOCKS requies all interfaces) with ACLs. Be carefull, because BIND command in SOCKS requies
BIND method with external interface IP address to be allowed. BIND method with external interface IP address to be allowed.
<li> Always use nserver and nscache under Unix, overwise DoS attack is possible <li> Before 3proxy 0.8 always use nserver and nscache under Unix, overwise DoS attack is possible
with unreachable DNS server (because gethostbyname will block over threads). with unreachable DNS server (because gethostbyname will block over threads).
<li>Remember, that 'nbname' authentication is not reliable and can be spoofed.
<li>Keep logs in secure location, because some confidential information from <li>Keep logs in secure location, because some confidential information from
user's request can be logged. user's request can be logged.
<li>Use -xyz+A character filtering sequences for 'logformat', especially with <li>Use -xyz+A character filtering sequences for 'logformat', especially with
@@ -31,7 +30,6 @@ ODBC logging to prevent SQL and log record injections.
<li>Participate in code audit :) <li>Participate in code audit :)
</ol> </ol>
</ol> </ul>
<p> <p>
<pre>$Id: securityen.html,v 1.4 2007/05/07 09:16:51 vlad Exp $</pre>
+1735 -1822
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -96,4 +96,3 @@ setuid 65534
После того как мы создали конфигурационный файл сервера, запускаем 3proxy командой: После того как мы создали конфигурационный файл сервера, запускаем 3proxy командой:
/usr/local/3proxy/3proxy /usr/local/3proxy/3proxy.cfg /usr/local/3proxy/3proxy /usr/local/3proxy/3proxy.cfg
$Id: example1.txt,v 1.7 2007/04/20 19:58:42 vlad Exp $
-1
View File
@@ -98,4 +98,3 @@ LIBS = -L /usr/local/lib -lodbc
make clean make clean
make -f Makefile.unix make -f Makefile.unix
$Id: iodbc.txt,v 1.3 2006/02/08 17:59:07 vlad Exp $
+4 -6
View File
@@ -1,4 +1,4 @@
.TH 3proxy "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH 3proxy "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B 3proxy .B 3proxy
\- 3[APA3A] tiny proxy server, or trivial proxy server, or free proxy \- 3[APA3A] tiny proxy server, or trivial proxy server, or free proxy
@@ -138,7 +138,7 @@ wget to automate this task.
configuration file configuration file
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy.cfg(3), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), 3proxy.cfg(3), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8),
kill(1), syslogd(8), kill(1), syslogd(8),
@@ -147,7 +147,5 @@ http://3proxy.ru/
.SH TRIVIA .SH TRIVIA
3APA3A is pronounced as \`\`zaraza\'\'. 3APA3A is pronounced as \`\`zaraza\'\'.
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+240 -183
View File
@@ -1,35 +1,37 @@
.TH 3proxy.cfg "3" "July 2009" "3proxy 0.7" "Universal proxy server" .TH 3proxy.cfg "3" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B 3proxy.cfg .B 3proxy.cfg
\- 3proxy configuration file \- 3proxy configuration file
.SH DESCRIPTION .SH DESCRIPTION
Common structure: Common structure:
.br .br
Configuration file is a text file 3proxy reads configuration from. Each line Configuration file is a text file 3proxy reads configuration from. Each line
of the file is a command executed immediately, as it was given from of the file is a command executed immediately, as it was given from
console. Sequence of commands is important. Configuration file as actually a console. Sequence of commands is important. Configuration file as actually a
script for 3proxy executable. script for 3proxy executable.
Each line of the file is treated as a blank (space or tab) separated Each line of the file is treated as a blank (space or tab) separated
command line. Additional space characters are ignored. command line. Additional space characters are ignored.
Think about 3proxy as "application level router" with console interface. Think about 3proxy as "application level router" with console interface.
.br .br
Comments: Comments:
.br .br
Any string beginning with space character or \'#\' character is comment. It\'s Any string beginning with space character or \'#\' character is comment. It\'s
ignored. <LF>s are ignored. <CR> is end of command. ignored. <LF>s are ignored. <CR> is end of command.
.br .br
Quotation: Quotation:
.br .br
Quotation character is " (double quote). Quotation must be used to quote Quotation character is " (double quote). Quotation must be used to quote
spaces or another special characters. To use quotation character inside spaces or another special characters. To use quotation character inside
quotation character must be dubbed (BASIC convention). For example to use quotation character must be dubbed (BASIC convention). For example to use
HELLO "WORLD" as an argument you should use it as "HELLO ""WORLD"""\. HELLO "WORLD" as an argument you should use it as "HELLO ""WORLD"""\.
Good practice is to quote any argument you use. Good practice is to quote any argument you use.
.br .br
File inclusion: File inclusion:
.br .br
You can include file by using $FILENAME macro (replace FILENAME with a path You can include file by using $FILENAME macro (replace FILENAME with a path
to file, for example $/usr/local/etc/3proxy/conf.incl or to file, for example $/usr/local/etc/3proxy/conf.incl or
$"c:\\Program Files\\3proxy\\include.cfg" Quotation is $"c:\\Program Files\\3proxy\\include.cfg" Quotation is
required in last example because path contains space character. required in last example because path contains space character.
@@ -39,9 +41,12 @@ Thus, include files are only useful to store long signle-line commands
(like userlist, network lists, etc). (like userlist, network lists, etc).
To use dollar sign somewhere in argument it must be quoted. To use dollar sign somewhere in argument it must be quoted.
Recursion is not allowed. Recursion is not allowed.
.br .br
Next commands start gateway services: Next commands start gateway services:
.br .br
.br
.B proxy .B proxy
[options] [options]
.br .br
@@ -103,15 +108,49 @@ change default server port to NUMBER
.B -n .B -n
disable NTLM authentication (required if passwords are stored in Unix crypt format. disable NTLM authentication (required if passwords are stored in Unix crypt format.
.br .br
.B -n1
enable NTLMv1 authentication.
.br
.B -s .B -s
(for admin) - allow only secure operations (currently only traffic counters (for admin) - secure, allow only secure operations (currently only traffic counters
view without ability to reset). view without ability to reset).
.br .br
(for dnspr) - simple, do not use 'resolver' and 3proxy cache, always use external DNS server.
.br
(for udppm) - singlepacket, expect only one packet from both client and server
.br
.B -u
Never ask for username/password
.br
.B -u2
(socks) require username/password in authentication methods
.br
.B -a .B -a
(for proxy) - anonymous proxy (no information about client reported) (for proxy) - anonymous proxy (no information about client reported)
.br .br
.B -a1 .B -a1
(for proxy) - anonymous proxy (random client information reported) (for proxy) - anonymous proxy (random client information reported)
.br
.B -a2
(for proxy) - generate Via: and X-Forwared-For: instead of Forwarded:
.br
.B -6
Only resolve IPv6 addresses. IPv4 addresses are packed in IPv6 in IPV6_V6ONLY compatible way.
.br
.B -4
Only resolve IPv4 addresses
.br
.B -46
Resolve IPv6 addresses if IPv4 address is not resolvable
.br
.B -64
Resolve IPv4 addresses if IPv6 address is not resolvable
.br
.B -RHOST:port
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.
.br
.B -rHOST:port
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.
.br .br
Also, all options mentioned for Also, all options mentioned for
.BR proxy (8) .BR proxy (8)
@@ -130,7 +169,9 @@ pop3username@pop3server. If POP3 proxy access must be authenticated, you can
specify username as proxy_username:proxy_password:POP3_username@pop3server specify username as proxy_username:proxy_password:POP3_username@pop3server
.br .br
DNS proxy resolves any types of records but only hostnames are cached. It DNS proxy resolves any types of records but only hostnames are cached. It
requires nserver/nscache to be configured. requires nserver/nscache to be configured. If nserver is configured as TCP,
redirections are applied on connection, so parent proxy may be used to resolve
names to IP.
.br .br
FTP proxy can be used as FTP server in any FTP client or configured as FTP FTP proxy can be used as FTP server in any FTP client or configured as FTP
proxy on a client with FTP proxy support. Username format is one of proxy on a client with FTP proxy support. Username format is one of
@@ -141,28 +182,24 @@ proxy on a client with FTP proxy support. Username format is one of
.br .br
proxyuser:proxypassword:FTPuser:FTPpassword@FTPserver proxyuser:proxypassword:FTPuser:FTPpassword@FTPserver
.br .br
Please note, if you use FTP client interface for FTP proxy 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
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
.br
.B include .B include
<path> <path>
.br .br
Include config file Include config file
.br .br
.B config .B config
<path> <path>
.br .br
Path to configuration file to use on 3proxy restart or to save configuration. Path to configuration file to use on 3proxy restart or to save configuration.
.br .br
.B writable .B writable
.br .br
ReOpens configuration file for write access via Web interface, ReOpens configuration file for write access via Web interface,
and re-reads it. Usually should be first command on config file and re-reads it. Usually should be first command on config file
but in combination with "config" it can be used anywhere to open but in combination with "config" it can be used anywhere to open
alternate config file. Think twice before using it. alternate config file. Think twice before using it.
@@ -170,13 +207,13 @@ alternate config file. Think twice before using it.
.br .br
.B end .B end
.br .br
End of configuration End of configuration
.br .br
.B log .B log
[[@|&]logfile] [<LOGTYPE>] [[@|&]logfile] [<LOGTYPE>]
.br .br
sets logfile for all gateways sets logfile for all gateways
.br .br
@ - (for Unix) use syslog, filename is used as ident name @ - (for Unix) use syslog, filename is used as ident name
.br .br
@@ -192,10 +229,10 @@ sets logfile for all gateways
.br .br
H - Hourly H - Hourly
.br .br
if logfile is not specified logging goes to stdout. You can specify individual logging options for gateway by using if logfile is not specified logging goes to stdout. You can specify individual logging options for gateway by using
-l option in gateway configuration. -l option in gateway configuration.
.br .br
"log" command supports same format specifications for filename template "log" command supports same format specifications for filename template
as "logformat" (if filename contains '%' sign it's believed to be template). as "logformat" (if filename contains '%' sign it's believed to be template).
As with "logformat" filename must begin with 'L' or 'G' to specify Local or As with "logformat" filename must begin with 'L' or 'G' to specify Local or
Grinwitch time zone for all time-based format specificators. Grinwitch time zone for all time-based format specificators.
@@ -203,13 +240,13 @@ Grinwitch time zone for all time-based format specificators.
.br .br
.B rotate .B rotate
<n> <n>
how many archived log files to keep how many archived log files to keep
.br .br
.B logformat .B logformat
<format> <format>
.br
Format for log record. First symbol in format must be L (local time) Format for log record. First symbol in format must be L (local time)
or G (absolute Grinwitch time). or G (absolute Grinwitch time).
It can be preceeded with -XXX+Y where XXX is list of characters to be It can be preceeded with -XXX+Y where XXX is list of characters to be
filtered in user input (any non-printable characters are filtered too filtered in user input (any non-printable characters are filtered too
@@ -217,72 +254,74 @@ in this case) and Y is replacement character. For example, "-,%+ L" in
the beginning of logformat means comma and percent are replaced the beginning of logformat means comma and percent are replaced
with space and all time based elemnts are in local time zone. with space and all time based elemnts are in local time zone.
.br .br
You can use: You can use:
.br .br
%y - Year in 2 digit format %y - Year in 2 digit format
.br .br
%Y - Year in 4 digit format %Y - Year in 4 digit format
.br .br
%m - Month number %m - Month number
.br .br
%o - Month abbriviature %o - Month abbriviature
.br .br
%d - Day %d - Day
.br .br
%H - Hour %H - Hour
.br .br
%M - Minute %M - Minute
.br .br
%S - Second %S - Second
.br .br
%t - Timstamp (in seconds since 01-Jan-1970) %t - Timstamp (in seconds since 01-Jan-1970)
.br .br
%. - milliseconds %. - milliseconds
.br .br
%z - timeZone (from Grinvitch) %z - timeZone (from Grinvitch)
.br .br
%D - request duration (in milliseconds) %D - request duration (in milliseconds)
.br .br
%b - average send rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager. %b - average send rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager.
.br .br
%B - average receive rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager. %B - average receive rate per request (in Bytes per second) this speed is typically below connection speed shown by download manager.
.br .br
%U - Username %U - Username
.br .br
%N - service Name %N - service Name
.br .br
%p - service Port %p - service Port
.br .br
%E - Error code %E - Error code
.br .br
%C - Client IP %C - Client IP
.br .br
%c - Client port %c - Client port
.br .br
%R - Remote IP %R - Remote IP
.br .br
%r - Remote port %r - Remote port
.br .br
%e - External IP used to establish connection %i - Internal IP used to accept client connection
.br .br
%Q - Requested IP %e - External IP used to establish connection
.br .br
%q - Requested port %Q - Requested IP
.br .br
%n - requested hostname %q - Requested port
.br .br
%I - bytes In %n - requested hostname
.br .br
%O - bytes Out %I - bytes In
.br .br
%h - Hops (redirections) count %O - bytes Out
.br .br
%T - service specific Text %h - Hops (redirections) count
.br .br
%N1-N2T - (N1 and N2 are positive numbers) - log only fields from N1 thorugh N2 of service specific text %T - service specific Text
.br .br
in case of ODBC logging logformat specifies SQL statement, for exmample: %N1-N2T - (N1 and N2 are positive numbers) - log only fields from N1 thorugh N2 of service specific text
.br
in case of ODBC logging logformat specifies SQL statement, for exmample:
.br .br
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')" 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')"
@@ -290,7 +329,7 @@ in case of ODBC logging logformat specifies SQL statement, for exmample:
.B logdump .B logdump
<in_traffic_limit> <out_traffic_limit> <in_traffic_limit> <out_traffic_limit>
.br .br
Immediately creates additional log records if given amount of incoming/outgoing Immediately creates additional log records if given amount of incoming/outgoing
traffic is achieved for connection, without waiting for connection to finish. traffic is achieved for connection, without waiting for connection to finish.
It may be useful to prevent information about long-lasting downloads on server It may be useful to prevent information about long-lasting downloads on server
shutdown. shutdown.
@@ -299,7 +338,7 @@ shutdown.
.B archiver .B archiver
<ext> <commandline> <ext> <commandline>
.br .br
Archiver to use for log files. <ext> is file extension produced by Archiver to use for log files. <ext> is file extension produced by
archiver. Filename will be last argument to archiver, optionally you archiver. Filename will be last argument to archiver, optionally you
can use %A as produced archive name and %F as filename. can use %A as produced archive name and %F as filename.
@@ -307,47 +346,51 @@ can use %A as produced archive name and %F as filename.
.B timeouts .B timeouts
<BYTE_SHORT> <BYTE_LONG> <STRING_SHORT> <STRING_LONG> <CONNECTION_SHORT> <CONNECTION_LONG> <DNS> <CHAIN> <BYTE_SHORT> <BYTE_LONG> <STRING_SHORT> <STRING_LONG> <CONNECTION_SHORT> <CONNECTION_LONG> <DNS> <CHAIN>
.br .br
Sets timeout values Sets timeout values
.br .br
BYTE_SHORT - short timeout for single byte, is usually used for receiving single byte from stream. BYTE_SHORT - short timeout for single byte, is usually used for receiving single byte from stream.
.br .br
BYTE_LONG - long timeout for single byte, is usually used for receiving first byte in frame (for example first byte in socks request). BYTE_LONG - long timeout for single byte, is usually used for receiving first byte in frame (for example first byte in socks request).
.br .br
STRING_SHORT - short timeout, for character string within stream (for example to wait between 2 HTTP headers) STRING_SHORT - short timeout, for character string within stream (for example to wait between 2 HTTP headers)
.br .br
STRING_LONG - long timeout, for first string in stream (for example to wait for HTTP request). STRING_LONG - long timeout, for first string in stream (for example to wait for HTTP request).
.br .br
CONNECTION_SHORT - inactivity timeout for short connections (HTTP, POP3, etc). CONNECTION_SHORT - inactivity timeout for short connections (HTTP, POP3, etc).
.br .br
CONNECTION_LONG - inactivity timeout for long connection (SOCKS, portmappers, etc). CONNECTION_LONG - inactivity timeout for long connection (SOCKS, portmappers, etc).
.br .br
DNS - timeout for DNS request before requesting next server DNS - timeout for DNS request before requesting next server
.br .br
CHAIN - timeout for reading data from chained connection CHAIN - timeout for reading data from chained connection
.br .br
.br .br
.B nserver .B nserver
<ipaddr> <ipaddr>[:port][/tcp]
.br .br
Nameserver to use for name resolutions. If none spcified system Nameserver to use for name resolutions. If none specified
or name server fails system routines for name resolution will be or name server fails system routines for name resolution will be
used. It's better to specify nserver because gethostbyname() may used. It's better to specify nserver because gethostbyname() may
be thread unsafe. be thread unsafe. Optional port number may be specified.
If optional /tcp is added to IP address, name resolution will be
performed over TCP.
.br .br
.B nscache .B nscache
<cachesize> <cachesize>
.B nscache6
<cachesize>
.br .br
Cache <cachesize> records for name resolution (nscache for IPv4,
Cache <cachesize> records for name resolution. Cachesize usually nscache6 for IPv6). Cachesize usually should be large enougth
should be large enougth (for example 65536). (for example 65536).
.br .br
.B nsrecord .B nsrecord
<hostname> <hostaddr> <hostname> <hostaddr>
.BR .br
Adds static record to nscache. nscache must be enabled. If 0.0.0.0 Adds static record to nscache. nscache must be enabled. If 0.0.0.0
is used as a hostaddr host will never resolve, it can be used to is used as a hostaddr host will never resolve, it can be used to
blacklist something or together with blacklist something or together with
.B dialer .B dialer
@@ -355,15 +398,15 @@ command to set up UDL for dialing.
.br .br
.B fakeresolve .B fakeresolve
.BR .br
All names are resolved to 127.0.0.2 address. Usefull if all requests are All names are resolved to 127.0.0.2 address. Usefull if all requests are
redirected to parent proxy with http, socks4+, connect+ or socks5+. redirected to parent proxy with http, socks4+, connect+ or socks5+.
.br .br
.B dialer .B dialer
<progname> <progname>
.br .br
Execute progname if external name can't be resolved. Execute progname if external name can't be resolved.
Hint: if you use nscache, dialer may not work, because names will Hint: if you use nscache, dialer may not work, because names will
be resolved through cache. In this case you can use something like be resolved through cache. In this case you can use something like
http://dial.right.now/ from browser to set up connection. http://dial.right.now/ from browser to set up connection.
@@ -373,29 +416,30 @@ http://dial.right.now/ from browser to set up connection.
.B internal .B internal
<ipaddr> <ipaddr>
.br .br
sets ip address of internal interface. This IP address will be used sets ip address of internal interface. This IP address will be used
to bind gateways. Alternatively you can use -i option for individual to bind gateways. Alternatively you can use -i option for individual
gateways gateways. Since 0.8 version, IPv6 address may be used.
.br .br
.B external .B external
<ipaddr> <ipaddr>
.br .br
sets ip address of external interface. This IP address will be source sets ip address of external interface. This IP address will be source
address for all connections made by proxy. Alternatively you can use address for all connections made by proxy. Alternatively you can use
-e option to specify individual address for gateway. -e option to specify individual address for gateway. Since 0.8 version
External or -e can be given twice: once with IPv4 and once with IPv6 address.
.br .br
.B maxconn .B maxconn
<number> <number>
.br .br
sets maximum number of simulationeous connections to each services sets maximum number of simulationeous connections to each services
started after this command. Default is 100. started after this command. Default is 100.
.br .br
.B service .B service
.br .br
(depricated). Indicates 3proxy to behave as Windows 95/98/NT/2000/XP (depricated). Indicates 3proxy to behave as Windows 95/98/NT/2000/XP
service, no effect for Unix. Not required for 3proxy 0.6 and above. If service, no effect for Unix. Not required for 3proxy 0.6 and above. If
you upgraded from previous version of 3proxy use --remove and --install you upgraded from previous version of 3proxy use --remove and --install
to reinstall service. to reinstall service.
@@ -403,7 +447,7 @@ to reinstall service.
.br .br
.B daemon .B daemon
.br .br
Should be specified to close console. Do not use 'daemon' with 'service'. Should be specified to close console. Do not use 'daemon' with 'service'.
At least under FreeBSD 'daemon' should preceed any proxy service At least under FreeBSD 'daemon' should preceed any proxy service
and log commands to avoid sockets problem. Always place it in the beginning and log commands to avoid sockets problem. Always place it in the beginning
of the configuration file. of the configuration file.
@@ -412,68 +456,64 @@ of the configuration file.
.B auth .B auth
<authtype> [...] <authtype> [...]
.br .br
Type of user authorization. Currently supported: Type of user authorization. Currently supported:
.br
none - no authentication or authorization required.
.br .br
none - no authentication or authorization required.
Note: is auth is none any ip based limitation, redirection, etc will not work. Note: is auth is none any ip based limitation, redirection, etc will not work.
This is default authentication type This is default authentication type
.br .br
iponly - authentication by access control list with username ignored. iponly - authentication by access control list with username ignored.
Appropriate for most cases Appropriate for most cases
.br .br
useronly - authentication by username without checking for any password with useronly - authentication by username without checking for any password with
authorization by ACLs. Useful for e.g. SOCKSv4 proxy and icqpr (icqpr set UIN / authorization by ACLs. Useful for e.g. SOCKSv4 proxy and icqpr (icqpr set UIN /
AOL screen name as a username) AOL screen name as a username)
.br .br
dnsname - authentication by DNS hostnname with authorization by ACLs. dnsname - authentication by DNS hostnname with authorization by ACLs.
DNS hostname is resolved via PTR (reverse) record and validated (resolved DNS hostname is resolved via PTR (reverse) record and validated (resolved
name must resolve to same IP address). It's recommended to use authcache by name must resolve to same IP address). It's recommended to use authcache by
ip for this authentication. ip for this authentication.
NB: there is no any password check, name may be spoofed. NB: there is no any password check, name may be spoofed.
.br .br
nbname - authentication by NetBIOS name with authorization by ACLs. strong - username/password authentication required. It will work with
Messanger service should be started on user's machine. Note, that
Windows 95/98 hosts do not have messanger service by default,
WinPopup program need to be started. It's recommended to use authcache by
ip for this authentication.
NB: there is no any password check, name may be spoofed.
.br
strong - username/password authentication required. It will work with
SOCKSv5, FTP, POP3 and HTTP proxy. SOCKSv5, FTP, POP3 and HTTP proxy.
.br .br
cache - cached authentication, may be used with 'authcache'. cache - cached authentication, may be used with 'authcache'.
.br .br
Plugins may add additional authentication types. Plugins may add additional authentication types.
.br .br
It's possible to use few authentication types in the same commands. E.g. It's possible to use few authentication types in the same commands. E.g.
.br .br
auth iponly strong auth iponly strong
.br .br
In this case 'strong' authentication will be used only in case resource In this case 'strong' authentication will be used only in case resource
access can not be performed with 'iponly' authentication, that is username is access can not be performed with 'iponly' authentication, that is username is
required in ACL. It's usefull to protect access to some resources with required in ACL. It's usefull to protect access to some resources with
password allowing passwordless access to another resources, or to use password allowing passwordless access to another resources, or to use
IP-based authentication for dedicated laptops and request username/password for IP-based authentication for dedicated laptops and request username/password for
shared ones. shared ones.
.br .br
.B authcache .B authcache
<cachtype> <cachtime> <cachtype> <cachtime>
.br .br
Cache authentication information to given amount of time (cachetime) in seconds. Cache authentication information to given amount of time (cachetime) in seconds.
Cahtype is one of: Cahtype is one of:
.br .br
ip - after successful authentication all connections during caching time ip - after successful authentication all connections during caching time
from same IP are assigned to the same user, username is not requested. from same IP are assigned to the same user, username is not requested.
.br .br
ip,user username is requested and all connections from the same IP are ip,user username is requested and all connections from the same IP are
assigned to the same user without actual authentication. assigned to the same user without actual authentication.
.br .br
user - same as above, but IP is not checked. user - same as above, but IP is not checked.
.br .br
user,password - both username and password are checked against cached ones. user,password - both username and password are checked against cached ones.
.br .br
Use auth type 'cache' for cached authentication Use auth type 'cache' for cached authentication
.br .br
.B allow .B allow
<userlist> <sourcelist> <targetlist> <targetportlist> <operationlist> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
@@ -483,11 +523,12 @@ Use auth type 'cache' for cached authentication
<userlist> <sourcelist> <targetlist> <targetportlist> <operationlist> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
<weekdayslist> <timeperiodslist> <weekdayslist> <timeperiodslist>
.br .br
Access control entries. All lists are comma-separated, no spaces are Access control entries. All lists are comma-separated, no spaces are
allowed. Usernames are case sensitive (if used with authtype nbname allowed. Usernames are case sensitive (if used with authtype nbname
username must be in uppercase). Source and target lists may contain username must be in uppercase). Source and target lists may contain
IP addresses (W.X.Y.Z) or CIDRs (W.X.Y.Z/L). Since 0.6, targetlist may also IP addresses (W.X.Y.Z), ranges A.B.C.D - W.X.Y.Z (since 0.8) or CIDRs
contain host names, instead of addresses. It's possible to use wildmask in (W.X.Y.Z/L). Since 0.6, targetlist may also contain host names,
instead of addresses. It's possible to use wildmask in
the begginning and in the the end of hostname, e.g. *badsite.com or the begginning and in the the end of hostname, e.g. *badsite.com or
*badcontent*. Hostname is only checked if hostname presents in request. *badcontent*. Hostname is only checked if hostname presents in request.
Targetportlist may contain ports (X) or port ranges lists (X-Y). For any field Targetportlist may contain ports (X) or port ranges lists (X-Y). For any field
@@ -509,55 +550,51 @@ to appropriate interface only or to use ip filters.
Operation is one of: Operation is one of:
.br .br
CONNECT - establish outgoing TCP connection CONNECT - establish outgoing TCP connection
.br .br
BIND - bind TCP port for listening BIND - bind TCP port for listening
.br .br
UDPASSOC - make UDP association UDPASSOC - make UDP association
.br .br
ICMPASSOC - make ICMP association (for future use) ICMPASSOC - make ICMP association (for future use)
.br .br
HTTP_GET - HTTP GET request HTTP_GET - HTTP GET request
.br .br
HTTP_PUT - HTTP PUT request HTTP_PUT - HTTP PUT request
.br .br
HTTP_POST - HTTP POST request HTTP_POST - HTTP POST request
.br .br
HTTP_HEAD - HTTP HEAD request HTTP_HEAD - HTTP HEAD request
.br .br
HTTP_CONNECT - HTTP CONNECT request HTTP_CONNECT - HTTP CONNECT request
.br .br
HTTP_OTHER - over HTTP request HTTP_OTHER - over HTTP request
.br .br
HTTP - matches any HTTP request except HTTP_CONNECT HTTP - matches any HTTP request except HTTP_CONNECT
.br .br
HTTPS - same as HTTP_CONNECT HTTPS - same as HTTP_CONNECT
.br .br
FTP_GET - FTP get request FTP_GET - FTP get request
.br .br
FTP_PUT - FTP put request FTP_PUT - FTP put request
.br .br
FTP_LIST - FTP list request FTP_LIST - FTP list request
.br .br
FTP_DATA - FTP data connection. Note: FTP_DATA requires access to dynamic FTP_DATA - FTP data connection. Note: FTP_DATA requires access to dynamic
non-ptivileged (1024-65535) ports on remote side. non-ptivileged (1024-65535) ports on remote side.
.br .br
FTP - matches any FTP/FTP Data request FTP - matches any FTP/FTP Data request
.br .br
ADMIN - access to administration interface ADMIN - access to administration interface
.br .br
Weeksdays are week days numbers or periods, 0 or 7 means Sunday, 1 is Monday, 1-5 means Monday through Friday. Timeperiodlists is a list of time
Weeksdays are week days numbers or periods (0 or 7 means Sunday, 1 is Monday, 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.
1-5 means Monday through Friday). Timeperiodlists is a list of time
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.
.br .br
.B parent .B parent
<weight> <type> <ip> <port> <username> <password> <weight> <type> <ip> <port> <username> <password>
.br .br
this command must follow "allow" rule. It extends last allow rule to this command must follow "allow" rule. It extends last allow rule to
build proxy chain. Proxies may be grouped. Proxy inside the build proxy chain. Proxies may be grouped. Proxy inside the
group is selected randomly. If few groups are specified one proxy group is selected randomly. If few groups are specified one proxy
is randomly picked from each group and chain of proxies is created is randomly picked from each group and chain of proxies is created
@@ -592,38 +629,38 @@ with probability of 0.7) for outgoing web connections.
.br .br
type is one of: type is one of:
.br .br
tcp - simply redirect connection. TCP is always last in chain. tcp - simply redirect connection. TCP is always last in chain.
.br .br
http - redirect to HTTP proxy. HTTP is always last chain. http - redirect to HTTP proxy. HTTP is always last chain.
.br .br
pop3 - redirect to POP3 proxy (only local redirection is supported, can not be pop3 - redirect to POP3 proxy (only local redirection is supported, can not be
used for chaining) used for chaining)
.br .br
ftp - redirect to FTP proxy (only local redirection is supported, can not be ftp - redirect to FTP proxy (only local redirection is supported, can not be
used for chaining) used for chaining)
.br .br
connect - parent is HTTP CONNECT method proxy connect - parent is HTTP CONNECT method proxy
.br .br
connect+ - parent is HTTP CONNECT proxy with name resolution connect+ - parent is HTTP CONNECT proxy with name resolution
.br .br
socks4 - parent is SOCKSv4 proxy socks4 - parent is SOCKSv4 proxy
.br .br
socks4+ - parent is SOCKSv4 proxy with name resolution (SOCKSv4a) socks4+ - parent is SOCKSv4 proxy with name resolution (SOCKSv4a)
.br .br
socks5 - parent is SOCKSv5 proxy socks5 - parent is SOCKSv5 proxy
.br .br
socks5+ - parent is SOCKSv5 proxy with name resolution socks5+ - parent is SOCKSv5 proxy with name resolution
.br .br
socks4b - parent is SOCKS4b (broken SOCKSv4 implementation with shortened socks4b - parent is SOCKS4b (broken SOCKSv4 implementation with shortened
server reply. I never saw this kind ofservers byt they say there are). server reply. I never saw this kind ofservers byt they say there are).
Normally you should not use this option. Do not mess this option with Normally you should not use this option. Do not mess this option with
SOCKSv4a (socks4+). SOCKSv4a (socks4+).
.br .br
socks5b - parent is SOCKS5b (broken SOCKSv5 implementation with shortened socks5b - parent is SOCKS5b (broken SOCKSv5 implementation with shortened
server reply. I think you will never find it useful). Never use this option server reply. I think you will never find it useful). Never use this option
unless you know exactly you need it. unless you know exactly you need it.
.br .br
admin - redirect request to local 'admin' service (with -s parameter). admin - redirect request to local 'admin' service (with -s parameter).
.br .br
Use "+" proxy only with "fakeresolve" option Use "+" proxy only with "fakeresolve" option
.br .br
@@ -664,14 +701,14 @@ example:
.br .br
socks socks
.br .br
redirects all SOCKS requests with target port 80 to local HTTP proxy, redirects all SOCKS requests with target port 80 to local HTTP proxy,
local HTTP proxy parses requests and allows only GET and POST requests. local HTTP proxy parses requests and allows only GET and POST requests.
.br .br
parent 1000 http 1.2.3.4 0 parent 1000 http 1.2.3.4 0
.br .br
Changes external address for given connection to 1.2.3.4 Changes external address for given connection to 1.2.3.4
(an equivalent to -e1.2.3.4) (an equivalent to -e1.2.3.4)
.br
Optional username and password are used to authenticate on parent Optional username and password are used to authenticate on parent
proxy. Username of '*' means username must be supplied by user. proxy. Username of '*' means username must be supplied by user.
@@ -679,7 +716,8 @@ proxy. Username of '*' means username must be supplied by user.
.br .br
.B nolog .B nolog
<n> <n>
extends last allow or deny command to prevent logging, e.g. .br
extends last allow or deny command to prevent logging, e.g.
.br .br
allow * * 192.168.1.1 allow * * 192.168.1.1
.br .br
@@ -689,13 +727,14 @@ nolog
.br .br
.B weight .B weight
<n> <n>
extends last allow or deny command to set weight for this request
.br .br
allow * * 192.168.1.1 extends last allow or deny command to set weight for this request
.br .br
weight 100 allow * * 192.168.1.1
.br .br
Weight may be used for different purposes. weight 100
.br
Weight may be used for different purposes.
.br .br
.B bandlimin .B bandlimin
@@ -703,6 +742,7 @@ Weight may be used for different purposes.
.br .br
.B nobandlimin .B nobandlimin
<userlist> <sourcelist> <targetlist> <targetportlist> <operationlist> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
.br
.B bandlimout .B bandlimout
<rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist> <rate> <userlist> <sourcelist> <targetlist> <targetportlist> <operationlist>
.br .br
@@ -727,7 +767,7 @@ addresses) to 57600 bps you have to specify 4 rules like
.br .br
bandlimin 57600 * 192.168.10.19 bandlimin 57600 * 192.168.10.19
.br .br
and every of you clients will have 56K channel. if you specify and every of you clients will have 56K channel. If you specify
.br .br
bandlimin 57600 * 192.168.10.16/30 bandlimin 57600 * 192.168.10.16/30
.br .br
@@ -764,6 +804,8 @@ no traffic information on this counter is saved in file (that is
if proxy restarted all information is loosed) overwise it should be if proxy restarted all information is loosed) overwise it should be
unique sequential number. unique sequential number.
Type specifies a type of counter. Type is one of: Type specifies a type of counter. Type is one of:
.br
H - counter is resetted hourly
.br .br
D - counter is resetted daily D - counter is resetted daily
.br .br
@@ -776,7 +818,7 @@ Reporttype is one of D,W,M,H(hourly) and repotname specifies filename
template for reports. Report is text file with counter values in template for reports. Report is text file with counter values in
format: format:
.br .br
<COUNTERNUMBER> <TRAF*4GB> <TRAF> <COUNTERNUMBER> <TRAF>
.br .br
The rest of parameters is identical to bandlim/nobandlim. The rest of parameters is identical to bandlim/nobandlim.
@@ -784,28 +826,28 @@ format:
.B users .B users
username[:pwtype:password] ... username[:pwtype:password] ...
.br .br
pwtype is one of: pwtype is one of:
.br .br
none (empty) - use system authentication none (empty) - use system authentication
.br .br
CL - password is cleartext CL - password is cleartext
.br .br
CR - password is crypt-style password CR - password is crypt-style password
.br .br
NT - password is NT password (in hex) NT - password is NT password (in hex)
.br .br
example: example:
.br .br
users test1:CL:password1 "test2:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY49." users test1:CL:password1 "test2:CR:$1$lFDGlder$pLRb4cU2D7GAT58YQvY49."
.br .br
users test3:NT:BD7DFBF29A93F93C63CB84790DA00E63 users test3:NT:BD7DFBF29A93F93C63CB84790DA00E63
.br .br
(note: double quotes are requiered because password contains $ sign). Note: double quotes are requiered because password contains $ sign.
.br .br
.B flush .B flush
.br .br
empty active access list. Access list must be flushed avery time you creating empty active access list. Access list must be flushed avery time you creating
new access list for new service. For example: new access list for new service. For example:
.br .br
allow * allow *
@@ -818,35 +860,36 @@ new access list for new service. For example:
.br .br
socks socks
.br .br
sets different ACLs for sets different ACLs for
.B pop3p .B pop3p
and and
.B socks .B socks
.br .br
.B system .B system
<command>
.br .br
execute system command execute system command
.br .br
.B pidfile .B pidfile
<filename> <filename>
.br .br
write pid of current process to file. It can be used to manipulate write pid of current process to file. It can be used to manipulate
3proxy with signals under Unix. Currently next signals are available: 3proxy with signals under Unix. Currently next signals are available:
.br .br
.B monitor .B monitor
<filename> <filename>
.br .br
If file monitored changes in modification time or size, 3proxy reloads If file monitored changes in modification time or size, 3proxy reloads
configuration within one minute. Any number of files may be monitored. configuration within one minute. Any number of files may be monitored.
.br .br
.B setuid .B setuid
<uid> <uid>
.br .br
calls setuid(uid), uid must be numeric. Unix only. Warning: under some Linux calls setuid(uid), uid must be numeric. Unix only. Warning: under some Linux
kernels setuid() works onle for current thread. It makes it impossible to suid kernels setuid() works onle for current thread. It makes it impossible to suid
for all threads. for all threads.
@@ -854,35 +897,51 @@ for all threads.
.B setgid .B setgid
<gid> <gid>
.br .br
calls setgid(gid), gid must be numeric. Unix only. calls setgid(gid), gid must be numeric. Unix only.
.br .br
.B chroot .B chroot
<path> <path>
.br .br
calls chroot(path). Unix only. calls chroot(path). Unix only.
.br
.B stacksize
<value_to_add_to_default_stack_size>
.br
Change default size for threads stack. May be required in some situation,
e.g. with non-default plugins, on on some platforms (some FreeBSD version
may require adjusting stack size due to invalid defined value in system
header files, this value is also oftent reqruied to be changed for ODBC and
PAM support on Linux. If you experience 3proxy
crash on request processing, try to set some positive value. You may start with
stacksize 65536
and then find the minimal value for service to work. If you experience
memory shortage, you can try to experiment with negative values.
.SH PLUGINS .SH PLUGINS
.br .br
.B plugin .B plugin
<path_to_shared_library> <function_to_call> [<arg1> ...] <path_to_shared_library> <function_to_call> [<arg1> ...]
.br .br
Loads specified library and calls given export function with given arguments, Loads specified library and calls given export function with given arguments,
as as
.br .br
int functions_to_call(struct pluginlink * pl, int argc, char * argv[]); int functions_to_call(struct pluginlink * pl, int argc, char * argv[]);
.br .br
function_to_call must return 0 in case of success, value > 0 to indicate error. function_to_call must return 0 in case of success, value > 0 to indicate error.
.br .br
.B filtermaxsize .B filtermaxsize
<max_size_of_data_to_filter> <max_size_of_data_to_filter>
.br .br
If Content-length (or another data length) is greater than given value, no If Content-length (or another data length) is greater than given value, no
data filtering will be performed thorugh filtering plugins to avoid data data filtering will be performed thorugh filtering plugins to avoid data
corruption and/or Content-Length chaging. Default is 1MB (1048576). corruption and/or Content-Length chaging. Default is 1MB (1048576).
.SH BUGS
Report all bugs to
.BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8),
.br .br
@@ -890,7 +949,5 @@ http://3proxy.ru/
.SH TRIVIA .SH TRIVIA
3APA3A is pronounced as \`\`zaraza\'\'. 3APA3A is pronounced as \`\`zaraza\'\'.
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH ftppr "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH ftppr "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B ftppr .B ftppr
\- FTP proxy gateway service \- FTP proxy gateway service
@@ -51,6 +51,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH CLIENTS .SH CLIENTS
You can use any FTP client, regardless of FTP proxy support. For client with You can use any FTP client, regardless of FTP proxy support. For client with
FTP proxy support configure FTP proxy support configure
@@ -73,13 +77,11 @@ is user\'s login on this FTP server. Login itself may contain \'@\' sign.
Only cleartext authentication is currently supported. Only cleartext authentication is currently supported.
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), pop3p(8), socks(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), pop3p(8), socks(8), tcppm(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH icqpr "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH icqpr "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B icqpr .B icqpr
\- ICQ (AOL OSCAR) proxy \- ICQ (AOL OSCAR) proxy
@@ -45,6 +45,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH ARGUMENTS .SH ARGUMENTS
.TP .TP
.I local_port .I local_port
@@ -66,13 +70,11 @@ as a destination in client application. Connection is forwarded to
.IR remote_host : remote_port .IR remote_host : remote_port
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH pop3p "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH pop3p "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B pop3p .B pop3p
\- POP3 proxy gateway service \- POP3 proxy gateway service
@@ -51,6 +51,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH CLIENTS .SH CLIENTS
You can use any MUA (Mail User Agent) with POP3 support. Set client to use You can use any MUA (Mail User Agent) with POP3 support. Set client to use
.I internal_ip .I internal_ip
@@ -69,13 +73,11 @@ authentication (APOP, CRAM-MD5, etc) requires challenge from server before
we know which server to connect. we know which server to connect.
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH proxy "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH proxy "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B proxy .B proxy
\- HTTP proxy gateway service \- HTTP proxy gateway service
@@ -52,6 +52,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH CLIENTS .SH CLIENTS
You should use client with HTTP proxy support or configure router to redirect You should use client with HTTP proxy support or configure router to redirect
HTTP traffic to proxy (transparent proxy). Configure client to connect to HTTP traffic to proxy (transparent proxy). Configure client to connect to
@@ -64,13 +68,11 @@ limit clients, use
instead. instead.
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH smtpp "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH smtpp "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B smtpp .B smtpp
\- SMTP proxy gateway service \- SMTP proxy gateway service
@@ -51,6 +51,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH CLIENTS .SH CLIENTS
You can use any MUA (Mail User Agent) with SMTP authentication support. You can use any MUA (Mail User Agent) with SMTP authentication support.
Set client to use Set client to use
@@ -70,13 +74,11 @@ authentication (CRAM-MD5, SPA, etc) requires challenge from server before
we know which server to connect. we know which server to connect.
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH socks "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH socks "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B socks .B socks
\- SOCKS 4/4.5/5 gateway service \- SOCKS 4/4.5/5 gateway service
@@ -48,6 +48,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH CLIENTS .SH CLIENTS
You should use client with SOCKS support or use some socksification support You should use client with SOCKS support or use some socksification support
(for example (for example
@@ -65,13 +69,11 @@ sufficient privileges). If you need to control access use
instead. instead.
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), ftppr(8), pop3p(8), tcppm(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), pop3p(8), tcppm(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH tcppm "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH tcppm "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B tcppm .B tcppm
\- TCP port mapper \- TCP port mapper
@@ -40,6 +40,10 @@ is specified logging is to file. Under Unix, if
preceeds preceeds
.IR logfile , .IR logfile ,
syslog is used for logging. syslog is used for logging.
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH ARGUMENTS .SH ARGUMENTS
.TP .TP
.I local_port .I local_port
@@ -59,13 +63,11 @@ as a destination in client application. Connection is forwarded to
.IR remote_host : remote_port .IR remote_host : remote_port
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+8 -6
View File
@@ -1,4 +1,4 @@
.TH udppm "8" "July 2009" "3proxy 0.7" "Universal proxy server" .TH udppm "8" "January 2016" "3proxy 0.8" "Universal proxy server"
.SH NAME .SH NAME
.B udppm .B udppm
\- UDP port mapper \- UDP port mapper
@@ -46,6 +46,10 @@ Single packet. By default only one client can use udppm service, but
if -s is specified only one packet will be forwarded between client and server. if -s is specified only one packet will be forwarded between client and server.
It allows to share service between multiple clients for single packet services It allows to share service between multiple clients for single packet services
(for example name lookups). (for example name lookups).
.TP
.B -S
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
crashes.
.SH ARGUMENTS .SH ARGUMENTS
.TP .TP
.I local_port .I local_port
@@ -65,13 +69,11 @@ as a destination in client application. All datagrams are forwarded to
.IR remote_host : remote_port .IR remote_host : remote_port
.SH BUGS .SH BUGS
Report all bugs to Report all bugs to
.BR 3proxy@security.nnov.ru .BR 3proxy@3proxy.ru
.SH SEE ALSO .SH SEE ALSO
3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8), 3proxy(8), proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8), syslogd(8),
.br .br
http://3proxy.ru/ http://3proxy.ru/
.SH AUTHORS .SH AUTHORS
3proxy is designed by 3APA3A 3proxy is designed by Vladimir 3APA3A Dubrovin
.RI ( 3APA3A@security.nnov.ru ), .RI ( 3proxy@3proxy.ru )
Vladimir Dubrovin
.RI ( vlad@sandy.ru )
+256
View File
@@ -0,0 +1,256 @@
[--admin--]
HTTP/1.0 401 Authentication Required\n
WWW-Authenticate: Basic realm="proxy", encoding="utf-8"\n
Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>401 Authentication Required</title></head>\n
<body><h2>401 Authentication Required</h2>
<h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource<br><hr>
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
</h3></body></html>\n
[end]
HTTP/1.0 200 OK\n
Connection: close\n
Expires: Thu, 01 Dec 1994 16:00:00 GMT\n
Cache-Control: no-cache\n
Content-type: text/html; charset=utf-8\n
\n
<http><head><title>%s Страница конфигурации</title></head>\n
<table width='100%%' border='0'>\n
<tr><td width='150' valign='top'>\n
<h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h2>\n
<A HREF='/C'>Счетчики</A><br><br>\n
<A HREF='/R'>Перезагрузка конфигурации сервера</A><br><br>\n
<A HREF='/S'>Запущенные сервисы</A><br><br>\n
<A HREF='/F'>Настройка сервера</A>\n
</td><td>
<h2>%s %s Конфигурация</h2>
[end]
HTTP/1.0 200 OK\n
Connection: close\n
Cache-Control: no-cache\n
Content-type: text/xml; charset=utf-8 \n
\n
<?xml version="1.0"?>\n
<?xml-stylesheet href="/SX" type="text/css"?>\n
<services>\n
<description>Текущие запущенные сервисы и подключившиеся клиенты</description>\n
[end]
</services>\n
[end]
HTTP/1.0 200 OK\n
Connection: close\n
Cache-Control: no-cache\n
Content-type: text/css\n
\n
services {\n
display: block;\n
margin: 10px auto 10px auto;\n
width: 80%;\n
background: black;\n"
font-family: sans-serif;\n
font-size: small;\n
color: silver;\n
}\n
item {\n
display: block;\n
margin-bottom: 10px;\n
border: 2px solid #CCC;\n
padding: 10px;\n
spacing: 2px;\n
}\n
parameter {\n
display: block;\n
padding: 2px;\n
margin-top: 10px;\n
border: 1px solid grey;\n
background: #EEE;\n
color: black;\n
}\n
name {\n
display: inline;\n
float: left;\n
margin-right: 5px;\n
font-weight: bold;\n
}\n
type {\n
display: inline;\n
font-size: x-small;\n
margin-right: 5px;\n
color: #666;\n
white-space: nowrap;\n
font-style: italic;\n
}\n
description {\n
display: inline;\n
margin-right: 5px;\n
white-space: nowrap;\n
}\n
value {\n
display: block;\n
margin-right: 5px;\n
}\n
[end]
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n
<pre><font size='-2'><b>
(c)3APA3A, Владимир Дубровин и <A href='http://3proxy.ru/'>3proxy.ru</A>\n
</b></font>\n
</td></tr></table></body></html>
[end]
<h3>Счетчики</h3>\n
<table border = '1'>\n
<tr align='center'><td>Описание</td><td>Активный</td>
<td>Пользователи</td><td>Адрес источника</td><td>Адрес назначения</td>
<td>Порты</td>
<td>Лимит</td><td>Ед.</td><td>Значение</td>
<td>Дата сброса</td><td>Дата обновения</td><td>Номер</td></tr>\n
[end]
</table>\n
[end]
[/--admin--]
[--proxy--]
HTTP/1.0 400 Bad Request\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>400 Bad Request</title></head>\n
<body><h2>400 Bad Request</h2>
<h2>400 Ошибка: Неправильный запрос.</h2>
</body>
</html>\n
[end]
HTTP/1.0 502 Bad Gateway\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>502 Bad Gateway</title></head>\n
<body><h2>502 Bad Gateway</h2><h3>Host Not Found or connection failed <br><hr>
Ошибка: Удалённый сервер не найден или не удалось связаться с ним.</h3>
</body></html>\n
[end]
HTTP/1.0 503 Service Unavailable\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>503 Service Unavailable</title></head>\n
<body><h2>503 Service Unavailable</h2><h3>You have exceeded your traffic limit <br><hr>
Вы превысили свой лимит трафика.
</h3></body></html>\n
[end]
HTTP/1.0 503 Service Unavailable\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>503 Service Unavailable</title></head>\n
<body><h2>503 Service Unavailable</h2><h3>Recursion detected<br><hr>
Ошибка: Сервис не доступен, обнаружена рекурсия
</h3></body></html>\n
[end]
HTTP/1.0 501 Not Implemented\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>501 Not Implemented</title></head>\n
<body><h2>501 Not Implemented</h2><h3>Required action is not supported by proxy server <br><hr>
Ошибка: Действие не поддерживается в данном proxy сервере
</h3></body></html>\n
[end]
HTTP/1.0 502 Bad Gateway\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>502 Bad Gateway</title></head>\n
<body><h2>502 Bad Gateway</h2><h3>Failed to connect parent proxy <br><hr>
Ошибка: Невозможно соединиться c вышестоящим proxy сервером
</h3></body></html>\n",
[end]
HTTP/1.0 500 Internal Error\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>500 Internal Error</title></head>\n
<body><h2>500 Internal Error</h2><h3>Internal proxy error during processing your request <br><hr>
Ошибка: Возникла внутренняя ошибка proxy сервера при обработке вашего запроса
</h3></body></html>\n
[end]
HTTP/1.0 407 Proxy Authentication Required\n
Proxy-Authenticate: Basic realm="proxy", encoding="utf-8"\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>407 Proxy Authentication Required</title></head>\n
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource.<br><hr>
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
</h3></body></html>\n
[end]
HTTP/1.0 200 Connection established\n\n
[end]
HTTP/1.0 200 Connection established\n
Content-Type: text/html\n\n
[end]
HTTP/1.0 404 Not Found\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>404 Not Found</title></head>\n
<body><h2>404 Not Found</h2><h3>File not found <br><hr>
Файл не найден
</h3></body></html>\n
[end]
HTTP/1.0 403 Forbidden\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>403 Access Denied</title></head>\n
<body><h2>403 Access Denied</h2><h3>Access control list denies you to access this resource.<br><hr>
Доступ к данному ресурсу запрещен списком доступа на proxy сервер.
Если Вы считаете, что это ошибка обратитесь к администратору
</h3></body></html>\n
[end]
HTTP/1.0 407 Proxy Authentication Required\n
Proxy-Authenticate: NTLM\n
Proxy-Authenticate: basic realm="proxy", encoding="utf-8"\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>407 Proxy Authentication Required</title></head>\n
<body><h2>407 Proxy Authentication Required</h2><h3>Access to requested resource disallowed by administrator or you need valid username/password to use this resource.<br><hr>
Доступ запрещен администратором или Вы ввели неправильное имя/пароль.
</h3></body></html>\n
[end]
HTTP/1.0 407 Proxy Authentication Required\n
Proxy-Connection: keep-alive\n
Content-Length: 0\n
Proxy-Authenticate: NTLM
[end]
HTTP/1.0 403 Forbidden\n
Proxy-Connection: close\n
Content-type: text/html; charset=us-ascii\n
\n
<pre>
[end]
HTTP/1.0 503 Service Unavailable\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>503 Service Unavailable</title></head>\n
<body><h2>503 Service Unavailable</h2><h3>Your request violates configured policy<br><hr>
Запрос не сответствует сконфигурированной политике.
</h3></body></html>\n
[end]
HTTP/1.0 401 Authentication Required\n
WWW-Authenticate: basic realm="FTP Server", encoding="utf-8"\n
Proxy-Connection: close\n
Content-type: text/html; charset=utf-8\n
\n
<html><head><title>401 FTP Server requires authentication</title></head>\n
<body><h2>401 FTP Server requires authentication</h2><h3>This FTP server rejects anonymous access<br><hr>
Этот FTP сервер отвергает анонимный доступ.
</h3></body></html>\n
[end]
HTTP/1.1 100 Continue\n
\n
[end]
[/--proxy--]
+34 -1521
View File
File diff suppressed because it is too large. Load diff
+16 -35
View File
@@ -1,14 +1,8 @@
#$Id: Makefile.inc,v 1.19 2008/12/10 13:12:10 vlad Exp $
# #
# 3 proxy common Makefile # 3 proxy common Makefile
# #
all: pre $(VERFILE) $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)mycrypt$(EXESUFFICS) $(BUILDDIR)dighosts$(EXESUFFICS) $(BUILDDIR)pop3p$(EXESUFFICS) $(BUILDDIR)smtpp$(EXESUFFICS) $(BUILDDIR)ftppr$(EXESUFFICS) $(BUILDDIR)tcppm$(EXESUFFICS) $(BUILDDIR)icqpr$(EXESUFFICS) $(BUILDDIR)msnpr$(EXESUFFICS) $(BUILDDIR)udppm$(EXESUFFICS) $(BUILDDIR)socks$(EXESUFFICS) $(BUILDDIR)proxy$(EXESUFFICS) $(BUILDDIR)countersutil$(EXESUFFICS) allplugins all: $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)mycrypt$(EXESUFFICS) $(BUILDDIR)dighosts$(EXESUFFICS) $(BUILDDIR)pop3p$(EXESUFFICS) $(BUILDDIR)smtpp$(EXESUFFICS) $(BUILDDIR)ftppr$(EXESUFFICS) $(BUILDDIR)tcppm$(EXESUFFICS) $(BUILDDIR)icqpr$(EXESUFFICS) $(BUILDDIR)udppm$(EXESUFFICS) $(BUILDDIR)socks$(EXESUFFICS) $(BUILDDIR)proxy$(EXESUFFICS) allplugins
pre:
-cd .. && $(TYPECOMMAND) copying
$(PREMAKE)
sockmap$(OBJSUFFICS): sockmap.c proxy.h structures.h sockmap$(OBJSUFFICS): sockmap.c proxy.h structures.h
@@ -53,9 +47,6 @@ tcppm$(OBJSUFFICS): tcppm.c proxy.h structures.h proxymain.c
icqpr$(OBJSUFFICS): icqpr.c proxy.h structures.h proxymain.c icqpr$(OBJSUFFICS): icqpr.c proxy.h structures.h proxymain.c
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP icqpr.c $(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP icqpr.c
msnpr$(OBJSUFFICS): msnpr.c proxy.h structures.h proxymain.c
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP msnpr.c
socks$(OBJSUFFICS): socks.c proxy.h structures.h proxymain.c socks$(OBJSUFFICS): socks.c proxy.h structures.h proxymain.c
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP socks.c $(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP socks.c
@@ -66,31 +57,28 @@ udppm$(OBJSUFFICS): udppm.c proxy.h structures.h proxymain.c
$(CC) $(CFLAGS) 3proxy.c $(CC) $(CFLAGS) 3proxy.c
$(BUILDDIR)proxy$(EXESUFFICS): sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)proxy$(EXESUFFICS): sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)proxy$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
$(BUILDDIR)pop3p$(EXESUFFICS): sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)pop3p$(EXESUFFICS): sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)pop3p$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)pop3p$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
$(BUILDDIR)smtpp$(EXESUFFICS): sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)smtpp$(EXESUFFICS): sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)smtpp$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) base64$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)smtpp$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) base64$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
$(BUILDDIR)ftppr$(EXESUFFICS): sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) ftp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)ftppr$(EXESUFFICS): sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) ftp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)ftppr$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)ftppr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
$(BUILDDIR)socks$(EXESUFFICS): sockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(BUILDDIR)socks$(EXESUFFICS): sockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)socks$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)socks$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
$(BUILDDIR)tcppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(BUILDDIR)tcppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)tcppm$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)tcppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
$(BUILDDIR)icqpr$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) icqpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(BUILDDIR)icqpr$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) icqpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)icqpr$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) icqpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)icqpr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) icqpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
$(BUILDDIR)msnpr$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) msnpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)msnpr$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) msnpr$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
$(BUILDDIR)udppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(BUILDDIR)udppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)udppm$(EXESUFFICS) $(LDFLAGS) $(VERFILE) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)udppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
mainfunc$(OBJSUFFICS): proxy.h structures.h proxymain.c mainfunc$(OBJSUFFICS): proxy.h structures.h proxymain.c
$(CC) $(COUT)mainfunc$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)MODULEMAINFUNC=mainfunc proxymain.c $(CC) $(COUT)mainfunc$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)MODULEMAINFUNC=mainfunc proxymain.c
@@ -115,9 +103,6 @@ srvtcppm$(OBJSUFFICS): tcppm.c proxy.h structures.h
srvicqpr$(OBJSUFFICS): icqpr.c proxy.h structures.h srvicqpr$(OBJSUFFICS): icqpr.c proxy.h structures.h
$(CC) $(COUT)srvicqpr$(OBJSUFFICS) $(CFLAGS) icqpr.c $(CC) $(COUT)srvicqpr$(OBJSUFFICS) $(CFLAGS) icqpr.c
srvmsnpr$(OBJSUFFICS): msnpr.c proxy.h structures.h
$(CC) $(COUT)srvmsnpr$(OBJSUFFICS) $(CFLAGS) msnpr.c
srvsocks$(OBJSUFFICS): socks.c proxy.h structures.h srvsocks$(OBJSUFFICS): socks.c proxy.h structures.h
$(CC) $(COUT)srvsocks$(OBJSUFFICS) $(CFLAGS) socks.c $(CC) $(COUT)srvsocks$(OBJSUFFICS) $(CFLAGS) socks.c
@@ -133,6 +118,9 @@ srvdnspr$(OBJSUFFICS): dnspr.c proxy.h structures.h
auth$(OBJSUFFICS): auth.c proxy.h structures.h auth$(OBJSUFFICS): auth.c proxy.h structures.h
$(CC) $(COUT)auth$(OBJSUFFICS) $(CFLAGS) auth.c $(CC) $(COUT)auth$(OBJSUFFICS) $(CFLAGS) auth.c
conf$(OBJSUFFICS): conf.c proxy.h structures.h
$(CC) $(COUT)conf$(OBJSUFFICS) $(CFLAGS) conf.c
datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h
$(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c $(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c
@@ -143,20 +131,13 @@ dighosts$(OBJSUFFICS): dighosts.c
$(CC) $(COUT)dighosts$(OBJSUFFICS) $(CFLAGS) dighosts.c $(CC) $(COUT)dighosts$(OBJSUFFICS) $(CFLAGS) dighosts.c
$(BUILDDIR)dighosts$(EXESUFFICS): dighosts$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)dighosts$(EXESUFFICS): dighosts$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)dighosts$(EXESUFFICS) $(LDFLAGS) $(VERFILE) dighosts$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)dighosts$(EXESUFFICS) $(LDFLAGS) dighosts$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
countersutil$(OBJSUFFICS): countersutil.c
$(CC) $(COUT)countersutil$(OBJSUFFICS) $(CFLAGS) countersutil.c
$(BUILDDIR)countersutil$(EXESUFFICS): countersutil$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)countersutil$(EXESUFFICS) $(LDFLAGS) $(VERFILE) countersutil$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
mycryptmain$(OBJSUFFICS): mycrypt.c mycryptmain$(OBJSUFFICS): mycrypt.c
$(CC) $(COUT)mycryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN mycrypt.c $(CC) $(COUT)mycryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN mycrypt.c
$(BUILDDIR)mycrypt$(EXESUFFICS): md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycryptmain$(OBJSUFFICS) base64$(OBJSUFFICS) $(BUILDDIR)mycrypt$(EXESUFFICS): md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycryptmain$(OBJSUFFICS) base64$(OBJSUFFICS)
$(LN) $(LNOUT)$(BUILDDIR)mycrypt$(EXESUFFICS) $(VERFILE) $(LDFLAGS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) base64$(OBJSUFFICS) mycryptmain$(OBJSUFFICS) $(LN) $(LNOUT)$(BUILDDIR)mycrypt$(EXESUFFICS) $(LDFLAGS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) base64$(OBJSUFFICS) mycryptmain$(OBJSUFFICS)
md4$(OBJSUFFICS): libs/md4.h libs/md4.c md4$(OBJSUFFICS): libs/md4.h libs/md4.c
@@ -174,8 +155,8 @@ ntlm$(OBJSUFFICS): ntlm.c
stringtable$(OBJSUFFICS): stringtable.c stringtable$(OBJSUFFICS): stringtable.c
$(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c $(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvicqpr$(OBJSUFFICS) srvmsnpr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) datatypes$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycrypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvicqpr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) mycrypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS)
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvicqpr$(OBJSUFFICS) srvmsnpr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) mycrypt$(OBJSUFFICS) md5$(OBJSUFFICS) md4$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(LIBS) $(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvicqpr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) myalloc$(OBJSUFFICS) common$(OBJSUFFICS) mycrypt$(OBJSUFFICS) md5$(OBJSUFFICS) md4$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) smbdes$(OBJSUFFICS) ntlm$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
clean: clean:
@$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES) @$(REMOVECOMMAND) *$(OBJSUFFICS) $(COMPFILES)
+330 -286
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -3,7 +3,6 @@
* *
* please read License Agreement * please read License Agreement
* *
* $Id: base64.c,v 1.6 2008/01/08 21:46:36 vlad Exp $
*/ */
#include <string.h> #include <string.h>
+252 -89
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: common.c,v 1.94 2014-04-07 21:24:45 vlad Exp $
*/ */
@@ -18,17 +17,36 @@ int randomizer = 1;
#ifndef _WIN32 #ifndef _WIN32
pthread_attr_t pa; pthread_attr_t pa;
void daemonize(void){
if(fork() > 0) {
usleep(SLEEPTIME);
_exit(0);
}
setsid();
}
#endif #endif
unsigned char **stringtable = NULL; unsigned char **stringtable = NULL;
int myinet_ntoa(struct in_addr in, char * buf){ int myinet_ntop(int af, void *src, char *dst, socklen_t size){
unsigned u = ntohl(in.s_addr); #ifndef NOIPV6
return sprintf(buf, "%u.%u.%u.%u", if(af != AF_INET6){
((u&0xFF000000)>>24), #endif
((u&0x00FF0000)>>16), unsigned u = ntohl(((struct in_addr *)src)->s_addr);
((u&0x0000FF00)>>8), return sprintf(dst, "%u.%u.%u.%u",
((u&0x000000FF))); ((u&0xFF000000)>>24),
((u&0x00FF0000)>>16),
((u&0x0000FF00)>>8),
((u&0x000000FF)));
#ifndef NOIPV6
}
*dst = 0;
inet_ntop(af, src, dst, size);
return (int)strlen(dst);
#endif
} }
char *rotations[] = { char *rotations[] = {
@@ -50,14 +68,22 @@ struct extparam conf = {
NULL, NULL, NULL, NULL,
NULL, NULL,
NULL, NULL,
0, -1, 0, 0, 0, 0, 0, 500, 0, 0, 0, #ifdef __FreeBSD__
8192,
#else
0,
#endif
0, -1, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0,
6, 600, 6, 600,
1048576, 1048576,
NULL, NULL, NULL, NULL,
NONE, NONE, NONE, NONE,
NULL, NULL,
INADDR_ANY, INADDR_ANY, #ifndef NOIPV6
0, 0, {AF_INET},{AF_INET6},{AF_INET},
#else
{AF_INET},{AF_INET},
#endif
NULL, NULL,
NULL, NULL,
doconnect, doconnect,
@@ -73,9 +99,13 @@ struct extparam conf = {
NULL, NULL,
(time_t)0, (time_t)0, (time_t)0, (time_t)0,
0,0, 0,0,
'@' '@',
}; };
int numservers=0;
char* NULLADDR="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
int myrand(void * entropy, int len){ int myrand(void * entropy, int len){
int i; int i;
unsigned short init; unsigned short init;
@@ -142,10 +172,10 @@ struct sockfuncs so = {
#else #else
mypoll, mypoll,
#endif #endif
send, (void *)send,
sendto, (void *)sendto,
recv, (void *)recv,
recvfrom, (void *)recvfrom,
shutdown, shutdown,
#ifdef _WIN32 #ifdef _WIN32
closesocket closesocket
@@ -201,31 +231,57 @@ int ceparseargs(const char *str){
#endif #endif
int parsehostname(char *hostname, struct clientparam *param, unsigned short port){ int parsehost(int family, unsigned char *host, struct sockaddr *sa){
char *sp; char *sp=NULL,*se=NULL;
unsigned short port=0;
int ret = 0;
if(!hostname || !*hostname)return 1; if(!host) return 2;
if ( (sp = strchr(hostname, ':')) ) *sp = 0; if(*host == '[') se=strchr((char *)host, ']');
if(hostname != param->hostname){ if ( (sp = strchr(se?se:(char *)host, ':')) && !strchr(sp+1, ':')) *sp = 0;
if(param->hostname) myfree(param->hostname); if(se){
param->hostname = (unsigned char *)mystrdup(hostname); *se = 0;
} }
if(sp){ if(sp){
port = atoi(sp+1); port = atoi(sp+1);
*sp = ':';
} }
param->req.sin_port=htons(port); ret = !getip46(family, host + (se!=0), (struct sockaddr *)sa);
param->req.sin_addr.s_addr = getip(param->hostname); if(se) *se = ']';
param->sins.sin_addr.s_addr = 0; if(sp) *sp = ':';
param->sins.sin_port = 0; if(port)*SAPORT(sa) = htons(port);
return 0; return ret;
}
int parsehostname(char *hostname, struct clientparam *param, unsigned short port){
char *sp=NULL,*se=NULL;
int ret = 0;
if(!hostname || !*hostname)return 2;
if(*hostname == '[') se=strchr(hostname, ']');
if ( (sp = strchr(se?se:hostname, ':')) && !strchr(sp+1, ':')) *sp = 0;
if(se){
*se = 0;
}
if(hostname != (char *)param->hostname){
if(param->hostname) myfree(param->hostname);
param->hostname = (unsigned char *)mystrdup(hostname + (se!=0));
}
if(sp){
port = atoi(sp+1);
}
ret = !getip46(param->srv->family, param->hostname, (struct sockaddr *)&param->req);
if(se) *se = ']';
if(sp) *sp = ':';
*SAPORT(&param->req) = htons(port);
memset(&param->sinsr, 0, sizeof(param->sinsr));
return ret;
} }
int parseusername(char *username, struct clientparam *param, int extpasswd){ int parseusername(char *username, struct clientparam *param, int extpasswd){
char *sb = NULL, *se = NULL, *sp = NULL; char *sb = NULL, *se = NULL, *sp = NULL;
if(!username || !*username) return 1; if(!username || !*username) return 1;
if(!param->srv->nouser && (sb = strchr(username, ':')) && (se = strchr(sb + 1, ':')) && (!extpasswd || (sp = strchr(se + 1, ':')))){ if(param->srv->needuser && (sb = strchr(username, ':')) && (se = strchr(sb + 1, ':')) && (!extpasswd || (sp = strchr(se + 1, ':')))){
*sb = 0; *sb = 0;
*se = 0; *se = 0;
if(sp) *sp = 0; if(sp) *sp = 0;
@@ -260,6 +316,7 @@ int parseconnusername(char *username, struct clientparam *param, int extpasswd,
if(!username || !*username) return 1; if(!username || !*username) return 1;
if ((sb=strchr(username, conf.delimchar)) == NULL){ if ((sb=strchr(username, conf.delimchar)) == NULL){
if(!param->hostname && param->remsock == INVALID_SOCKET) return 2; if(!param->hostname && param->remsock == INVALID_SOCKET) return 2;
if(param->hostname)parsehostname((char *)param->hostname, param, port);
return parseusername(username, param, extpasswd); return parseusername(username, param, extpasswd);
} }
while ((se=strchr(sb+1, conf.delimchar)))sb=se; while ((se=strchr(sb+1, conf.delimchar)))sb=se;
@@ -287,7 +344,7 @@ void clearstat(struct clientparam * param) {
param->time_start = (time_t)tv.tv_sec; param->time_start = (time_t)tv.tv_sec;
param->msec_start = (tv.tv_usec / 1000); param->msec_start = (tv.tv_usec / 1000);
#endif #endif
param->statscli = param->statssrv = param->nreads = param->nwrites = param->statscli64 = param->statssrv64 = param->nreads = param->nwrites =
param->nconnects = 0; param->nconnects = 0;
} }
@@ -306,7 +363,6 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
long timezone; long timezone;
unsigned delay; unsigned delay;
struct in_addr tmpia;
@@ -378,10 +434,10 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
i+=10; i+=10;
break; break;
case 'b': case 'b':
i+=sprintf((char *)buf+i, "%u", delay?(unsigned)(param->statscli * 1000./delay):0); i+=sprintf((char *)buf+i, "%u", delay?(unsigned)(param->statscli64 * 1000./delay):0);
break; break;
case 'B': case 'B':
i+=sprintf((char *)buf+i, "%u", delay?(unsigned)(param->statssrv * 1000./delay):0); i+=sprintf((char *)buf+i, "%u", delay?(unsigned)(param->statssrv64 * 1000./delay):0);
break; break;
case 'D': case 'D':
i+=sprintf((char *)buf+i, "%u", delay); i+=sprintf((char *)buf+i, "%u", delay);
@@ -412,7 +468,7 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
break; break;
case 'n': case 'n':
len = param->hostname? (int)strlen((char *)param->hostname) : 0; len = param->hostname? (int)strlen((char *)param->hostname) : 0;
if (len > 0) for(len = 0; param->hostname[len] && i < 4000; len++, i++){ if (len > 0 && !strchr((char *)param->hostname, ':')) for(len = 0; param->hostname[len] && i < 4000; len++, i++){
buf[i] = param->hostname[len]; buf[i] = param->hostname[len];
if(param->srv->nonprintable && (buf[i] < 0x20 || strchr((char *)param->srv->nonprintable, buf[i]))) buf[i] = param->srv->replace; if(param->srv->nonprintable && (buf[i] < 0x20 || strchr((char *)param->srv->nonprintable, buf[i]))) buf[i] = param->srv->replace;
if(doublec && strchr((char *)doublec, buf[i])) { if(doublec && strchr((char *)doublec, buf[i])) {
@@ -420,11 +476,16 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
i++; i++;
} }
} }
else i += myinet_ntoa(param->sins.sin_addr, (char *)buf + i); else {
buf[i++] = '[';
i += myinet_ntop(*SAFAMILY(&param->req), SAADDR(&param->req), (char *)buf + i, 64);
buf[i++] = ']';
buf[i++] = 0;
}
break; break;
case 'N': case 'N':
if(param->service >=0 && param->service < 15) { if(param->service < 15) {
len = (conf.stringtable)? (int)strlen((char *)conf.stringtable[SERVICES + param->service]) : 0; len = (conf.stringtable)? (int)strlen((char *)conf.stringtable[SERVICES + param->service]) : 0;
if(len > 20) len = 20; if(len > 20) len = 20;
memcpy(buf+i, (len)?conf.stringtable[SERVICES + param->service]:(unsigned char*)"-", (len)?len:1); memcpy(buf+i, (len)?conf.stringtable[SERVICES + param->service]:(unsigned char*)"-", (len)?len:1);
@@ -449,40 +510,42 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
} }
break; break;
case 'e': case 'e':
tmpia.s_addr = param->extip; i += myinet_ntop(*SAFAMILY(&param->sinsl), SAADDR(&param->sinsl), (char *)buf + i, 64);
i += myinet_ntoa(tmpia, (char *)buf + i); break;
case 'i':
i += myinet_ntop(*SAFAMILY(&param->sincl), SAADDR(&param->sincl), (char *)buf + i, 64);
break; break;
case 'C': case 'C':
i += myinet_ntoa(param->sinc.sin_addr, (char *)buf + i); i += myinet_ntop(*SAFAMILY(&param->sincr), SAADDR(&param->sincr), (char *)buf + i, 64);
break; break;
case 'R': case 'R':
i += myinet_ntoa(param->sins.sin_addr, (char *)buf + i); i += myinet_ntop(*SAFAMILY(&param->sinsr), SAADDR(&param->sinsr), (char *)buf + i, 64);
break; break;
case 'Q': case 'Q':
i += myinet_ntoa(param->req.sin_addr, (char *)buf + i); i += myinet_ntop(*SAFAMILY(&param->req), SAADDR(&param->req), (char *)buf + i, 64);
break; break;
case 'p': case 'p':
sprintf((char *)buf+i, "%hu", ntohs(param->srv->intport)); sprintf((char *)buf+i, "%hu", ntohs(*SAPORT(&param->srv->intsa)));
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'c': case 'c':
sprintf((char *)buf+i, "%hu", ntohs(param->sinc.sin_port)); sprintf((char *)buf+i, "%hu", ntohs(*SAPORT(&param->sincr)));
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'r': case 'r':
sprintf((char *)buf+i, "%hu", ntohs(param->sins.sin_port)); sprintf((char *)buf+i, "%hu", ntohs(*SAPORT(&param->sinsr)));
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'q': case 'q':
sprintf((char *)buf+i, "%hu", ntohs(param->req.sin_port)); sprintf((char *)buf+i, "%hu", ntohs(*SAPORT(&param->req)));
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'I': case 'I':
sprintf((char *)buf+i, "%lu", param->statssrv); sprintf((char *)buf+i, "%"PRINTF_INT64_MODIFIER"u", param->statssrv64);
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'O': case 'O':
sprintf((char *)buf+i, "%lu", param->statscli); sprintf((char *)buf+i, "%"PRINTF_INT64_MODIFIER"u", param->statscli64);
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'h': case 'h':
@@ -560,77 +623,99 @@ void lognone(struct clientparam * param, const unsigned char *s) {
if(param->trafcountfunc)(*param->trafcountfunc)(param); if(param->trafcountfunc)(*param->trafcountfunc)(param);
clearstat(param); clearstat(param);
} }
unsigned char tmpbuf[8192];
void logstdout(struct clientparam * param, const unsigned char *s) { void logstdout(struct clientparam * param, const unsigned char *s) {
unsigned char buf[4096];
FILE *log; FILE *log;
pthread_mutex_lock(&log_mutex);
log = param->srv->stdlog?param->srv->stdlog:conf.stdlog?conf.stdlog:stdout; log = param->srv->stdlog?param->srv->stdlog:conf.stdlog?conf.stdlog:stdout;
dobuf(param, buf, s, NULL); dobuf(param, tmpbuf, s, NULL);
if(!param->nolog)if(fprintf(log, "%s\n", buf) < 0) { if(!param->nolog)if(fprintf(log, "%s\n", tmpbuf) < 0) {
perror("printf()"); perror("printf()");
}; };
if(log != conf.stdlog)fflush(log); if(log != conf.stdlog)fflush(log);
pthread_mutex_unlock(&log_mutex);
} }
#ifndef _WIN32 #ifndef _WIN32
void logsyslog(struct clientparam * param, const unsigned char *s) { void logsyslog(struct clientparam * param, const unsigned char *s) {
unsigned char buf[4096];
dobuf(param, buf, s, NULL); pthread_mutex_lock(&log_mutex);
if(!param->nolog)syslog(LOG_INFO, "%s", buf); dobuf(param, tmpbuf, s, NULL);
if(!param->nolog)syslog(LOG_INFO, "%s", tmpbuf);
pthread_mutex_unlock(&log_mutex);
} }
#endif #endif
int doconnect(struct clientparam * param){ int doconnect(struct clientparam * param){
SASIZETYPE size = sizeof(param->sins); SASIZETYPE size;
struct sockaddr_in bindsa;
if (*SAFAMILY(&param->sincr) == *SAFAMILY(&param->req) && !memcmp(SAADDR(&param->sincr), SAADDR(&param->req), SAADDRLEN(&param->req)) &&
*SAPORT(&param->sincr) == *SAPORT(&param->req)) return 519;
if (param->operation == ADMIN || param->operation == DNSRESOLVE || param->operation == BIND || param->operation == UDPASSOC) if (param->operation == ADMIN || param->operation == DNSRESOLVE || param->operation == BIND || param->operation == UDPASSOC)
return 0; return 0;
if (param->remsock != INVALID_SOCKET){ if (param->remsock != INVALID_SOCKET){
if(so._getpeername(param->remsock, (struct sockaddr *)&param->sins, &size)==-1) {return (15);} size = sizeof(param->sinsr);
if(so._getpeername(param->remsock, (struct sockaddr *)&param->sinsr, &size)==-1) {return (15);}
} }
else { else {
struct linger lg; struct linger lg = {1,conf.timeouts[SINGLEBYTE_S]};
if(!param->sins.sin_addr.s_addr) if(SAISNULL(&param->sinsr)){
if(!(param->sins.sin_addr.s_addr = param->req.sin_addr.s_addr)) return 100; if(SAISNULL(&param->req)) {
if(!param->sins.sin_port)param->sins.sin_port = param->req.sin_port; return 100;
if ((param->remsock=so._socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {return (11);}
so._setsockopt(param->remsock, SOL_SOCKET, SO_LINGER, (unsigned char *)&lg, sizeof(lg));
memset(&bindsa, 0, sizeof(bindsa));
bindsa.sin_family = AF_INET;
bindsa.sin_port = param->extport;
bindsa.sin_addr.s_addr = param->extip;
if (param->srv->targetport && !bindsa.sin_port && ntohs(param->sinc.sin_port) > 1023) bindsa.sin_port = param->sinc.sin_port;
if(so._bind(param->remsock, (struct sockaddr*)&bindsa, sizeof(bindsa))==-1) {
memset(&bindsa, 0, sizeof(bindsa));
bindsa.sin_family = AF_INET;
bindsa.sin_addr.s_addr = param->extip;
bindsa.sin_port = 0;
if(so._bind(param->remsock, (struct sockaddr*)&bindsa, sizeof(bindsa))==-1) {
return 12;
} }
*SAFAMILY(&param->sinsr) = *SAFAMILY(&param->req);
memcpy(SAADDR(&param->sinsr), SAADDR(&param->req), SAADDRLEN(&param->req));
}
if(!*SAPORT(&param->sinsr))*SAPORT(&param->sinsr) = *SAPORT(&param->req);
if ((param->remsock=so._socket(SASOCK(&param->sinsr), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {return (11);}
so._setsockopt(param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
#ifdef REUSE
{
int opt;
#ifdef SO_REUSEADDR
opt = 1;
so._setsockopt(param->remsock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int));
#endif
#ifdef SO_REUSEPORT
opt = 1;
so._setsockopt(param->remsock, SOL_SOCKET, SO_REUSEPORT, (unsigned char *)&opt, sizeof(int));
#endif
}
#endif
if(SAISNULL(&param->sinsl)){
#ifndef NOIPV6
if(*SAFAMILY(&param->sinsr) == AF_INET6) param->sinsl = param->srv->extsa6;
else
#endif
param->sinsl = param->srv->extsa;
}
*SAPORT(&param->sinsl) = 0;
if(so._bind(param->remsock, (struct sockaddr*)&param->sinsl, SASIZE(&param->sinsl))==-1) {
return 12;
} }
param->sins.sin_family = AF_INET;
if(param->operation >= 256 || (param->operation & CONNECT)){ if(param->operation >= 256 || (param->operation & CONNECT)){
#ifdef _WIN32 #ifdef _WIN32
unsigned long ul = 1; unsigned long ul = 1;
#endif #endif
if(so._connect(param->remsock,(struct sockaddr *)&param->sins,sizeof(param->sins))) {return (13);} if(so._connect(param->remsock,(struct sockaddr *)&param->sinsr,SASIZE(&param->sinsr))) {
return (13);
}
param->nconnects++; param->nconnects++;
#ifdef _WIN32 #ifdef _WIN32
ioctlsocket(param->remsock, FIONBIO, &ul); ioctlsocket(param->remsock, FIONBIO, &ul);
#else #else
fcntl(param->remsock,F_SETFL,O_NONBLOCK); fcntl(param->remsock,F_SETFL,O_NONBLOCK);
#endif #endif
if(so._getsockname(param->remsock, (struct sockaddr *)&bindsa, &size)==-1) {return (15);}
param->extip = bindsa.sin_addr.s_addr;
}
else {
if(so._getsockname(param->remsock, (struct sockaddr *)&param->sins, &size)==-1) {return (15);}
} }
size = sizeof(param->sinsl);
if(so._getsockname(param->remsock, (struct sockaddr *)&param->sinsl, &size)==-1) {return (15);}
} }
return 0; return 0;
} }
@@ -667,11 +752,13 @@ struct hostent * my_gethostbyname(char *name, char *buf, struct hostent *hp){
} }
#endif #endif
#ifdef NOIPV6
unsigned long getip(unsigned char *name){ unsigned long getip(unsigned char *name){
unsigned long retval; unsigned long retval;
int i; int i;
int ndots = 0; int ndots = 0;
struct hostent *hp=NULL; struct hostent *hp=NULL;
RESOLVFUNC tmpresolv;
#ifdef GETHOSTBYNAME_R #ifdef GETHOSTBYNAME_R
struct hostent he; struct hostent he;
@@ -688,15 +775,14 @@ unsigned long getip(unsigned char *name){
if(name[i] <'0' || name[i] >'9') break; if(name[i] <'0' || name[i] >'9') break;
} }
if(!name[i] && ndots == 3){ if(!name[i] && ndots == 3){
unsigned long ip; if(scanaddr(name, &retval, NULL) == 4){
if(scanaddr(name, &ip, NULL) == 4){ return retval;
return ip;
} }
} }
if(resolvfunc){ if((tmpresolv=resolvfunc)){
if((retval = (*resolvfunc)(name))) return retval; if((*tmpresolv)(AF_INET, name, (unsigned char *)&retval)) return retval;
if(conf.demanddialprog) system(conf.demanddialprog); if(conf.demanddialprog) system(conf.demanddialprog);
return (*resolvfunc)(name); return (*tmpresolv)(AF_INET, name, (unsigned char *)&retval)?retval:0;
} }
#if !defined(_WIN32) && !defined(GETHOSTBYNAME_R) #if !defined(_WIN32) && !defined(GETHOSTBYNAME_R)
if(!ghbn_init){ if(!ghbn_init){
@@ -719,3 +805,80 @@ unsigned long getip(unsigned char *name){
#endif #endif
return retval; return retval;
} }
#endif
unsigned long getip46(int family, unsigned char *name, struct sockaddr *sa){
#ifndef NOIPV6
int ndots=0, ncols=0, nhex=0;
struct addrinfo *ai, hint;
int i;
RESOLVFUNC tmpresolv;
if(!sa) return 0;
if(!family) {
family = 4;
#else
((struct sockaddr_in *)sa)->sin_family = AF_INET;
return (((struct sockaddr_in *)sa)->sin_addr.s_addr = getip(name))? AF_INET:0;
#endif
#ifndef NOIPV6
}
for(i=0; name[i]; i++){
if(name[i] == '.'){
if(++ndots > 3) {
break;
}
}
else if(name[i] == ':'){
if(++ncols > 7) {
break;
}
}
else if(name[i] == '%' || (name[i] >= 'a' && name[i] <= 'f') || (name[i] >= 'A' && name[i] <= 'F')){
nhex++;
}
else if(name[i] <'0' || name[i] >'9') {
break;
}
}
if(!name[i]){
if(ndots == 3 && ncols == 0 && nhex == 0){
*SAFAMILY(sa)=(family == 6)?AF_INET6 : AF_INET;
return inet_pton(*SAFAMILY(sa), (char *)name, SAADDR(sa))? *SAFAMILY(sa) : 0;
}
if(ncols >= 2) {
*SAFAMILY(sa)=AF_INET6;
return inet_pton(AF_INET6, (char *)name, SAADDR(sa))?(family==4? 0:AF_INET6) : 0;
}
}
if((tmpresolv = resolvfunc)){
int f = (family == 6 || family == 64)?AF_INET6:AF_INET;
*SAFAMILY(sa) = f;
if(tmpresolv(f, name, SAADDR(sa))) return f;
if(family == 4 || family == 6) return 0;
f = (family == 46)? AF_INET6 : AF_INET;
*SAFAMILY(sa) = f;
if(tmpresolv(f, name, SAADDR(sa))) return f;
return 0;
}
memset(&hint, 0, sizeof(hint));
hint.ai_family = (family == 6 || family == 64)?AF_INET6:AF_INET;
if (getaddrinfo((char *)name, NULL, &hint, &ai)) {
if(family == 64 || family == 46){
hint.ai_family = (family == 64)?AF_INET:AF_INET6;
if (getaddrinfo((char *)name, NULL, &hint, &ai)) return 0;
}
else return 0;
}
if(ai){
if(ai->ai_addr->sa_family == AF_INET || ai->ai_addr->sa_family == AF_INET6){
*SAFAMILY(sa)=ai->ai_addr->sa_family;
memcpy(SAADDR(sa), SAADDR(ai->ai_addr), SAADDRLEN(ai->ai_addr));
freeaddrinfo(ai);
return *SAFAMILY(sa);
}
freeaddrinfo(ai);
}
return 0;
#endif
}
+1711
View File
File diff suppressed because it is too large. Load diff
-145
View File
@@ -1,145 +0,0 @@
/*
3APA3A simpliest proxy server
(c) 2002-2008 by ZARAZA <3APA3A@security.nnov.ru>
please read License Agreement
$Id: common.c,v 1.81 2007/12/18 09:26:44 vlad Exp $
*/
#include "proxy.h"
struct counter_header {
unsigned char sig[4];
time_t updated;
} cheader = {"3CF", (time_t)0};
struct counter_record {
unsigned long traf;
unsigned long trafgb;
time_t cleared;
time_t updated;
} crecord;
#ifdef _WIN32
struct counter_header_old {
unsigned char sig[4];
DWORD updated;
} cheader_old = {"3CF", (time_t)0};
struct counter_record_old {
unsigned long traf;
unsigned long trafgb;
DWORD cleared;
DWORD updated;
} crecord_old;
#endif
int main(int argc, char *argv[]){
FILE *txt;
int bin;
int i;
long unsigned lu1, lu2;
char buf[256];
if(argc!=4){
fprintf(stderr, "Usage: %s command binary_file text_file\n"
" commands are:\n"
"\texport - dump counterfile to text\n"
#ifdef _WIN32
"\toldexport - export counterfile from older 3proxy version\n"
#endif
"\timport- import counterfile from text\n"
"Examples:\n"
#ifdef _WIN32
" %s oldexport counterfile.3cf tmpfile\n"
#else
" %s export counterfilenew.3cf tmpfile\n"
#endif
" %s import counterfilenew.3cf tmpfile\n"
"text file record format:\n"
"%%d %%10lu %%10lu %%lu %%lu\n"
" 1 - counter number\n"
" 2 - traffic (Bytes)\n"
" 3 - traffic (GB)\n"
" 4 - time counter reset (time_t)\n"
" 5 - time counter updated (time_t)\n"
,argv[0] , argv[0], argv[0]);
return 1;
}
if(!strcmp(argv[1], "export")){
bin = open((char *)argv[2], O_BINARY|O_RDONLY, 0660);
if(bin < 0){
fprintf(stderr, "Failed to open %s\n", argv[2]);
return 2;
}
if(read(bin, &cheader, sizeof(cheader)) != sizeof(cheader) ||
memcmp(&cheader, "3CF", 4)){
fprintf(stderr, "Invalid counter file\n");
return 3;
}
txt = fopen(argv[3], "w");
if(!txt) txt = stdout;
for(i=1; read(bin, &crecord, sizeof(crecord))==sizeof(crecord); i++)
fprintf(txt,"%d %10lu %10lu %lu %lu\n", i,
crecord.trafgb,
crecord.traf,
(unsigned long) crecord.cleared,
(unsigned long) crecord.updated);
}
#ifdef _WIN32
else if(!strcmp(argv[1], "oldexport")){
bin = open((char *)argv[2], O_BINARY|O_RDONLY, 0660);
if(bin < 0){
fprintf(stderr, "Failed to open %s\n", argv[2]);
return 2;
}
if(read(bin, &cheader_old, sizeof(cheader_old)) != sizeof(cheader_old) ||
memcmp(&cheader, "3CF", 4)){
fprintf(stderr, "Invalid counter file\n");
return 3;
}
txt = fopen(argv[3], "w");
if(!txt) txt = stdout;
for(i=1; read(bin, &crecord_old, sizeof(crecord_old))==sizeof(crecord_old); i++)
fprintf(txt, "%d %10lu %10lu %lu %lu\n", i,
crecord_old.trafgb,
crecord_old.traf,
(unsigned long) crecord_old.cleared,
(unsigned long) crecord_old.updated);
}
#endif
else if(!strcmp(argv[1], "import")){
bin = open((char *)argv[2], O_BINARY|O_WRONLY|O_CREAT|O_EXCL, 0660);
if(bin < 0){
fprintf(stderr, "Failed to open %s\n", argv[2]);
return 2;
}
txt = fopen(argv[3], "r");
if(!txt) {
fprintf(stderr, "Failed to open %s\n", argv[3]);
return 3;
}
cheader.updated = time(0);
write(bin, &cheader, sizeof(cheader));
while(fgets(buf, 256, txt) &&
sscanf(buf, "%d %10lu %10lu %lu %lu\n",
&i, &crecord.trafgb, &crecord.traf,
&lu1, &lu2) == 5){
crecord.cleared = (time_t) lu1;
crecord.updated = (time_t) lu1;
lseek(bin,
sizeof(struct counter_header) + (i-1) * sizeof(crecord),
SEEK_SET);
write(bin, &crecord, sizeof(crecord));
}
}
else {
fprintf(stderr, "Unknown command: %s\n", argv[1]);
return 5;
}
return 0;
}
+112 -127
View File
@@ -3,11 +3,15 @@
* *
* please read License Agreement * please read License Agreement
* *
* $Id: datatypes.c,v 1.28 2009/08/14 09:56:21 v.dubrovin Exp $
*/ */
#include "proxy.h" #include "proxy.h"
static void pr_unsigned64(struct node *node, CBFUNC cbf, void*cb){
char buf[32];
if(node->value)(*cbf)(cb, buf, sprintf(buf, "%"PRINTF_INT64_MODIFIER"u", *(uint64_t *)node->value));
}
static void pr_integer(struct node *node, CBFUNC cbf, void*cb){ static void pr_integer(struct node *node, CBFUNC cbf, void*cb){
char buf[16]; char buf[16];
if(node->value)(*cbf)(cb, buf, sprintf(buf, "%d", *(int *)node->value)); if(node->value)(*cbf)(cb, buf, sprintf(buf, "%d", *(int *)node->value));
@@ -52,19 +56,29 @@ static void pr_datetime(struct node *node, CBFUNC cbf, void*cb){
} }
} }
int ipprint(char *buf, unsigned uu){
unsigned u = ntohl(uu);
return sprintf(buf, "%u.%u.%u.%u",
((u&0xFF000000)>>24),
((u&0x00FF0000)>>16),
((u&0x0000FF00)>>8),
((u&0x000000FF)));
}
static void pr_ip(struct node *node, CBFUNC cbf, void*cb){ static void pr_ip(struct node *node, CBFUNC cbf, void*cb){
char buf[16]; char buf[16];
if(node->value)(*cbf)(cb, buf, ipprint(buf, *(unsigned *)node -> value)); if(node->value)(*cbf)(cb, buf, myinet_ntop(AF_INET, node -> value, buf, 4));
}
#ifndef NOIPV6
static void pr_ip6(struct node *node, CBFUNC cbf, void*cb){
char buf[64];
if(node->value)(*cbf)(cb, buf, myinet_ntop(AF_INET6, node -> value, buf, 16));
}
#endif
static void pr_sa(struct node *node, CBFUNC cbf, void*cb){
#ifdef NOIPV6
if(node->value)pr_ip(node, cbf, cb);
#else
char buf[64];
buf[0] = '[';
buf[1] = 0;
inet_ntop(*SAFAMILY(node->value), node->value, buf+1, sizeof(buf)-10);
sprintf(buf + strlen(buf), "]:%hu", (unsigned short)*SAPORT(node->value));
if(node->value)(*cbf)(cb, buf, strlen(buf));
#endif
} }
static void pr_wdays(struct node *node, CBFUNC cbf, void*cb){ static void pr_wdays(struct node *node, CBFUNC cbf, void*cb){
@@ -225,9 +239,22 @@ static void pr_userlist(struct node *node, CBFUNC cbf, void*cb){
} }
} }
int printiple(char *buf, struct iplist* ipl){
int addrlen = (ipl->family == AF_INET6)?16:4, i;
i = myinet_ntop(ipl->family, &ipl->ip_from, buf, addrlen);
if(memcmp(&ipl->ip_from, &ipl->ip_to, addrlen)){
buf[i++] = '-';
i += myinet_ntop(ipl->family, &ipl->ip_from, buf+i, addrlen);
}
if(ipl->next){
buf[i++] = ',';
buf[i++] = ' ';
}
return i;
}
static void pr_iplist(struct node *node, CBFUNC cbf, void*cb){ static void pr_iplist(struct node *node, CBFUNC cbf, void*cb){
char buf[20]; char buf[128];
int i;
struct iplist *il = (struct iplist *)node->value; struct iplist *il = (struct iplist *)node->value;
if(!il) { if(!il) {
@@ -235,10 +262,7 @@ static void pr_iplist(struct node *node, CBFUNC cbf, void*cb){
return; return;
} }
for(; il; il = il->next){ for(; il; il = il->next){
i = ipprint(buf, il->ip); (*cbf)(cb, buf, printiple(buf, il));
i += cidrprint(buf+i, il->mask);
if(il->next)buf[i++] = ',';
(*cbf)(cb, buf, i);
} }
} }
@@ -259,18 +283,6 @@ static void * ef_iplist_next(struct node *node){
return (((struct iplist *)node->value) -> next); return (((struct iplist *)node->value) -> next);
} }
static void * ef_iplist_ip(struct node *node){
return &(((struct iplist *)node->value) -> ip);
}
static void * ef_iplist_cidr(struct node *node){
return &(((struct iplist *)node->value) -> mask);
}
static void * ef_iplist_mask(struct node *node){
return &(((struct iplist *)node->value) -> mask);
}
static void * ef_userlist_next(struct node * node){ static void * ef_userlist_next(struct node * node){
return (((struct userlist *)node->value) -> next); return (((struct userlist *)node->value) -> next);
} }
@@ -333,12 +345,8 @@ static void * ef_chain_type(struct node * node){
} }
} }
static void * ef_chain_ip(struct node * node){ static void * ef_chain_addr(struct node * node){
return &((struct chain *)node->value) -> redirip; return &((struct chain *)node->value) -> addr;
}
static void * ef_chain_port(struct node * node){
return &((struct chain *)node->value) -> redirport;
} }
static void * ef_chain_weight(struct node * node){ static void * ef_chain_weight(struct node * node){
@@ -446,12 +454,26 @@ static void * ef_trafcounter_type(struct node * node){
return &((struct trafcount *)node->value) -> type; return &((struct trafcount *)node->value) -> type;
} }
static void * ef_trafcounter_traffic(struct node * node){ static void * ef_trafcounter_traffic64(struct node * node){
return &((struct trafcount *)node->value) -> traf; return &((struct trafcount *)node->value) -> traf64;
}
static void * ef_trafcounter_limit64(struct node * node){
return &((struct trafcount *)node->value) -> traflim64;
}
static void * ef_client_maxtrafin64(struct node * node){
return &((struct clientparam *)node->value) -> maxtrafin64;
} }
static void * ef_trafcounter_limit(struct node * node){ static void * ef_client_maxtrafout64(struct node * node){
return &((struct trafcount *)node->value) -> traflim; return &((struct clientparam *)node->value) -> maxtrafout64;
}
static void * ef_client_bytesin64(struct node * node){
return &((struct clientparam *)node->value) -> statssrv64;
}
static void * ef_client_bytesout64(struct node * node){
return &((struct clientparam *)node->value) -> statscli64;
} }
static void * ef_trafcounter_cleared(struct node * node){ static void * ef_trafcounter_cleared(struct node * node){
@@ -487,7 +509,6 @@ static void * ef_server_auth(struct node * node){
AUTHFUNC af = ((struct srvparam *)node->value) -> authfunc; AUTHFUNC af = ((struct srvparam *)node->value) -> authfunc;
if(af == alwaysauth) return "none"; if(af == alwaysauth) return "none";
if(af == nbnameauth) return "nbname";
if(af == ipauth) return "iponly"; if(af == ipauth) return "iponly";
if(af == strongauth) return "strong"; if(af == strongauth) return "strong";
return "uknown"; return "uknown";
@@ -536,21 +557,19 @@ static void * ef_server_targetport(struct node * node){
return &((struct srvparam *)node->value) -> targetport; return &((struct srvparam *)node->value) -> targetport;
} }
static void * ef_server_intip(struct node * node){ static void * ef_server_intsa(struct node * node){
return &((struct srvparam *)node->value) -> intip; return &((struct srvparam *)node->value) -> intsa;
} }
static void * ef_server_extip(struct node * node){ static void * ef_server_extsa(struct node * node){
return &((struct srvparam *)node->value) -> extip; return &((struct srvparam *)node->value) -> extsa;
} }
static void * ef_server_intport(struct node * node){ #ifndef NOIPV6
return &((struct srvparam *)node->value) -> intport; static void * ef_server_extsa6(struct node * node){
} return &((struct srvparam *)node->value) -> extsa6;
static void * ef_server_extport(struct node * node){
return &((struct srvparam *)node->value) -> extport;
} }
#endif
static void * ef_server_acl(struct node * node){ static void * ef_server_acl(struct node * node){
return ((struct srvparam *)node->value) -> acl; return ((struct srvparam *)node->value) -> acl;
@@ -573,14 +592,6 @@ static void * ef_client_next(struct node * node){
return ((struct clientparam *)node->value) -> next; return ((struct clientparam *)node->value) -> next;
} }
static void * ef_client_maxtrafin(struct node * node){
return &((struct clientparam *)node->value) -> maxtrafin;
}
static void * ef_client_maxtrafout(struct node * node){
return &((struct clientparam *)node->value) -> maxtrafout;
}
static void * ef_client_type(struct node * node){ static void * ef_client_type(struct node * node){
int service = ((struct clientparam *)node->value) -> service; int service = ((struct clientparam *)node->value) -> service;
return (service>=0 && service < 15)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown"; return (service>=0 && service < 15)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown";
@@ -617,36 +628,16 @@ static void * ef_client_extpassword(struct node * node){
return ((struct clientparam *)node->value) -> extpassword; return ((struct clientparam *)node->value) -> extpassword;
} }
static void * ef_client_cliip(struct node * node){ static void * ef_client_clisa(struct node * node){
return &((struct clientparam *)node->value) -> sinc.sin_addr.s_addr; return &((struct clientparam *)node->value) -> sincr;
} }
static void * ef_client_srvip(struct node * node){ static void * ef_client_srvsa(struct node * node){
return &((struct clientparam *)node->value) -> sins.sin_addr.s_addr; return &((struct clientparam *)node->value) -> sinsr;
} }
static void * ef_client_reqip(struct node * node){ static void * ef_client_reqsa(struct node * node){
return &((struct clientparam *)node->value) -> req.sin_addr.s_addr; return &((struct clientparam *)node->value) -> req;
}
static void * ef_client_reqport(struct node * node){
return &((struct clientparam *)node->value) -> req.sin_port;
}
static void * ef_client_srvport(struct node * node){
return &((struct clientparam *)node->value) -> sins.sin_port;
}
static void * ef_client_cliport(struct node * node){
return &((struct clientparam *)node->value) -> sinc.sin_port;
}
static void * ef_client_bytesin(struct node * node){
return &((struct clientparam *)node->value) -> statssrv;
}
static void * ef_client_bytesout(struct node * node){
return &((struct clientparam *)node->value) -> statscli;
} }
static void * ef_client_pwtype(struct node * node){ static void * ef_client_pwtype(struct node * node){
@@ -695,20 +686,12 @@ static struct property prop_pwlist[] = {
{NULL, "next", ef_pwlist_next, TYPE_PWLIST, "next"} {NULL, "next", ef_pwlist_next, TYPE_PWLIST, "next"}
}; };
static struct property prop_iplist[] = {
{prop_iplist + 1, "ip", ef_iplist_ip, TYPE_IP, "ip address"},
{prop_iplist + 2, "cidr", ef_iplist_cidr, TYPE_CIDR, "ip mask length"},
{prop_iplist + 3, "mask", ef_iplist_mask, TYPE_IP, "ip mask"},
{NULL, "next", ef_iplist_next, TYPE_IPLIST, "next"}
};
static struct property prop_chain[] = { static struct property prop_chain[] = {
{prop_chain + 1, "ip", ef_chain_ip, TYPE_IP, "parent ip address"}, {prop_chain + 1, "addr", ef_chain_addr, TYPE_SA, "parent address"},
{prop_chain + 2, "port", ef_chain_port, TYPE_PORT, "parent port"}, {prop_chain + 2, "type", ef_chain_type, TYPE_STRING, "parent type"},
{prop_chain + 3, "type", ef_chain_type, TYPE_STRING, "parent type"}, {prop_chain + 3, "weight", ef_chain_weight, TYPE_SHORT, "parent weight 0-1000"},
{prop_chain + 4, "weight", ef_chain_weight, TYPE_SHORT, "parent weight 0-1000"}, {prop_chain + 4, "user", ef_chain_user, TYPE_STRING, "parent login"},
{prop_chain + 5, "user", ef_chain_user, TYPE_STRING, "parent login"}, {prop_chain + 5, "password", ef_chain_password, TYPE_STRING, "parent password"},
{prop_chain + 6, "password", ef_chain_password, TYPE_STRING, "parent password"},
{NULL, "next", ef_chain_next, TYPE_CHAIN, "next"} {NULL, "next", ef_chain_next, TYPE_CHAIN, "next"}
}; };
@@ -742,8 +725,10 @@ static struct property prop_trafcounter[] = {
{prop_trafcounter + 2, "ace", ef_trafcounter_ace, TYPE_ACE, "traffic to count"}, {prop_trafcounter + 2, "ace", ef_trafcounter_ace, TYPE_ACE, "traffic to count"},
{prop_trafcounter + 3, "number", ef_trafcounter_number, TYPE_UNSIGNED, "counter number"}, {prop_trafcounter + 3, "number", ef_trafcounter_number, TYPE_UNSIGNED, "counter number"},
{prop_trafcounter + 4, "type", ef_trafcounter_type, TYPE_ROTATION, "rotation type"}, {prop_trafcounter + 4, "type", ef_trafcounter_type, TYPE_ROTATION, "rotation type"},
{prop_trafcounter + 5, "traffic", ef_trafcounter_traffic, TYPE_TRAFFIC, "counter value"},
{prop_trafcounter + 6, "limit", ef_trafcounter_limit, TYPE_TRAFFIC, "counter limit"},
{prop_trafcounter + 5, "traffic", ef_trafcounter_traffic64, TYPE_UNSIGNED64, "counter value"},
{prop_trafcounter + 6, "limit", ef_trafcounter_limit64, TYPE_UNSIGNED64, "counter limit"},
{prop_trafcounter + 7, "cleared", ef_trafcounter_cleared, TYPE_DATETIME, "last rotated"}, {prop_trafcounter + 7, "cleared", ef_trafcounter_cleared, TYPE_DATETIME, "last rotated"},
{prop_trafcounter + 8, "updated", ef_trafcounter_updated, TYPE_DATETIME, "last updated"}, {prop_trafcounter + 8, "updated", ef_trafcounter_updated, TYPE_DATETIME, "last updated"},
{prop_trafcounter + 9, "comment", ef_trafcounter_comment, TYPE_STRING, "counter comment"}, {prop_trafcounter + 9, "comment", ef_trafcounter_comment, TYPE_STRING, "counter comment"},
@@ -758,21 +743,22 @@ static struct property prop_server[] = {
{prop_server + 2, "target", ef_server_target, TYPE_STRING, "portmapper target ip"}, {prop_server + 2, "target", ef_server_target, TYPE_STRING, "portmapper target ip"},
{prop_server + 3, "targetport", ef_server_targetport, TYPE_PORT, "portmapper target port"}, {prop_server + 3, "targetport", ef_server_targetport, TYPE_PORT, "portmapper target port"},
{prop_server + 4, "starttime", ef_server_starttime, TYPE_DATETIME, "service started seconds"}, {prop_server + 4, "starttime", ef_server_starttime, TYPE_DATETIME, "service started seconds"},
{prop_server + 5, "intip", ef_server_intip, TYPE_IP, "ip address of internal interface"}, {prop_server + 5, "intsa", ef_server_intsa, TYPE_SA, "ip address of internal interface"},
{prop_server + 6, "extip", ef_server_extip, TYPE_IP, "ip address of external interface"}, {prop_server + 6, "extsa", ef_server_extsa, TYPE_SA, "ip address of external interface"},
{prop_server + 7, "intport", ef_server_intport, TYPE_PORT, "port to listen"}, {prop_server + 7, "auth", ef_server_auth, TYPE_STRING, "service authentication type"},
{prop_server + 8, "extport", ef_server_extport, TYPE_PORT, "port to use for outgoing connection"}, {prop_server + 8, "acl", ef_server_acl, TYPE_ACE, "access control list"},
{prop_server + 9, "auth", ef_server_auth, TYPE_STRING, "service authentication type"}, {prop_server + 9, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"},
{prop_server + 10, "acl", ef_server_acl, TYPE_ACE, "access control list"}, {prop_server + 10, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"},
{prop_server + 11, "singlepacket", ef_server_singlepacket, TYPE_INTEGER, "is single packet redirection"}, {prop_server + 11, "log", ef_server_log, TYPE_STRING, "type of logging"},
{prop_server + 12, "usentlm", ef_server_usentlm, TYPE_INTEGER, "allow NTLM authentication"}, {prop_server + 12, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"},
{prop_server + 13, "log", ef_server_log, TYPE_STRING, "type of logging"}, {prop_server + 13, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"},
{prop_server + 14, "logtarget", ef_server_logtarget, TYPE_STRING, "log target options"}, {prop_server + 14, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"},
{prop_server + 15, "logformat", ef_server_logformat, TYPE_STRING, "logging format string"}, {prop_server + 15, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"},
{prop_server + 16, "nonprintable", ef_server_nonprintable, TYPE_STRING, "non printable characters"}, {prop_server + 16, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"},
{prop_server + 17, "replacement", ef_server_replacement, TYPE_CHAR, "replacement character"}, {prop_server + 17, "child", ef_server_child, TYPE_CLIENT, "connected clients"},
{prop_server + 18, "childcount", ef_server_childcount, TYPE_INTEGER, "number of servers connected"}, #ifndef NOIPV6
{prop_server + 19, "child", ef_server_child, TYPE_CLIENT, "connected clients"}, {prop_server + 18, "extsa6", ef_server_extsa6, TYPE_SA, "ipv6 address of external interface"},
#endif
{NULL, "next", ef_server_next, TYPE_SERVER, "next"} {NULL, "next", ef_server_next, TYPE_SERVER, "next"}
}; };
@@ -789,17 +775,14 @@ static struct property prop_client[] = {
{prop_client + 9, "extpassword", ef_client_extpassword, TYPE_STRING, "password for requested host"}, {prop_client + 9, "extpassword", ef_client_extpassword, TYPE_STRING, "password for requested host"},
{prop_client + 10, "username", ef_client_username, TYPE_STRING, "client username"}, {prop_client + 10, "username", ef_client_username, TYPE_STRING, "client username"},
{prop_client + 11, "password", ef_client_password, TYPE_STRING, "client password"}, {prop_client + 11, "password", ef_client_password, TYPE_STRING, "client password"},
{prop_client + 12, "cliip", ef_client_cliip, TYPE_IP, "client ip"}, {prop_client + 12, "clisa", ef_client_clisa, TYPE_SA, "client sa"},
{prop_client + 13, "cliport", ef_client_cliport, TYPE_PORT, "client port"}, {prop_client + 13, "srvsa", ef_client_srvsa, TYPE_IP, "target server sa"},
{prop_client + 14, "srvip", ef_client_srvip, TYPE_IP, "target server ip"}, {prop_client + 14, "reqsa", ef_client_reqsa, TYPE_IP, "requested server sa"},
{prop_client + 15, "srvport", ef_client_srvport, TYPE_PORT, "target server port"}, {prop_client + 15, "bytesin", ef_client_bytesin64, TYPE_UNSIGNED64, "bytes from server to client"},
{prop_client + 16, "reqip", ef_client_reqip, TYPE_IP, "requested server ip"}, {prop_client + 16, "bytesout", ef_client_bytesout64, TYPE_UNSIGNED64, "bytes from client to server"},
{prop_client + 17, "reqport", ef_client_reqport, TYPE_PORT, "requested server port"}, {prop_client + 17, "maxtrafin", ef_client_maxtrafin64, TYPE_UNSIGNED64, "maximum traffic allowed for download"},
{prop_client + 18, "bytesin", ef_client_bytesin, TYPE_UNSIGNED, "bytes from server to client"}, {prop_client + 18, "maxtrafout", ef_client_maxtrafout64, TYPE_UNSIGNED64, "maximum traffic allowed for upload"},
{prop_client + 19, "bytesout", ef_client_bytesout, TYPE_UNSIGNED, "bytes from client to server"}, {prop_client + 19, "pwtype", ef_client_pwtype, TYPE_INTEGER, "type of client password"},
{prop_client + 20, "pwtype", ef_client_pwtype, TYPE_INTEGER, "type of client password"},
{prop_client + 21, "maxtrafin", ef_client_maxtrafin, TYPE_UNSIGNED, "maximum traffic allowed for download"},
{prop_client + 22, "maxtrafout", ef_client_maxtrafout, TYPE_UNSIGNED, "maximum traffic allowed for upload"},
{NULL, "next", ef_client_next, TYPE_CLIENT, "next"} {NULL, "next", ef_client_next, TYPE_CLIENT, "next"}
@@ -810,16 +793,18 @@ struct datatype datatypes[64] = {
{"short", NULL, pr_short, NULL}, {"short", NULL, pr_short, NULL},
{"char", NULL, pr_char, NULL}, {"char", NULL, pr_char, NULL},
{"unsigned", NULL, pr_unsigned, NULL}, {"unsigned", NULL, pr_unsigned, NULL},
{"unsigned64", NULL, pr_unsigned64, NULL},
{"traffic", NULL, pr_traffic, NULL}, {"traffic", NULL, pr_traffic, NULL},
{"port", NULL, pr_port, NULL}, {"port", NULL, pr_port, NULL},
{"ip", NULL, pr_ip, NULL}, {"ip", NULL, pr_ip, NULL},
{"sa", NULL, pr_sa, NULL},
{"cidr", NULL, pr_cidr, NULL}, {"cidr", NULL, pr_cidr, NULL},
{"string", NULL, pr_string, NULL}, {"string", NULL, pr_string, NULL},
{"datetime", NULL, pr_datetime, NULL}, {"datetime", NULL, pr_datetime, NULL},
{"operations", NULL, pr_operations, NULL}, {"operations", NULL, pr_operations, NULL},
{"rotation", NULL, pr_rotation, NULL}, {"rotation", NULL, pr_rotation, NULL},
{"portlist", ef_portlist_next, pr_portlist, prop_portlist}, {"portlist", ef_portlist_next, pr_portlist, prop_portlist},
{"iplist", ef_iplist_next, pr_iplist, prop_iplist}, {"iplist", ef_iplist_next, pr_iplist, NULL},
{"userlist", ef_userlist_next, pr_userlist, prop_userlist}, {"userlist", ef_userlist_next, pr_userlist, prop_userlist},
{"pwlist", ef_pwlist_next, NULL, prop_pwlist}, {"pwlist", ef_pwlist_next, NULL, prop_pwlist},
{"chain", ef_chain_next, NULL, prop_chain}, {"chain", ef_chain_next, NULL, prop_chain},
+4 -5
View File
@@ -3,10 +3,10 @@
* *
* please read License Agreement * please read License Agreement
* *
* $Id: dighosts.c,v 1.10 2009/10/06 08:38:00 v.dubrovin Exp $
*/ */
#include "proxy.h" #include "proxy.h"
pthread_mutex_t log_mutex;
int sockgetchar(SOCKET sock, int timeosec, int timeousec){ int sockgetchar(SOCKET sock, int timeosec, int timeousec){
@@ -19,7 +19,7 @@ int sockgetchar(SOCKET sock, int timeosec, int timeousec){
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(sock, &fds); FD_SET(sock, &fds);
if (select (((int)sock)+1, &fds, NULL, NULL, &tv)!=1) return EOF; if (select (((int)sock)+1, &fds, NULL, NULL, &tv)!=1) return EOF;
if (recv(sock, &buf, 1, 0)!=1) return EOF; if (recv(sock, (char *)&buf, 1, 0)!=1) return EOF;
return((int)buf); return((int)buf);
} }
@@ -84,19 +84,18 @@ int main(int argc, char *argv[]){
return 4; return 4;
} }
*hostend = '/'; *hostend = '/';
if(!(sa.sin_addr.s_addr = getip(host))) { if(!getip46(4, host, (struct sockaddr *)&sa)) {
fprintf(stderr, "Unable to resolve %s\n", host); fprintf(stderr, "Unable to resolve %s\n", host);
return 5; return 5;
} }
sa.sin_port = htons(80); sa.sin_port = htons(80);
sa.sin_family = AF_INET;
if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) return 6; if((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) return 6;
sprintf((char *)buf, (char *)request, hostend, host); sprintf((char *)buf, (char *)request, hostend, host);
if(connect(sock,(struct sockaddr *)&sa,sizeof(sa))) { if(connect(sock,(struct sockaddr *)&sa,sizeof(sa))) {
fprintf(stderr, "Unable to connect: %s\n", host); fprintf(stderr, "Unable to connect: %s\n", host);
return 8; return 8;
} }
if(send(sock, buf, (int)strlen((char *)buf), 0) != (int)strlen((char *)buf)) return 9; if(send(sock, (char *)buf, (int)strlen((char *)buf), 0) != (int)strlen((char *)buf)) return 9;
while( (i = sockgetline(sock, buf, sizeof(buf) - 1, '\n', 30)) > 2); while( (i = sockgetline(sock, buf, sizeof(buf) - 1, '\n', 30)) > 2);
if(i<1) return 9; if(i<1) return 9;
if(!(fp = fopen(argv[argc-1], "w"))) { if(!(fp = fopen(argv[argc-1], "w"))) {
+60 -45
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: dnspr.c,v 1.22 2009/09/17 12:21:05 v.dubrovin Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -14,11 +13,12 @@
#endif #endif
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; } #define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
#define BUFSIZE 4096 #define BUFSIZE 16384
void * dnsprchild(struct clientparam* param) { void * dnsprchild(struct clientparam* param) {
unsigned long ip = 0; unsigned long ip = 0;
unsigned char *bbuf;
unsigned char *buf, *s1, *s2; unsigned char *buf, *s1, *s2;
char * host = NULL; char * host = NULL;
unsigned char c; unsigned char c;
@@ -27,26 +27,28 @@ void * dnsprchild(struct clientparam* param) {
int len; int len;
unsigned type=0; unsigned type=0;
unsigned ttl; unsigned ttl;
unsigned char addr[16];
#ifdef _WIN32 #ifdef _WIN32
unsigned long ul = 1; unsigned long ul = 1;
#endif #endif
if(!(buf = myalloc(BUFSIZE))){ if(!(bbuf = myalloc(BUFSIZE+2))){
param->srv->fds.events = POLLIN; param->srv->fds.events = POLLIN;
RETURN (21); RETURN (21);
} }
size = sizeof(struct sockaddr_in); buf = bbuf+2;
i = so._recvfrom(param->srv->srvsock, buf, BUFSIZE, 0, (struct sockaddr *)&param->sinc, &size); size = sizeof(param->sincr);
i = so._recvfrom(param->srv->srvsock, (char *)buf, BUFSIZE, 0, (struct sockaddr *)&param->sincr, &size);
size = sizeof(param->sinsl);
getsockname(param->srv->srvsock, (struct sockaddr *)&param->sincl, &size);
#ifdef _WIN32 #ifdef _WIN32
if((param->clisock=so._socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) { if((param->clisock=so._socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) {
RETURN(818); RETURN(818);
} }
ioctlsocket(param->clisock, FIONBIO, &ul); ioctlsocket(param->clisock, FIONBIO, &ul);
size = sizeof(struct sockaddr_in); if(so._setsockopt(param->clisock, SOL_SOCKET, SO_REUSEADDR, (char *)&ul, sizeof(int))) {RETURN(820);};
if(so._getsockname(param->srv->srvsock, (struct sockaddr *)&param->sins, &size)) {RETURN(21);}; if(so._bind(param->clisock,(struct sockaddr *)&param->sincl,SASIZE(&param->sincl))) {
if(so._setsockopt(param->clisock, SOL_SOCKET, SO_REUSEADDR, (unsigned char *)&ul, sizeof(int))) {RETURN(820);};
if(so._bind(param->clisock,(struct sockaddr *)&param->sins,sizeof(struct sockaddr_in))) {
RETURN(822); RETURN(822);
} }
@@ -80,8 +82,8 @@ void * dnsprchild(struct clientparam* param) {
*s2 = (len - (int)(s2 - buf)) - 1; *s2 = (len - (int)(s2 - buf)) - 1;
type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2]; type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2];
if(type==1){ if((type==0x01 || type==0x1c) && !param->srv->singlepacket){
ip = udpresolve((unsigned char *)host, &ttl, param, 0); ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0);
} }
len+=5; len+=5;
@@ -95,19 +97,19 @@ void * dnsprchild(struct clientparam* param) {
memset(buf+len, 0, 16); memset(buf+len, 0, 16);
buf[len] = 0xc0; buf[len] = 0xc0;
buf[len+1] = 0x0c; buf[len+1] = 0x0c;
buf[len+3] = 1; buf[len+3] = type;
buf[len+5] = 1; buf[len+5] = 1;
ttl = htonl(ttl); ttl = htonl(ttl);
memcpy(buf + len + 6, &ttl, 4); memcpy(buf + len + 6, &ttl, 4);
buf[len+11] = 4; buf[len+11] = type==1? 4:16;
memcpy(buf+len+12,(void *)&ip,4); memcpy(buf+len+12,(void *)&addr,type==1? 4:16);
len+=16; len+=(type==1?16:28);
} }
if(type == 0x0c) { else if(type == 0x0c) {
unsigned a, b, c, d; unsigned a, b, c, d;
sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d); sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d);
ip = htonl((d<<24) ^ (c<<16) ^ (b<<8) ^ a); ip = htonl((d<<24) ^ (c<<16) ^ (b<<8) ^ a);
if(ip == param->srv->intip){ if(*SAFAMILY(&param->sincl) == AF_INET && ip == *(unsigned long*)SAADDR(&param->sincl)){
buf[2] = 0x85; buf[2] = 0x85;
buf[3] = 0x80; buf[3] = 0x80;
buf[6] = 0; buf[6] = 0;
@@ -127,36 +129,52 @@ void * dnsprchild(struct clientparam* param) {
} }
else ip = 0; else ip = 0;
} }
if(!ip && nservers[0] && type!=1){ if(!ip && numservers){
if((param->remsock=so._socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) { if((param->remsock=so._socket(SASOCK(&nservers[0].addr), nservers[0].usetcp? SOCK_STREAM:SOCK_DGRAM, nservers[0].usetcp?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {
RETURN(818); RETURN(818);
} }
#ifdef _WIN32 memset(&param->sinsl, 0, sizeof(param->sinsl));
ioctlsocket(param->remsock, FIONBIO, &ul); *SAFAMILY(&param->sinsl) = *SAFAMILY(&nservers[0].addr);
#else if(so._bind(param->remsock,(struct sockaddr *)&param->sinsl,SASIZE(&param->sinsl))) {
fcntl(param->remsock,F_SETFL,O_NONBLOCK);
#endif
param->sins.sin_family = AF_INET;
param->sins.sin_port = htons(0);
param->sins.sin_addr.s_addr = htonl(0);
if(so._bind(param->remsock,(struct sockaddr *)&param->sins,sizeof(struct sockaddr_in))) {
RETURN(819); RETURN(819);
} }
param->sins.sin_addr.s_addr = nservers[0]; param->sinsr = nservers[0].addr;
param->sins.sin_port = htons(53); if(nservers[0].usetcp) {
if(socksendto(param->remsock, &param->sins, buf, i, conf.timeouts[SINGLEBYTE_L]*1000) != i){ if(so._connect(param->remsock,(struct sockaddr *)&param->sinsr,SASIZE(&param->sinsr))) RETURN(830);
buf-=2;
*(unsigned short*)buf = htons(i);
i+=2;
}
else {
#ifdef _WIN32
/* ioctlsocket(param->remsock, FIONBIO, &ul); */
#else
/* fcntl(param->remsock,F_SETFL,O_NONBLOCK); */
#endif
}
if(socksendto(param->remsock, (struct sockaddr *)&param->sinsr, buf, i, conf.timeouts[SINGLEBYTE_L]*1000) != i){
RETURN(820); RETURN(820);
} }
param->statscli += i; param->statscli64 += i;
param->nwrites++; param->nwrites++;
len = sockrecvfrom(param->remsock, &param->sins, buf, BUFSIZE, 15000); len = sockrecvfrom(param->remsock, (struct sockaddr *)&param->sinsr, buf, BUFSIZE, conf.timeouts[DNS_TO]*1000);
if(len <= 13) { if(len <= 13) {
RETURN(821); RETURN(821);
} }
param->statssrv += len; param->statssrv64 += len;
param->nreads++; param->nreads++;
if(nservers[0].usetcp) {
unsigned short us;
us = ntohs(*(unsigned short *)buf);
if(us > 4096) RETURN(833);
buf += 2;
len -= 2;
if(len < us) len += sockgetlinebuf(param, SERVER, buf+len, us - len, 0, conf.timeouts[SINGLEBYTE_L]);
if(len != us) RETURN(832);
}
if(buf[6] || buf[7]){ if(buf[6] || buf[7]){
if(socksendto(param->clisock, &param->sinc, buf, len, conf.timeouts[SINGLEBYTE_L]*1000) != len){ if(socksendto(param->clisock, (struct sockaddr *)&param->sincr, buf, len, conf.timeouts[SINGLEBYTE_L]*1000) != len){
RETURN(822); RETURN(822);
} }
RETURN(0); RETURN(0);
@@ -167,25 +185,22 @@ void * dnsprchild(struct clientparam* param) {
buf[2] = 0x85; buf[2] = 0x85;
buf[3] = 0x83; buf[3] = 0x83;
} }
usleep(SLEEPTIME); res = socksendto(param->clisock, (struct sockaddr *)&param->sincr, buf, len, conf.timeouts[SINGLEBYTE_L]*1000);
res = socksendto(param->clisock, &param->sinc, buf, len, conf.timeouts[SINGLEBYTE_L]*1000);
if(res != len){RETURN(819);} if(res != len){RETURN(819);}
if(!ip) {RETURN(888);} if(!ip) {RETURN(888);}
CLEANRET: CLEANRET:
if(param->res!=813){ if(param->res!=813){
sprintf((char *)buf, "%04x/%s(%u.%u.%u.%u)", sprintf((char *)buf, "%04x/%s/",
(unsigned)type, (unsigned)type,
host?host:"", host?host:"");
(unsigned)(ntohl(ip)&0xff000000)>>24, if((ip && type == 0x01) || type == 0x1c){
(unsigned)(ntohl(ip)&0x00ff0000)>>16, myinet_ntop(type == 0x01? AF_INET:AF_INET6, addr, (char *)buf+strlen((char *)buf), 64);
(unsigned)(ntohl(ip)&0x0000ff00)>>8, }
(unsigned)(ntohl(ip)&0x000000ff)
);
(*param->srv->logfunc)(param, buf); (*param->srv->logfunc)(param, buf);
} }
if(buf)myfree(buf); if(bbuf)myfree(bbuf);
if(host)myfree(host); if(host)myfree(host);
#ifndef _WIN32 #ifndef _WIN32
param->clisock = INVALID_SOCKET; param->clisock = INVALID_SOCKET;
+32 -18
View File
@@ -3,24 +3,23 @@
* *
* please read License Agreement * please read License Agreement
* *
* $Id: ftp.c,v 1.34 2009/09/17 12:21:06 v.dubrovin Exp $
*/ */
#include "proxy.h" #include "proxy.h"
int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) { int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) {
char tbuf[1024]; char tbuf[256];
int i; int i;
char *buf; char *buf;
int len; int len;
int res; int res;
buf = nbuf?nbuf:tbuf; buf = nbuf?nbuf:tbuf;
len = nbuf?*innbuf:1024; len = nbuf?*innbuf:sizeof(tbuf);
if(innbuf)*innbuf = 0; if(innbuf)*innbuf = 0;
if(len < 48) return 707; if(len < 140) return 707;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
if(i < 3) return 706; if(i < 3) return 706;
@@ -29,11 +28,11 @@ int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) {
*innbuf = i; *innbuf = i;
return 702; return 702;
} }
sprintf(buf, "USER %.32s\r\n", param->extusername?param->extusername:(unsigned char *)"anonymous"); sprintf(buf, "USER %.128s\r\n", param->extusername?param->extusername:(unsigned char *)"anonymous");
if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){ if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){
return 703; return 703;
} }
param->statscli += (int)strlen(buf); param->statscli64 += (int)strlen(buf);
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
@@ -41,7 +40,7 @@ int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) {
buf[i] = 0; buf[i] = 0;
res = atoi(buf)/100; res = atoi(buf)/100;
if(res == 3){ if(res == 3){
sprintf(buf, "PASS %.32s\r\n", sprintf(buf, "PASS %.128s\r\n",
param->extusername? param->extusername?
(param->extpassword? (param->extpassword?
param->extpassword:(unsigned char *)"") param->extpassword:(unsigned char *)"")
@@ -50,7 +49,7 @@ int ftplogin(struct clientparam *param, char *nbuf, int *innbuf) {
if((int)socksend(param->remsock, (unsigned char *)buf, res, conf.timeouts[STRING_S]) != (int)strlen(buf)){ if((int)socksend(param->remsock, (unsigned char *)buf, res, conf.timeouts[STRING_S]) != (int)strlen(buf)){
return 705; return 705;
} }
param->statscli += res; param->statscli64 += res;
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0){
buf[i] = 0; buf[i] = 0;
@@ -81,7 +80,7 @@ int ftpcd(struct clientparam *param, unsigned char* path, char *nbuf, int *innbu
if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){ if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){
return 711; return 711;
} }
param->statscli += (int)strlen(buf); param->statscli64 += (int)strlen(buf);
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
if(nbuf && innbuf && inbuf + i < *innbuf && i > 6) { if(nbuf && innbuf && inbuf + i < *innbuf && i > 6) {
@@ -114,7 +113,7 @@ int ftpsyst(struct clientparam *param, unsigned char *buf, unsigned len){
if(socksend(param->remsock, (unsigned char *)"SYST\r\n", 6, conf.timeouts[STRING_S]) != 6){ if(socksend(param->remsock, (unsigned char *)"SYST\r\n", 6, conf.timeouts[STRING_S]) != 6){
return 721; return 721;
} }
param->statscli+=6; param->statscli64 += 6;
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
@@ -133,7 +132,7 @@ int ftppwd(struct clientparam *param, unsigned char *buf, unsigned len){
if(socksend(param->remsock, (unsigned char *)"PWD\r\n", 5, conf.timeouts[STRING_S]) != 5){ if(socksend(param->remsock, (unsigned char *)"PWD\r\n", 5, conf.timeouts[STRING_S]) != 5){
return 731; return 731;
} }
param->statscli += 5; param->statscli64 += 5;
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, buf, len - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
@@ -158,7 +157,7 @@ int ftptype(struct clientparam *param, unsigned char* f_type){
if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){ if((int)socksend(param->remsock, (unsigned char *)buf, (int)strlen(buf), conf.timeouts[STRING_S]) != (int)strlen(buf)){
return 741; return 741;
} }
param->statscli += (int)strlen(buf); param->statscli64 += (int)strlen(buf);
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
@@ -175,11 +174,12 @@ SOCKET ftpdata(struct clientparam *param){
SOCKET s = INVALID_SOCKET, rem; SOCKET s = INVALID_SOCKET, rem;
unsigned long b1, b2, b3, b4; unsigned long b1, b2, b3, b4;
unsigned short b5, b6; unsigned short b5, b6;
SASIZETYPE sasize;
if(socksend(param->remsock, (unsigned char *)"PASV\r\n", 6, conf.timeouts[STRING_S]) != 6){ if(socksend(param->remsock, (unsigned char *)"PASV\r\n", 6, conf.timeouts[STRING_S]) != 6){
return INVALID_SOCKET; return INVALID_SOCKET;
} }
param->statscli+=6; param->statscli64 += 6;
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
@@ -188,14 +188,28 @@ SOCKET ftpdata(struct clientparam *param){
buf[i-2] = 0; buf[i-2] = 0;
if(!(sb = strchr(buf+4, '(')) || !(se= strchr(sb, ')'))) return INVALID_SOCKET; if(!(sb = strchr(buf+4, '(')) || !(se= strchr(sb, ')'))) return INVALID_SOCKET;
if(sscanf(sb+1, "%lu,%lu,%lu,%lu,%hu,%hu", &b1, &b2, &b3, &b4, &b5, &b6)!=6) return INVALID_SOCKET; if(sscanf(sb+1, "%lu,%lu,%lu,%lu,%hu,%hu", &b1, &b2, &b3, &b4, &b5, &b6)!=6) return INVALID_SOCKET;
sasize = sizeof(param->sinsl);
if(so._getsockname(param->remsock, (struct sockaddr *)&param->sinsl, &sasize)){return INVALID_SOCKET;}
sasize = sizeof(param->sinsr);
if(so._getpeername(param->remsock, (struct sockaddr *)&param->sinsr, &sasize)){return INVALID_SOCKET;}
rem = param->remsock; rem = param->remsock;
param->remsock = INVALID_SOCKET; param->remsock = INVALID_SOCKET;
param->req.sin_family = AF_INET; param->req = param->sinsr;
param->req.sin_port = param->sins.sin_port = htons((unsigned short)((b5<<8)^b6)); *SAPORT(&param->req) = *SAPORT(&param->sinsr) = htons((unsigned short)((b5<<8)^b6));
param->req.sin_addr.s_addr = param->sins.sin_addr.s_addr = htonl((b1<<24)^(b2<<16)^(b3<<8)^b4); *SAPORT(&param->sinsl) = 0;
i = param->operation; i = param->operation;
param->operation = FTP_DATA; param->operation = FTP_DATA;
if((param->res = (*param->srv->authfunc)(param))) return INVALID_SOCKET; if((param->res = (*param->srv->authfunc)(param))) {
if(param->remsock != INVALID_SOCKET) {
so._closesocket(param->remsock);
param->remsock = INVALID_SOCKET;
}
memset(&param->sinsl, 0, sizeof(param->sinsl));
if((param->res = (*param->srv->authfunc)(param))) {
param->remsock = rem;
return INVALID_SOCKET;
}
}
param->operation = i; param->operation = i;
s = param->remsock; s = param->remsock;
param->remsock = rem; param->remsock = rem;
@@ -217,7 +231,7 @@ SOCKET ftpcommand(struct clientparam *param, unsigned char * command, unsigned c
so._closesocket(s); so._closesocket(s);
return INVALID_SOCKET; return INVALID_SOCKET;
} }
param->statscli += (int)strlen(buf); param->statscli64 += (int)strlen(buf);
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){ while((i = sockgetlinebuf(param, SERVER, (unsigned char *)buf, sizeof(buf) - 1, '\n', conf.timeouts[STRING_L])) > 0 && (i < 3 || !isnumber(*buf) || buf[3] == '-')){
} }
+37 -36
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: ftppr.c,v 1.45 2011-08-15 19:52:27 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -71,13 +70,13 @@ void * ftpprchild(struct clientparam* param) {
param->res = res; param->res = res;
if(inbuf && inbuf != BUFSIZE && socksend(param->ctrlsock, buf, inbuf, conf.timeouts[STRING_S])!=inbuf) {RETURN (807);} if(inbuf && inbuf != BUFSIZE && socksend(param->ctrlsock, buf, inbuf, conf.timeouts[STRING_S])!=inbuf) {RETURN (807);}
if(!res) status = 3; if(!res) status = 3;
sprintf((char *)buf, "%.64s@%.128s%c%hu", param->extusername, param->hostname, (ntohs(param->sins.sin_port)==21)?0:':', ntohs(param->sins.sin_port)); sprintf((char *)buf, "%.128s@%.128s%c%hu", param->extusername, param->hostname, (ntohs(*SAPORT(&param->sinsr))==21)?0:':', ntohs(*SAPORT(&param->sinsr)));
req = mystrdup((char *)buf); req = mystrdup((char *)buf);
#ifndef WITHMAIN #ifndef WITHMAIN
{ {
int action, reqbufsize, reqsize; int action, reqbufsize, reqsize;
reqbufsize = BUFSIZE; reqbufsize = BUFSIZE;
reqsize = (int)strlen(buf) + 1; reqsize = (int)strlen((char *)buf) + 1;
action = handlereqfilters(param, &buf, &reqbufsize, 0, &reqsize); action = handlereqfilters(param, &buf, &reqbufsize, 0, &reqsize);
if(action == HANDLED){ if(action == HANDLED){
@@ -95,7 +94,7 @@ void * ftpprchild(struct clientparam* param) {
{ {
int action, reqbufsize, reqsize; int action, reqbufsize, reqsize;
reqbufsize = BUFSIZE; reqbufsize = BUFSIZE;
reqsize = (int)strlen(buf) + 1; reqsize = (int)strlen((char *)buf) + 1;
action = handlehdrfilterscli(param, &buf, &reqbufsize, 0, &reqsize); action = handlehdrfilterscli(param, &buf, &reqbufsize, 0, &reqsize);
if(action == HANDLED){ if(action == HANDLED){
@@ -119,43 +118,45 @@ void * ftpprchild(struct clientparam* param) {
so._closesocket(clidatasock); so._closesocket(clidatasock);
clidatasock = INVALID_SOCKET; clidatasock = INVALID_SOCKET;
} }
if ((clidatasock=socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);} if ((clidatasock=socket(SASOCK(&param->sincl), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);}
sasize = sizeof(struct sockaddr_in); *SAPORT(&param->sincl) = 0;
if(so._getsockname(param->ctrlsock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(824);} if(so._bind(clidatasock, (struct sockaddr *)&param->sincl, SASIZE(&param->sincl))){RETURN(822);}
param->sinc.sin_port = 0;
if(so._bind(clidatasock, (struct sockaddr *)&param->sinc, sasize)){RETURN(822);}
if (pasv) { if (pasv) {
if(so._listen(clidatasock, 1)) {RETURN(823);} if(so._listen(clidatasock, 1)) {RETURN(823);}
if(so._getsockname(clidatasock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(824);} sasize = sizeof(param->sincl);
sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n", if(so._getsockname(clidatasock, (struct sockaddr *)&param->sincl, &sasize)){RETURN(824);}
(unsigned)(((unsigned char *)(&param->sinc.sin_addr.s_addr))[0]), if(*SAFAMILY(&param->sincl) == AF_INET)
(unsigned)(((unsigned char *)(&param->sinc.sin_addr.s_addr))[1]), sprintf((char *)buf, "227 OK (%u,%u,%u,%u,%u,%u)\r\n",
(unsigned)(((unsigned char *)(&param->sinc.sin_addr.s_addr))[2]), (unsigned)(((unsigned char *)(SAADDR(&param->sincl)))[0]),
(unsigned)(((unsigned char *)(&param->sinc.sin_addr.s_addr))[3]), (unsigned)(((unsigned char *)(SAADDR(&param->sincl)))[1]),
(unsigned)(((unsigned char *)(&param->sinc.sin_port))[0]), (unsigned)(((unsigned char *)(SAADDR(&param->sincl)))[2]),
(unsigned)(((unsigned char *)(&param->sinc.sin_port))[1]) (unsigned)(((unsigned char *)(SAADDR(&param->sincl)))[3]),
); (unsigned)(((unsigned char *)(SAPORT(&param->sincl)))[0]),
(unsigned)(((unsigned char *)(SAPORT(&param->sincl)))[1])
);
else sprintf((char *)buf, "227 OK (127,0,0,1,%u,%u)\r\n",
(unsigned)(((unsigned char *)(SAPORT(&param->sincl)))[0]),
(unsigned)(((unsigned char *)(SAPORT(&param->sincl)))[1])
);
} }
else { else {
unsigned long b1, b2, b3, b4; unsigned long b1, b2, b3, b4;
unsigned short b5, b6; unsigned short b5, b6;
if(sscanf((char *)buf+5, "%lu,%lu,%lu,%lu,%hu,%hu", &b1, &b2, &b3, &b4, &b5, &b6)!=6) {RETURN(828);} if(sscanf((char *)buf+5, "%lu,%lu,%lu,%lu,%hu,%hu", &b1, &b2, &b3, &b4, &b5, &b6)!=6) {RETURN(828);}
param->sinc.sin_family = AF_INET; *SAPORT(&param->sincr) = htons((unsigned short)((b5<<8)^b6));
param->sinc.sin_port = htons((unsigned short)((b5<<8)^b6)); if(so._connect(clidatasock, (struct sockaddr *)&param->sincr, SASIZE(&param->sincr))) {
param->sinc.sin_addr.s_addr = htonl((b1<<24)^(b2<<16)^(b3<<8)^b4);
if(so._connect(clidatasock, (struct sockaddr *)&param->sinc, sasize)) {
so._closesocket(clidatasock); so._closesocket(clidatasock);
clidatasock = INVALID_SOCKET; clidatasock = INVALID_SOCKET;
RETURN(826); RETURN(826);
} }
sprintf(buf, "200 OK\r\n"); sprintf((char *)buf, "200 OK\r\n");
} }
#ifndef WITHMAIN #ifndef WITHMAIN
{ {
int action, reqbufsize, reqsize; int action, reqbufsize, reqsize;
reqbufsize = BUFSIZE; reqbufsize = BUFSIZE;
reqsize = (int)strlen(buf) + 1; reqsize = (int)strlen((char *)buf) + 1;
action = handlehdrfilterssrv(param, &buf, &reqbufsize, 0, &reqsize); action = handlehdrfilterssrv(param, &buf, &reqbufsize, 0, &reqsize);
if(action == HANDLED){ if(action == HANDLED){
@@ -183,7 +184,7 @@ void * ftpprchild(struct clientparam* param) {
{ {
int action, reqbufsize, reqsize; int action, reqbufsize, reqsize;
reqbufsize = BUFSIZE; reqbufsize = BUFSIZE;
reqsize = (int)strlen(buf) + 1; reqsize = (int)strlen((char *)buf) + 1;
action = handlehdrfilterscli(param, &buf, &reqbufsize, 0, &reqsize); action = handlehdrfilterscli(param, &buf, &reqbufsize, 0, &reqsize);
if(action == HANDLED){ if(action == HANDLED){
@@ -203,8 +204,8 @@ void * ftpprchild(struct clientparam* param) {
if(res != 1) { if(res != 1) {
RETURN(857); RETURN(857);
} }
sasize = sizeof(struct sockaddr_in); sasize = sizeof(param->sincr);
ss = so._accept(clidatasock, (struct sockaddr *)&param->sinc, &sasize); ss = so._accept(clidatasock, (struct sockaddr *)&param->sincr, &sasize);
if (ss == INVALID_SOCKET) { RETURN (858);} if (ss == INVALID_SOCKET) { RETURN (858);}
so._shutdown(clidatasock, SHUT_RDWR); so._shutdown(clidatasock, SHUT_RDWR);
so._closesocket(clidatasock); so._closesocket(clidatasock);
@@ -238,8 +239,8 @@ void * ftpprchild(struct clientparam* param) {
} }
sc = param->remsock; sc = param->remsock;
param->remsock = ss; param->remsock = ss;
so._setsockopt(param->remsock, SOL_SOCKET, SO_LINGER, (unsigned char *)&lg, sizeof(lg)); so._setsockopt(param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
so._setsockopt(clidatasock, SOL_SOCKET, SO_LINGER, (unsigned char *)&lg, sizeof(lg)); so._setsockopt(clidatasock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
param->clisock = clidatasock; param->clisock = clidatasock;
res = sockmap(param, conf.timeouts[CONNECTION_S]); res = sockmap(param, conf.timeouts[CONNECTION_S]);
if(param->remsock != INVALID_SOCKET) { if(param->remsock != INVALID_SOCKET) {
@@ -274,7 +275,7 @@ void * ftpprchild(struct clientparam* param) {
buf[i++] = '\r'; buf[i++] = '\r';
buf[i++] = '\n'; buf[i++] = '\n';
if(socksend(param->remsock, buf, i, conf.timeouts[STRING_S])!=i) {RETURN (811);} if(socksend(param->remsock, buf, i, conf.timeouts[STRING_S])!=i) {RETURN (811);}
param->statscli += i; param->statscli64+=(i);
param->nwrites++; param->nwrites++;
while((i = sockgetlinebuf(param, SERVER, buf, BUFSIZE, '\n', conf.timeouts[STRING_L])) > 0){ while((i = sockgetlinebuf(param, SERVER, buf, BUFSIZE, '\n', conf.timeouts[STRING_L])) > 0){
if(socksend(param->ctrlsock, buf, i, conf.timeouts[STRING_S])!=i) {RETURN (812);} if(socksend(param->ctrlsock, buf, i, conf.timeouts[STRING_S])!=i) {RETURN (812);}
@@ -283,9 +284,9 @@ void * ftpprchild(struct clientparam* param) {
if(status == 5) {RETURN (0);} if(status == 5) {RETURN (0);}
if(i < 3) {RETURN (813);} if(i < 3) {RETURN (813);}
} }
sasize = sizeof(struct sockaddr_in); sasize = sizeof(param->sincr);
if(so._getpeername(param->ctrlsock, (struct sockaddr *)&param->sinc, &sasize)){RETURN(819);} if(so._getpeername(param->ctrlsock, (struct sockaddr *)&param->sincr, &sasize)){RETURN(819);}
if(req && (param->statscli || param->statssrv)){ if(req && (param->statscli64 || param->statssrv64)){
(*param->srv->logfunc)(param, (unsigned char *)req); (*param->srv->logfunc)(param, (unsigned char *)req);
} }
} }
@@ -304,9 +305,9 @@ CLEANRET:
so._shutdown(clidatasock, SHUT_RDWR); so._shutdown(clidatasock, SHUT_RDWR);
so._closesocket(clidatasock); so._closesocket(clidatasock);
} }
sasize = sizeof(struct sockaddr_in); sasize = sizeof(param->sincr);
so._getpeername(param->ctrlsock, (struct sockaddr *)&param->sinc, &sasize); so._getpeername(param->ctrlsock, (struct sockaddr *)&param->sincr, &sasize);
if(param->res != 0 || param->statscli || param->statssrv ){ if(param->res != 0 || param->statscli64 || param->statssrv64 ){
(*param->srv->logfunc)(param, (unsigned char *)((req && (param->res > 802))? req:NULL)); (*param->srv->logfunc)(param, (unsigned char *)((req && (param->res > 802))? req:NULL));
} }
if(req) myfree(req); if(req) myfree(req);
+21 -25
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: icqpr.c,v 1.30 2012-04-11 23:01:19 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -26,20 +25,20 @@ struct flap_header {
unsigned char chan; unsigned char chan;
unsigned short seq; unsigned short seq;
unsigned short size; unsigned short size;
char data[0]; char data[1];
}; };
struct snack_header { struct snack_header {
unsigned family; unsigned family;
unsigned short flags; unsigned short flags;
unsigned id; unsigned id;
char data[0]; char data[1];
}; };
struct tlv_header { struct tlv_header {
unsigned short type; unsigned short type;
unsigned short size; unsigned short size;
char data[0]; char data[1];
}; };
@@ -105,11 +104,11 @@ static void addbuffer(int increment, struct clientparam * param, unsigned char *
*buf_p = newbuf; *buf_p = newbuf;
*bufsize_p = bufsize; *bufsize_p = bufsize;
} }
if(increment) len = sockrecvfrom(param->remsock, &param->sins, *buf_p + *length_p, increment, conf.timeouts[STRING_S]*1000); if(increment) len = sockrecvfrom(param->remsock, (struct sockaddr *)&param->sinsr, *buf_p + *length_p, increment, conf.timeouts[STRING_S]*1000);
if(len > 0) { if(len > 0) {
*length_p += len; *length_p += len;
param->nreads++; param->nreads++;
param->statssrv += len; param->statssrv64 += len;
} }
return; return;
} }
@@ -118,7 +117,7 @@ static void addbuffer(int increment, struct clientparam * param, unsigned char *
static int searchcookie(struct clientparam *param, struct flap_header * flap, int len, int * dif, struct tlv_header *tlv, int extra){ static int searchcookie(struct clientparam *param, struct flap_header * flap, int len, int * dif, struct tlv_header *tlv, int extra){
struct icq_cookie *ic; struct icq_cookie *ic;
char smallbuf[32]; char smallbuf[64];
struct tlv_header *bostlv = NULL; struct tlv_header *bostlv = NULL;
struct sockaddr_in sa; struct sockaddr_in sa;
SASIZETYPE size = sizeof(sa); SASIZETYPE size = sizeof(sa);
@@ -129,11 +128,11 @@ static int searchcookie(struct clientparam *param, struct flap_header * flap, in
icq_cookie_mutex_init = 1; icq_cookie_mutex_init = 1;
} }
pthread_mutex_lock(&icq_cookie_mutex); pthread_mutex_lock(&icq_cookie_mutex);
for(ic = icq_cookies; ic; ic = ic->next)if(!strcmp(param->username, ic->id))break; for(ic = icq_cookies; ic; ic = ic->next)if(!strcmp((char *)param->username, ic->id))break;
if(!ic){ if(!ic){
ic = myalloc(sizeof(struct icq_cookie)); ic = myalloc(sizeof(struct icq_cookie));
memset(ic, 0, sizeof(struct icq_cookie)); memset(ic, 0, sizeof(struct icq_cookie));
ic->id = mystrdup(param->username); ic->id = mystrdup((char *)param->username);
ic->next = icq_cookies; ic->next = icq_cookies;
icq_cookies = ic; icq_cookies = ic;
} }
@@ -165,7 +164,7 @@ static int searchcookie(struct clientparam *param, struct flap_header * flap, in
pthread_mutex_unlock(&icq_cookie_mutex); pthread_mutex_unlock(&icq_cookie_mutex);
if(bostlv){ if(bostlv){
if(so._getsockname(param->clisock, (struct sockaddr *)&sa, &size)==-1) return 1; if(so._getsockname(param->clisock, (struct sockaddr *)&sa, &size)==-1) return 1;
len = myinet_ntoa(sa.sin_addr, smallbuf); len = myinet_ntop(*SAFAMILY(&sa),SAADDR(&sa), smallbuf, 64);
if(strchr(ic->connectstring, ':'))sprintf(smallbuf+len, ":%hu", ntohs(sa.sin_port)); if(strchr(ic->connectstring, ':'))sprintf(smallbuf+len, ":%hu", ntohs(sa.sin_port));
len = (int)strlen(smallbuf); len = (int)strlen(smallbuf);
*dif = len - (int)ntohs(bostlv->size); *dif = len - (int)ntohs(bostlv->size);
@@ -203,10 +202,10 @@ static FILTER_ACTION icq_srv(void *fc, struct clientparam * param, unsigned char
state->state = ONCHAN; state->state = ONCHAN;
} }
else { else {
if(!state->leftinstate)param->srv->logfunc(param, "Warning: need resync"); if(!state->leftinstate)param->srv->logfunc(param, (unsigned char *)"Warning: need resync");
state->leftinstate++; state->leftinstate++;
if(state->leftinstate > 65535){ if(state->leftinstate > 65535){
param->srv->logfunc(param, "Out of Sync"); param->srv->logfunc(param, (unsigned char *)"Out of Sync");
return REJECT; return REJECT;
} }
} }
@@ -215,7 +214,7 @@ static FILTER_ACTION icq_srv(void *fc, struct clientparam * param, unsigned char
break; break;
case ONCHAN: case ONCHAN:
if (*start >= 10){ if (*start >= 10){
param->srv->logfunc(param, "Warning: Wrong channel"); param->srv->logfunc(param, (unsigned char *)"Warning: Wrong channel");
state->state = ONBEGIN; state->state = ONBEGIN;
} }
else { else {
@@ -235,15 +234,15 @@ static FILTER_ACTION icq_srv(void *fc, struct clientparam * param, unsigned char
case ONSEQ2: case ONSEQ2:
state->gotseq += *start; state->gotseq += *start;
if(state->gotseq != state->srvseq){ if(state->gotseq != state->srvseq){
char smallbuf[64]; unsigned char smallbuf[64];
if(((state->gotseq < state->srvseq) || ((state->gotseq - state->srvseq) > 10 )) && (!state->resyncseq || state->gotseq != state->resyncseq)){ if(((state->gotseq < state->srvseq) || ((state->gotseq - state->srvseq) > 10 )) && (!state->resyncseq || state->gotseq != state->resyncseq)){
sprintf(smallbuf, "Warning: Wrong sequence, expected: %04hx got: %04hx", state->srvseq, state->gotseq); sprintf((char *)smallbuf, "Warning: Wrong sequence, expected: %04hx got: %04hx", state->srvseq, state->gotseq);
param->srv->logfunc(param, smallbuf); param->srv->logfunc(param, smallbuf);
state->state = ONBEGIN; state->state = ONBEGIN;
state->resyncseq = state->gotseq; state->resyncseq = state->gotseq;
break; break;
} }
sprintf(smallbuf, "Warning: %hu flaps are lost on resync", state->gotseq - state->srvseq ); sprintf((char *)smallbuf, "Warning: %d flaps are lost on resync", state->gotseq - state->srvseq );
param->srv->logfunc(param, smallbuf); param->srv->logfunc(param, smallbuf);
state->srvseq = state->gotseq; state->srvseq = state->gotseq;
*(start-1) = (state->seq>>8); *(start-1) = (state->seq>>8);
@@ -340,7 +339,7 @@ static int readflap(struct clientparam * param, int direction, unsigned char *bu
if(flap->id != 0x2a) return 2; if(flap->id != 0x2a) return 2;
len = ntohs(flap->size); len = ntohs(flap->size);
if(len > buflen-6) return 3; if(len > buflen-6) return 3;
i = sockgetlinebuf(param, direction, flap->data, len, EOF, conf.timeouts[STRING_S]); i = sockgetlinebuf(param, direction, (unsigned char *)flap->data, len, EOF, conf.timeouts[STRING_S]);
if(len != i) return 4; if(len != i) return 4;
return 0; return 0;
@@ -419,7 +418,7 @@ void * icqprchild(struct clientparam* param) {
for(ic = icq_cookies; ic; ic=ic->next){ for(ic = icq_cookies; ic; ic=ic->next){
if(ic->size && ic->size == tlv->size && !memcmp(ic->cookie, tlv->data, ntohs(tlv->size))){ if(ic->size && ic->size == tlv->size && !memcmp(ic->cookie, tlv->data, ntohs(tlv->size))){
parsehostname((char *)ic->connectstring, param, ntohs(param->srv->targetport)); parsehostname((char *)ic->connectstring, param, ntohs(param->srv->targetport));
if(!param->username && ic->id) param->username = mystrdup(ic->id); if(!param->username && ic->id) param->username = (unsigned char *)mystrdup(ic->id);
break; break;
} }
} }
@@ -437,20 +436,17 @@ void * icqprchild(struct clientparam* param) {
if(greet){ if(greet){
if(socksend(param->remsock, tmpsend, 10, conf.timeouts[STRING_S])!=10) {RETURN (1105);} if(socksend(param->remsock, tmpsend, 10, conf.timeouts[STRING_S])!=10) {RETURN (1105);}
param->statscli += 10; param->statscli64 += 10;
} }
if(readflap(param, SERVER, tmpsend, 1024)) {RETURN (1111);} if(readflap(param, SERVER, tmpsend, 1024)) {RETURN (1111);}
param->statssrv += (ntohs(((struct flap_header *)tmpsend)->size) + 6); param->statssrv64 += (ntohs(((struct flap_header *)tmpsend)->size) + 6);
mystate.srvseq = ntohs(((struct flap_header *)tmpsend)->seq) + 1; mystate.srvseq = ntohs(((struct flap_header *)tmpsend)->seq) + 1;
mystate.seq = 1; mystate.seq = 1;
len = ntohs(flap->size) + 6; len = ntohs(flap->size) + 6;
if((res=handledatfltcli(param, &buf, &buflen, offset, &len))!=PASS) RETURN(res); if((res=handledatfltcli(param, &buf, &buflen, offset, &len))!=PASS) RETURN(res);
if(socksend(param->remsock, buf+offset, len, conf.timeouts[STRING_S])!=(ntohs(flap->size)+6)) {RETURN (1106);} if(socksend(param->remsock, buf+offset, len, conf.timeouts[STRING_S])!=(ntohs(flap->size)+6)) {RETURN (1106);}
offset = 0; offset = 0;
param->statscli += len; param->statscli64 += len;
if(logintype == ICQMD5) { if(logintype == ICQMD5) {
if(readflap(param, SERVER, buf, 65550)) {RETURN (1112);} if(readflap(param, SERVER, buf, 65550)) {RETURN (1112);}
@@ -466,7 +462,7 @@ void * icqprchild(struct clientparam* param) {
len = ntohs(flap->size) + 6; len = ntohs(flap->size) + 6;
if((res=handledatfltcli(param, &buf, &buflen, offset, &len))!=PASS) RETURN(res); if((res=handledatfltcli(param, &buf, &buflen, offset, &len))!=PASS) RETURN(res);
if(socksend(param->remsock, buf+offset, len, conf.timeouts[STRING_S])!=len) {RETURN (1115);} if(socksend(param->remsock, buf+offset, len, conf.timeouts[STRING_S])!=len) {RETURN (1115);}
param->statscli += len; param->statscli64 += len;
offset = 0; offset = 0;
} }
if(logintype != ICQCOOKIE) { if(logintype != ICQCOOKIE) {
-2
View File
@@ -1,8 +1,6 @@
/* /*
* md4c.c MD4 message-digest algorithm * md4c.c MD4 message-digest algorithm
* *
* Version: $Id: md4.c,v 1.1 2010-11-11 11:32:32 v.dubrovin Exp $
*
* License to copy and use this software is granted provided that it * License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software * Algorithm" in all material mentioning or referencing this software
-234
View File
@@ -1,234 +0,0 @@
/*
3APA3A simpliest proxy server
(c) 2002-2008 by ZARAZA <3APA3A@security.nnov.ru>
please read License Agreement
$Id: msnpr.c,v 1.3 2012-04-11 23:01:19 vlad Exp $
*/
#include "proxy.h"
#ifndef PORTMAP
#define PORTMAP
#endif
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
struct msn_cookie {
struct msn_cookie *next;
unsigned char *userid;
char * connectstring;
};
static struct msn_cookie *msn_cookies = NULL;
pthread_mutex_t msn_cookie_mutex;
int msn_cookie_mutex_init = 0;
static void msn_clear(void *fo){
};
static FILTER_ACTION msn_srv(void *fc, struct clientparam * param, unsigned char ** buf_p, int * bufsize_p, int offset, int * length_p){
unsigned char *data = *buf_p + offset;
int len = (int)(*length_p - offset);
struct sockaddr_in sa;
SASIZETYPE size = sizeof(sa);
struct msn_cookie *cookie;
char tmpbuf[256];
char *sp1, *sp2, *sp3;
if(*bufsize_p - *length_p < 32) return CONTINUE;
if(len < 10 || len > 220) return CONTINUE;
data[len] = 0;
sp1 = data + 3;
if(data[0] == 'X' && data[1] == 'F' && data[2] == 'R' && data[3] == ' '){
if(!(sp2 = strchr(sp1 + 1, ' ')) || !(sp2 = strchr(sp2 + 1, ' '))|| !(sp3 = strchr(sp2 + 1, ' '))) return CONTINUE;
}
else if(data[0] == 'R' && data[1] == 'N' && data[2] == 'G' && data[3] == ' '){
if(!(sp2 = strchr(sp1 + 1, ' ')) || !(sp3 = strchr(sp2 + 1, ' '))) return CONTINUE;
}
else return CONTINUE;
*sp2 = 0;
*sp3 = 0;
if(getsockname(param->clisock, (struct sockaddr *)&sa, &size)==-1) {
return CONTINUE;
};
cookie = myalloc(sizeof(struct msn_cookie));
cookie->connectstring = mystrdup(sp2 + 1);
cookie->userid = mystrdup(param->username);
pthread_mutex_lock(&msn_cookie_mutex);
cookie->next = msn_cookies;
msn_cookies = cookie;
pthread_mutex_unlock(&msn_cookie_mutex);
strcpy(tmpbuf, data);
len = (int)strlen(tmpbuf);
tmpbuf[len++] = ' ';
len+=myinet_ntoa(sa.sin_addr, tmpbuf+len);
sprintf(tmpbuf+len, ":%hu %s", ntohs(sa.sin_port), sp3 + 1);
len = (int)strlen(tmpbuf);
memcpy(*buf_p + offset, tmpbuf, len);
*length_p = offset + len;
return CONTINUE;
}
static struct filter msnfilter = {
NULL,
"msnfilter",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
*msn_srv,
*msn_clear,
NULL
};
void * msnprchild(struct clientparam* param) {
int res, len;
unsigned char *buf;
int buflen = 256;
char *sp1, *sp2, *sp3;
char *verstr = NULL;
int id;
struct msn_cookie *cookie, *prevcookie=NULL;
int sec = 0;
struct filterp **newfilters;
int skip = 0;
struct filterp msnfilterp = {
&msnfilter,
(void *)&skip
};
if(!msn_cookie_mutex_init){
msn_cookie_mutex_init = 1;
pthread_mutex_init(&msn_cookie_mutex, NULL);
}
buf = myalloc(buflen);
res = sockgetlinebuf(param, CLIENT, buf, 240, '\n', conf.timeouts[STRING_S]);
if(res < 10) RETURN(1201);
buf[res] = 0;
if(!(sp1 = strchr(buf, ' ')) || !(sp2 = strchr(sp1 + 1, ' ')) || !(sp3 = strchr(sp2 + 1, ' ')) || ((int)(sp3-sp2)) < 6) RETURN(1202);
if((buf[0] == 'U' && buf[1] == 'S' && buf[2] == 'R') ||
(buf[0] == 'A' && buf[1] == 'N' && buf[2] == 'S')){
len = 1 + (int)(sp3 - sp2);
param->username = myalloc(len - 1);
memcpy(param->username, sp2 + 1, len - 2);
sec = 1;
}
else if(buf[0] != 'V' || buf[1] != 'E' || buf[2] != 'R') {RETURN(1203);}
else {
id = atoi(sp1 + 1);
verstr = mystrdup(buf);
if(socksend(param->clisock, buf, res, conf.timeouts[STRING_S])!=res) {RETURN (1204);}
res = sockgetlinebuf(param, CLIENT, buf, 240, '\n', conf.timeouts[STRING_S]);
if(res < 10) RETURN(1205);
buf[res] = 0;
if(buf[0] != 'C' || buf[1] != 'V' || buf[2] != 'R' || !(sp1=strrchr(buf,' ')) || (len = (int)strlen(sp1+1)) < 3) RETURN(1206);
param->username = myalloc(len - 1);
memcpy(param->username, sp1 + 1, len - 2);
}
param->username[len - 2] = 0;
param->operation = CONNECT;
pthread_mutex_lock(&msn_cookie_mutex);
for(cookie = msn_cookies; cookie; cookie = cookie->next){
if(!strcmp(param->username, cookie->userid)){
parsehostname(cookie->connectstring, param, ntohs(param->srv->targetport));
if(prevcookie)prevcookie->next = cookie->next;
else msn_cookies = cookie->next;
myfree(cookie->connectstring);
myfree(cookie->userid);
myfree(cookie);
break;
}
prevcookie = cookie;
}
pthread_mutex_unlock(&msn_cookie_mutex);
if(!cookie) {
if(sec) RETURN(1233);
parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport));
}
res = (*param->srv->authfunc)(param);
if(res) {RETURN(res);}
if(!sec){
len = (int)strlen(verstr);
if(socksend(param->remsock, verstr, len, conf.timeouts[STRING_S])!= len) {RETURN (1207);}
param->statscli += len;
myfree(verstr);
verstr = mystrdup(buf);
len = sockgetlinebuf(param, SERVER, buf, 240, '\n', conf.timeouts[STRING_S]);
if(len < 10) RETURN(1208);
param->statssrv += len;
strcpy(buf, verstr);
}
len = (int)strlen(buf);
if((res=handledatfltcli(param, &buf, &buflen, 0, &len))!=PASS) RETURN(res);
if(socksend(param->remsock, buf, len, conf.timeouts[STRING_S])!= len) {RETURN (1207);}
param->statscli += len;
if(sec){
RETURN(sockmap(param, conf.timeouts[CONNECTION_L]));
}
param->ndatfilterssrv++;
newfilters = myalloc(param->ndatfilterssrv * sizeof(struct filterp *));
if(param->ndatfilterssrv > 1){
memcpy(newfilters, param->datfilterssrv, (param->ndatfilterssrv - 1) * sizeof(struct filterp *));
myfree(param->datfilterssrv);
}
param->datfilterssrv = newfilters;
newfilters[param->ndatfilterssrv - 1] = &msnfilterp;
param->res = sockmap(param, conf.timeouts[CONNECTION_L]);
param->ndatfilterssrv--;
CLEANRET:
if(verstr)myfree(verstr);
if(buf)myfree(buf);
(*param->srv->logfunc)(param, NULL);
freeparam(param);
return (NULL);
}
#ifdef WITHMAIN
struct proxydef childdef = {
msnprchild,
0,
0,
S_MSNPR,
""
};
#include "proxymain.c"
#endif
+1 -2
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: myalloc.c,v 1.5 2008/01/08 21:46:38 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -333,7 +332,7 @@ void *myrealloc(void *ptr, size_t size){
if(size <= memsizes[l]) return ptr; if(size <= memsizes[l]) return ptr;
p = myalloc(size); p = myalloc(size);
if(p){ if(p){
memcpy(p,ptr,size); memmove(p,ptr,size);
myfree(ptr); myfree(ptr);
} }
return p; return p;
-1
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: mycrypt.c,v 1.8 2008/01/08 21:46:38 vlad Exp $
*/ */
#include "libs/md5.h" #include "libs/md5.h"
#include "libs/md4.h" #include "libs/md4.h"
+2 -3
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: ntlm.c,v 1.9 2008/01/08 21:46:38 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -81,8 +80,8 @@ void genchallenge(struct clientparam *param, char * challenge, char *buf){
chal->flags[3] = 0xA0; chal->flags[3] = 0xA0;
text2unicode(hostname, (char *)chal->data, 64); text2unicode(hostname, (char *)chal->data, 64);
time((time_t *)challenge); time((time_t *)challenge);
memcpy(challenge+4, &param->sinc.sin_addr.s_addr, 4); memcpy(challenge+4, SAADDR(&param->sincr), 4);
challenge[1]^=param->sinc.sin_port; challenge[1]^=*SAPORT(&param->sincr);
for(i = 0; i < 8; i++) challenge[i] ^= myrand(challenge, 8); for(i = 0; i < 8; i++) challenge[i] ^= myrand(challenge, 8);
memcpy(chal->challenge, challenge, 8); memcpy(chal->challenge, challenge, 8);
en64((unsigned char *)tmpbuf, (unsigned char *)buf, (int)((unsigned char *)chal->data - (unsigned char *)chal) + len); en64((unsigned char *)tmpbuf, (unsigned char *)buf, (int)((unsigned char *)chal->data - (unsigned char *)chal) + len);
+39 -39
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: ntlm.c,v 1.8 2007/12/27 13:20:04 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -33,10 +32,10 @@ struct symbol symbols[] = {
{symbols+5, "sockgetcharcli", (void *) sockgetcharcli}, {symbols+5, "sockgetcharcli", (void *) sockgetcharcli},
{symbols+6, "sockgetcharsrv", (void *) sockgetcharsrv}, {symbols+6, "sockgetcharsrv", (void *) sockgetcharsrv},
{symbols+7, "sockgetlinebuf", (void *) sockgetlinebuf}, {symbols+7, "sockgetlinebuf", (void *) sockgetlinebuf},
{symbols+8, "myinet_ntoa", (void *) myinet_ntoa}, {symbols+8, "myinet_ntop", (void *) myinet_ntop},
{symbols+9, "dobuf", (void *) dobuf}, {symbols+9, "dobuf", (void *) dobuf},
{symbols+10, "scanaddr", (void *) scanaddr}, {symbols+10, "scanaddr", (void *) scanaddr},
{symbols+11, "getip", (void *) getip}, {symbols+11, "getip46", (void *) getip46},
{symbols+12, "sockmap", (void *) sockmap}, {symbols+12, "sockmap", (void *) sockmap},
{symbols+13, "sockfuncs", (void *) &so}, {symbols+13, "sockfuncs", (void *) &so},
{symbols+14, "ACLmatches", (void *) ACLmatches}, {symbols+14, "ACLmatches", (void *) ACLmatches},
@@ -44,40 +43,41 @@ struct symbol symbols[] = {
{symbols+16, "trafcountfunc", (void *) trafcountfunc}, {symbols+16, "trafcountfunc", (void *) trafcountfunc},
{symbols+17, "alwaysauth", (void *) alwaysauth}, {symbols+17, "alwaysauth", (void *) alwaysauth},
{symbols+18, "ipauth", (void *) ipauth}, {symbols+18, "ipauth", (void *) ipauth},
{symbols+19, "nbnameauth", (void *) nbnameauth}, {symbols+19, "strongauth", (void *) strongauth},
{symbols+20, "strongauth", (void *) strongauth}, {symbols+20, "checkACL", (void *) checkACL},
{symbols+21, "checkACL", (void *) checkACL}, {symbols+21, "nametohash", (void *) nametohash},
{symbols+22, "nametohash", (void *) nametohash}, {symbols+22, "hashindex", (void *) hashindex},
{symbols+23, "hashindex", (void *) hashindex}, {symbols+23, "nservers", (void *) nservers},
{symbols+24, "nservers", (void *) nservers}, {symbols+24, "udpresolve", (void *) udpresolve},
{symbols+25, "udpresolve", (void *) udpresolve}, {symbols+25, "bandlim_mutex", (void *) &bandlim_mutex},
{symbols+26, "bandlim_mutex", (void *) &bandlim_mutex}, {symbols+26, "tc_mutex", (void *) &tc_mutex},
{symbols+27, "tc_mutex", (void *) &tc_mutex}, {symbols+27, "hash_mutex", (void *) &hash_mutex},
{symbols+28, "hash_mutex", (void *) &hash_mutex}, {symbols+28, "pwl_mutex", (void *) &pwl_mutex},
{symbols+29, "pwl_mutex", (void *) &pwl_mutex}, {symbols+29, "linenum", (void *) &linenum},
{symbols+30, "linenum", (void *) &linenum}, {symbols+30, "proxy_stringtable", (void *) proxy_stringtable},
{symbols+31, "proxy_stringtable", (void *) proxy_stringtable}, {symbols+31, "en64", (void *) en64},
{symbols+32, "en64", (void *) en64}, {symbols+32, "de64", (void *) de64},
{symbols+33, "de64", (void *) de64}, {symbols+33, "tohex", (void *) tohex},
{symbols+34, "tohex", (void *) tohex}, {symbols+34, "fromhex", (void *) fromhex},
{symbols+35, "fromhex", (void *) fromhex}, {symbols+35, "dnspr", (void *) dnsprchild},
{symbols+36, "dnspr", (void *) dnsprchild}, {symbols+36, "pop3p", (void *) pop3pchild},
{symbols+37, "pop3p", (void *) pop3pchild}, {symbols+37, "proxy", (void *) proxychild},
{symbols+38, "proxy", (void *) proxychild}, {symbols+38, "socks", (void *) sockschild},
{symbols+39, "socks", (void *) sockschild}, {symbols+39, "tcppm", (void *) tcppmchild},
{symbols+40, "tcppm", (void *) tcppmchild}, {symbols+40, "udppm", (void *) udppmchild},
{symbols+41, "udppm", (void *) udppmchild}, {symbols+41, "admin", (void *) adminchild},
{symbols+42, "admin", (void *) adminchild}, {symbols+42, "ftppr", (void *) ftpprchild},
{symbols+43, "ftppr", (void *) ftpprchild}, {symbols+43, "smtpp", (void *) smtppchild},
{symbols+44, "smtpp", (void *) smtppchild}, {symbols+44, "icqpr", (void *) icqprchild},
{symbols+45, "icqpr", (void *) icqprchild}, /*
{symbols+46, "msnpr", (void *) msnprchild}, {symbols+45, "msnpr", (void *) msnprchild},
{symbols+47, "authfuncs", (void *) &authfuncs}, */
{symbols+48, "commandhandlers", (void *) &commandhandlers}, {symbols+45, "authfuncs", (void *) &authfuncs},
{symbols+49, "decodeurl", (void *) decodeurl}, {symbols+46, "commandhandlers", (void *) &commandhandlers},
{symbols+50, "parsestr", (void *) parsestr}, {symbols+47, "decodeurl", (void *) decodeurl},
{symbols+51, "make_ace", (void *) make_ace}, {symbols+48, "parsestr", (void *) parsestr},
{symbols+52, "freeacl", (void *) freeacl}, {symbols+49, "make_ace", (void *) make_ace},
{symbols+50, "freeacl", (void *) freeacl},
{NULL, "", NULL} {NULL, "", NULL}
}; };
@@ -103,11 +103,11 @@ struct pluginlink pluginlink = {
sockgetcharcli, sockgetcharcli,
sockgetcharsrv, sockgetcharsrv,
sockgetlinebuf, sockgetlinebuf,
myinet_ntoa, myinet_ntop,
dobuf, dobuf,
dobuf2, dobuf2,
scanaddr, scanaddr,
getip, getip46,
sockmap, sockmap,
ACLmatches, ACLmatches,
alwaysauth, alwaysauth,
+34 -14
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: FilePlugin.c,v 1.8 2012-04-11 23:01:22 vlad Exp $
*/ */
#include "../../structures.h" #include "../../structures.h"
@@ -847,6 +846,36 @@ static struct symbol fp_symbols[] = {
{NULL, "fp_stringtable", (void*) fp_stringtable} {NULL, "fp_stringtable", (void*) fp_stringtable}
}; };
static int h_cachedir(int argc, unsigned char **argv){
char * dirp;
size_t len;
dirp = (argc > 1)? argv[1] : getenv("TEMP");
len = strlen(dirp);
if(!dirp || !len || len > 200 || strchr(dirp, '%')) {
fprintf(stderr, "FilePlugin: invalid directory path: %s\n", dirp);
return (1);
}
#ifdef _WIN32
if(dirp[len-1] == '\\') dirp[len-1] = 0;
sprintf(path, "%.256s\\%%07d.tmp", dirp);
#else
if(dirp[len-1] == '/') dirp[len-1] = 0;
sprintf(path, "%.256s/%%07d.tmp", dirp);
#endif
return 0;
}
static int h_preview(int argc, unsigned char **argv){
preview = atoi(argv[1]);
return 0;
}
static struct commands file_commandhandlers[] = {
{file_commandhandlers + 1, "file_cachedir", h_cachedir, 2, 2},
{NULL, "file_preview", h_preview, 2, 2},
};
static int file_loaded=0; static int file_loaded=0;
@@ -858,7 +887,6 @@ __declspec(dllexport)
int file_plugin (struct pluginlink * pluginlink, int file_plugin (struct pluginlink * pluginlink,
int argc, char** argv){ int argc, char** argv){
char * dirp;
if(!file_loaded){ if(!file_loaded){
pthread_mutex_init(&file_mutex, NULL); pthread_mutex_init(&file_mutex, NULL);
file_loaded = 1; file_loaded = 1;
@@ -875,19 +903,11 @@ __declspec(dllexport)
pl->conf->filters = &fp_filter; pl->conf->filters = &fp_filter;
fp_symbols[1].next = pl->symbols.next; fp_symbols[1].next = pl->symbols.next;
pl->symbols.next = fp_symbols; pl->symbols.next = fp_symbols;
file_commandhandlers[1].next = pl->commandhandlers->next;
pl->commandhandlers->next = file_commandhandlers;
} }
dirp = (argc > 1)? argv[1] : getenv("TEMP"); h_cachedir(0, NULL);
if(strlen(dirp) > 200 || strchr(dirp, '%')) { preview = 32768;
fprintf(stderr, "FilePlugin: invalid directory path: %s\n", dirp);
return (13001);
}
#ifdef _WIN32
sprintf(path, "%.256s\\%%07d.tmp", dirp);
#else
sprintf(path, "%.256s/%%07d.tmp", dirp);
#endif
if(argc > 2) preview = atoi(argv[2]);
if(!preview) preview = 32768;
return 0; return 0;
+7
View File
@@ -0,0 +1,7 @@
all: $(BUILDDIR)ldapauth$(DLSUFFICS)
ldapauth$(OBJSUFFICS): ldapauth.c
$(CC) $(DCFLAGS) $(CFLAGS) ldapauth.c
$(BUILDDIR)ldapauth$(DLSUFFICS): ldapauth$(OBJSUFFICS)
$(LN) $(LNOUT)../../$(BUILDDIR)ldapauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)ladp$(LIBSSUFFIX) ldapauth$(OBJSUFFICS)
+15 -15
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: pcre_plugin.c,v 1.11 2012-04-25 18:17:22 vlad Exp $
*/ */
#include "../../structures.h" #include "../../structures.h"
@@ -145,7 +144,7 @@ static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, uns
if(!pcrefd->re) return pcrefd->action; if(!pcrefd->re) return pcrefd->action;
for(; offset < *length_p; nreplaces++){ for(; offset < *length_p; nreplaces++){
count = pcre_exec(pcrefd->re, NULL, *buf_p, *length_p, offset, 0, ovector, 48); count = pcre_exec(pcrefd->re, NULL, (char *)*buf_p, *length_p, offset, 0, ovector, 48);
if(count <= 0) break; if(count <= 0) break;
if(!(replace = pcrefd->replace) || param->nooverwritefilter) return pcrefd->action; if(!(replace = pcrefd->replace) || param->nooverwritefilter) return pcrefd->action;
@@ -196,7 +195,7 @@ static FILTER_ACTION pcre_filter_buffer(void *fc, struct clientparam *param, uns
} }
memcpy(newbuf, *buf_p, ovector[0]); memcpy(newbuf, *buf_p, ovector[0]);
(*pl->myfree)(*buf_p); (*pl->myfree)(*buf_p);
*buf_p = newbuf; *buf_p = (unsigned char *)newbuf;
*bufsize_p = ovector[0] + replen + 1; *bufsize_p = ovector[0] + replen + 1;
} }
memcpy(*buf_p + ovector[0], tmpbuf, replen); memcpy(*buf_p + ovector[0], tmpbuf, replen);
@@ -230,15 +229,15 @@ static int h_pcre(int argc, unsigned char **argv){
struct filter *newf; struct filter *newf;
char *replace = NULL; char *replace = NULL;
if(!strcmp(argv[2], "allow")) action = PASS; if(!strncmp((char *)argv[2], "allow",5)) action = PASS;
else if(!strcmp(argv[2], "deny")) action = REJECT; else if(!strncmp((char *)argv[2], "deny",4)) action = REJECT;
else if(!strcmp(argv[2], "remove")) action = REMOVE; else if(!strncmp((char *)argv[2], "remove",6)) action = REMOVE;
else if(!strcmp(argv[2], "dunno")) action = CONTINUE; else if(!strncmp((char *)argv[2], "dunno",5)) action = CONTINUE;
else return 1; else return 1;
if(!strcmp(argv[0], "pcre_rewrite")) { if(!strncmp((char *)argv[0], "pcre_rewrite", 12)) {
int i,j; int i,j;
offset = 5; offset = 5;
replace = pl->mystrdup(argv[4]); replace = pl->mystrdup((char *)argv[4]);
if(!replace) return 9; if(!replace) return 9;
for(i=0, j=0; replace[i]; i++, j++){ for(i=0, j=0; replace[i]; i++, j++){
if(replace[i] == '\\'){ if(replace[i] == '\\'){
@@ -267,6 +266,7 @@ static int h_pcre(int argc, unsigned char **argv){
replace[j] = 0; replace[j] = 0;
} }
if(!(acl = pl->make_ace(argc - offset, argv + offset))) return 2; if(!(acl = pl->make_ace(argc - offset, argv + offset))) return 2;
acl->nolog = (strstr((char *)argv[2],"log") == 0);
if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){ if(*argv[3] && !(*argv[3] == '*' && !argv[3][1]) ){
re = pcre_compile((char *)argv[3], pcre_options, &errptr, &offset, NULL); re = pcre_compile((char *)argv[3], pcre_options, &errptr, &offset, NULL);
if(!re) { if(!re) {
@@ -296,11 +296,11 @@ static int h_pcre(int argc, unsigned char **argv){
newf->data = flt; newf->data = flt;
newf->filter_open = pcre_filter_open; newf->filter_open = pcre_filter_open;
newf->filter_client = pcre_filter_client; newf->filter_client = pcre_filter_client;
if(strstr(argv[1], "request"))newf->filter_request = pcre_filter_buffer; if(strstr((char *)argv[1], "request"))newf->filter_request = pcre_filter_buffer;
if(strstr(argv[1], "cliheader"))newf->filter_header_cli = pcre_filter_buffer; if(strstr((char *)argv[1], "cliheader"))newf->filter_header_cli = pcre_filter_buffer;
if(strstr(argv[1], "clidata"))newf->filter_data_cli = pcre_filter_buffer; if(strstr((char *)argv[1], "clidata"))newf->filter_data_cli = pcre_filter_buffer;
if(strstr(argv[1], "srvheader"))newf->filter_header_srv = pcre_filter_buffer; if(strstr((char *)argv[1], "srvheader"))newf->filter_header_srv = pcre_filter_buffer;
if(strstr(argv[1], "srvdata"))newf->filter_data_srv = pcre_filter_buffer; if(strstr((char *)argv[1], "srvdata"))newf->filter_data_srv = pcre_filter_buffer;
newf->filter_clear = pcre_filter_clear; newf->filter_clear = pcre_filter_clear;
newf->filter_close = pcre_filter_close; newf->filter_close = pcre_filter_close;
@@ -334,7 +334,7 @@ static int h_pcre_options(int argc, unsigned char **argv){
pcre_options = 0; pcre_options = 0;
for(j=1; j<argc; j++) for(j=1; j<argc; j++)
for(i=0; pcreopts[i].name; i++) for(i=0; pcreopts[i].name; i++)
if(!strcmp(pcreopts[i].name, argv[j])) if(!strcmp(pcreopts[i].name, (char *)argv[j]))
pcre_options |= pcreopts[i].value; pcre_options |= pcreopts[i].value;
return 0; return 0;
+1 -1
View File
@@ -4,4 +4,4 @@ pamauth$(OBJSUFFICS): pamauth.c
$(CC) $(DCFLAGS) $(CFLAGS) pamauth.c $(CC) $(DCFLAGS) $(CFLAGS) pamauth.c
$(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS) $(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS)
$(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) -lpam pamauth$(OBJSUFFICS) $(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)pam$(LIBSSUFFIX) pamauth$(OBJSUFFICS)
+7 -4
View File
@@ -12,14 +12,14 @@ Kirill Lopuchov <lopuchov@mail.ru>
#include <security/pam_appl.h> #include <security/pam_appl.h>
pthread_mutex_t pam_mutex;
static int already_loaded = 0; static int already_loaded = 0;
static struct auth pamauth; static struct auth pamauth;
#ifdef USERCASE #ifdef USERCASE
static int usercaselow = 0; static int usercaselow = 0;
#edif #endif
static unsigned char *service=NULL; static unsigned char *service=NULL;
static struct pluginlink * pl; static struct pluginlink * pl;
@@ -89,9 +89,10 @@ static int pamfunc(struct clientparam *param)
/*start process auth */ /*start process auth */
conv.appdata_ptr = (char *) param->password; conv.appdata_ptr = (char *) param->password;
pthread_mutex_lock(&pam_mutex);
if (!pamh) if (!pamh)
{ {
retval = pam_start ((char *)service, "3proxy@" , &conv, &pamh); retval = pam_start ((char *)service, "3proxy@" , &conv, &pamh);
} }
if (retval == PAM_SUCCESS) if (retval == PAM_SUCCESS)
retval = pam_set_item (pamh, PAM_USER, param->username); retval = pam_set_item (pamh, PAM_USER, param->username);
@@ -110,6 +111,7 @@ static int pamfunc(struct clientparam *param)
retval = pam_end (pamh, retval); retval = pam_end (pamh, retval);
if (retval != PAM_SUCCESS) if (retval != PAM_SUCCESS)
{ pamh = NULL; } { pamh = NULL; }
pthread_mutex_unlock(&pam_mutex);
return rc; return rc;
@@ -124,12 +126,13 @@ int start(struct pluginlink * pluginlink, int argc, unsigned char** argv)
if(argc < 2) return 1; if(argc < 2) return 1;
pl = pluginlink; pl = pluginlink;
if(service) pl->myfree(service); if(service) pl->myfree(service);
service=pl->mystrdup(argv[1]); service=(unsigned char *)pl->mystrdup((char *)argv[1]);
if (already_loaded) { return (0); } if (already_loaded) { return (0); }
already_loaded = 1; already_loaded = 1;
pthread_mutex_init(&pam_mutex, NULL);
pamauth.authenticate = pamfunc; pamauth.authenticate = pamfunc;
pamauth.authorize = pluginlink->checkACL; pamauth.authorize = pluginlink->checkACL;
pamauth.desc = "pam"; pamauth.desc = "pam";
+35 -14
View File
@@ -2,12 +2,11 @@
#define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
#include "../../structures.h" #include "../../structures.h"
#include "../../proxy.h"
#include "my_ssl.h"
#include <memory.h> #include <memory.h>
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifndef _WIN32
#include <sys/file.h>
#endif
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/x509.h> #include <openssl/x509.h>
@@ -16,6 +15,12 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include <openssl/err.h>
#include "../../proxy.h"
#include "my_ssl.h"
typedef struct _ssl_conn { typedef struct _ssl_conn {
SSL_CTX *ctx; SSL_CTX *ctx;
SSL *ssl; SSL *ssl;
@@ -110,20 +115,23 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
static char hash_name[sizeof(src_cert->sha1_hash)*2 + 1]; static char hash_name[sizeof(src_cert->sha1_hash)*2 + 1];
static char cache_name[200]; static char cache_name[200];
pthread_mutex_lock(&ssl_file_mutex);
bin2hex(src_cert->sha1_hash, sizeof(src_cert->sha1_hash), hash_name, sizeof(hash_name)); bin2hex(src_cert->sha1_hash, sizeof(src_cert->sha1_hash), hash_name, sizeof(hash_name));
sprintf(cache_name, "%s%s.pem", cert_path, hash_name); sprintf(cache_name, "%s%s.pem", cert_path, hash_name);
/* check if certificate is already cached */ /* check if certificate is already cached */
fcache = fopen(cache_name, "rb"); fcache = fopen(cache_name, "rb");
if ( fcache != NULL ) { if ( fcache != NULL ) {
#ifndef _WIN32
flock(fileno(fcache), LOCK_SH);
#endif
dst_cert = PEM_read_X509(fcache, &dst_cert, NULL, NULL); dst_cert = PEM_read_X509(fcache, &dst_cert, NULL, NULL);
#ifndef _WIN32
flock(fileno(fcache), LOCK_UN);
#endif
fclose(fcache); fclose(fcache);
if ( dst_cert != NULL ){ if ( dst_cert != NULL ){
pthread_mutex_unlock(&ssl_file_mutex);
return dst_cert; return dst_cert;
} }
} }
pthread_mutex_unlock(&ssl_file_mutex);
/* proceed if certificate is not cached */ /* proceed if certificate is not cached */
dst_cert = X509_dup(src_cert); dst_cert = X509_dup(src_cert);
@@ -163,18 +171,22 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert)
/* write to cache */ /* write to cache */
pthread_mutex_lock(&ssl_file_mutex);
fcache = fopen(cache_name, "wb"); fcache = fopen(cache_name, "wb");
if ( fcache != NULL ) { if ( fcache != NULL ) {
#ifndef _WIN32
flock(fileno(fcache), LOCK_EX);
#endif
PEM_write_X509(fcache, dst_cert); PEM_write_X509(fcache, dst_cert);
#ifndef _WIN32
flock(fileno(fcache), LOCK_UN);
#endif
fclose(fcache); fclose(fcache);
} }
pthread_mutex_unlock(&ssl_file_mutex);
return dst_cert; return dst_cert;
} }
SSL_CONN ssl_handshake_to_server(SOCKET s, SSL_CERT *server_cert, char **errSSL) SSL_CONN ssl_handshake_to_server(SOCKET s, char * hostname, SSL_CERT *server_cert, char **errSSL)
{ {
int err = 0; int err = 0;
X509 *cert; X509 *cert;
@@ -204,6 +216,7 @@ SSL_CONN ssl_handshake_to_server(SOCKET s, SSL_CERT *server_cert, char **errSSL)
ssl_conn_free(conn); ssl_conn_free(conn);
return NULL; return NULL;
} }
if(hostname && *hostname)SSL_set_tlsext_host_name(conn->ssl, hostname);
err = SSL_connect(conn->ssl); err = SSL_connect(conn->ssl);
if ( err == -1 ) { if ( err == -1 ) {
*errSSL = ERR_error_string(ERR_get_error(), errbuf); *errSSL = ERR_error_string(ERR_get_error(), errbuf);
@@ -212,6 +225,10 @@ SSL_CONN ssl_handshake_to_server(SOCKET s, SSL_CERT *server_cert, char **errSSL)
} }
cert = SSL_get_peer_certificate(conn->ssl); cert = SSL_get_peer_certificate(conn->ssl);
if(!cert) {
ssl_conn_free(conn);
return NULL;
}
/* TODO: Verify certificate */ /* TODO: Verify certificate */
@@ -312,10 +329,14 @@ void ssl_conn_free(SSL_CONN connection)
{ {
ssl_conn *conn = (ssl_conn *) connection; ssl_conn *conn = (ssl_conn *) connection;
SSL_shutdown(conn->ssl); if(conn){
SSL_free(conn->ssl); if(conn->ssl){
SSL_CTX_free(conn->ctx); SSL_shutdown(conn->ssl);
free(conn); SSL_free(conn->ssl);
}
if(conn->ctx) SSL_CTX_free(conn->ctx);
free(conn);
}
} }
void _ssl_cert_free(SSL_CERT cert) void _ssl_cert_free(SSL_CERT cert)
+1 -1
View File
@@ -18,7 +18,7 @@ SSL_CERT ssl_copy_cert(SSL_CERT cert);
// //
// SSL/TLS handshakes // SSL/TLS handshakes
// //
SSL_CONN ssl_handshake_to_server(SOCKET s, SSL_CERT *server_cert, char **errSSL); SSL_CONN ssl_handshake_to_server(SOCKET s, char * hostname, SSL_CERT *server_cert, char **errSSL);
SSL_CONN ssl_handshake_to_client(SOCKET s, SSL_CERT server_cert, char **errSSL); SSL_CONN ssl_handshake_to_client(SOCKET s, SSL_CERT server_cert, char **errSSL);
// //
+59 -16
View File
@@ -4,17 +4,15 @@
please read License Agreement please read License Agreement
$Id: ssl_plugin.c,v 1.9 2010-11-11 11:32:33 v.dubrovin Exp $
*/ */
#include "../../structures.h" #include "../../structures.h"
#include "../../proxy.h"
#include <openssl/rsa.h> /* SSLeay stuff */ #include <openssl/rsa.h> /* SSLeay stuff */
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/err.h> #include "../../proxy.h"
#include "my_ssl.h" #include "my_ssl.h"
#ifndef _WIN32 #ifndef _WIN32
@@ -54,13 +52,15 @@ struct SSLqueue {
/* /*
Todo: use hashtable TO DO: use hashtable
*/ */
static struct SSLqueue *searchSSL(SOCKET s){ static struct SSLqueue *searchSSL(SOCKET s){
struct SSLqueue *sslq; struct SSLqueue *sslq = NULL;
pthread_mutex_lock(&ssl_mutex);
for(sslq = SSLq; sslq; sslq = sslq->next) for(sslq = SSLq; sslq; sslq = sslq->next)
if(sslq->s == s) return sslq; if(sslq->s == s) break;
return NULL; pthread_mutex_unlock(&ssl_mutex);
return sslq;
} }
static void addSSL(SOCKET s, SSL_CERT cert, SSL_CONN conn, struct clientparam* param){ static void addSSL(SOCKET s, SSL_CERT cert, SSL_CONN conn, struct clientparam* param){
@@ -235,7 +235,7 @@ int dossl(struct clientparam* param, SSL_CONN* ServerConnp, SSL_CONN* ClientConn
ul = ((unsigned long)ssl_connect_timeout)*1000; ul = ((unsigned long)ssl_connect_timeout)*1000;
setsockopt(param->remsock, SOL_SOCKET, SO_SNDTIMEO, (char *)&ul, 4); setsockopt(param->remsock, SOL_SOCKET, SO_SNDTIMEO, (char *)&ul, 4);
} }
ServerConn = ssl_handshake_to_server(param->remsock, &ServerCert, &errSSL); ServerConn = ssl_handshake_to_server(param->remsock, (char *)param->hostname, &ServerCert, &errSSL);
if ( ServerConn == NULL || ServerCert == NULL ) { if ( ServerConn == NULL || ServerCert == NULL ) {
param->res = 8011; param->res = 8011;
param->srv->logfunc(param, (unsigned char *)"SSL handshake to server failed"); param->srv->logfunc(param, (unsigned char *)"SSL handshake to server failed");
@@ -325,6 +325,52 @@ static struct filter ssl_filter = {
ssl_filter_close ssl_filter_close
}; };
int mitm = 0;
int ssl_inited = 0;
static int h_mitm(int argc, unsigned char **argv){
if(!ssl_inited) {
ssl_init();
ssl_inited = 1;
}
if((mitm&1)) return 1;
if(mitm) usleep(100*SLEEPTIME);
ssl_filter.next = pl->conf->filters;
pl->conf->filters = &ssl_filter;
mitm++;
return 0;
}
static int h_nomitm(int argc, unsigned char **argv){
struct filter * sf;
if(!(mitm&1)) return 1;
if(mitm) usleep(100*SLEEPTIME);
if(pl->conf->filters == &ssl_filter) pl->conf->filters = ssl_filter.next;
else for(sf = pl->conf->filters; sf && sf->next; sf=sf->next){
if(sf->next == &ssl_filter) {
sf->next = ssl_filter.next;
break;
}
}
mitm++;
return 0;
}
static int h_certpath(int argc, unsigned char **argv){
size_t len;
len = strlen(argv[1]);
if(!len || (argv[1][len - 1] != '/' && argv[1][len - 1] != '\\')) return 1;
if(cert_path && *cert_path) free(cert_path);
cert_path = strdup(argv[1]);
return 0;
}
static struct commands ssl_commandhandlers[] = {
{ssl_commandhandlers+1, "ssl_mitm", h_mitm, 1, 1},
{ssl_commandhandlers+2, "ssl_nomitm", h_nomitm, 1, 1},
{NULL, "ssl_certcache", h_certpath, 2, 2},
};
#ifdef _WIN32 #ifdef _WIN32
__declspec(dllexport) __declspec(dllexport)
@@ -333,15 +379,9 @@ __declspec(dllexport)
int ssl_plugin (struct pluginlink * pluginlink, int ssl_plugin (struct pluginlink * pluginlink,
int argc, char** argv){ int argc, char** argv){
pl = pluginlink; pl = pluginlink;
if(argc > 1) {
if(cert_path && *cert_path) free(cert_path);
cert_path = strdup(argv[1]);
}
if(!ssl_loaded){ if(!ssl_loaded){
ssl_loaded = 1; ssl_loaded = 1;
pthread_mutex_init(&ssl_mutex, NULL); pthread_mutex_init(&ssl_mutex, NULL);
ssl_filter.next = pl->conf->filters;
pl->conf->filters = &ssl_filter;
memcpy(&sso, pl->so, sizeof(struct sockfuncs)); memcpy(&sso, pl->so, sizeof(struct sockfuncs));
pl->so->_send = ssl_send; pl->so->_send = ssl_send;
pl->so->_recv = ssl_recv; pl->so->_recv = ssl_recv;
@@ -349,11 +389,14 @@ __declspec(dllexport)
pl->so->_recvfrom = ssl_recvfrom; pl->so->_recvfrom = ssl_recvfrom;
pl->so->_closesocket = ssl_closesocket; pl->so->_closesocket = ssl_closesocket;
pl->so->_poll = ssl_poll; pl->so->_poll = ssl_poll;
ssl_commandhandlers[2].next = pl->commandhandlers->next;
pl->commandhandlers->next = ssl_commandhandlers;
} }
else{ else {
ssl_release(); ssl_release();
ssl_inited = 0;
} }
ssl_init();
tcppmfunc = (PROXYFUNC)pl->findbyname("tcppm"); tcppmfunc = (PROXYFUNC)pl->findbyname("tcppm");
if(!tcppmfunc){return 13;} if(!tcppmfunc){return 13;}
proxyfunc = (PROXYFUNC)pl->findbyname("proxy"); proxyfunc = (PROXYFUNC)pl->findbyname("proxy");
+33 -5
View File
@@ -179,18 +179,27 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
int port; int port;
int rule = 0; int rule = 0;
struct trafcorrect * starttrafcorrect = firsttrafcorrect; struct trafcorrect * starttrafcorrect = firsttrafcorrect;
int statssrv_before, statscli_before; #ifndef NOPSTDINT
uint64_t statssrv_before, statscli_before;
#else
unsigned long statssrv_before, statscli_before;
#endif
int ok = 0; int ok = 0;
for (;starttrafcorrect != NULL; starttrafcorrect = starttrafcorrect->next) { for (;starttrafcorrect != NULL; starttrafcorrect = starttrafcorrect->next) {
port = starttrafcorrect->port; port = starttrafcorrect->port;
g_s = starttrafcorrect->p_service; g_s = starttrafcorrect->p_service;
if (starttrafcorrect->p_service == S_NOSERVICE) g_s = param->service; if (starttrafcorrect->p_service == S_NOSERVICE) g_s = param->service;
if (starttrafcorrect->port <= 0) port = myhtons(param->sins.sin_port); if (starttrafcorrect->port <= 0) port = myhtons(*SAPORT(&param->sinsr));
#ifndef NOPSTDINT
statssrv_before = param->statssrv64;
statscli_before = param->statscli64;
#else
statssrv_before = param->statssrv; statssrv_before = param->statssrv;
statscli_before = param->statscli; statscli_before = param->statscli;
#endif
rule++; rule++;
if (((g_s == param->service) && (port == myhtons(param->sins.sin_port))) || if (((g_s == param->service) && (port == myhtons(*SAPORT(&param->sinsr)))) ||
( ((starttrafcorrect->type == UDP) && ( ((starttrafcorrect->type == UDP) &&
((param->operation == UDPASSOC)|| ((param->operation == UDPASSOC)||
(param->operation == DNSRESOLVE)|| (param->operation == DNSRESOLVE)||
@@ -201,28 +210,47 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
/* ôèëüòð ïîäîø¸ë. ìîæíî èçìåíÿòü çíà÷åíèå òðàôôèêà /* ôèëüòð ïîäîø¸ë. ìîæíî èçìåíÿòü çíà÷åíèå òðàôôèêà
äîìíîæàåì íà ÷èñëî */ äîìíîæàåì íà ÷èñëî */
if (starttrafcorrect->type == MULTIPLAY) { if (starttrafcorrect->type == MULTIPLAY) {
#ifndef NOPSTDINT
param->statssrv64 = (unsigned)((double)param->statssrv64 *starttrafcorrect->coeff);
param->statscli64 = (unsigned)((double)param->statscli64 * starttrafcorrect->coeff);
#else
param->statssrv = (unsigned)((double)param->statssrv *starttrafcorrect->coeff); param->statssrv = (unsigned)((double)param->statssrv *starttrafcorrect->coeff);
param->statscli = (unsigned)((double)param->statscli * starttrafcorrect->coeff); param->statscli = (unsigned)((double)param->statscli * starttrafcorrect->coeff);
#endif
} }
/* ñ ó÷¸òîì ïàêåòîâ */ /* ñ ó÷¸òîì ïàêåòîâ */
if (starttrafcorrect->type == IPCORRECT) { if (starttrafcorrect->type == IPCORRECT) {
if (starttrafcorrect->con_type == TCP) { if (starttrafcorrect->con_type == TCP) {
#ifndef NOPSTDINT
param->statssrv64+=(param->nreads + 3*param->nconnects)*starttrafcorrect->psize;
param->statscli64+=(param->nwrites + 3*param->nconnects)*starttrafcorrect->psize;
#else
param->statssrv+=(param->nreads + 3*param->nconnects)*starttrafcorrect->psize; param->statssrv+=(param->nreads + 3*param->nconnects)*starttrafcorrect->psize;
param->statscli+=(param->nwrites + 3*param->nconnects)*starttrafcorrect->psize; param->statscli+=(param->nwrites + 3*param->nconnects)*starttrafcorrect->psize;
#endif
} else { } else {
#ifndef NOPSTDINT
param->statssrv64+=param->nreads*starttrafcorrect->psize;
param->statscli64+=param->nwrites*starttrafcorrect->psize;
#else
param->statssrv+=param->nreads*starttrafcorrect->psize; param->statssrv+=param->nreads*starttrafcorrect->psize;
param->statscli+=param->nwrites*starttrafcorrect->psize; param->statscli+=param->nwrites*starttrafcorrect->psize;
#endif
} }
} }
if (DBGLEVEL == 1) { if (DBGLEVEL == 1) {
fprintf(stdout, "Port=%hd; Before: srv=%d, cli=%d; After: srv=%ld, cli=%ld; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(param->sins.sin_port), statssrv_before, statscli_before, param->statssrv, param->statscli,param->nreads,param->nwrites,rule); #ifndef NOPSTDINT
fprintf(stdout, "Port=%hd; Before: srv=%"PRINTF_INT64_MODIFIER"d, cli=%"PRINTF_INT64_MODIFIER"d; After: srv=%"PRINTF_INT64_MODIFIER"d, cli=%"PRINTF_INT64_MODIFIER"d; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(*SAPORT(&param->sinsr)), statssrv_before, statscli_before, param->statssrv64, param->statscli64,param->nreads,param->nwrites,rule);
#else
fprintf(stdout, "Port=%hd; Before: srv=%lu, cli=%lu; After: srv=%lu, cli=%lu; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(param->sins.sin_port), statssrv_before, statscli_before, param->statssrv, param->statscli,param->nreads,param->nwrites,rule);
#endif
} }
ok = 1; ok = 1;
break; break;
} }
} }
if ((!ok) && (DBGLEVEL == 1)) { if ((!ok) && (DBGLEVEL == 1)) {
fprintf(stdout, "No rules specifed: service=%d, port=%d, operation=%d", param->service, param->sins.sin_port,param->operation); fprintf(stdout, "No rules specifed: service=%d, port=%d, operation=%d", param->service, *SAPORT(&param->sinsr),param->operation);
} }
origlogfunc(param, pz); origlogfunc(param, pz);
} }
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: transparent_plugin.c,v 1.9 2010-11-11 11:32:33 v.dubrovin Exp $
*/ */
#include <sys/utsname.h> #include <sys/utsname.h>
@@ -48,7 +47,6 @@ static FILTER_ACTION transparent_filter_client(void *fo, struct clientparam * pa
len = sizeof(addr); len = sizeof(addr);
if(getsockopt(param->clisock, SOL_IP, SO_ORIGINAL_DST,(struct sockaddr *) &addr, &len) || !addr.sin_addr.s_addr){ if(getsockopt(param->clisock, SOL_IP, SO_ORIGINAL_DST,(struct sockaddr *) &addr, &len) || !addr.sin_addr.s_addr){
perror("getsockopt()");
return PASS; return PASS;
} }
u = ntohl(addr.sin_addr.s_addr); u = ntohl(addr.sin_addr.s_addr);
@@ -60,8 +58,6 @@ perror("getsockopt()");
((u&0x000000FF)), ((u&0x000000FF)),
p); p);
param->srv->logfunc(param, (unsigned char *)"transparent_filter_client() Success");
param->srv->logfunc(param, (unsigned char *)addrbuf);
pl->parsehostname(addrbuf, param, 0); pl->parsehostname(addrbuf, param, 0);
return PASS; return PASS;
#else #else
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: WindowsAuthentication.c,v 1.12 2011-04-12 13:05:58 v.dubrovin Exp $
*/ */
#include "../../structures.h" #include "../../structures.h"
@@ -42,7 +41,7 @@ extern "C" {
if(dom)*dom++=0; if(dom)*dom++=0;
if(!LogonUser( dom?dom:(char *)param->username, if(!LogonUser( dom?dom:(char *)param->username,
dom?(char *)param->username:NULL, dom?(char *)param->username:NULL,
param->password, (char *)param->password,
LOGON32_LOGON_NETWORK, LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT, LOGON32_PROVIDER_DEFAULT,
&h))return 5; &h))return 5;
@@ -55,7 +54,7 @@ extern "C" {
if(GetLengthSid(ptg->Groups[i].Sid)==sidlen){ if(GetLengthSid(ptg->Groups[i].Sid)==sidlen){
if(!memcmp((void *)ptg->Groups[i].Sid, (void *)psid, sidlen)) { if(!memcmp((void *)ptg->Groups[i].Sid, (void *)psid, sidlen)) {
setlocale(LC_CTYPE, ".ACP"); setlocale(LC_CTYPE, ".ACP");
_strlwr(param->username); _strlwr((char *)param->username);
return 0; return 0;
} }
} }
+1 -2
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: utf8tocp1251.c,v 1.9 2009/09/03 05:32:56 v.dubrovin Exp $
*/ */
#include "../../structures.h" #include "../../structures.h"
@@ -27,7 +26,7 @@ extern "C" {
#endif #endif
unsigned char * conv_utf8_to_cp1251(unsigned char *s){ unsigned char * conv_utf8_to_cp1251(unsigned char *s){
int i, j=0, n=(int)strlen(s); int i, j=0, n=(int)strlen((char *)s);
int byte2 = 0; int byte2 = 0;
int c1, new_c1, new_c2, new_i; int c1, new_c1, new_c2, new_i;
for(i = 0; i < n; i++){ for(i = 0; i < n; i++){
+2 -3
View File
@@ -4,7 +4,6 @@
please read License Agreement please read License Agreement
$Id: pop3p.c,v 1.17 2008/01/08 21:46:38 vlad Exp $
*/ */
#include "proxy.h" #include "proxy.h"
@@ -43,13 +42,13 @@ void * pop3pchild(struct clientparam* param) {
socksend(param->remsock, param->extusername, (int)strlen((char *)param->extusername), conf.timeouts[STRING_S]) <= 0 || socksend(param->remsock, param->extusername, (int)strlen((char *)param->extusername), conf.timeouts[STRING_S]) <= 0 ||
socksend(param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2) socksend(param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2)
{RETURN(623);} {RETURN(623);}
param->statscli += (int)(strlen((char *)param->extusername) + 7); param->statscli64 += (uint64_t)(strlen((char *)param->extusername) + 7);
param->nwrites++; param->nwrites++;
RETURN (sockmap(param, 180)); RETURN (sockmap(param, 180));
CLEANRET: CLEANRET:
if(param->hostname&&param->extusername) { if(param->hostname&&param->extusername) {
sprintf((char *)buf, "%.64s@%.128s%c%hu", param->extusername, param->hostname, (ntohs(param->sins.sin_port)==110)?0:':', ntohs(param->sins.sin_port)); sprintf((char *)buf, "%.128s@%.128s%c%hu", param->extusername, param->hostname, (*SAPORT(&param->sinsr)==110)?0:':', ntohs(*SAPORT(&param->sinsr)));
(*param->srv->logfunc)(param, buf); (*param->srv->logfunc)(param, buf);
} }
else (*param->srv->logfunc)(param, NULL); else (*param->srv->logfunc)(param, NULL);
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff. Show more