Openvpn disconnects after hibernate

I have configured openvpn to run on start up. Everything is working fine until I hibernate. After I restore from hibernation, I no longer have an Internet connection. I find that if I restart openvpn, I get a connection again.
What is happening and what is a solution?

Second question: Is there a way to store my username and password credentials in a non-world-readable way?

Love it when I can solve my own problem. Here is the solution.

Apparently this is a known issue: 12.1Client daemon not reconnecting after suspend

Here is what I added to my configuration.nix: = {
    enable = true;
    description = "Restart OpenVPN after suspend";
    script = "${pkgs.procps}/bin/pkill --signal SIGHUP --exact openvpn";
    wantedBy = [ "" ];

1 Like

Hello. Actually, I’ve just recently added a special option for openvpn module - NixOS Search :slightly_smiling_face:

How recent? Because it looks like it defaults to true, but it wasn’t restarting for me. I had to create the above service.

I don’t know exactly, maybe a week or two. You can try and set it to false in your configuration, to verify it’s available in your nixpkgs channel. If it’s not, then you should update. If it is available, and not working, then we should debug it. I haven’t tested it with hibernation, but it definitely work for suspend to RAM.

Ah. Unstable. I’m on stable.

1 Like

How about this question?

Totally depends on the details.

Any secret that can be read from a file can generally be made a real secret.

If you then use sideloading to copy the file manually, or sops-nix or age-nix depends on even more details.