mirror of
https://github.com/bol-van/zapret.git
synced 2025-05-24 22:32:58 +03:00
Merge branch 'bol-van:master' into tpws-luci
This commit is contained in:
@@ -329,3 +329,10 @@ v65:
|
||||
init.d: dynamic number allocation for dnum,tpws_port,qnum
|
||||
init.d: FW_EXTRA_PRE, FW_EXTRA_POST
|
||||
init.d: zapret_custom_firewall_nft_flush
|
||||
nfqws,tpws: l7proto and client ip:port info in autohostlist debug log
|
||||
nfqws,tpws: user mode ipset filter support
|
||||
nfqws,tpws: l7proto filter support
|
||||
tpws: fixed MSS apply in transparent mode
|
||||
nfqws: fixed autottl apply if desync profile changed
|
||||
tpws,nfqws: fixed 100% cpu hang on gzipped list with comments
|
||||
ipset: get_refilter_ipsum.sh , get_refilter_domain.sh
|
||||
|
@@ -211,6 +211,9 @@ nfqws takes the following parameters:
|
||||
--filter-l3=ipv4|ipv6 ; L3 protocol filter. multiple comma separated values allowed.
|
||||
--filter-tcp=[~]port1[-port2] ; TCP port filter. ~ means negation. setting tcp and not setting udp filter denies udp.
|
||||
--filter-udp=[~]port1[-port2] ; UDP port filter. ~ means negation. setting udp and not setting tcp filter denies tcp.
|
||||
--filter-l7=[http|tls|quic|wireguard|dht|unknown] ; L6-L7 protocol filter. multiple comma separated values allowed.
|
||||
--ipset=<filename> ; ipset include filter (one ip/CIDR per line, ipv4 and ipv6 accepted, gzip supported, multiple ipsets allowed)
|
||||
--ipset-exclude=<filename> ; ipset exclude filter (one ip/CIDR per line, ipv4 and ipv6 accepted, gzip supported, multiple ipsets allowed)
|
||||
```
|
||||
|
||||
The manipulation parameters can be combined in any way.
|
||||
@@ -575,18 +578,18 @@ You need to use nftables instead with hook priority 101 or higher.
|
||||
`nfqws` can apply different strategies to different requests. It's done with multiple desync profiles.
|
||||
Profiles are delimited by the `--new` parameter. First profile is created automatically and does not require `--new`.
|
||||
Each profile has a filter. By default it's empty and profile matches any packet.
|
||||
Filter can have hard parameters : ip version and tcp/udp port range.
|
||||
Hard parameters are always identified unambiguously even on zero-phase when hostname is unknown yet.
|
||||
Hostlist can also act as a filter. They can be combined with hard parameters.
|
||||
Filter can have hard parameters : ip version, ipset and tcp/udp port range.
|
||||
Hard parameters are always identified unambiguously even on zero-phase when hostname and L7 are unknown yet.
|
||||
Hostlists can also act as a filter. They can be combined with hard parameters.
|
||||
When a packet comes profiles are matched from the first to the last until first filter condition match.
|
||||
Hard filter is matched first. If it does not match verification goes to the next profile.
|
||||
If a profile matches hard filter and has autohostlist it's selected immediately.
|
||||
If a profile matches hard filter and has normal hostlist(s) and hostname is unknown yet verification goes to the next profile.
|
||||
If a profile matches hard filter , L7 filter and has autohostlist it's selected immediately.
|
||||
If a profile matches hard filter , L7 filter and has normal hostlist(s) and hostname is unknown yet verification goes to the next profile.
|
||||
Otherwise profile hostlist(s) are checked for the hostname. If it matches profile is selected.
|
||||
Otherwise verification goes to the next profile.
|
||||
|
||||
It's possible that before getting hostname connection is served by one profile and after
|
||||
hostname is revealed it's switched to another profile.
|
||||
It's possible that before knowing L7 and hostname connection is served by one profile and after
|
||||
this information is revealed it's switched to another profile.
|
||||
If you use 0-phase desync methods think carefully what can happen during strategy switch.
|
||||
Use `--debug` logging to understand better what `nfqws` does.
|
||||
|
||||
@@ -597,6 +600,9 @@ IMPORTANT : multiple strategies exist only for the case when it's not possible t
|
||||
Copy-pasting blockcheck results of different websites to multiple strategies lead to the mess.
|
||||
This way you may never unblock all resources and only confuse yourself.
|
||||
|
||||
IMPORTANT : user-mode ipset implementation was not designed as a kernel version replacement. Kernel version is much more effective.
|
||||
It's for the systems that lack ipset support : Windows and Linux without nftables and ipset kernel modules (Android, for example).
|
||||
|
||||
## tpws
|
||||
|
||||
tpws is transparent proxy.
|
||||
@@ -637,6 +643,9 @@ tpws is transparent proxy.
|
||||
--new ; begin new strategy
|
||||
--filter-l3=ipv4|ipv6 ; L3 protocol filter. multiple comma separated values allowed.
|
||||
--filter-tcp=[~]port1[-port2] ; TCP port filter. ~ means negation
|
||||
--filter-l7=[http|tls|unknown] ; L6-L7 protocol filter. multiple comma separated values allowed.
|
||||
--ipset=<filename> ; ipset include filter (one ip/CIDR per line, ipv4 and ipv6 accepted, gzip supported, multiple ipsets allowed)
|
||||
--ipset-exclude=<filename> ; ipset exclude filter (one ip/CIDR per line, ipv4 and ipv6 accepted, gzip supported, multiple ipsets allowed)
|
||||
|
||||
--hostlist=<filename> ; only act on hosts in the list (one host per line, subdomains auto apply, gzip supported, multiple hostlists allowed)
|
||||
--hostlist-exclude=<filename> ; do not act on hosts in the list (one host per line, subdomains auto apply, gzip supported, multiple hostlists allowed)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
zapret v.64
|
||||
zapret v.65
|
||||
|
||||
English
|
||||
-------
|
||||
@@ -280,6 +280,9 @@ nfqws
|
||||
--filter-l3=ipv4|ipv6 ; фильтр версии ip для текущей стратегии
|
||||
--filter-tcp=[~]port1[-port2] ; фильтр портов tcp для текущей стратегии. ~ означает инверсию. установка фильтра tcp и неустановка фильтра udp запрещает udp.
|
||||
--filter-udp=[~]port1[-port2] ; фильтр портов udp для текущей стратегии. ~ означает инверсию. установка фильтра udp и неустановка фильтра tcp запрещает udp.
|
||||
--filter-l7=[http|tls|quic|wireguard|dht|unknown] ; фильтр протокола L6-L7. поддерживается несколько значений через запятую.
|
||||
--ipset=<filename> ; включающий ip list. на каждой строчке ip или cidr ipv4 или ipv6. поддерживается множество листов и gzip.
|
||||
--ipset-exclude=<filename> ; исключающий ip list. на каждой строчке ip или cidr ipv4 или ipv6. поддерживается множество листов и gzip.
|
||||
|
||||
Параметры манипуляции могут сочетаться в любых комбинациях.
|
||||
|
||||
@@ -664,20 +667,22 @@ nfqws способен по-разному реагировать на разл
|
||||
Профили разделяются в командной строке параметром --new. Первый профиль создается автоматически.
|
||||
Для него не нужно --new. Каждый профиль имеет фильтр. По умолчанию он пуст, то есть профиль удовлетворяет
|
||||
любым условиям.
|
||||
Фильтр может содержать жесткие параметры : версия ip протокола или порты tcp/udp.
|
||||
Они всегда однозначно идентифицируются даже на нулевой фазе десинхронизации, когда еще хост неизвестен.
|
||||
В качестве фильтра могут выступать и хост-листы. Они могут сочетаться с жесткими параметрами.
|
||||
Фильтр может содержать жесткие параметры : версия ip протокола, ipset и порты tcp/udp.
|
||||
Они всегда однозначно идентифицируются даже на нулевой фазе десинхронизации, когда еще хост и L7 неизвестны.
|
||||
В качестве мягкого фильтра могут выступать хост-листы и протокол прикладного уровня (l7).
|
||||
L7 протокол становится известен обычно после первого пакета с данными.
|
||||
При поступлении запроса идет проверка профилей в порядке от первого до последнего до
|
||||
достижения первого совпадения с фильтром.
|
||||
Жесткие параметры фильтра сверяются первыми. При несовпадении идет сразу же переход к следующему профилю.
|
||||
Если какой-то профиль удовлетворяет жесткому фильтру и содержит авто-хостлист, он выбирается сразу.
|
||||
Если профиль удовлетворяет жесткому фильтру, для него задан хостлист, и у нас еще нет имени хоста,
|
||||
Если какой-то профиль удовлетворяет жесткому фильтру и L7 фильтру и содержит авто-хостлист, он выбирается сразу.
|
||||
Если профиль удовлетворяет жесткому фильтру и L7 фильтру, для него задан хостлист, и у нас еще нет имени хоста,
|
||||
идет переход к следующему профилю. В противном случае идет проверка по хостлистам этого профиля.
|
||||
Если имя хоста удовлетворяет листам, выбирается этот профиль. Иначе идет переход к следующему.
|
||||
Может так случиться, что до получения имени хоста соединение идет по одному профилю, а при получении
|
||||
хоста профиль меняется на лету. Поэтому если у вас есть параметры дурения нулевой фазы, тщательно
|
||||
продумывайте что может произойти при переключении стратегии. Смотрите debug log, чтобы лучше
|
||||
понять что делает nfqws.
|
||||
Может так случиться, что до получения имени хоста или узнавания L7 протокола соединение идет по одному профилю,
|
||||
а при выяснении этих параметров профиль меняется на лету. Это может произойти даже дважды - при выяснении L7
|
||||
и имени хоста. Чаще всего это выяснение совмещается в одно действие, поскольку по одному пакету как правило узнается и L7, и хост.
|
||||
Поэтому если у вас есть параметры дурения нулевой фазы, тщательно продумывайте что может произойти при переключении стратегии.
|
||||
Смотрите debug log, чтобы лучше понять что делает nfqws.
|
||||
Нумерация профилей идет с 1 до N. Последним в цепочке создается пустой профиль с номером 0.
|
||||
Он используется, когда никакие условия фильтров не совпали.
|
||||
|
||||
@@ -686,6 +691,10 @@ nfqws способен по-разному реагировать на разл
|
||||
во множество профилей без понимания как они работают приведет к нагромождению параметров, которые все равно
|
||||
не покроют все возможные заблокированные ресурсы. Вы только увязните в этой каше.
|
||||
|
||||
ВАЖНО : user-mode реализация ipset создавалась не как удобная замена *nix версии, реализованной в ядре.
|
||||
Вариант в ядре работает гораздо эффективнее. Это создавалось для систем без подержки ipset в ядре.
|
||||
Конкретно - Windows и ядра Linux, собранные без nftables и ipset модулей ядра. Например, в android нет ipset.
|
||||
|
||||
|
||||
tpws
|
||||
-----
|
||||
@@ -777,6 +786,9 @@ tpws - это transparent proxy.
|
||||
--new ; начало новой стратегии
|
||||
--filter-l3=ipv4|ipv6 ; фильтр версии ip для текущей стратегии
|
||||
--filter-tcp=[~]port1[-port2] ; фильтр портов tcp для текущей стратегии. ~ означает инверсию.
|
||||
--filter-l7=[http|tls|quic|wireguard|dht|unknown] ; фильтр протокола L6-L7. поддерживается несколько значений через запятую.
|
||||
--ipset=<filename> ; включающий ip list. на каждой строчке ip или cidr ipv4 или ipv6. поддерживается множество листов и gzip.
|
||||
--ipset-exclude=<filename> ; исключающий ip list. на каждой строчке ip или cidr ipv4 или ipv6. поддерживается множество листов и gzip.
|
||||
|
||||
|
||||
--debug позволяет выводить подробный лог действий на консоль, в syslog или в файл.
|
||||
|
@@ -80,11 +80,13 @@ curl -O https://www.cygwin.com/setup-x86_64.exe
|
||||
setup-x86_64.exe --allow-unsupported-windows --no-verify --site http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2024/01/30/231215
|
||||
```
|
||||
You must choose to install `curl`. To compile from sources install `gcc-core`,`make`,`zlib-devel`.
|
||||
Make from directory `nfq` using `make cygwin`.
|
||||
|
||||
`winws` requires `cygwin1.dll`, `windivert.dll`, `windivert64.sys`. You can take them from `binaries/win64/zapret-winws`.
|
||||
|
||||
It's possible to build x86 32-bit version but this version is not shipped. You have to build it yourself.
|
||||
32-bit `windivert` can be downloaded from it's developer github. Required version is 2.2.2.
|
||||
32-bit x86 version can be build from 32-bit cygwin using `make cygwin32`.
|
||||
`windivert.dll` and `windivert32.sys` can be taken from [windivert 2.2.2 archive](https://reqrypt.org/download)
|
||||
|
||||
There's no `arm64` signed `windivert` driver and no `cygwin`.
|
||||
But it's possible to use unsigned driver version in test mode and user mode components with x64 emulation.
|
||||
x64 emulation requires `windows 11` and not supported in `windows 10`.
|
||||
@@ -159,3 +161,5 @@ unix2dos winws.log
|
||||
```
|
||||
|
||||
`winws.log` will be in `cygwin/home/<username>`. `unix2dos` helps with `windows 7` notepad. It's not necessary in `Windows 10` and later.
|
||||
|
||||
Pre-compiled 32-bit binaries can be downloaded [here](https://github.com/bol-van/zapret-win32)
|
||||
|
@@ -120,8 +120,9 @@ setup-x86_64.exe --allow-unsupported-windows --no-verify --site http://ctm.crouc
|
||||
Для сборки из исходников требуется gcc-core,make,zlib-devel.
|
||||
Собирать из директории nfq командой "make cygwin".
|
||||
winws требует cygwin1.dll, windivert.dll, windivert64.sys. Их можно взять из binaries/win64/zapret-winws.
|
||||
Версию для 32-битных x86 windows собрать можно, но такие системы уже уходят в прошлое, поэтому если надо - собирайте сами.
|
||||
32-битный windivert можно взять с сайта разработчика. Требуется версия 2.2.2.
|
||||
|
||||
32-битную x86 версию можно собрать из 32-битного cygwin командой "make cygwin32".
|
||||
windivert.dll и windivert32.sys можно взять из комплекта windivert 2.2.2 : https://reqrypt.org/download
|
||||
|
||||
Для arm64 windows нет подписанного драйвера windivert и нет cygwin.
|
||||
Однако, эмуляция x64 windows 11 позволяет использовать все, кроме WinDivert64.sys без изменений.
|
||||
@@ -220,3 +221,6 @@ winws --debug --wf-tcp=80,443 | tee winws.log
|
||||
winws.log будет в cygwin/home/<имя_пользователя>
|
||||
Если у вас windows 7, то блокнот не поймет переводы строк в стиле unix. Воспользуйтесь командой
|
||||
unix2dos winws.log
|
||||
|
||||
Готовую 32-битную версию можно скачать здесь : https://github.com/bol-van/zapret-win32
|
||||
Поскольку 32-битные windows мало востребованы, выложены только бинарники и ничего больше.
|
||||
|
Reference in New Issue
Block a user