Solution to openvpn only working in command line, not vpnclient

What type of hardware are you using: Other ARM board
What YunoHost version are you running: 12.0.11
What app is this about: ynh-vpnclient

Describe your issue

I’ve had issues with my VPN using the ynh-vpnclient service. Reading forum posts, a few other people (e.g. Service vpnclient failed - #2 by rodinux, Vpn client 2.2~ynh6, Issues with my VPN Client) observed that manually launching openvpn --config /etc/openvpn/client.conf led to a successful VPN connection, but yunohost service start ynh-vpnclient failed, with no helpful error message. It would then try to restart, getting stuck into a loop of intermittent VPN connectivity - openvpn connects, but ynh-vpnclient doesn’t believe it, so it kills it and restarts, etc.

I determined in my case this was because openvpn was not logging to /var/log/openvpn-client.log but to syslog. The application checks /var/log/openvpn-client.log to confirm the VPN is up in this line: vpnclient_ynh/conf/ynh-vpnclient at 179f9fa3354a3b6d2425653af0b6749e1be82f43 · YunoHost-Apps/vpnclient_ynh · GitHub

But if nothing is being written to that log, ynh-vpnclient will think the connection was unsuccessful.

Edit: this was not correct…

I manually edited /etc/default/openvpn to ensure this would be logged correctly:

code in edit history

systemctl restart-daemon is needed after this. Afterwards, I could successfully run the VPN from yunohost service start ynh-vpnclient and re-enable this service, avoiding having to periodically launch it manually

This did actually fix it

Adding log /var/log/openvpn-client.log to the end of the file in /etc/openvpn/client.conf. This way it doesn’t go to syslog and ynh-vpnclient service recognizes the VPN is up.

I have two Yunohost servers running on ARM boards and this solved the issue for both of them. I hope it may be useful to other people since I spent a lot of time troubleshooting this. I don’t know if this is the real reason my problem went away or if it would solve the previously linked posts’ problems, but figured I’d share my findings in any case.

Share relevant logs or error messages

hastebin (this is it working, previous errors in log are from me manually killing prior processes)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.