OpenVPN Library built for IOS and NEFramework integration

Official client software for OpenVPN Access Server and OpenVPN Cloud.
Post Reply
LucaG4B
OpenVpn Newbie
Posts: 4
Joined: Mon Aug 01, 2016 2:00 pm

OpenVPN Library built for IOS and NEFramework integration

Post by LucaG4B » Mon Sep 05, 2016 7:10 am

We are trying to use NE Framework to setup a VPN based on OpenVPN.

Thanks to OpenVPN library that we have integrated in our app, we can obtain all tun network parameters (ip, route ..) from OpenVPN server.
The initial handshake from App and Server to validate SSL certificate and key it's succesfully completed by OpenVPN library that call some callback in our App (for example tun_builder_add_address(), tun_builder_add_route() etc)
Our problem is: how we can configure IOS device VPN tunnel with that tun parameters obtained ?

As starting point (but I'm not sure that this is the correct starting point), we first try to setup a configuration using NETunnelProviderManager, but when we call NETunnelProviderSession with connection method we obtain Domain Error 1 and the startTunnelWithOptions:completionHandler of the extension is never called !
This is already a problem for us !
I re-attach our code for this first step

TunProviderManager = nil;
[NETunnelProviderManager loadAllFromPreferencesWithCompletionHandler:^(NSArray<NETunnelProviderManager *> * _Nullable managers, NSError * _Nullable error) {
if(managers != nil)
{
for(int8_t i = 0; i < [managers count]; i++)
{
if([[[managers objectAtIndex:i] localizedDescription] isEqualToString:@"iPCallVPN"])
{
TunProviderManager = [managers objectAtIndex:i];
}
}
}
else
{
}

if(TunProviderManager == nil)
{
TunProviderManager = [[NETunnelProviderManager alloc] init];
NETunnelProviderProtocol *protocol = [[NETunnelProviderProtocol alloc] init];
protocol.providerBundleIdentifier = @"com.infiniteplay.ipCall.vpnex"; /

/
protocol.serverAddress = @"195.78.202.220"; /
TunProviderManager.localizedDescription = @"iPCallVPN";
TunProviderManager.protocolConfiguration = protocol;
[TunProviderManager saveToPreferencesWithCompletionHandler:^(NSError * _Nullable error)
{
if(error)
{

}
else
{
}
}];

}
NETunnelProviderSession *session = (NETunnelProviderSession*) TunProviderManager.connection;
NSError *err;
[session startTunnelWithOptions:nil andReturnError:&err];
if(err)
{
// At this point we obtain Domain Error 1
}
}];

Thanks in advance for suggestions

Post Reply