Thanks for adding the latest information. To be honest this report seemed odd to me from a general mail usage case, so I took a few minutes verified that the Mail.app does still receive email when a Transparent Proxy is running with a very broad set of TCP/UDP NENetworkRules rules. For example:
Code Block swiftsettings.includedNetworkRules = [ |
NENetworkRule(remoteNetwork: nil, remotePrefix: 0, localNetwork: nil, localPrefix: 0, protocol: .TCP, direction: .outbound), |
NENetworkRule(remoteNetwork: nil, remotePrefix: 0, localNetwork: nil, localPrefix: 0, protocol: .UDP, direction: .outbound) |
] |
When running this on macOS 11 Big Sur (Big Sur 11 beta 6) and built with Xcode 12, I was able to start the Transparent Proxy as normal and see my flow copier start running. I then sent an email to my inbox that I configured just for this test and it was received just fine. I seen the email come through my flow copier and I could view the email contents in the Mail.app with no problem.
Code Block text2020-09-16 07:26:13.503985-0700 0x295890 remote: imap.gmail.com:993 |
2020-09-16 07:26:13.507324-0700 0x295890 new flow with bundle id com.apple.mail |
2020-09-16 07:26:13.507378-0700 0x295890 ### (TCP) ### provider will handle new NEAppProxyTCPFlow, flow: 0x7fe04261a4d0 - TCP com.apple.mail[{length = 20, bytes = ...}] remote: imap.x.com:993 |
2020-09-16 07:26:13.544090-0700 0x29592c copier 19 connection did change state, |
2020-09-16 07:26:13.544120-0700 0x29592c ##### Copier - Ready 19 ##### |
2020-09-16 07:26:13.544133-0700 0x29592c copier 19 connection did change state, state: ready |
Now, there are a few distinct differences about my test and the test that you ran, ngorskikh. Here are those differences:
1) I did not disable IPv6 on my network interface.
2) I did not use a Yahoo account when testing.
3) My flow copier is not setup to not use nil to open the flow and the flow is open only after the remote side of the connection is opened.
In regards to number 3, in my testing I alway open the remote side of the connection first so that the flow can be opened with
connection.currentPath?.localEndpoint, instead of using nil. Why do you use nil to open the flow here for the localEndpoint? I would try rearranging your flow copier to open your flow ONLY if you have a localEndpoint on your localPath available. Note that this will involve rewriting your flow copier. Let me know if this improves your situation. If not,
open a TSI and I can dig in further.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com