Hello everyone !
Switching recently from other distros to Fedora, did not find any related query so here is my first post.
To have a Vpn launched from its own provided script, I did create a systemd unit and enable it:
So it does start it at boot and connects.
Systemd creates its own Cgroup:
└─12171 openvpn xxxxxxxxx
systemd: Started Vpn auto-connect
Now when the connection is lost, or resuming from suspend, openvpn process stays on and no more connectivity.
So the systemd service needs to be restarted.
As per systemd documentation, network-online.target is only valid at first time connection happens.
So I found out to use NetworkManager-dispatcher, with a script like:
case “$2” in
/bin/systemctl restart myvpn || :
/bin/systemctl stop myvpn || :
- issue a systemctl restart NetworkManager,
- vpn connects.
- right after, the unit is stopped;
- it loops on and off indefinitely.
It does not seem to be a timeout as I changed delays without effects.
Also, I found that the dispatcher unit has Kill=process. So the dispatcher ending does not kill the vpn Cgroup.
Has anyone got any clue ?!
It must be obvious once one knows the exact internals but I could not find anything.
I could see:
But not sure what exactly was the solution.
Thanks in advance !