Openvpn импорт конфигурации linux

Connecting to Access Server with Linux

Connecting to OpenVPN Access Server from Linux requires a client program. It will capture the traffic you wish to send through the OpenVPN tunnel, encrypting it and passing it to the OpenVPN server. And of course, the reverse, to decrypt the return traffic.

Linux Packages Discussed

OpenVPN Access Server openvpn-as
OpenVPN 3 Linux Client openvpn3
OpenVPN open source openvpn

OpenVPN 3 Linux Client

The OpenVPN 3 Linux project is a new client built on top of the OpenVPN 3 Core Library. This client is the official OpenVPN Linux Client program. You can find an overview of the features, frequently asked questions, and instructions on installing the openvpn3 package on our OpenVPN 3 for Linux site.

After following the instructions there to install the client, you’ll need a connection profile. This is a file generated by your OpenVPN Access Server installation for your specific user account. It contains the required certificates and connection settings. Go to the Client web interface of your Access Server (the main address, not the /admin portion). Log in with your user credentials. You will be shown a list of files available to download. Pick the user-locked profile or the auto-login profile, and you will be sent a client.ovpn file. Save this file to your Linux operating system.

Once you’ve moved the file to your Linux system, you can import it.

openvpn3 config-import —config $

You can start a new VPN session:

openvpn3 session-start —config $

You can manage a running VPN session:

And so on. More details can be found here: OpenVPN3Linux.

OpenVPN open source OpenVPN CLI program

The open source project client program can also connect to the Access Server. The package is available in most distributions and is known simply as openvpn. It supports the option to connect to multiple OpenVPN servers simultaneously, and it comes with a service component that can automatically and silently start any auto-login profiles it finds in the /etc/openvpn folder, even before a user has logged in. This service component can be set to automatically start at boot time with the tools available in your Linux distribution if supported. On Ubuntu and Debian, when you install the openvpn package, it is automatically configured to start at boot time.

To install the OpenVPN client on Linux, it is possible in many cases to just use the version that is in the software repository for the Linux distribution itself. If you run into any connectivity problems when using outdated software, it may be due to a possible lack of support for higher TLS versions in older versions of OpenVPN. Follow the instructions found on the open source openvpn community wiki if you wish to install the OpenVPN client on your Linux system.

After installing, you will need a connection profile. This is a file generated by your OpenVPN Access Server installation for your specific user account. It contains the required certificates and connection settings. Go to the Client web interface of your Access Server (the main address, not the /admin portion). Log in with your user credentials. You will be shown a list of files available to you for download. Pick the user-locked profile or the auto-login profile, and you will be sent a client.ovpn file. Save this file to your Linux operating system somewhere. OpenVPN Access Server supports server-locked, user-locked, and auto-login profiles, but the OpenVPN command line client is only able to connect with user-locked or auto-login connection profiles.

Читайте также:  Альт линукс подключить сетевой диск

We are assuming you are going to start the connection through either the command line as a root user, or via the service daemon. If you want unprivileged users to be able to make a connection, take a look at the community wiki for more information on how to implement that. Here we are going to focus on the simplest implementation; run the connection as root user directly, or via the service daemon.

Start a connection with an auto-login profile manually:

openvpn --config client.ovpn

Start a connection with a user-locked profile manually:

openvpn --config client.ovpn --auth-user-pass

If you use Google Authenticator or another extra factor authentication, add the auth-retry parameter:

openvpn --config client.ovpn --auth-user-pass --auth-retry interact

To start an auto-login connection via the service daemon, place client.ovpn in /etc/openvpn/ and rename the file. It must end with .conf as file extension. Ensure the service daemon is enabled to run after a reboot, and then simply reboot the system. The auto-login type profile will be picked up automatically and the connection will start itself. You can verify this by checking the output of the ifconfig command; you should see a tun0 network adapter in the list.

One major feature that is missing with the command line client is the ability to automatically implement DNS servers that are pushed by the VPN server. It is possible, but it requires you to install a DNS management program such as resolvconf or openresolv, and it may or may not clash with existing network management software in your OS. The idea here, however, is that you use a script that runs when the connection goes up, and when it goes down, that uses resolvconf or openresolv to implement the DNS servers for you. The reason why this client is not able to manage it completely by itself is mainly because in an operating system like Windows, Macintosh, Android, or iOS, there is already an established single method of handling DNS management. It is therefore easy for us to create a software client for those operating systems that already knows how to handle DNS. But Linux is available in so many variations and also supports different programs and methods of implementing DNS servers, and so it was only reasonable to leave built-in DNS support out of the OpenVPN program and instead to provide, where possible, a script that handles DNS implementation. Such a script could even be written by yourself to do whatever tasks are necessary to implement the DNS servers in your unique situation.

Читайте также:  Отличия графических оболочек линукса

