ss-abramchuk / OpenVPNAdapter

Objective-C wrapper for OpenVPN library. Compatible with iOS and macOS.
GNU Affero General Public License v3.0
473 stars 209 forks source link

Getting Permission Denied on Mac #207

Closed houmie closed 3 years ago

houmie commented 3 years ago

Hi @ss-abramchuk

I hope you're well.

I have been using your project for quite some time on iOS without any problems. But I have tried it for the first time today on Mac and am getting this permission error:

self.tunnelProviderManager?.saveToPreferences(completionHandler: { (error) in
                    if error == nil  {
                        self.tunnelProviderManager?.loadFromPreferences(completionHandler: { (error) in
                            do {
                                    try self.tunnelProviderManager?.connection.startVPNTunnel()
                            } catch let error {
                                print(error.localizedDescription)
                            }
                        })
                    }
                })
domain: "NEVPNErrorDomain" - code: 5    
"NSLocalizedDescription" : "permission denied"  

Is this the permission it needs to ask the user to allow the VPN profile to be installed for the first time? If that's so, why isn't it triggering a popup to ask me to give permission? What do I have to do?

The IKEv2 variant that comes with Mac works fine (it did ask for permission at very beginning). I think installing the VPN profile for OpenVPN needs another permission before it can be installed.

Many Thanks, Houman

houmie commented 3 years ago

@ss-abramchuk I actually found out if I give all these extra capabilities, then the error goes away:

Screenshot 2021-06-06 at 13 34 04

However when I connect, it simply disconnects right after. It never reaches the VPN server. I keep digging to find out about the mystery. Where can I check for logs to see why it didn't connect after try self.tunnelProviderManager?.connection.startVPNTunnel() has run?

Thanks

houmie commented 3 years ago

@ss-abramchuk I tried everything. It is simply not working on Mac. Do you have a sample project that works with Mac? That would be so awesome, if you had that.

Again the iOS project works perfectly fine. But something is off with the Mac version. Maybe there is a bug that we have missed?

Thank you Houman

ss-abramchuk commented 3 years ago

Hi @houmie,

You may try checking logs using Console app, pay attention to anything related to NetworkExtension and bundle identifier of your extension. And following this link you will find the demo project for macOS.

zubairahmad2 commented 3 years ago

@ss-abramchuk I tried everything. It is simply not working on Mac. Do you have a sample project that works with Mac? That would be so awesome, if you had that.

Again the iOS project works perfectly fine. But something is off with the Mac version. Maybe there is a bug that we have missed?

Thank you Houman

hi @houmie can you share the iOS project configuration which you have successfully configuration done. I have tried many time but still not connection established Thanks

houmie commented 3 years ago

Sorry for the late reply.

@ss-abramchuk Thank you for the project and the tips you have provided. I finally saw my mistake in the console. My mistake was in PacketTunnelProvider.swift. I guess I close this issue then. So this works with Mac as well.

@zubairahmad2 It's best to start a new ticket and explain what you have done. I'm happy to help. I followed the iOS example that was provided on the main page. Make sure to create the tunnel in the project. This was my first mistake when I started with this project. You can't just use this code from your project.