Version 28 (modified by 12 months ago) (diff) | ,
---|
OpenVPN 3 Linux
Table of Contents
The OpenVPN 3 Linux project is a new client built on top of the OpenVPN 3 Core Library, which is also used in the various OpenVPN Connect clients and OpenVPN for Android (need to be enabled via the settings page in the app).
This client is built around a completely different architecture in regards to usage. It builds heavily on D-Bus and allows unprivileged users to start and manage their own VPN tunnels out-of-the box. System administrators wanting more control can also control and restrict this access both by hardening the default OpenVPN 3 D-Bus policy or facilitating features in OpenVPN 3 Linux.
Even though the project name carries "Linux", it doesn't mean it is restricted to Linux only. Any platform which has D-Bus available should be capable of running this client in theory. But since D-Bus is most commonly used in Linux environments, this will naturally be the primary focus for the project.
The release notes are stored in git tags in the project git repository. They can also be viewed here: https://github.com/OpenVPN/openvpn3-linux/tags (expand the tag to see the full text)
Pre-built packages
Debian, Ubuntu
First ensure that your apt supports the https transport:
# apt install apt-transport-https
Install the OpenVPN repository key used by the OpenVPN 3 Linux packages
# curl -fsSL https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/openvpn-repo-pkg-keyring.gpg
Then you need to install the proper repository. Replace $DISTRO with the release name depending on your Debian/Ubuntu distribution.
# curl -fsSL https://swupdate.openvpn.net/community/openvpn3/repos/openvpn3-$DISTRO.list >/etc/apt/sources.list.d/openvpn3.list # apt update
Supported distributions:
Distribution | Release | Release name ($DISTRO) | Architecture | DCO support |
---|---|---|---|---|
Debian | 10 | buster | amd64, arm64* | - |
Debian | 11 | bullseye | amd64, arm64* | - |
Ubuntu | 20.04 | focal | amd64, arm64* | yes* |
Ubuntu | 22.04 | jammy | amd64, arm64* | yes* |
Ubuntu | 22.10 | kinetic | amd64, arm64* | yes* |
[*] Please note that both arm64 platform support and the Data Channel Offload (DCO) feature are currently considered a tech-preview for the time being
And finally the openvpn3 package can be installed
# apt install openvpn3
Fedora, Red Hat Enterprise Linux, CentOS
Packages for these distributions are provided via a Fedora Copr repository. Supported versions:
Distribution | Release versions | Architecture | DCO support |
---|---|---|---|
Fedora | 36, 37, Rawhide (*2) | aarch64, s390x, x86_64 | yes (*1) |
Red Hat Enterprise Linux / CentOS | 7 | x86_64 | - |
Red Hat Enterprise Linux | 8 | aarch64, x86_64 | yes (*1) |
Red Hat Enterprise Linux | 9 | aarch64, x86_64 | yes (*1) |
[*1] Please note that DCO support are currently considered a tech-preview for the time being.
[*2] Fedora Rawhide is a moving target and there will be periods where there will not be updates available until we sort out the required changes to the build environment.
If you are running Red Hat Enterprise Linux or its clones, you need to install both the Fedora EPEL repository and the yum copr module first. Instructions for enabling Fedora EPEL can be found here: https://fedoraproject.org/wiki/EPEL. Fedora releases usually have the yum/dnf copr module preinstalled.
# yum install yum-plugin-copr (you also might need to enable EPEL if not on Fedora, see https://fedoraproject.org/wiki/EPEL for the required commands)
With the Copr module available, it is time to enable the OpenVPN 3 Copr repository.
# yum copr enable dsommers/openvpn3
And then the OpenVPN 3 Linux client can be installed
# yum install openvpn3-client
Quick start - how to use OpenVPN 3 Linux
With the openvpn3 packages installed, everything should be ready to be used. By default any user account on the system should be able to start VPN tunnels.
Using openvpn2
For users familiar with the classic OpenVPN 2.x command line, the openvpn2
front-end aims to be fairly close to old behaviour.
$ openvpn2 --config ${MY_CONFIGURATION_FILE} --verb 6
Replace ${MY_CONFIGURATION_FILE} with the OpenVPN configuration file you want to use. If this configuration includes the --daemon
option, the VPN session will be started in the background and the user is given the command line back again. To further manage this VPN session, the openvpn3 session-manage
command line interface must be used. Without --daemon
the console will be filled with log data from the VPN session and the session can be disconnected via a simple CTRL-C in the terminal.
For more information, see openvpn2 --help
, openvpn3 session-manage --help
as well as the openvpn2 and openvpn3-session-manage man pages.
Using openvpn3
For more advanced usage, the openvpn3
command line offers a lot more features. Configuration profiles in OpenVPN 3 Linux are managed by a Configuration Manager before the VPN session is started via the Session Manager. The openvpn3
utility gives access to the features these manager services provides.
Starting a one-shot configuration profile
A "one-shot configuration profile" means that the configuration file is parsed, loaded and deleted from the the configuration manage as soon as the VPN session has been attempted started. No configuration file is available for re-use after this approach. This is achieved by giving the configuration file to the openvpn3 session-start
command directly.
$ openvpn3 session-start --config ${MY_CONFIGURATION_FILE}
Importing a configuration file for re-use and starting a VPN session
Using this approach, an imported configuration file can be used several times and access to the configuration file itself is not needed to start VPN tunnels. By default, configuration profiles imported are only available to the user who imported the configuration file. But OpenVPN 3 Linux also provides an Access Control List feature via openvpn3 config-acl to grant access to specific or all users on the system.
$ openvpn3 config-import --config ${MY_CONFIGURATION_FILE}
This loads the configuration profile and stores it in memory-only. That means, if the system is rebooted, the configuration profile is not preserved. If the --persistent
argument is added to the command line above, the configuration profile will be saved to disk in a directory only accessible by the openvpn
user. Whenever the Configuration Manager is started, configuration files imported with --persistent
will be automatically loaded as well.
To list all available configuration profiles, run this command:
$ openvpn3 configs-list
A configuration file typically contains generic options to be able to connect to a specific server, regardless of the device itself. OpenVPN 3 Linux also supports setting more host-specific settings on a configuration profile as well. This is handled via the `openvpn3 config-manage` interface. Any settings here will also be preserved across boots if the configuration profile was imported with the --persistent
argument.
Starting a new VPN session from an imported configuration profile
When a configuration profile is available via openvpn3 configs-list
, it can easily be started via openvpn3 session-start
using the configuration profile name (typically the filename used during the import)
$ openvpn3 session-start --config ${CONFIGURATION_PROFILE_NAME}
or it is possible to use the D-Bus path to the configuration profile:
$ openvpn3 session-start --config-path /net/openvpn/v3/configuration/.........
In either of these cases is it necessarily to have access to the configuration profile on disk. As long as configuration profiles are available via openvpn3 configs-list
, all needed to start a VPN session should be present.
Managing a running VPN session
Once a VPN session has started, it should be seen in `openvpn3 sessions-list`:
$ openvpn3 sessions-list
Using the openvpn3 session-manage
there are a few things which can be done, but most typically it is the --disconnect
or --restart
alternatives which is most commonly used.
$ openvpn3 session-manage --config ${CONFIGURATION_PROFILE_NAME} --restart
This disconnects and re-connects to the server again, re-establishing the connection. The ${CONFIGURATION_PROFILE_NAME}
is the configuration name as displayed in openvpn3 sessions-list
. It is also possible to use the D-Bus path to the session as well:
$ openvpn3 session-manage --session-path /net/openvpn/v3/sessions/..... --disconnect
This command above will disconnect a running session. Once this operation has completed, it will be removed from the openvpn3 sessions-list
overview.
It is also possible to retrieve real-time tunnel statistics from running sessions:
$ openvpn3 session-stats --config ${CONFIGURATION_PROFILE_NAME} $ openvpn3 session-stats --session-path /net/openvpn/v3/sessions/.....
And to retrieve real-time log events as they occur, run the `openvpn3 log` command line below:
$ openvpn3 log --config ${CONFIGURATION_PROFILE_NAME}
This might be quite silent, as it does not provide any log events from the past. Issue an openvpn3 session-manage --restart
from a different terminal, and log events will occur. You may want to boost the log-level with --log-level 6
. Valid log levels are from 0 to 6, where 6 is the most verbose.
Note that the maximum log level is configured centrally. If you don't get more output with higher log levels increase maximum log level first with `openvpn3-admin` (note that this command needs to be executed as root):
# openvpn3-admin log-service --log-level 6
VPN sessions are also owned by the user which started it. But the Session Manager also provides its own Access Control List feature via `openvpn3 session-acl`.
TECH-PREVIEW: OpenVPN Data Channel Offload - kernel module support
As of v11_beta, the OpenVPN 3 Linux client ships with Data Channel Offload (DCO) support. This is only supported on a selected list of Linux distributions, please see the distribution table earlier on this page for details.
To enable it, first install the kmod-ovpn-dco
package from the software repositories described on this page.
Ubuntu preparation
# apt install kmod-ovpn-dco
Fedora preparation
# yum install kmod-ovpn-dco
Enable DCO on a VPN configuration profile
Now the OpenVPN configuration file must be pre-imported and the DCO mode must be activated:
$ openvpn3 config-import --config CONFIG_FILE --name CONFIG_NAME --persistent $ openvpn3 config-manage --show --config CONFIG_NAME --dco true
And now a VPN session with DCO activated can be started as any normal VPN session:
$ openvpn3 session-start --config CONFIG_NAME
Start a VPN session directly with DCO enabled
Using the openvpn2
command line:
$ openvpn2 --config CONFIG_FILE --enable-dco
Using the openvpn3
command line:
$ openvpn3 session-start --config CONFIG_NAME --dco true
If the configuration profile is pre-imported and configured to use DCO by default, you can temporarily disable that by adding --dco false
instead.
Further information
- man pages:
- openvpn3-linux(7) - Main overview
- openvpn3(1) -
openvpn3
command line interface - openvpn2(1) -
openvpn2
command line interface which is similar to the classic OpenVPN 2.x interface - openvpn3-autoload(8) - Automatic load and start of VPN tunnels
- More man pages
- Developers / D-Bus API documentation
- D-Bus Primer - Understanding D-Bus
- OpenVPN 3 D-Bus overview - Overview of all D-Bus services which are provided and used
- Debugging - How to debug OpenVPN 3 Linux
- More D-Bus documentation