Posts

Post not yet marked as solved
1 Replies
543 Views
I am trying to implement Transparent Proxy using NETransparentProxy on macOS 10.15 to see the flows but not able to do thatExtension code:class AppProxyProvider: NEAppProxyProvider { override func startProxy(options: [String : Any]? = nil, completionHandler: @escaping (Error?) -> Void) { os_log("startProxy function called.") let includeRule = NENetworkRule(destinationHost: NWHostEndpoint(hostname: "google.com", port: "443"), protocol: .TCP) let proxySettings = NETransparentProxyNetworkSettings(tunnelRemoteAddress: "127.0.0.1") proxySettings.includedNetworkRules = [includeRule] setTunnelNetworkSettings(proxySettings) { error in if let applyError = error { os_log("Failed to apply proxy settings: %@", applyError.localizedDescription) } completionHandler(error) } } override func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { completionHandler() } override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool { if let tcpflow = flow as? NEAppProxyTCPFlow { os_log("Got TCP flow for site. %@", tcpflow.metaData.debugDescription) } else { os_log("Got something else. %@", flow.metaData.debugDescription) } return false }}App code:func enableProxyConfiguration() { let manager = NETunnelProviderManager.shared() guard !manager.isEnabled else { registerWithProvider() return } loadProxyConfiguration { success in guard success else { self.status = .stopped return } if manager.protocolConfiguration == nil { manager.protocolConfiguration = NETunnelProviderProtocol() manager.protocolConfiguration?.serverAddress = "127.0.0.1" if let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String { manager.localizedDescription = appName } } manager.isEnabled = true manager.saveToPreferences { saveError in DispatchQueue.main.async { if let error = saveError { os_log("Failed to save the configuration: %@", error.localizedDescription) self.status = .stopped return } self.registerWithProvider() } } } }I am getting following message when starting the app:default 13:04:21.099931+0530 TransparentProxy Failed to save the configuration: Missing protocol or protocol has invalid typeAlso not getting any flows and no logs even for startProxy.In app I have tried bothlet manager = NETunnelProviderManager.shared()and let manager = NETransparentProxyManager.shared()but nothing is working.I have trying searching the issue in forum but couldn't find anything to resolve it.Please help on how to resolve this issue.
Posted
by padhikari.
Last updated
.
Post not yet marked as solved
4 Replies
509 Views
Hi,My software currently uses network kernel extension functionalities and I am trying to port it to new network system extension.One of the functionality of my software is to capture the packet and if it is of interest then consume it and send out processed packets.I am looking into Content Filter right now and couldn't find any option for this. Are there any alternative for this in current system extension framework.
Posted
by padhikari.
Last updated
.
Post not yet marked as solved
6 Replies
1.2k Views
Hi,I have a product for macOS which uses Network Kernel Extensions to get the network data and modify the data based on some pre-defined rules.As kexts will no longer be supported starting macOS 10.16, I have to port my solution to use Network System Extensions.I am not able to find out what APIs to use for this purpose.I looked into NEFilterPacketProvider under Content Filters which can provide me the packet and based on rules I can allow/deny/delay. But is it possible to perform some computation and forward the manipulated data before allowing it??Also I couldn't find any example for NEFilterPacketProvider which can help me in speeding up the process. If someone could point me to any references it will be really helpful.
Posted
by padhikari.
Last updated
.