Search code examples
iosswiftnetworkextensionnevpnmanager

NEVPNManager stop working with iOS 14 beta


I've tried to run my app on iOS 14 beta. It works fine on iOS 13 but can't connect to any server on iOS 14 beta. NEVPNManager.shared().connection.startVPNTunnel() doesn't throw any error and NEVPNStatus become .disconnected with any server that I connect. I can't find what changed in NEVPNManager on iOS 14.

This is configuration of my manager:

let p = NEVPNProtocolIKEv2()
p.authenticationMethod = NEVPNIKEAuthenticationMethod.none
p.serverAddress = account.server
p.disconnectOnSleep = false
p.deadPeerDetectionRate = NEVPNIKEv2DeadPeerDetectionRate.medium
p.username = account.account
p.passwordReference = KeychainWrapper.passwordRefForVPNID()
p.disableMOBIKE = false
p.disableRedirect = false
p.enableRevocationCheck = false
p.enablePFS = false
p.useExtendedAuthentication = true
p.useConfigurationAttributeInternalIPSubnet = false
p.remoteIdentifier = account.server
p.localIdentifier = account.account
            
let manager = NEVPNManager.shared()
manager.protocolConfiguration = p
manager.isEnabled = true
let ruleConnect = NEOnDemandRuleConnect()
ruleConnect.probeURL = account.probeUrl
manager.onDemandRules = [ruleConnect]
manager.isOnDemandEnabled = true

Solution

  • It seems Apple changed the ciphers on iOS 14(with documented), you can see some of the threads here:

    https://developer.apple.com/forums/thread/659209
    https://developer.apple.com/forums/thread/657792
    https://developer.apple.com/forums/thread/657792
    https://developer.apple.com/forums/thread/661298?page=2
    

    If you're using StrongSwan like me, you can fix it by update the configs from your VPN server, just set ike=aes256-sha2_256-modp2048 and esp=aes256-sha2_256, and restart StrongSwan, then it works for iOS 14. Refs: https://wiki.strongswan.org/projects/strongswan/wiki/AppleClients