Compare commits

...
12 Commits
13 changed files with 84 additions and 33 deletions

No files matched your search

+5 -5
View File
@@ -2,8 +2,8 @@
1 VERSIONINFO
FILEVERSION 0,9,0,0
PRODUCTVERSION 0,9,0,0
FILEVERSION 0,9,0,201022
PRODUCTVERSION 0,9,0,201022
FILETYPE 1
FILESUBTYPE 0x0L
BEGIN
@@ -14,12 +14,12 @@ BEGIN
VALUE "Comments", "3proxy - tiny proxy server, http://3proxy.org/\0"
VALUE "CompanyName", "Vladimir Dubrovin\0"
VALUE "FileDescription", "3proxy - tiny proxy server\0"
VALUE "FileVersion", "0.9-devel-" BUILDDATE "\0"
VALUE "FileVersion", "0.9.0\0"
VALUE "InternalName", "3proxy\0"
VALUE "LegalCopyright", "Copyright (C) 2002-2019 Vladimir Dubrovin\0"
VALUE "LegalCopyright", "Copyright (C) 2002-2020 Vladimir Dubrovin\0"
VALUE "OriginalFilename", "3proxy.exe\0"
VALUE "ProductName", "3proxy\0"
VALUE "ProductVersion", "0.9-devel-" BUILDDATE "\0"
VALUE "ProductVersion", "0.9.0\0"
END
END
BLOCK "VarFileInfo"
+7 -7
View File
@@ -1,5 +1,5 @@
# 3APA3A 3proxy tiny proxy server
(c) 2002-2019 by Vladimir '3APA3A' Dubrovin <3proxy@3proxy.ru>
(c) 2002-2020 by Vladimir '3APA3A' Dubrovin <3proxy@3proxy.ru>
Download:
https://github.com/z3APA3A/3proxy/releases
@@ -58,7 +58,7 @@ Please read doc/html/index.html and man pages.
+ Threaded application (no child process).
+ Web administration and statistics
+ Plugins for functionality extension
+ Native 64 bit application
+ Native 32/64 bit application
2. Proxy chaining and network connections
+ Can be used as a bridge between client and different proxy type
(e.g. convert incoming HTTP proxy request from client to SOCKSv5
@@ -78,9 +78,8 @@ Please read doc/html/index.html and man pages.
+ syslog logging (Unix)
+ ODBC logging
+ RADIUS accounting
+ log file rotation (hourly, daily, weekly, monthly)
+ automatic log file comperssion with external archiver (for files)
+ automatic removal of older log files
+ log file rotation
+ automatic log file processing with external archiver (for files)
+ Character filtering for log files
+ different log files for different servces are supported
4. Access control
@@ -89,12 +88,13 @@ Please read doc/html/index.html and man pages.
(POST, PUT, GET, etc), weekday and daytime.
+ 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
+ ACL-driven traffic limitation per day, week or month for incoming and
outgoing traffic
+ Connection limitation and ratelimting
+ User authentication by username / password
+ RADIUS Authentication and Authorization
+ User authentication by DNS hostname
+ Authentication cache with possibility to limit user to single IP address
+ Access control by username/password for SOCKSv5 and HTTP/HTTPS/FTP
+ Cleartext or encrypted (crypt/MD5 or NT) passwords.
+ Connection redirection
+1 -1
View File
@@ -874,7 +874,7 @@ You can control 3proxy service via "Services" administration ot via "net" comman
<li>90 - unexpected system error (should not happen)
<li>91 - unexpected poll error (should not happen)
<li>92 - connection terminated by timeout (see timeouts)
<li>93 - connection terminated by ratelimit-related timeout
<li>93 - connection terminated by ratelimit-related timeout or due to errors limit
<li>94 - connection termination by server or client with unsent data
<li>95 - dirty connection termination by client (or networking issue)
<li>96 - dirty connection termination by server (or networking issue)
+1 -1
View File
@@ -1050,7 +1050,7 @@
<li>90 - неожиданная системная ошибка (не должно происходить)
<li>91 - ошибка poll (не должно происходить)
<li>92 - соединение прервано по таймауту на сетевую операцию (см. timeouts)
<li>93 - соединение прервано по таймауту связанному с рейтлимитом
<li>93 - соединение прервано по таймауту связанному с рейтлимитом или из-за превышения числа ошибок
<li>94 - клиент или сервер закрыли соединение или произошла сетевая ошибка, остались неотправленные данные
<li>95 - клиент "грязно" закрыл соединение или сетевая ошибка
<li>96 - сервер "грязно" закрыл соединение или сетевая ошибка
+26
View File
@@ -240,6 +240,8 @@ alternate config file. Think twice before using it.
@ (for Unix) use syslog, filename is used as ident name
.br
& use ODBC, filename consists of comma-delimited datasource,username,password (username and password are optional)
.br
radius - use RADIUS for logging
.br
LOGTYPE is one of:
.br
@@ -388,6 +390,28 @@ can use %A as produced archive name and %F as filename.
.br
default timeouts 1 5 30 60 180 1800 15 60 15 5
.br
.B radius
<NAS_SECRET> <radius_server_1[:port][/local_address_1]> <radius_server_2[:port][/local_address_2]>
.br
Configures RADIUS servers to be used for logging and authentication (log and auth types
must be set to radius). port and local address to use with given server may be specified.
.br
Attributes within request: User-Name, Password: (username and password if presented by client),
Service Type: Authenticate-Only,
NAS-Port-Type: NAS-Port-Virtual,
NAS-Port-ID: (proxy service port, e.g. 1080),
NAS-IPv6-Address / NAS-IP-Address: (proxy interface accessed by client),
NAS-Identifier: (text identifing proxy, e.g. PROXY or SOCKSv5),
Framed-IPv6-Address / Framed-IP-Address: (IP address of the client),
Called-Station-ID: (requested Hostname, if presents),
Login-Service: (type of request, e.g. 1001 - SOCKS CONNECT, 1010 - HTTP GET, 1013 - HTTP CONNECT),
Login-TCP-Port: (requested port),
Login-IPv6-Host / Login-IP-Host: (requested IP).
.br
Supported reply attributes for authentication:
Framed-IP-Address / Framed-IPv6-Address (IP to assign to user), Reply-Message.
Use authcache to speedup authentication. RADIUS feature is currently experimental.
.br
.B nserver
@@ -503,6 +527,8 @@ NB: there is no any password check, name may be spoofed.
SOCKSv5, FTP, POP3 and HTTP proxy.
.br
cache - cached authentication, may be used with \'authcache\'.
.br
radius - authentication with RADIUS.
.br
Plugins may add additional authentication types.
+1
View File
@@ -554,6 +554,7 @@ int radsend(struct clientparam * param, int auth, int stop){
}
else remsock = radiuslist[loop].logsock;
*/
so._bind(param->remsock,(struct sockaddr *)&radiuslist[loop].localaddr,SASIZE(&radiuslist[loop].localaddr));
len = so._sendto(remsock, (char *)&packet, total_length, 0,
(struct sockaddr *)&saremote, sizeof(saremote));
if(len != ntohs(packet.length)){
+4 -1
View File
@@ -293,7 +293,10 @@ int parsehostname(char *hostname, struct clientparam *param, unsigned short port
if(!hostname || !*hostname)return 2;
if(*hostname == '[') se=strchr(hostname, ']');
if ( (sp = strchr(se?se:hostname, ':')) && !strchr(sp+1, ':')) *sp = 0;
if (sp = strchr(se?se:hostname, ':')) {
if(strchr(sp+1, ':'))sp = NULL;
else *sp = 0;
}
if(se){
*se = 0;
}
+7 -1
View File
@@ -1329,13 +1329,19 @@ static int h_radius(int argc, unsigned char **argv){
if(strlen(argv[1]) > 63) argv[1][63] = 0;
strcpy(radiussecret, argv[1]);
for( nradservers=0; nradservers < MAXRADIUS && nradservers < argc -2; nradservers++){
char *s = 0;
if(strchr(argv[nradservers + 2], '/')){
*s = 0;
s++;
}
if( !getip46(46, argv[nradservers + 2], (struct sockaddr *)&radiuslist[nradservers].authaddr)) return 1;
if( s && !getip46(46, s, (struct sockaddr *)&radiuslist[nradservers].localaddr)) return 2;
if(!*SAPORT(&radiuslist[nradservers].authaddr))*SAPORT(&radiuslist[nradservers].authaddr) = htons(1812);
port = ntohs(*SAPORT(&radiuslist[nradservers].authaddr));
radiuslist[nradservers].logaddr = radiuslist[nradservers].authaddr;
*SAPORT(&radiuslist[nradservers].logaddr) = htons(port+1);
/*
bindaddr = conf.intsa;
bindaddr = radiuslist[nradservers].localaddr;
if ((radiuslist[nradservers].logsock = so._socket(SASOCK(&radiuslist[nradservers].logaddr), SOCK_DGRAM, 0)) < 0) return 2;
if (so._bind(radiuslist[nradservers].logsock, (struct sockaddr *)&bindaddr, SASIZE(&bindaddr))) return 3;
*/
+2 -2
View File
@@ -320,9 +320,9 @@ extern struct commands commandhandlers[];
extern struct radserver {
#ifdef NOIPV6
struct sockaddr_in authaddr, logaddr;
struct sockaddr_in authaddr, logaddr, localaddr;
#else
struct sockaddr_in6 authaddr, logaddr;
struct sockaddr_in6 authaddr, logaddr, localaddr;
#endif
/*
SOCKET logsock;
+5 -6
View File
@@ -61,7 +61,7 @@ void * threadfunc (void *p) {
#ifndef _WIN32
sigset_t mask;
sigfillset(&mask);
pthread_sigmask(SIG_SETMASK, &mask, NULL);
if(param->srv->service != S_UDPPM)pthread_sigmask(SIG_SETMASK, &mask, NULL);
#endif
((struct clientparam *) p)->srv->pf((struct clientparam *)p);
@@ -286,11 +286,6 @@ int MODULEMAINFUNC (int argc, char** argv){
srv.next = conf.services;
conf.services = conf.services->prev = &srv;
}
#else
srv.needuser = 0;
pthread_mutex_init(&log_mutex, NULL);
#endif
#ifndef _WIN32
{
sigset_t mask;
@@ -298,6 +293,10 @@ int MODULEMAINFUNC (int argc, char** argv){
pthread_sigmask(SIG_SETMASK, &mask, NULL);
}
#endif
#else
srv.needuser = 0;
pthread_mutex_init(&log_mutex, NULL);
#endif
for (i=1; i<argc; i++) {
if(*argv[i]=='-') {
+23 -7
View File
@@ -8,6 +8,8 @@
#include "proxy.h"
#define MAXFAILATTEMPT 10
#ifdef WITHLOG
#if WITHLOG > 1
char logbuf[1024];
@@ -121,17 +123,17 @@ int sockmap(struct clientparam * param, int timeo, int usesplice){
if(action != PASS) RETURN(19);
while(
((!CLIENTTERM) && (inserverbuf
((!CLIENTTERM) && fromserver && (inserverbuf
#ifdef WITHSPLICE
|| inserverpipe
#endif
|| (!SERVERTERM && fromserver)))
|| (!SERVERTERM )))
||
((!SERVERTERM) && (inclientbuf
((!SERVERTERM) && fromclient && (inclientbuf
#ifdef WITHSPLICE
|| inclientpipe
#endif
|| (!CLIENTTERM && fromclient)))
|| (!CLIENTTERM )))
){
@@ -157,7 +159,7 @@ log(logbuf);
#endif
if(needaction > 2 && !sleeptime){
if(needaction > 13){RETURN (93);}
if(needaction > (MAXFAILATTEMPT+1)){RETURN (93);}
sleeptime = (1<<(needaction-2));
}
if(sleeptime > 0) {
@@ -315,6 +317,10 @@ log("read from client to pipe");
log("read failed");
#endif
FROMCLIENT = TOCLIENTPIPE = 0;
if(res == 0) {
CLIENTTERM = 1;
continue;
}
}
else {
#ifdef WITHLOG
@@ -338,6 +344,10 @@ log("splice finished\n");
#endif
if(res <= 0) {
FROMSERVER = TOSERVERPIPE = 0;
if(res == 0 || !errno) {
SERVERTERM = 1;
continue;
}
}
else {
#ifdef WITHLOG
@@ -371,8 +381,11 @@ log("read from client to buf");
sasize = sizeof(param->sincr);
res = so._recvfrom(param->clisock, (char *)param->clibuf + param->cliinbuf, (int)MIN((uint64_t)param->clibufsize - param->cliinbuf, fromclient-inclientbuf), 0, (struct sockaddr *)&param->sincr, &sasize);
if(res <= 0) {
if(!errno)CLIENTTERM = 1;
FROMCLIENT = 0;
if(res == 0){
CLIENTTERM = 1;
continue;
}
}
else {
#ifdef WITHLOG
@@ -393,8 +406,11 @@ log("read from server to buf");
sasize = sizeof(param->sinsr);
res = so._recvfrom(param->remsock, (char *)param->srvbuf + param->srvinbuf, (int)MIN((uint64_t)param->srvbufsize - param->srvinbuf, fromserver-inserverbuf), 0, (struct sockaddr *)&param->sinsr, &sasize);
if(res <= 0) {
if(!errno) SERVERTERM = 1;
FROMSERVER = 0;
if(res == 0) {
SERVERTERM = 1;
continue;
}
}
else {
#ifdef WITHLOG
+1 -1
View File
@@ -16,7 +16,7 @@
void * tcppmchild(struct clientparam* param) {
int res;
if(!param->hostname)parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport));
if(!param->hostname && parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport))) RETURN(100);
param->operation = CONNECT;
res = (*param->srv->authfunc)(param);
if(res) {RETURN(res);}
+1 -1
View File
@@ -38,7 +38,7 @@ void * udppmchild(struct clientparam* param) {
struct pollfd fds[256];
if(!param->hostname)parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport));
if(!param->hostname && parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport))) RETURN(100);
if (SAISNULL(&param->req)) {
param->srv->fds.events = POLLIN;
RETURN (100);