Transparent Proxy Providers and DNS

We have found a VPN that does not work while our TPP is running, and I have a hypothesis why, and it does not make any sense.

It only fails when our TPP asks for UDP flows.

Their VPN claims to fail at a DNS query, but it's getting EPIPE (this is Twingate for the curious). Looking at all the logs I can on the system, including dtruss and dtrace, I see that it does a sendto, and gets that errno. I can't, of course, determine more.

By adding more logging, I can see that their VPN tunnel provider tries to open up a UDP flow to 8.8.8.8 port 53. First red flag: I did not think we were supposed to get DNS queries -- my guess is that only means for apps that use the system DNS libraries, implying (to me) that this VPN has their own DNS code.

We look at the app name, and decide we don't care for it -- handleNewUDPFlow(_:initialEndpoint:) returns false/NO.

I see this in the system logs:

2024-06-26 11:06:56.342680+0100 0x300c839  Default     0x0                  40823  0    ${us}.Redirector: (NetworkExtension) [com.apple.networkextension:] [Extension ${us}]: provider rejected new flow UDP ${them}.macos.tunnelprovider[{length = 20, bytes = 0xca1b405e014154c2e38e20159d033f9b2d3eea18}] local port 0 interface en0(bound)

which is all correct. But then the very next log entry is

2024-06-26 11:06:56.342717+0100 0x300cc14  Info        0x0                  0      0    kernel: (399482302): received connect result 61

which, there you go, ECONNREFUSED which will be turned into EPIPE by sendto. (ETA: No, that's not what happens at all. I see other port 53 queries in my logs, and they follow the same, er, flow -- TPP refuses them, next log entry for the flow by the system is result 61.)

There is no traffic to 8.8.8.8 over any of the interfaces.

I have tried using a NENetworkRule that _excludes` port 53, but it does not allow that at all.

I am very deeply confused by all of this, to the point I'm not quite sure how to begin to articulate a request for help. If anyone has any thoughts, comments, questions, commiserative howls of agony, I'd appreciate it.

As a workaround, if we exclude 8.8.8.8 UDP all ports... it works.

Transparent Proxy Providers and DNS
 
 
Q