OK, I have stumbled through the linked thread and after some misinterpretations I have at least managed to create a new ovpn file that does no longer requires a password to operate. This command:
Code: Select all
openssl rsa -in xxx.ovpn -out xxx.key
gave me a password-free rsa key, which I could replace the existing key with to wind up with an ovpn file not requiring password entry.
When I use this on the command line to start a connection it works fine and connects without asking for a password.
But then it is blocking of course...
So far so good, but the other thread is about starting VPN connection on boot, which is not what I want....
Is there a way to create the openvpn connection service in systemd but have it "dormant" until needed?
@DougieLawson in the other thread suggests these commands may be used where nl is the name of the /etc/openvpn/nl.ovpn file):
Code: Select all
sudo systemctl enable openvpn@nl (enables the service to start at boot?)
sudo systemctl start openvpn@nl (starts the service manually)
sudo systemctl stop openvpn@nl (stops the service manually)
sudo systemctl remove openvpn@nl
I tried the first command and it executed seemingly OK.
But I was unable to start the connection:
Code: Select all
$ sudo systemctl enable openvpn@BosseB_NP
Created symlink /etc/systemd/system/multi-user.target.wants/openvpn@BosseB_NP.service → /lib/systemd/system/n@.service.
$ sudo systemctl start openvpn@BosseB_NP
Job for openvpn@BosseB_AGI_NP.service failed because the control process exited with error code.
See "systemctl status openvpn@BosseB_NP.service" and "journalctl -xe" for details.
$ sudo systemctl status openvpn@BosseB_AGI_RPi_local95_NP.service
● openvpn@BosseB_NP.service - OpenVPN connection to BosseB_NP
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Mon 2019-12-23 11:03:41 CET; 2s ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Process: 28107 ExecStart=/usr/sbin/openvpn --daemon ovpn-BosseB_NP --status /run/openvpn/BosseB_AGI_RPi_lo
Main PID: 28107 (code=exited, status=1/FAILURE)
So now I have removed the service again...
CONCLUSION:
Won't waste more time on this since I can use the password-free ovpn file to connect using a simple to remember shellscript.