XCode: 12.4
MacOS: 10.15.7
Signing Certificate: Sign to Run Locally
Provisioning Profile: Xcode Managed Profile
Capabilities: Network Extension, Personal VPN
Issue:
startTunnelWithOptions does get called, and then I call setTunnelNetworkSettings inside it. But it never gets executed. My assumption is that it might be some security policy or something. I am not familiar with App development for Mac systems and apparently it is quite confusing with very scarce documentation. Most of the errors throw in Console, I can't find documentation on them. At least not with simple googling, but ChatGPT has been helpful in explaining some of the errors. I have no intention of distributing the application through App Store.
- (void)startTunnelWithOptions:(NSDictionary *)options completionHandler:(void (^)(NSError *))completionHandler
{
NEPacketTunnelNetworkSettings* settings = [[NEPacketTunnelNetworkSettings alloc] initWithTunnelRemoteAddress:@"20.21.13.24"];
NEIPv4Settings* settingsIPV4 = [[NEIPv4Settings alloc] initWithAddresses:@[@"20.21.13.24"] subnetMasks:@[@"255.255.255.255"]];
NEDNSSettings* settingsDNS = [[NEDNSSettings alloc] initWithServers: @[@"8.8.8.8", @"8.8.4.4"]];
settings.IPv4Settings = settingsIPV4;
settings.IPv4Settings.includedRoutes = @[NEIPv4Route.defaultRoute];
settings.DNSSettings = settingsDNS;
settings.MTU = [NSNumber numberWithInteger:@1500];
[self setTunnelNetworkSettings:settings completionHandler:^(NSError* _Nullable error)
{
NSLog(@"Completion Handler Called");
completionHandler(nil);
}];
}
Console Errors:
Here are few of the errors from the console, there are many more and there are different processes throwing them so its hard for me to pin point which ones are related to my extension but these are the ones that look helpful in this case.
CS_PLATFORM_BINARY set but not AppleSigned; prompt policy is Deny.
Failed to add policy:
order = 10810
result = {
result-type = ip-tunnel
secondary-result = pass
}
conditions = (
{
condition-type = effective-application
application-uuid = AADC77FD-D5E1-3A11-B327-8137FD04C0B5
},
{
condition-type = real-application
application-uuid = AADC77FD-D5E1-3A11-B327-8137FD04C0B5
},
{
condition-type = all-interfaces
},
{
condition-type = effective-pid
pid = 1337
},
)
Sandbox: nesessionmanager(851) System Policy: deny(1) system-privilege 10006