Fortunately on Ubuntu and Debian, for example, there is the /etc/openvpn/update-resolv-conf script that comes with the openvpn package that handles DNS implementation for these operating systems. You need only to activate the use of these by following the instructions:

Open your client.ovpn file in a text editor:

At the very bottom simply add these lines:

script-security 2 up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf

The first line enables the use of external scripts to handle the DNS implementation tasks. The up and down lines are there to implement DNS servers pushed by the VPN server when the connection goes up, and afterwards to undo it, when the connection goes down.

Ubuntu network management program

There is also the option of connecting through the GUI using the openvpn extension for the Gnome network manager plugin. But this is currently a bit tricky to set up. There is for example the incorrect assumption that all VPNs will be able to redirect Internet traffic, and older versions might not understand the .ovpn file format, requiring you to split up the certificate embedded in it into separate file. And you would likely have to dig into the options to ensure that a default Internet traffic route going through the VPN server is not always enabled by default, especially for servers where you only give access to some internal resources, and not the entire Internet. However the advantage of using the GUI component is that you can start/stop the connection from the desktop environment on Linux.

Источник

How can I use a .ovpn file with Network Manager?

Open Network Manager, click «Add» and from the opened window select «Import a saved VPN configuration. » under «Choose a Connection Type». Navigate to your .ovpn file (~jrg/Documents/vpn-config.ovpn). If it doesn’t automatically find your certificates/keys (the paths of which are found in the .ovpn file), you can select them here, or make any other small changes.

openvpn dialog

One other thing that may save you some headache down the road is to click IPv4 Settings, then change the method to «Automatic (VPN) Addresses Only». When kept at the default, this will cause ALL internet traffic to go over the VPN, regardless of your .ovpn settings. Here you can also set the DNS server and search domains to use while connected.

openvpn dialog

Open VPN AS ver 2.0.12 does not produce a .ovpn files that contains the locations of certs, it contains them itself. Therefore if will not find them and you can not find the location. You have to copy n paste like in the other answer.

as of 16.04, It’s still not working and at least this time you get «import is not supported in the plugin». Network manager still has issues even when manually configured

Since ubuntu 18.04, if you already have the opvn file you can import it. (sudo is not required)

nmcli connection import type openvpn file [client].ovpn 

Once done, go to search and find ‘network’, the new vpn connection will be there.

Читайте также:  Usb to 485 linux

Thanks, this is way better than fooling around in the Network Manager GUI. (I don’t even have to use sudo if nm-applet is owned by me)

This worked for Ubuntu 18, just one fact if it continuously asks for password even if you are entering correct password, please check the configuration, I had to manually enter the username, password by editing the config via GUI.

My own experience of successful VPN connection establishing on Ubuntu 14.04.

Our admin gave me 3 files to install them into openVPN for Windows 7: *.ovpn, *.crt, *.key

    Execute the following commands in your Ubuntu terminal:

sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome network-manager-vpnc sudo /etc/init.d/networking restart 

That’s all, I hope it helps. Good luck!

It’s late to answer, but I found a solution (and it is a PAIN).

  1. Create a folder in your home directory called .OpenVPN (with the dot in front of it so it is hidden) then open that folder and create one called FrootVPN (no dot needed). This makes management of different VPN providers easier.
  2. Copy/Paste froot.ovpn to the /home/YOU/.OpenVPN/FrootVPN folder.
  3. Open the froot.ovpn file with a text editor.
  4. Copy everything between the ca /ca tags.
  5. Paste the contents to a new file and save it as ca.crt within the /home/YOU/.OpenVPN/FrootVPN folder.
  6. Click on the Network Manager icon and go to VPN CONNECTIONS > CONFIGURE VPN.
  7. Click on ADD and select OpenVPN. Click CREATE.
  8. Call it FrootVPN 1194 and use se-openvpn.frootvpn.com for the Gateway. Type will be PASSWORD. Enter your FrootVPN username and password. On CA Certificate, click the folder icon and browse to the ca.crt file you created.
  9. Click the Advanced button and change «Use custom gateway port:» to 1194. Click OK.
  10. Change the Method on both the IPv4 and IPv6 tabs to Automatic (VPN) addresses only.
  11. Click SAVE.

Now for the PAIN part: you will have to create 15 more FrootVPN connections since they use ports 1194-1209. Repeat Steps 7-11 above for port 1195 then again for 1196 and so on until you finish with port 1209 making sure the name in Step 8 matches the port in Step 9. I know. it sucks!

Now you can connect to FrootVPN by clicking on the Network Manager icon and going to VPN Connections. Work through the list of FrootVPN connections until you find one you can connect to.

Frankly, I wish Network Manager supported .ovpn files directly. We should be able to IMPORT the .ovpn file, Network Manager gets all the correct settings from the .ovpn file, does the correct range of gateway ports and other settings specified by the VPN provider, and saves it all as ONE connection. The .crt files should not be needed if everything is in the .ovpn file.

Источник

Оцените статью
Adblock
detector