I’d like to find a way to properly install a new ovpn client configuration via ssh (I need to do many and would like to script this as a part of device setup).
I’ve copied the .ovpn file, added lines to set script-security 2 and run update-resolv-conf on up/down, and I’ve added entries to /etc/config/ovpnclients as well as /etc/config/glconfig to point at the correct file.
But I think i’m missing where these configurations are stored. The VPN connection can be successfully made, but I’ve been seeing some strange things when the link is interrupted (e.g. can’t disconnect/reconnect in the gui, up/down script not firing correctly, routes and iptables rules not being applied as a result).
Is there a way for me to properly add an ovpn client config without using the web GUI?
You can add some ovpn using the GUI then check how the files are put in the system.
here should just be some common settings, e.g. groups
/etc/config/glconfig should only contains which config is chosen
here is the real ovpn /etc/openvpn, there are folders contains the ovpn files.
As for the up/down script, there is nothing related to the GUI. As long as your ovpn file can be found, the scripts in the ovpn should be able executed. but you must make sure the path for up/down is correct.
Finally, you need to post the real logs to tell the reason.
I started again and repeated these steps and it seems the problem has resolved. Before, the VPN would connect automatically, but when I tried to disconnect via the web GUI, I would get an error " ERROR: Invalid parameter, value or format!" The system log also contained this entry:
Sat Jan 26 14:11:56 2019 user.info : 1266: gl-vpn-client>> Stop, vpnpath=, serverfile=
This may have been due to storing the ovpn file outside the etc/openvpn directory initially, not sure. But I’ve managed to manually add the configuration to this directory, edit the two config files and everything is working properly. Thanks!