Compare languages | The openvpn module: FAQ

Why doesn’t automatic DNS server configuration work when connecting to macOS and Linux using the OpenVPN client

Почему не работает автоматическая настройка DNS-сервера при подключении на macOS и Linux с помощью клиента OpenVPN

Due to the architectural features of the Linux and macOS operating systems, automatic DNS server configuration when using the official OpenVPN client is not possible.

В связи с архитектурными особенностями операционных систем семейства Linux и macOS автоматическая конфигурация DNS-сервера при подключении с помощью официального клиента OpenVPN невозможна.

To configure the DNS server on such operating systems, the service provides the ability to use third-party scripts that run when the client connects or disconnects.

Для настройки DNS-сервера в таких ОС сервисом предусмотрена возможность использования сторонних скриптов, которые запускаются при подключении и отключении клиента.

In the client configurations generated by the module, the blocks responsible for these settings are predefined and commented out:

В клиентских конфигурациях, генерируемых модулем, предопределены и закомментированы блоки, отвечающие за эти настройки:

bash

bash

Uncomment the lines below for use with Linux

Uncomment the lines below for use with Linux

script-security 2

script-security 2

If you use resolved

If you use resolved

up /etc/openvpn/update-resolv-conf

up /etc/openvpn/update-resolv-conf

down /etc/openvpn/update-resolv-conf

down /etc/openvpn/update-resolv-conf

If you use systemd-resolved, first install the openvpn-systemd-resolved package

If you use systemd-resolved, first install the openvpn-systemd-resolved package

up /etc/openvpn/update-systemd-resolved

up /etc/openvpn/update-systemd-resolved

down /etc/openvpn/update-systemd-resolved

down /etc/openvpn/update-systemd-resolved

To use these code blocks, uncomment them (remove the initial # symbol), and specify the correct paths to the scripts.

Для активации указанных блоков кода необходимо их раскомментировать (удалить начальный символ #), а также указать корректные пути к скриптам.

You can either prepare the scripts yourself or use ready-made scripts from the official OpenVPN Community (for Linux). For macOS, you can use a third-party script.

Скрипты можно подготовить самостоятельно или воспользоваться готовыми решениями от официального OpenVPN Community (для Linux). Для macOS можно воспользоваться сторонним скриптом.

Scripts must have execution permissions.

Скрипты должны обладать правами на исполнение.

How to revoke, rotate or delete a user certificate

Как отозвать, ротировать или удалить сертификат клиента

All operations with client certificates are performed via the openvpn-admin web interface. Buttons for managing certificates are available to the right of each user’s name:

Все действия с клиентскими сертификатами выполняются через веб-интерфейс openvpn-admin. Справа от имени каждого пользователя доступны кнопки для управления сертификатом:

Actions with an active user

Действия с активным пользователем

To rotate (issue a new certificate) or delete a client, you must first revoke their current certificate:

Чтобы ротировать (выпустить новый сертификат) или удалить клиента, необходимо сначала отозвать его текущий сертификат (Revoke):

Actions with a revoked user

Действия с отозванным пользователем

Once revoked, the Renew (rotation) and Delete (removal) actions become available.

После отзыва становятся доступными действия Renew (ротация) и Delete (удаление).

How to rotate a server certificate

Как ротировать сертификат сервера

The server certificate is rotated automatically several days before it expires.

Серверный сертификат ротируется автоматически за 1 день до окончания срока его действия.

If you need to rotate the certificate manually (e.g., due to certificate corruption or an unscheduled replacement), follow these steps:

Если требуется выполнить ротацию вручную (например, при повреждении сертификата или внеплановой замене), выполните следующие шаги:

  1. Delete the secret openvpn-pki-server in the namespace d8-openvpn:
  1. Удалите текущий секрет, содержащий сертификат и ключ сервера:

shell kubectl -n d8-openvpn delete secrets openvpn-pki-server

shell kubectl -n d8-openvpn delete secrets openvpn-pki-server

  1. Restart the OpenVPN pods to trigger the generation of a new certificate:
  1. Перезапустите подs OpenVPN, чтобы инициировать генерацию нового сертификата:

shell kubectl -n d8-openvpn rollout restart sts openvpn

shell kubectl -n d8-openvpn rollout restart sts openvpn

A new certificate will be generated automatically when the pods start.

Как ротировать корневой сертификат (CA)

How to rotate a root certificate (CA)

Корневой сертификат (CA) и серверный сертификат ротируется автоматически за 1 день до окончания срока действия. Автоматическая ротация сертификатов пользователя не предусмотрена. Корневой сертификат (CA) используется для подписи всех сертификатов в OpenVPN — как серверных, так и клиентских. Поэтому при его замене необходимо перевыпустить все зависимые сертификаты.

The root certificate (CA) and server certificate are rotated automatically 1 day before expiration. Automatic rotation of clients certificates is not provided. The root certificate (CA) is used to sign all certificates in OpenVPN — both server and client. Therefore, when replacing the CA, you must reissue all dependent certificates.

Шаги для ротации корневого сертификата:

Steps to rotate the root certificate:

  1. Отзовите или удалите все активные клиентские сертификаты. Сделать это можно через интерфейс openvpn-admin. Если вы воспользуетесь отзывом, то после замены CA можно будет выполнить ротацию сертификатов (Renew), не создавая клиента заново.
  1. Revoke or delete all active client certificates using the openvpn-admin web interface. If you choose to revoke certificates, you can rotate them later (Renew) after the CA is replaced, without recreating the clients.
  1. Удалите секреты openvpn-pki-ca и openvpn-pki-server в пространстве имён d8-openvpn:
  1. Delete secrets openvpn-pki-ca and openvpn-pki-server in the namespace d8-openvpn:

shell kubectl -n d8-openvpn delete secrets openvpn-pki-ca openvpn-pki-server

shell kubectl -n d8-openvpn delete secrets openvpn-pki-ca openvpn-pki-server

  1. Перезапустите поды OpenVPN:
  1. Restart OpenVPN pods:

shell kubectl -n d8-openvpn rollout restart sts openvpn

shell kubectl -n d8-openvpn rollout restart sts openvpn

  1. Выполните ротацию сертификатов для отозванных клиентов или создайте новых клиентов с новыми сертификатами.
  1. Rotate certificates of revoked users, or create new ones.
  1. Удалите все отозванные сертификаты:
  1. Delete all revoked certificate secrets:

shell kubectl -n d8-openvpn delete secrets -l revokedForever=true

shell kubectl -n d8-openvpn delete secrets -l revokedForever=true