Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenVPN: Added information about mfa settings #1460

Merged
merged 1 commit into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/configuration/interfaces/openvpn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
still don't support it. However, it's very useful for quickly setting up
tunnels between routers.

As of VyOS 1.4, OpenVPN site-to-site mode can use either pre-shared keys or x.509 certificates.

Check warning on line 48 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=95

The pre-shared key mode is deprecated and will be removed from future OpenVPN versions,

Check warning on line 50 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=87
so VyOS will have to remove support for that option as well. The reason is that using pre-shared keys

Check warning on line 51 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=101
is significantly less secure than using TLS.

We'll configure OpenVPN using self-signed certificates, and then discuss the legacy

Check warning on line 54 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=83
pre-shared key mode.

In both cases, we will use the following settings:
Expand All @@ -73,16 +73,16 @@
Setting up certificates
=======================

Setting up a full-blown PKI with a CA certificate would arguably defeat the purpose

Check warning on line 76 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=83
of site-to-site OpenVPN, since its main goal is supposed to be configuration simplicity,

Check warning on line 77 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=88
compared to server setups that need to support multiple clients.

However, since VyOS 1.4, it is possible to verify self-signed certificates using
certificate fingerprints.

On both sides, you need to generate a self-signed certificate, preferrably using the "ec" (elliptic curve) type.

Check warning on line 83 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=112
You can generate them by executing command ``run generate pki certificate self-signed install <name>`` in the configuration mode.

Check warning on line 84 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=129
Once the command is complete, it will add the certificate to the configuration session, to the ``pki`` subtree.

Check warning on line 85 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=111
You can then review the proposed changes and commit them.

.. code-block:: none
Expand Down Expand Up @@ -116,13 +116,13 @@

vyos@vyos# commit

You do **not** need to copy the certificate to the other router. Instead, you need to retrieve its SHA-256 fingerprint.

Check warning on line 119 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Line too long: len=119
OpenVPN only supports SHA-256 fingerprints at the moment, so you need to use the following command:

.. code-block:: none

vyos@vyos# run show pki certificate openvpn-local fingerprint sha256
5C:B8:09:64:8B:59:51:DC:F4:DF:2C:12:5C:B7:03:D1:68:94:D7:5B:62:C2:E1:83:79:F1:F0:68:B2:81:26:79

Check failure on line 125 in docs/configuration/interfaces/openvpn.rst

View workflow job for this annotation

GitHub Actions / lint

Use IPv6 reserved for Documentation (RFC 3849) or private Space: 5c:b8:9:64:8b:59:51:dc

Note: certificate names don't matter, we use 'openvpn-local' and 'openvpn-remote' but they can be arbitrary.

Expand Down Expand Up @@ -652,6 +652,88 @@
quotes. This is done through a hack on our config generator. You can pass
quotes using the ``&quot;`` statement.

***************************
Multi-factor Authentication
***************************

VyOS supports multi-factor authentication (MFA) or two-factor authentication
using Time-based One-Time Password (TOTP). Compatible with Google Authenticator
software token, other software tokens.

MFA TOTP options
================

.. cfgcmd:: set interfaces openvpn <interface> server mfa totp challenge <enable | disable>

If set to enable, openvpn-otp will expect password as result of challenge/
response protocol.

.. cfgcmd:: set interfaces openvpn <interface> server mfa totp digits <1-65535>

Configure number of digits to use for totp hash (default: 6)

.. cfgcmd:: set interfaces openvpn <interface> server mfa totp drift <1-65535>

Configure time drift in seconds (default: 0)

.. cfgcmd:: set interfaces openvpn <interface> server mfa totp slop <1-65535>

Configure maximum allowed clock slop in seconds (default: 180)

.. cfgcmd:: set interfaces openvpn <interface> server mfa totp step <1-65535>

Configure step value for totp in seconds (default: 30)

Example
=======

.. code-block:: none

set interfaces openvpn vtun20 encryption cipher 'aes256'
set interfaces openvpn vtun20 hash 'sha512'
set interfaces openvpn vtun20 mode 'server'
set interfaces openvpn vtun20 persistent-tunnel
set interfaces openvpn vtun20 server client user1
set interfaces openvpn vtun20 server mfa totp challenge 'disable'
set interfaces openvpn vtun20 server subnet '10.10.2.0/24'
set interfaces openvpn vtun20 server topology 'subnet'
set interfaces openvpn vtun20 tls ca-certificate 'openvpn_vtun20'
set interfaces openvpn vtun20 tls certificate 'openvpn_vtun20'
set interfaces openvpn vtun20 tls dh-params 'dh-pem'

For every client in the openvpn server configuration a totp secret is created.
To display the authentication information, use the command:

.. cfgcmd:: show interfaces openvpn <interface> user <username> mfa <qrcode|secret|uri>

An example:

.. code-block:: none

vyos@vyos:~$ sh interfaces openvpn vtun20 user user1 mfa qrcode
█████████████████████████████████████
█████████████████████████████████████
████ ▄▄▄▄▄ █▀▄▀ ▀▀▄▀ ▀▀▄ █ ▄▄▄▄▄ ████
████ █ █ █▀▀▄ █▀▀▀█▀██ █ █ █ ████
████ █▄▄▄█ █▀█ ▄ █▀▀ █▄▄▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄█ █ █ ▀ █▄▀▄█▄▄▄▄▄▄▄████
████▄▄ ▄ █▄▄ ▄▀▄█▄ ▄▀▄█ ▄▄▀ ▀▄█ ▀████
████ ▀██▄▄▄█▄ ██ █▄▄▄▄ █▄▀█ █ █▀█████
████ ▄█▀▀▄▄ ▄█▀ ▀▄ ▄▄▀▄█▀▀▀ ▄▄▀████
████▄█ ▀▄▄▄▀ ▀ ▄█ ▄ █▄█▀ █▀ █▀█████
████▀█▀ ▀ ▄█▀▄▀▀█▄██▄█▀▀ ▀ ▀ ▄█▀████
████ ██▄▄▀▄▄█ ██ ▀█ ▄█ ▀▄█ █▀██▀████
████▄███▄█▄█ ▀█▄ ██▄▄▄█▀ ▄▄▄ █ ▀ ████
████ ▄▄▄▄▄ █▄█▀▄ ▀▄ ▀█▀ █▄█ ██▀█████
████ █ █ █ ▄█▀█▀▀▄ ▄▀▀▄▄▄▄▄▄ ████
████ █▄▄▄█ █ ▄ ▀ █▄▄▄██▄▀█▄▀▄█▄ █████
████▄▄▄▄▄▄▄█▄██▄█▄▄▄▄▄█▄█▄█▄██▄██████
█████████████████████████████████████
█████████████████████████████████████

Use the QR code to add the user account in Google authenticator application and
on client side, use the OTP number as password.


**********************************
OpenVPN Data Channel Offload (DCO)
Expand Down
Loading