tlspr (SNI proxy) implemented

Options -cN - level of TLS check
default - allow non-TLS traffic
1 - require TLS, only check client HELLO packet
2 - require TLS, check both client and server HELLO
3 - require TLS, check server send certificate (not compatible with TLS 1.3)
4 - require mutual TLS, check server send certificate request and client sends certificate (not compatible with TLS 1.3)
-P - default port

examples:

1.
tlspr -p1443 -P443 -c1
(port 1443 may be used to redirect traffic to destination port 143). SNI is used to find destination host

2.
allow * * * 80
parent 1000 http 0.0.0.0 0
allow * * * * CONNECT
parent 1000 tls 0.0.0.0 0
deny * * some.not.allowed.host
allow *
socks

attempts to take destination hostname from SNI in SOCKS
This commit is contained in:
Vladimir Dubrovin committed 2024-05-20 13:01:38 +03:00
1 parent 29ef226b3c
commit 013d4bc333
10 files changed
+343 -16

No files matched your search

+10 -1
View File
@@ -238,6 +238,13 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.service = S_TCPPM;
childdef.helpmessage = "";
}
else if(!strcmp((char *)argv[0], "tlspr")) {
childdef.pf = tlsprchild;
childdef.port = 1443;
childdef.isudp = 0;
childdef.service = S_TLSPR;
childdef.helpmessage = "";
}
else if(!strcmp((char *)argv[0], "udppm")) {
childdef.pf = udppmchild;
childdef.port = 0;
@@ -756,6 +763,7 @@ static int h_parent(int argc, unsigned char **argv){
else if(!strcmp((char *)argv[2], "socks4b"))chains->type = R_SOCKS4B;
else if(!strcmp((char *)argv[2], "socks5b"))chains->type = R_SOCKS5B;
else if(!strcmp((char *)argv[2], "pop3"))chains->type = R_POP3;
else if(!strcmp((char *)argv[2], "tls"))chains->type = R_TLS;
else if(!strcmp((char *)argv[2], "ftp"))chains->type = R_FTP;
else if(!strcmp((char *)argv[2], "admin"))chains->type = R_ADMIN;
else if(!strcmp((char *)argv[2], "extip"))chains->type = R_EXTIP;
@@ -1618,8 +1626,9 @@ struct commands commandhandlers[]={
{commandhandlers+63, "parentretries", h_parentretries, 2, 2},
{commandhandlers+64, "auto", h_proxy, 1, 0},
{commandhandlers+65, "backlog", h_backlog, 2, 2},
{commandhandlers+66, "tlspr", h_proxy, 1, 0},
#ifndef NORADIUS
{commandhandlers+66, "radius", h_radius, 3, 0},
{commandhandlers+67, "radius", h_radius, 3, 0},
#endif
{specificcommands, "", h_noop, 1, 0}
};