Compare languages | Модуль openvpn: FAQ

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

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

В связи с архитектурными особенностями операционных систем семейства Linux и macOS автоматическая конфигурация DNS-сервера при подключении с помощью официального клиента 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.

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

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.

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

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.

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

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.

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

Scripts must have execution permissions.

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

How to revoke, rotate or delete a user certificate

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

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:

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

Actions with an active user

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

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

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

Actions with a revoked user

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

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

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

How to rotate a server certificate

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

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

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

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

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

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

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

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

shell kubectl -n d8-openvpn rollout restart sts openvpn

shell kubectl -n d8-openvpn rollout restart sts openvpn

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

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

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

How to rotate a root certificate (CA)

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

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.

  1. Отзовите или удалите все активные клиентские сертификаты. Сделать это можно через интерфейс openvpn-admin. Если вы воспользуетесь отзывом, то после замены CA можно будет выполнить ротацию сертификатов (Renew), не создавая клиента заново.

Steps to rotate the root certificate:

  1. Удалите секреты openvpn-pki-ca и openvpn-pki-server в пространстве имён d8-openvpn:
  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.

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

  1. Delete secrets openvpn-pki-ca and openvpn-pki-server in the namespace d8-openvpn:
  1. Перезапустите поды OpenVPN:

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

shell kubectl -n d8-openvpn rollout restart sts openvpn

  1. Restart OpenVPN pods:
  1. Выполните ротацию сертификатов для отозванных клиентов или создайте новых клиентов с новыми сертификатами.

shell kubectl -n d8-openvpn rollout restart sts openvpn

  1. Удалите все отозванные сертификаты:
  1. Rotate certificates of revoked users, or create new ones.

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

  1. Delete all revoked certificate secrets:
 

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