Настройка клиента openvpn astra linux

OpenVPN 3 Client for Linux

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 regard to usage. It builds heavily on D-Bus and allows unprivileged Users to start and manage their own WPC 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/releases (expand the tag to see the full text).

Installation as Connector for CloudConnexa

Installation of CloudConnexa 3 client as a Connector for CloudConnexa Host or Network has been simplified and documented here.

Installation for Debian and Ubuntu

Follow these steps in order to install OpenVPN 3 Client on Linux for Debian and Ubuntu:

  1. Open the Terminal by pressing ctrl + alt + T .
  2. Type the following command into the Terminal: sudo wget https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub . This will install the OpenVPN repository key used by the OpenVPN 3 Linux packages.
  3. Type the following command into the Terminal: curl -fsSL https://swupdate.openvpn.net/repos/openvpn-repo-pkg-key.pub | gpg —dearmor | sudo tee /etc/apt/trusted.gpg.d/openvpn-repo-pkg-keyring.gpg . This will install the OpenVPN repository key used by the OpenVPN 3 Linux packages.
  4. Type the following command into the Terminal: DISTRO=$(lsb_release -c | awk ») . This will detect the OS distribution and will be automatically used in the next command.
Читайте также:  Linux mint sstp client

Important

It is recommended to be cautious of the distribution and release you are running. Distribution and version should preferably be retrieved using the hostnamectl command, where the user needs to link the Operating System field with the supported distros table.

Distribution

Release name ($DISTRO)

Installation for Fedora, Red Hat Enterprise Linux, CentOS, or Scientific Linux

Packages for these distributions are provided via a Fedora Copr repository. Supported versions:

Distribution

Release versions

Red Hat Enterprise Linux / CentOS

In order to install the OpenVPN 3 Client for Fedora , Red Hat Enterprise Linux , CentOS , or Scientific Linux , follow the steps below:

  1. Open Terminal by typing terminal into the search bar.
  2. If you are running Red Hat Enterprise Linux or its clones, you need to install the Fedora EPEL repository first. Here is the list of commands for each version: (The original article on Fedora EPEL can be found here). RHEL/CentOS 6 : sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm RHEL/CentOS 7 : sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm On RHEL 7 it is recommended to also enable the optional, extras , and HA repositories since EPEL packages may depend on packages from these repositories: sudo subscription-manager repos —enable «rhel-*-optional-rpms» —enable «rhel-*-extras-rpms» —enable «rhel-ha-for-rhel-*-server-rpms RHEL/CentOS 8 : sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm On RHEL 8 it is required to also enable the codeready-builder-for-rhel-8-$-rpms repository since EPEL packages may depend on packages from it: sudo ARCH=$( /bin/arch ) followed by sudo subscription-manager repos —enable «codeready-builder-for-rhel-8-$-rpms On CentOS 8 it is recommended to also enable the PowerTools repository since EPEL packages may depend on packages from it: sudo dnf config-manager —set-enabled PowerTools
  3. You need to install the yum copr module first by running the following command: sudo yum install yum-plugin-copr .

Note

Using .ovpn Profile

Please note that by this point you should have downloaded a .ovpn Profile to your machine.

Mandatory Commands

  1. In order to start a one-shot configuration Profile, type the following command into the Terminal: openvpn3 session-start —config $ .

Important

A » one-shot configuration Profile » means that the configuration file is parsed, loaded, and deleted from the configuration manager as soon as the WPC session has been 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.

Note

Using this approach, an imported configuration file can be used several times, and access to the configuration file itself is not needed to start WPC 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.

Читайте также:  Astra linux добавление репозитория debian

Important

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 CloudConnexa User. Whenever the Configuration Manager is started, configuration files imported with –persistent will be automatically loaded as well.

Note

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)

Источник

Управление VPN подключениями из консоли Linux

В этой статье мы рассмотрим, как создать VPN подключение из консоли Linux и подключиться к удаленному VPN серверу из CLI. Отдельно рассмотрим, как создать L2TP и PPTP VPN подключения.

Как создать L2TP VPN подключение в Linux?

Вы можете использовать NetworkManager для создания VPN подключений L2TP из консоли Linux.

Для установки NetworkManager с поддержкой L2TP выполните команду:

  • В CentOS/RHEL/Fedora: # yum -y install NetworkManager-l2tp
  • Для установки в Ubuntu/Debian, нужно сначала добавить репозиторий:
    $ sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
    $ sudo apt-get install network-manager-l2tp

установка network-manager-l2tp в linux

Для создания нового VPN подключения L2TP используется команда:

