tinyproxy无法转发Connect方法

Han*_*ian 6 https proxy http http-proxy transparentproxy

我正在尝试为所有类型的帧(HTTP,HTTPS)设置透明代理,我正在使用tinyproxy这样做.我已经设置了我的路由器,将所有传入和传出帧重定向(使用NAT)到tinyproxy(正在侦听端口8888).

我尝试访问HTTPS网站(https://www.google.com/),但收到SSL连接错误.浏览tinyproxy日志,我看到以下内容:

CONNECT   Mar 24 23:34:27 [22533]: Connect (file descriptor 11): 128.112.94.38 [128.112.94.38]
CONNECT   Mar 24 23:34:27 [22533]: Request (file descriptor 11): 
WARNING   Mar 24 23:34:27 [22533]: Could not retrieve all the headers from the client
INFO      Mar 24 23:34:27 [22533]: Read request entity of 103 bytes
Run Code Online (Sandbox Code Playgroud)

tinyproxy文档说,只要我在tinyproxy.conf文件中设置以下行,Connect帧的转发应该透明地工作:

# ConnectPort: This is a list of ports allowed by tinyproxy when the
# CONNECT method is used.  To disable the CONNECT method altogether, set
# the value to 0.  If no ConnectPort line is found, all ports are
# allowed (which is not very secure.)
#
# The following two ports are used by SSL.
ConnectPort 443
ConnectPort 563
Run Code Online (Sandbox Code Playgroud)

我也尝试删除所有ConnectPort行,看看是否有效(它没有).有谁知道为什么我无法透明地转发HTTPS流量?

mr.*_*tic 3

您没有在正常网络意义上使用术语“框架”(L2),TCP 或 HTTP/HTTPS 连接 (L6/7) 是在这里使用的更好术语。

tinyproxy将处理 HTTP 代理请求连接(其中CONNECT一种类型),或在透明模式下处理非代理 HTTP 请求(您可以确认在显示的功能列表中已启用tinyproxy -h)。

当浏览器配置为使用代理时,它会相应地修改其出站请求。在透明模式下,浏览器不知道代理(并且不得配置代理)。该ConnectPort选项列出了在正常代理模式下允许客户端使用的端口CONNECT(以防止滥用)。

如果您在 HTTPS 的透明模式下使用tinyproxy,则没有CONNECT,更重要的是没有标头(这就是您看到该错误的原因),也没有 URL。通常,主机/端口部分可以从目标 IP、端口和 SNI 扩展推断出 - 由于tinyproxy依赖某些外部防火墙将连接重定向(更改目标 IP)到它,因此它没有请求的完整信息。

目前tinyproxy只能用作透明的 HTTP 代理,文档对此有点模糊。如果没有 HTTPS 检查(即 TLS 连接解密)来访问客户端请求,它甚至不能成为一个简单的 TCP 连接转发器。其他代理例如squid支持 TLS 检查 ( sslbump)。