diff --git a/doc/html/howtoe.html b/doc/html/howtoe.html index af29118..33de486 100644 --- a/doc/html/howtoe.html +++ b/doc/html/howtoe.html @@ -648,16 +648,16 @@ see How to set up a DNS proxy (dnspr).
tlspr can be used as a parent with the "tls" type to implement SNI splitting for DPI bypass (similar to NoDPI/GoodByeDPI). The client sends the first part of the TLS ClientHello, tlspr splits it at the SNI extension and sends it in two TCP packets, which can bypass some DPI systems that look for blocked hostnames in TLS handshakes. -
To enable SNI break, use parent ... tls 0.0.0.0 0 and the -s option on the listening service with TCP_NODELAY: +
To enable SNI break, use parent ... tls 0.0.0.0 0 and the -B option on the listening service:

 auth iponly
 allow *
 parent 1000 tls 0.0.0.0 0
 allow *
-proxy -s -i127.0.0.1 -ocTCP_NODELAY -osTCP_NODELAY -p1443
+proxy -B -i127.0.0.1 -p1443
 

-TCP_NODELAY is required to prevent the kernel from merging the split packets. +TCP_NODELAY, set by default, is required to prevent the kernel from merging the split packets: do not turn it off with -ocTCP_NODELAY=0 or -osTCP_NODELAY=0.

Configuration examples: diff --git a/doc/html/howtor.html b/doc/html/howtor.html index 238cd3a..a48ee3e 100644 --- a/doc/html/howtor.html +++ b/doc/html/howtor.html @@ -656,16 +656,16 @@ iptables -t nat -A PREROUTING -p tcp -m multiport --dports 443,993,465 -j REDIRE
tlspr может использоваться как родительский прокси типа "tls" для реализации SNI-фрагментации (аналог NoDPI/GoodByeDPI). Клиент отправляет первую часть TLS ClientHello, tlspr разбивает его на расширении SNI и отправляет двумя TCP-пакетами, что позволяет обойти некоторые DPI-системы, ищущие заблокированные имена хостов в TLS-рукопожатиях. -
Для включения SNI break используйте parent ... tls 0.0.0.0 0 и опцию -s на слушающем сервисе с TCP_NODELAY: +
Для включения SNI break используйте parent ... tls 0.0.0.0 0 и опцию -B на слушающем сервисе:

 auth iponly
 allow *
 parent 1000 tls 0.0.0.0 0
 allow *
-proxy -s -i127.0.0.1 -ocTCP_NODELAY -osTCP_NODELAY -p1443
+proxy -B -i127.0.0.1 -p1443
 

-TCP_NODELAY необходим, чтобы ядро не объединяло разделенные пакеты. +TCP_NODELAY, установленный по умолчанию, необходим, чтобы ядро не объединяло разделенные пакеты: не отключайте его опциями -ocTCP_NODELAY=0 или -osTCP_NODELAY=0.

Примеры конфигурации: diff --git a/man/3proxy.cfg.5 b/man/3proxy.cfg.5 index a5b1fe9..2ad48e2 100644 --- a/man/3proxy.cfg.5 +++ b/man/3proxy.cfg.5 @@ -198,6 +198,13 @@ any protocol-specific data. .B -g(\fIGRACE_TRAFF\fB,\fIGRACE_NUM\fB,\fIGRACE_DELAY\fR) delay GRACE_DELAY milliseconds before polling if average polling size is below GRACE_TRAFF bytes and GRACE_NUM read operations in a single direction are detected within 1 second. Useful to minimize polling .br +.B -B +(for TCP services) split the TLS ClientHello across two TCP segments in the +middle of the server name (SNI) when it is passed through tlspr, as with +\fBparent ... tls 0.0.0.0 0\fR: some DPI systems looking for blocked host names +do not reassemble it. TCP_NODELAY, set by default, must not be turned off, or the +kernel may join the segments again. In builds without splice() \fB-s\fR does the same. +.br .B -s (for admin) secure, allow only secure operations, currently only traffic counters view without ability to reset. diff --git a/man/tlspr.8 b/man/tlspr.8 index 6bd903d..db3e0c5 100644 --- a/man/tlspr.8 +++ b/man/tlspr.8 @@ -76,8 +76,8 @@ destination_port. Port to establish outgoing connections. Required unless the Tr .B -c TLS_CHECK_LEVEL. 0 (default) - allow non-TLS traffic to pass, 1 - require TLS, only check client HELLO packet, 2 - require TLS, check both client and server HELLO, 3 - require TLS, check that the server sends a certificate (not compatible with TLS 1.3), 4 - require mutual TLS, check that the server sends a certificate request and the client sends a certificate (not compatible with TLS 1.3) .TP -.B -s -Split the TLS Client HELLO packet across multiple TCP segments to make SNI-based DPI detection harder. An optional numeric value can follow (e.g. \fB-s1\fR) to control the splitting behaviour. +.B -B +Split the TLS Client HELLO packet across two TCP segments, in the middle of the SNI, to make SNI-based DPI detection harder. In builds without splice() \fB-s\fR does the same; with splice() (Linux) \fB-s\fR is splice, see \fB3proxy.cfg\fR(5). .TP .B -Ximap | -Xpop3 | -Xsmtp STARTTLS mode for the given protocol. The proxy speaks the plaintext protocol diff --git a/src/mainconf.c b/src/mainconf.c index be25534..6bc4137 100644 --- a/src/mainconf.c +++ b/src/mainconf.c @@ -221,6 +221,7 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){ " association: 1 - log, 2 - authorize, 3 - both (default), 0 (same as -U) -\n" " neither. The first destination is always authorized and logged\n" #endif + " -B split the TLS ClientHello passed through tlspr at the SNI (DPI bypass)\n" "-g(GRACE_TRAFF,GRACE_NUM,GRACE_DELAY) - delay GRACE_DELAY milliseconds before polling if average polling size below GRACE_TRAFF bytes and GRACE_NUM read operations in single directions are detected within 1 second to minimize polling\n" " -fFORMAT logging format (see documentation)\n" " -l log to stdout\n" @@ -486,6 +487,13 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){ case 'U': srv->udpauth = *(argv[i]+2)? atoi(argv[i]+2) : 0; break; + case 'B': + /* the TLS ClientHello split at the SNI (tlspr), which -s is + where -s is not splice; s_option means something else + for these */ + if(!s->isudp && srv->service != S_ADMIN && srv->service != S_HTTPSRV) + srv->s_option = 1 + atoi(argv[i]+2); + break; case 's': #ifdef WITHSPLICE /* admin is an httpsrv, where -s is the limited mode */