passepartoutvpn / tunnelkit

VPN client library for Apple platforms.
GNU General Public License v3.0
9 stars 8 forks source link

Connect via ovpn configuration data #331

Closed manglikankit closed 1 year ago

manglikankit commented 1 year ago
          There's a Demo project for what you need.

Originally posted by @keeshux in https://github.com/passepartoutvpn/tunnelkit/issues/329#issuecomment-1668578664

Hi, Davide, I'm configured the all inputs as following: do { let parser = try? OpenVPN.ConfigurationParser.parsed(fromContents: ovpnConfigSTR)

        textServer.text = parser?.configuration.dnsTLSServerName
        textDomain.text = parser?.configuration.dnsDomain
        textPort.text = "443"
        switchTCP.isOn = false
        textUsername.text = username
        textPassword.text = password
    }

and make method :

static func make(params: Parameters) -> OpenVPN.ProviderConfiguration { var builder = OpenVPN.ConfigurationBuilder() builder.ca = ca builder.cipher = .aes256cbc builder.digest = .sha1 builder.compressionFraming = .compLZO builder.renegotiatesAfter = nil builder.remotes = [Endpoint(params.hostname, EndpointProtocol(params.socketType, params.port))] builder.tlsWrap = TLSWrap(strategy: .auth, key: tlsKey) builder.mtu = 1350 builder.routingPolicies = [.IPv4, .IPv6] let cfg = builder.build()

        var providerConfiguration = OpenVPN.ProviderConfiguration(params.title, appGroup: params.appGroup, configuration: cfg)
        providerConfiguration.shouldDebug = true
        providerConfiguration.masksPrivateData = false
        return providerConfiguration
    }

Also changed the vc value of variable : static let ca = OpenVPN.CryptoContainer(pem: """, but for static let tlsKey = OpenVPN.StaticKey(file: """. It is same as it is 'coz can't convert into 2048 bit statickey. I've configures all the app group and bundleidentifier also.

Still I am unable to connect. Do you have any video link where you are connecting with .ovpn file? It would help me much more. I need to connect only in iPhone/iPad devices. Please find the attached sample doc file through which I need to connect. ovpn-config.docx

keeshux commented 1 year ago

Dude, this is not an issue.

manglikankit commented 1 year ago

Hey Davide, I know this is not an issue but just asking for your help please.