mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Transparent moved to main code (TransparentPlugin removed), BSD pf support added
(cherry picked from commit 88b3225bdf)
This commit is contained in:
1 parent
69c6ddc8c4
commit
da66016c7f
19 files changed
+972
-191
No files matched your search
@@ -1,31 +1,56 @@
|
||||
<h3>3proxy TransparentPlugin (Linux/BSD only)</h3>
|
||||
<h3>3proxy transparent proxying (Linux/BSD only)</h3>
|
||||
|
||||
This plugin can turn 3proxy into a transparent proxy for virtually any TCP-based protocol
|
||||
and use all 3proxy features - redirections, parent proxies, ACLs, traffic limitations,
|
||||
etc. The TransparentPlugin takes the destination IP:port from Linux and uses this
|
||||
information as the target IP in the proxy. An example usage:
|
||||
Transparent proxying is part of 3proxy itself since 1.0.1. It was the separate
|
||||
TransparentPlugin before that, and the <b>plugin</b> line that used to load it
|
||||
is no longer needed: the <b>transparent</b> and <b>notransparent</b> commands
|
||||
are always available on the platforms that can redirect a connection.
|
||||
|
||||
<p>
|
||||
It turns 3proxy into a transparent proxy for virtually any TCP-based protocol,
|
||||
with the rest of 3proxy applying as usual - redirections, parent proxies, ACLs,
|
||||
traffic limitations and logging. The destination IP and port come from the
|
||||
packet filter that redirected the connection, and are used as the target of the
|
||||
proxied connection.
|
||||
</p>
|
||||
|
||||
<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
|
||||
|
||||
transparent
|
||||
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
|
||||
tcppm -eLOCAL_IP 12345 127.0.0.1 11111
|
||||
notransparent
|
||||
proxy
|
||||
</pre>
|
||||
Now, any TCP traffic transparently redirected to port 12345 will be routed via
|
||||
the parent SOCKSv5 proxy and logged; all URLs for web requests are visible in logs.
|
||||
The parameters '127.0.0.1 11111' in this case are not used and are overwritten by
|
||||
the destination IP:port for each transparent connection.
|
||||
|
||||
<h4>Download:</h4>
|
||||
<ul>
|
||||
<li>Plugin is included in 3proxy 0.8
|
||||
</li></ul>
|
||||
<p>
|
||||
Any TCP traffic redirected to port 12345 is routed through the parent SOCKSv5
|
||||
proxy and logged, with the URLs of web requests visible in the log. The
|
||||
'127.0.0.1 11111' arguments are not used in that case: they are replaced by the
|
||||
destination the client was trying to reach.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The destination is looked up in pf on the BSDs, through <b>/dev/pf</b>, and
|
||||
asked of the kernel on Linux; a redirection that leaves the address on the
|
||||
socket is used where there is one. <b>transparent</b> takes an optional
|
||||
<b>auto</b>, <b>netfilter</b>, <b>pf</b> or <b>socket</b> to pin that choice.
|
||||
</p>
|
||||
<p>
|
||||
The redirection rules must not match the connections 3proxy itself makes, or
|
||||
the traffic returns to the proxy and loops. Give the service an address to
|
||||
connect from with <b>-e</b> and exclude it in the rules, or run 3proxy as its
|
||||
own account and exclude that account.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Redirection rules for iptables, nftables, firewalld, ufw and pf are in
|
||||
<a href="../howtoe.html#TRANSPARENT">How to proxy transparently</a>, and the
|
||||
commands are described in 3proxy.cfg(5).
|
||||
</p>
|
||||
|
||||
© Vladimir Dubrovin, License: BSD style
|
||||
@@ -1,33 +1,56 @@
|
||||
<h3>Плагин TransparentPlugin 3proxy (только для Linux/BSD)</h3>
|
||||
<h3>Транспарентное проксирование 3proxy (только для Linux/BSD)</h3>
|
||||
|
||||
Плагин превращает 3proxy в транспарентный прокси для практически любых TCP-соединений
|
||||
и позволяет прозрачно для клиентов использовать весь фунционал прокси - редиректоры,
|
||||
родительские прокси, ACLи, ограничения трафика. TransparentPlugin получает IP:port
|
||||
назначения от Linux и использует эту информацию в качестве конечного адреса назначения.
|
||||
<br>
|
||||
Пример использования:
|
||||
Начиная с 1.0.1 транспарентное проксирование встроено в 3proxy. Раньше это был
|
||||
отдельный TransparentPlugin, и строка <b>plugin</b>, которой он загружался,
|
||||
больше не нужна: команды <b>transparent</b> и <b>notransparent</b> доступны
|
||||
всегда на тех платформах, где соединение можно перенаправить.
|
||||
|
||||
<p>
|
||||
3proxy становится транспарентным прокси практически для любых TCP-соединений,
|
||||
причём весь остальной функционал работает как обычно - редиректоры,
|
||||
родительские прокси, ACLи, ограничения трафика и логирование. IP и порт
|
||||
назначения берутся у пакетного фильтра, перенаправившего соединение, и
|
||||
используются как адрес назначения проксируемого соединения.
|
||||
</p>
|
||||
|
||||
<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
|
||||
|
||||
transparent
|
||||
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
|
||||
tcppm -eLOCAL_IP 12345 127.0.0.1 11111
|
||||
notransparent
|
||||
proxy
|
||||
</pre>
|
||||
Теперь любые TCP-соединения транспарентно перенаправленные в локальный порт 12345
|
||||
будут прологгированы и перенаправлены в родительский SOCKSv5 proxy, при этом для
|
||||
HTTP-запросов по порту TCP/80 будут видны параметры HTTP-запроса.
|
||||
Параметры '127.0.0.1 11111' в данном случае не оказывают влияния, т.к.
|
||||
будут перезаписываться IP и портом назначения для каждого TCP-соединения соответственно.
|
||||
<h4>Загрузить:</h4>
|
||||
<ul>
|
||||
<li>Плагин включен в дистрибутив 3proxy 0.8
|
||||
</li></ul>
|
||||
|
||||
<p>
|
||||
Любой TCP-трафик, перенаправленный на порт 12345, пойдёт через родительский
|
||||
SOCKSv5 прокси и будет залогирован, URL веб-запросов видны в логе. Аргументы
|
||||
'127.0.0.1 11111' в этом случае не используются: они заменяются адресом, к
|
||||
которому обращался клиент.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
В BSD адрес назначения ищется в pf через <b>/dev/pf</b>, в Linux запрашивается у
|
||||
ядра; если перенаправление оставляет адрес на сокете, используется он. Команда
|
||||
<b>transparent</b> принимает необязательный аргумент <b>auto</b>,
|
||||
<b>netfilter</b>, <b>pf</b> или <b>socket</b>, чтобы зафиксировать выбор.
|
||||
</p>
|
||||
<p>
|
||||
Правила перенаправления не должны попадать на соединения, которые устанавливает
|
||||
сам 3proxy, иначе трафик возвращается в прокси и зацикливается. Задайте сервису
|
||||
адрес для исходящих соединений через <b>-e</b> и исключите его в правилах, либо
|
||||
запускайте 3proxy под отдельной учётной записью и исключайте её.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Правила перенаправления для iptables, nftables, firewalld, ufw и pf приведены в
|
||||
<a href="../howtor.html#TRANSPARENT">описании транспарентного проксирования</a>,
|
||||
команды описаны в 3proxy.cfg(5).
|
||||
</p>
|
||||
|
||||
© Vladimir Dubrovin, License: BSD style
|
||||
Reference in new issue
Block a user