$ nmcli connection add connection.id [VPNConnectionName] con-name [VPNConnectionName] type VPN vpn-type l2tp ifname — connection.autoconnect no ipv4.method auto vpn.data «gateway = [ipv4], ipsec-enabled = yes, ipsec-psk = 0s»$(base64

  • [VPNConnectionName] — имя VPN соединения
  • [ipv4] — ip адрес VPN сервера L2TP/IPSEC
  • [PSK] — ключ PSK (Pre Shared Key)
  • [user] — имя пользователя VPN
  • [user-password] — пароль

Настройки нового VPN подключения сохраняются в файл /etc/NetworkManager/system-connections/.

Вывести все подключения в NetworkManager:

Показать информацию о созданном VPN подключении:

$ nmcli c show id [VPNConnectionName]

Для Для подключения к VPN серверу из командной строки:к VPN серверу их командной строки:

$ nmcli c up [VPNConnectionName]

При подключении к удаленному VPN серверу может появится ошибка:

Error: Connection activation failed: Could not find source connection.
  • Проверьте логи journactl
  • Для физического интерфейса (например, ens33 ) задан шлюз по-умолчанию
  • Возможно на сервере используется интерфейс br0 , который не используется. Попробуйте удалить его

Чтобы завершить сессию VPN, выполните:

Читайте также:  The account is locked linux

nmcli c down [VPNConnectionName]

Создаем PPTP VPN подключение в Linux

Для установки PPTP клиента VPN в Ubuntu/Debian, установите утилиту:

$ sudo apt-get install pptp-linux network-manager-pptp

Добавьте следующее содержимое:

pty "pptp YOUR_VPN_SERVER --nolaunchpppd --debug" name VPNUsername password VPNPassword remotename PPTP require-mppe-128 require-mschap-v2 refuse-eap refuse-pap refuse-chap refuse-mschap noauth debug persist maxfail 0 defaultroute replacedefaultroute usepeerdns

Сохраните файл, нажав CTLR+X, Y -> Enter.

$ chmod 600 /etc/ppp/peers/PPTP

Чтобы подключится к PPTP VPN серверу, выполните:

Настройка SSTP VPN подключения в командной строке Linux

Вы можете настроить SSTP подключение к VPN серверу в Linux. В Ubuntu можно использовать пакет sstp для nmcli.

$ sudo add-apt-repository ppa:eivnaes/network-manager-sstp
$ sudo apt update
$ sudo apt install network-manager-sstp sstp-client

Для подключения к SSTP серверу используется команда:

$ sudo sstpc —cert-warn —save-server-route —user —password usepeerdns require-mschap-v2 noauth noipdefault nobsdcomp nodeflate

Можно сохранить настройки подключения к VPN серверу в текстовый файл:

remotename sstptest linkname sstptest ipparam sstptest pty "sstpc --ipparam sstptest --nolaunchpppd sstpvpn.vmblog.ru" name user1 plugin sstp-pppd-plugin.so sstp-sock /var/run/sstpc/sstpc-sstp-test usepeerdns require-mppe require-mschap-v2 refuse-eap refuse-pap refuse-chap refuse-mschap nobsdcomp nodeflate

Имя пользователя и пароль для аутентификации на VPN сервере нужно задать в файле /etc/ppp/chap-secrets

# Secrets for authentication using CHAP # client server secret IP addresses user1 * xxxxxx *

Теперь для подключения к SSTP серверу с помощью настроенного подключения, выполните:

Чтобы отправить весь трафик через VPN подключение, нужно добавить маршрут:

$ sudo route add default (обычно это устройствл ppp0 )

Или только трафик к определенным подсетям/хостам:

$ sudo route add -net 192.168.2.0/24 dev ppp0

Подключение к OpenVPN серверу из консоли Linux

Для установки пакета OpenVPN в Linux:

  • Debian, Ubuntu, Linux Mint, Kali Linux:
    $ sudo apt-get update && apt-get upgrade
    $ sudo apt-get install openvpn
  • RedHat, Fedora, CentOS, Oracle, Rocky Linux:
    # yum install epel-release –y
    # yum install openvpn –y

Для подключения к OpenVPN серверу вам понадобится файл конфигурации ovpn. Чтобы подключиться к VPN с помощью ovpn файла:

$ sudo openvpn —config /etc/openvpn/client.ovpn —daemon

Введите имя пользователя и пароль (если настроена AD аутентификация для OpenVPN).

Проверьте что VPN подключение установлено:

Чтобы завершить OpenVPN подключение, нажмите CTRL+C (если клиент запущен без параметра –daemon) или выполните команду:

Чтобы OpenVPN подключение автоматически устанавливалось при старте Linux, нужно создать отдельный юнит systemd:

$ sudo vi /lib/systemd/system/OpenVPNClientCorp.service

[Unit] Description=Hide.me OpenVPN Client Corp After=multi-user.target [Service] Type=idle ExecStart=/usr/sbin/openvpn --config /etc/openvpn/client.ovpn [Install] WantedBy=multi-user.target

Измените разрешения на файл:

$ sudo chmod 644 /lib/systemd/system/OpenVPNClientCorp.service

Добавьте юнит через systemctl

$ sudo systemctl daemon-reload
$ sudo systemctl enable OpenVPNClientCorp.service

Источник

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