I have a script that works to check if my VPN connection is up, and if not, it restarts it. This works correctly in a terminal, but the command
nmcli con up uuid 7c514892-6a6a-4d33-946b-84aeb37615bb
seems to give an error when cron tries to run it, specifically: Error: Connection activation failed: Not authorized to control networking.
This is in my user crontab, so it seems like it should work? How ought I debug this?
More generally, what am I trying to do? I want my VPN to auto-reconnect when it stops. The GUI applet will erroneously show the lock icon when ifconfig will show no tun0 connection. On Scientific Linux 6, this is pretty easy, I can edit /etc/crontab and run a script that does the check and then if so, does a service openvpn restart, assuming my openvpn.conf includes a pointer to a pass.txt.
However, none of this works in SL7. OpenVPN doesn't seem to read /etc/openvpn/*.conf anymore, service openvpn restart fails on the command line. The only want in SL7 I can interact with it is via nmcli. Moreso, I have to do it as my user or else it doesn't have any VPN secrets, even when I've added them to the file and changed password-flags=0. The file format for the command line --password-file is apparently very different from the simple openvpn password file so that also doesn't work.
Hence, I'm working as my user. I'm fine with this, in fact I think I prefer it to having this done by root, in case I want to change VPN settings I can do it from the GUI...
Maybe I'm missing something obvious here, and my hack is stupid - hence the background. I don't need to solve the permission problem if there is a way to have the vpn re-connect automatically when it's down...