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.
Post
Replies
Boosts
Views
Activity
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.