For SSH try using a NENetworkRule like this:
Code Block swiftsettings.includedNetworkRules = [ |
NENetworkRule(remoteNetwork: NWHostEndpoint(hostname: "0.0.0.0", port: "22"), |
remotePrefix: 0, |
localNetwork: nil, |
localPrefix: 0, |
protocol:.TCP, |
direction: .outbound) |
] |
I was able to turn on a Transparent Proxy and make a SSH connection to a remote test machine.
Code Block text% ssh user@xx.x.x.155 |
... |
Welcome to Ubuntu 18.04.3 LTS ... |
System information as of Fri Sep 18 13:58:57 UTC 2020 |
|
System load: 0.0 Processes: 90 |
Memory usage: 20% IP address for eth0: x.x.x.155 |
Swap usage: 0% |
|
On the Transparent Proxy log:
Code Block 2020-09-18 06:58:47.997426-0700 provider will handle new flow, flow: 0x7f8d1d4151d0 TCP com.apple.openssh[{length = 20, bytes = x}] remote: x.x.x.155:22 |
2020-09-18 06:58:48.002330-0700 new flow with bundle id com.apple.openssh |
2020-09-18 06:58:48.002391-0700 ### (TCP) ### provider will handle new NEAppProxyTCPFlow, flow: 0x7f8d1d4151d0 - TCP com.apple.openssh[{length = 20, bytes = x}] remote: x.x.x.155:22 |
2020-09-18 06:58:48.002444-0700 provider core will start new TCP flow, flow: 0x7f8d1d4151d0 |
2020-09-18 06:58:48.002513-0700 ##### Copier - Ready 4 ##### |
Yes, but this logic applies to the new connection only. Correct? How is it possible to do this for the existing ones?
Yes, existing connection may see interruptions and may have to be restarted. Is that what you are seeing too?
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com