OpenVPN / openvpn3

OpenVPN 3 is a C++ class library that implements the functionality of an OpenVPN client, and is protocol-compatible with the OpenVPN 2.x branch.
https://openvpn.net
Other
1k stars 403 forks source link

Error calling protect method on socket [Mac M1] #243

Closed alexsmartens closed 2 years ago

alexsmartens commented 2 years ago

This issue is related to https://github.com/OpenVPN/openvpn3/issues/139 which was unfortunately closed without anyone attempting to solve it.

I'm seeing this problem on an M1 Mac. OpenVPN Connect 3.3.6 (4368): Error calling protect () method on socket. Here's my log:

[Sep 15, 2022, 07:17:13] EVENT: RESOLVE
[Sep 15, 2022, 07:17:13] Contacting
XXX.XXX.XXX.XXX:1194 via UDP
[Sep 15, 2022, 07:17:13] EVENT: WAIT
[Sep 15, 2022, 07:17:13] UnixCommandAgent:
transmitting bypass route to
/var/run/agent_ovpnconnect.sock
"host": "XXX.XXX.XXX.XXX"
"ipv6": false,
"pid": 11202
[Sep 15, 2022, 07:17:13] Transport Error:
socket_protect error (UDP)
[Sep 15, 2022, 07:17:13] Client terminated
restarting in 2000 ms...
Screen Shot 2022-09-15 at 7 50 46 AM
alexsmartens commented 2 years ago

The OpenVPN community would really appreciate if someone could take care of fixing the above problem.

For now, @antonb-taod suggested a good temporary fix that worked for me:

I don't know what issue other have, but I was able to solve mine today.

I was getting an error calling protected() method and same logs as mentiones above. I figured out that the file /var/run/agent_ovpnconnect.sock didn't exist and apparently the problem was that for any reason the ovpn agent wasn't running. To solve this I had to start /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent manually (I'm using macOS M1 12.2.1).

Hope it will help someone.

ordex commented 2 years ago

This bug tracker is about the OpenVPN3 library. For problems with OpenVPN Connect (that is a commercial product), please go to https://openvpn.net/support

strayon commented 1 year ago

I resolved this issue by revisiting OpenVPN's startup settings in "Settings > General > Login Items" and re-enabling it. Previously, I had unchecked it in the startup section.

georganix commented 1 year ago

Thank you @strayon that helped. Also, when entering the username in the VPN some servers require a prefix DOMAIN\userhandler. I also removed the DOMAIN\ portion and connected immediately.

diereysaa commented 12 months ago

In my case (MacOS Sonoma 14.1.2 on M2) the solution proposed by @antonb-taod and posted by @alexsmartens worked like a charm. Just needed to add sudo to it and the ampersand for leaving the daemon running in the background:

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent &

hemanthshopflo commented 7 months ago

In my case (MacOS Sonoma 14.1.2 on M2) the solution proposed by @antonb-taod and posted by @alexsmartens worked like a charm. Just needed to add sudo to it and the ampersand for leaving the daemon running in the background:

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent &

@diereysaa i tried in mac M2 its not working, can u suggest a better way.

diereysaa commented 7 months ago

@diereysaa i tried in mac M2 its not working, can u suggest a better way

Hmmm, I guess I forgot to mention that my own proposed solution didn't work for me to leave working in the background. I'm using Zsh and have an alias like this:

alias openvpn='sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent'

Without the ampersand at the end, and leaving the console window running the background: image

However, some times it gets stuck somehow, so it's a matter of cancelling (Ctrl+C) the background process and restarting it.

Hope you get it fixed and running soon :)

free521521521 commented 6 months ago

I resolved this issue by revisiting OpenVPN's startup settings in "Settings > General > Login Items" and re-enabling it. Previously, I had unchecked it in the startup section.

It works for me. Actually I realise the login item right after the app installation, I closed all of them immediately. That make the app not work.

Screenshot 2024-06-05 at 16 17 13
vd-eerkul commented 5 months ago

In my case (MacOS Sonoma 14.1.2 on M2) the solution proposed by @antonb-taod and posted by @alexsmartens worked like a charm. Just needed to add sudo to it and the ampersand for leaving the daemon running in the background:

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent &

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent

worked without &, terminal need still while connecting it.

fabiodepaula7 commented 5 months ago

In my case (MacOS Sonoma 14.1.2 on M2) the solution proposed by @antonb-taod and posted by @alexsmartens worked like a charm. Just needed to add sudo to it and the ampersand for leaving the daemon running in the background: sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent &

sudo /Library/Frameworks/OpenVPNConnect.framework/Versions/Current/usr/sbin/ovpnagent

worked without &, terminal need still while connecting it.

You can do this enabling Settings->General->Login Itens->Allow in Background->OpenVPN Client.

Screenshot 2024-07-09 at 21 49 19
RamdlanFaqih commented 1 month ago

I resolved this issue by revisiting OpenVPN's startup settings in "Settings > General > Login Items" and re-enabling it. Previously, I had unchecked it in the startup section.

it works !

JackPala commented 1 day ago

I resolved this as well by re-adding as a login item and giving it background access.

That being said, having an app that is required to be a startup item in order to function is a bug.

schwabe commented 1 day ago

@JackPala please reports the bug at support.openvpn.net. The connect team unfortunately completely ignores github issues.