Bosse_B
Posts: 966
Joined: Thu Jan 30, 2014 9:53 am

How can I install and use an openvpn client GUI on Raspbian_

Thu Dec 19, 2019 1:45 pm

I am using OpenVPN to access our office network to reach the subversion server.
On Windows this works fine using an application called OpenVPN/GUI where I can import my OVPN files and connect&disconnect the VPN easily.

I have failed to find any such thing for Linux except today I found this howto that describes how one can do it.
But it is for Ubuntu Mint only as I understand it, and it uses NetworkManager, which is not used by Buster, right?
Anyone that knows if there is something similar available for Raspbian Buster?

Right now I am developing code on an RPi4 box and I need to use the SVN repository server, so I have had to go to the command line (terminal) and launch the OpenVPN client and there is no way I can disconnect easily except by using sudo kill <pid>...
Bo Berglund
Sweden

epoch1970
Posts: 5022
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: How can I install and use an openvpn client GUI on Raspbian_

Thu Dec 19, 2019 9:55 pm

You should be able to start and stop the tunnel via systemd I believe. It will do the kill for you.
https://www.raspberrypi.org/forums/view ... &p=1522848

That, because installing an alternate network manager could be a wild goose chase.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Bosse_B
Posts: 966
Joined: Thu Jan 30, 2014 9:53 am

Re: How can I install and use an openvpn client GUI on Raspbian_

Mon Dec 23, 2019 10:19 am

epoch1970 wrote:
Thu Dec 19, 2019 9:55 pm
You should be able to start and stop the tunnel via systemd I believe. It will do the kill for you.
https://www.raspberrypi.org/forums/view ... &p=1522848

That, because installing an alternate network manager could be a wild goose chase.
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.
Bo Berglund
Sweden

Return to “General discussion”