Ubuntu: Can't connect to OpenVPN Access Server using Network Manager configuration



Question:

I usually use the terminal and type

sudo openvpn --config client.ovpn  

in order to connect to my VPS on which I installed OpenVPN Access Server in order to make my own VPN. However, it's not very practical, especially when I have to switch with another VPN (Cisco, in the network manager).

So I looked it up and found that I could add an OpenVPN config to my network manager after installing network-manager-openvpn.

However, my config file is not recognized when I click "Import a saved VPN configuration...", it says

 Error: Key file contains line 'setenv FORWARD_COMPATIBLE 1' which is not a key-value pair, group, or comment.  

I tried deleting that line, but then it's another line that's faulty, and then another, and so on.

So I tried splitting my .ovpn file into ca.crt, client.cr, client.key, using the sacli script that OpenVPN Access Server provides on the server itself. I put the the gateway, with and without port/tcp/udp, chose "Password with Certificates (TLS)", the username linked to the config file, the password, linked the different .crt and .key files, tried many different combinations of advanced parameters (use custom gateway port 443/1194, use TCP connection ON/OFF, use LZO data compression ON/OFF)... No result, after I chose the VPN connection the network manager icon shows that it tries to connect for second, shows a padlock for a split second, and goes on like this for a minute before telling me it failed.

If I try using the static key I have to fill in "Remote IP Address" and "Local IP Address", and I haven't found what they're supposed to be as I already have the gateway. I can't save the settings without them, so I tried putting the gateway in the "Remote IP Address" and "127.0.0.1" as the "Local IP Address", but when I do this it just instantly tells me "VPN Connection Failed".

Has anyone an idea of how I could finally manage to get this working?


Solution:1

I managed to find a way to have more detail about the errors. I looked through the syslog on the client while trying to connect, and the log openvpnas.log at /var/log on the server.

I'm using the Password with Certificates (TLS) authentification, and apparently, in order to make the configuration right I had to go in Advanced then TLS Authentification, tick Use additional TLS authentification, chose the ta.key file and chose direction 1. On the General tab I have just Use custom gateway port set to 443, Use LZO data compression and Use a TCP connection ticked. I hope this can help somebody in the future, I've lost so much time on this..


Solution:2

I have also had problems importing .ovpn configuration files into network manager as well. Oddly, it works for me on some machines, but not all.

I use the "Certificates (TLS)" option so I do not know about the userid / password options.

When I have to input the individual key files I use the following options.

On a 14.04 machine I use tick Use LZO data compression (nothing else ticked on any of the advanced options screens). (This has to match the server setting).

On the General tab I tick "All users may connect to this network".

On a 16.04 machine I additionally tick Set Virtual Device Type select TUN and set name TUN


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »