MacOS 上著名防火墙软件 Little Snitch,下面简称 LS,使用中发现并不能监控本地 PAC 代理,进一步发现默认设置的 LS 不能监控或过滤所有本机流量,推测是产品设计故意隐藏,毕竟有相当多本地 127.0.0.1 上的端口之间通讯不需要用户知情。
但这给所有使用本机 proxy 的用户带来相当大泄漏风险 -- 你以为开着防火墙和 PAC 代理,但只要 PAC 代理文件内设置了目标 hostname 或 IP,app 访问流量就会直接通过本地代理偷偷走掉了。
进一步和 LS 的技术团队沟通后,发现使用本地代理,并同时使用 PAC 的用户,在 LS 自带的 little snitch network monitor 里看到通过本机 PAC 走的流量同样被“误导性”的记录为远程目标,而没有任何它是从本机 PAC 代理跑掉的相关信息。
下面是 LS 技术支持目前给出的解决方式:
as for your question, there is a hidden rule that allows localhost connections. But you can for example create a High Priority Ask Rule to get over it. E.g. with this rule you get a connection alert for processes from your user, which connect to localhost (e.g. ssh localhost, if SSH is active):
- action: ask
- direction: outgoing
- priority: high
- process: any
- owner: me
- destination: 0.0.0.0, 127.0.0.1, ::-::1
But with such rules you should be careful. Processes usually do not assume that connections to localhost will be blocked for a long time, i.e. while the connection alert is pending.
简单来说,目前的方法是如上设置一个 high priority 的 ask 规则,用来每个连接进行确认,我测试过,如果不设置 hight priority,这条规则完全无效 <<-- 这也是好大一个坑
另外对于每个 app 进行设置 Deny any incoming connection,即便提高到 high priority,并 global,依然无效,流量依然会通过本地端口跑掉 <<-- 这是更大一个坑