Post

Replies

Boosts

Views

Activity

Reply to Data storage for Network Extension
I followed your advice and tried to first test access to the shared container and everything worked as expected: Filter Data and Filter Control Providers were able to read from app group container and main target was able to write data. After that I tried to add Core Data like this: private lazy var persistentContainer: NSPersistentContainer = { guard let sharedContainerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "MyGroupIdentifier") else { fatalError("Shared container is not accessible.") } let storeURL = URL.storeURL(group: "MyGroupIdentifier", database: "MyCoreDataModel") let description = NSPersistentStoreDescription(url: storeURL) let container = NSPersistentContainer(name: "MyCoreDataModel") container.persistentStoreDescriptions = [description] container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError("Unresolved error \(error), \(error.userInfo)") } }) return container }() public extension URL { static func storeURL(group: String, database: String) -> URL { guard let fileContainer = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: group) else { fatalError("Shared file container could not be created.") } return fileContainer.appendingPathComponent("\(database).sqlite") } } My VM in the main app target stores Model shared instance and everything compiled as expected. However, if I try to call let's say fetch for database, Content Filter becomes Invalid. I had similar problem, when I tried to add async operation to my Filter Data Provider handleNewFlow func in order to store intercepted flows, that's why I moved logic to VM and UserDefaults at that time
May ’24
Reply to Data storage for Network Extension
I thought that I could do something wrong yesterday so I tried to rewrite my data related module using Core Data again. But I still receive this message in console failed to launch: 'Could not attach to pid : “1275”' -- Failed to get reply to handshake packet within timeout of 6.0 seconds Not sure what's wrong with my implementation
Apr ’24
Reply to DNSProxy with configuration profile & MDM
However, I have another question regarding DNS Proxy. Yesterday, I made it work in my main project with Content Filter and it worked as expected. Today after some testing (no changes were made to the project), the device is not functioning right. All flows are not going through even after removing all the filtering logic. And in safari I receive "Safari could not open the page because the server stopped responding". So I tried to isolate the problem and it seems that DNSProxy is the one that's not working properly, because Content Filter itself works properly. It says running in the System Settings for DNS Proxy and the principal class looks like this: class DNSProxyProvider: NEDNSProxyProvider { override func startProxy(options:[String: Any]? = nil, completionHandler: @escaping (Error?) -> Void) { // Add code here to start the DNS proxy. completionHandler(nil) } override func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { // Add code here to stop the DNS proxy. completionHandler() } override func sleep(completionHandler: @escaping () -> Void) { // Add code here to get ready to sleep. completionHandler() } override func wake() { // Add code here to wake up. } override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool { // Add code here to handle the incoming flow. return true } } But it still wouldn't work. So I tried to run the project that had only DNSProxy with default settings, the same problem there. Not sure what's causing this problem. Would be grateful to hear any thoughts
Apr ’24
Reply to DNSProxy with configuration profile & MDM
So, I removed all existing profiles from the device and added a new payload for DNS Proxy, that is similar to the one I added earlier. After that I created an empty project to test if it's going to work (NEDNSProxyProvider principal class file added to compile sources of the main target), and it worked as expected. DNS Proxy now is displayed as Running in System Settings.
Apr ’24
Reply to DNSProxy with configuration profile & MDM
Yes, I was trying to install configuration payload profile via MDM. In this configuration profile I have two payloads (Content Filter and DNS Proxy). Content Filter works as expected, but not the DNS Proxy. That's why I had another post on my profile regarding async operations in Network Extension, as the initial idea of using DNS Proxy with specified resolver didn't work for me.
Apr ’24
Reply to DNSProxy with configuration profile & MDM
And could you help me understand the work of the Content Filter in the following context. When I use the Network Tools app for testing ping commands for specified domains/IP addresses, the content filter (both socket and browser filtering enabled) is unable to intercept them. Is it the problem of sandbox restrictions? However, if I use DNSProxy with NEDNSManager which I tested before, I can intercept ping of the domains but not IP addresses, which is obvious. However, why is the content filter unable to intercept traffic from the Network Tools app?
Apr ’24
Reply to Unable to start NEContentFilter on iOS
I tried to use configuration profile on the new project so it wasn't the initial project, but it didn't work. I only added two extension targets for Filter Data Provider and Filter Control Provider, and set handleNewFlow in Filter Data Provider to .drop() by default. I am just trying to test the concept of Content Filter, so that I could move on to implementing some custom filtering logic.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’24