Оглавление
- Managing a Running Session
- Сертификаты внутри конфигурационного файла
- Где скачать бесплатный OpenVPN для Windows 10? И как его установить?
- Возможные проблемы
- Limitations of an unlicensed OpenVPN Access Server
- Installation requirements and preparation
- Создаем конфигурационные файлы для OpenVPN
- Installation for Debian and Ubuntu
- Introduction
- Stop and Remove System Service
- Несколько конфигурационных файлов
- Locating the server log files
- Connect App Installation
- Настройка сервера
- Locating the client log files
- Finishing configuration and using the product
- Background
- Alternative OpenVPN client: tunXten
Managing a Running Session
- Once a VPN session has started, it should be seen in the session 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 are most commonly used. . 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: . This command above will disconnect a running session. Once this operation has completed, it will be removed from the openvpn3 sessions-list overview. Important: you will be able to start a new session with this or another OpenVPN profile only after you have disconnected from the current session using the command in this step
- It is also possible to retrieve real-time tunnel statistics from running sessions: or
- And to retrieve real-time log events as they occur, run the following command: 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: VPN sessions are also owned by the user which started it. But the Session Manager also provides its own Access Control List feature via
Сертификаты внутри конфигурационного файла
Ключи сертификатов можно хранить не в отдельных файлах, а внутри конфигурационного файла ovpn.
…
key-direction 1
<ca>
——BEGIN CERTIFICATE——
…
——END CERTIFICATE——
</ca>
<tls-auth>
——BEGIN OpenVPN Static key V1——
…
——END OpenVPN Static key V1——
</tls-auth>
<cert>
——BEGIN CERTIFICATE——
…
——END CERTIFICATE——
</cert>
<key>
——BEGIN PRIVATE KEY——
…
——END PRIVATE KEY——
</key>
<dh>
——BEGIN DH PARAMETERS——
…
——END DH PARAMETERS——
</dh>
* key-direction 1 — необходим для tls-auth, в противном случае, работать не будет; ca — ключ центра сертификации (ca.crt); tls-auth — ta.key; cert — открытый сертификат клиента (clients.crt); key — закрытый сертификат клиента (clients.key); dh — сертификат, созданный на базе протокола Диффи Хеллмана.
Где скачать бесплатный OpenVPN для Windows 10? И как его установить?
OpenVPN – это лучшее и наиболее рекомендуемое во всем мире программное обеспечение VPN с открытым исходным кодом, которое обеспечивает безопасное соединение VPN.
Для того, чтобы скачать клиент OpenVPN, необходимо зайти в браузер, в котором уже работает VPN, так как сайт, о котором дальше пойдет речь заблокирован в России по понятным причинам.
Я рекомендую вам на время установить расширение «Avira Phantom VPN», позволяющие использовать VPN в Яндекс Браузере или Google Chrome. Это позволит вам зайти на сайт «VPNBOOK» и скачать оттуда клиент OpenVPN и комплект сертификатов для настройки подключения.
У вас откроется страница в виде слайдов на английском языке, где вы увидите пошаговую инструкцию по скачиванию, установке и настройке клиента OpenVPN. Вы можете ей воспользоваться и сами все настроить. Но если вам что-то не понятно, то читайте дальше я все подробно расскажу.
Кликните на стрелочку вправо на слайдере.
На слайде 1-го шага вы увидите ссылку для скачивания клиента OpenVPN для Windows 10. Кликните по данной ссылке.
У вас откроется страница сайта, где можно будет скачать клиент OpenVPN. В зависимости от разрядности вашей системы выберите установочный пакет.
Сохраните файл в удобное для вас место. (я сохранил в папку «Загрузки»). Затем запустите двойным кликом левой кнопки мыши данный установщик и в открывшемся окне нажмите кнопку «Install Now».
Дождитесь завершения установки и закройте окно, нажав на кнопку «Close». После этого у вас запуститься окно и появится сообщение, в котором будет написано, что файлы конфигурации не найдены.
Это те самые сертификаты, которые необходимо скачать и добавить в папку с файлами конфигурации.
Закройте это окно, и переходите ко второй части инструкции. Скачиванию и установке Tap-драйвера.
Возможные проблемы
Большая часть проблем решается при помощи логов, которые находятся в папке C:\Program Files\OpenVPN\log. Уровень детализации лога контролируется параметром verb в конфигурационном файле сервера или клиента.
Также возможны следующие часто возникающие проблемы:
- Проблема: клиент постоянно пытается подключиться к серверу, но соединения не происходит или подключение зависает.
Причина: сервер блокирует подключения по настроенному порту VPN (в нашем примере, 443).
Решение: на сервере необходимо добавить 443 порт в исключения брандмауэра или отключить последний.
- Проблема: при попытке подключиться к серверу выскакивает ошибка «Не удалось подключиться к config».
Причина: ошибка в настройках.
Решение: перепроверьте каждую строчку файла конфигурации. Проверьте наличие всех файлов, на которые ссылаетесь в настройках.
- Проблема: клиенты получают одинаковые IP-адреса.
Причина: подключение выполняется под одним и тем же пользователем.
Решение: сервер выдает одинаковые адреса одинаковым клиентам. Необходимо настроить авторизацию на сервере и выдать каждому клиенту индивидуальные настройки.
- Проблема: соединение происходит, но через несколько минут связь прерывается.
Причина: дублирование IP-адресов.
Решение: данная проблема описана выше (пункт 3).
Limitations of an unlicensed OpenVPN Access Server
When the OpenVPN Access Server is installed without a license key it goes into a sort of demonstration mode. There is no time limit or functionality limit on this mode. The only difference between a licensed Access Server and an unlicensed one is the amount of simultaneous OpenVPN tunnel connections the Access Server allows. An unlicensed server will only ever allow 2 simultaneous connections and that’s it. To unlock more connections you can purchase a license key to unlock more connections. We suggest you read the licensing frequently asked questions page and the pricing overview page to learn more.
Installation requirements and preparation
You will need to have access to a working supported Linux operating system installation that you have root level access to. It doesn’t matter if this is through the console directly or through an SSH session using for example a tool like PuTTY, and it doesn’t matter if you must log on as an unprivileged user first, and then can ‘sudo up’ to gain root privileges. As long as at the end you have root privileges, then you will be able to proceed.
It is important that the time and date on your server are accurate. This is necessary for both certificate generation and verification as well Google Authenticator multi-factor authentication which is time-based. If you are using a modern operating system like Ubuntu 18 or higher, it will usually already have time synchronization software built in. Usually you only need to worry about setting the timezone. You can use the ‘date’ command to see what the current time and date and timezone are.
The OpenVPN Access Server can function entirely within an environment where no Internet access is possible, but this does make licensing the server much more complicated and will require that you contact our support department. And if the Access Server doesn’t have Internet access it obviously can’t accept connections from clients from the Internet either of course.
It’s best to have the Access Server connected to the Internet, and we recommend doing this behind a firewall system with only ports TCP 443, TCP 943, TCP 945, and UDP 1194 forwarded from the public Internet to the private address of the Access Server behind the firewall. It is also important to check that DNS resolution is working as expected, so that pinging for example www.google.com will result in the server being able to resolve this to an IP address. If DNS resolution doesn’t work right it can slow down the web interface, cause problems with VPN clients that want to redirect their Internet traffic through the VPN server, and prevents successful licensing of the Access Server.
Access Server since version 2.7.5 gets distributed via a software repository now. So if your system is isolated from the Internet, it will be more work to install it without Internet access. We do still offer the option to download software packages separately, but Access Server now comes in 2 packages. The OpenVPN Connect client software bundle, and the OpenVPN Access Server. Both must be installed for Access Server to successfully install. On top of that, various dependencies are required which must be installed separately as well. You can find these instructions also on our software repository page by selecting the manual installation option.
Создаем конфигурационные файлы для OpenVPN
Конфигурационный файл сервера OpenVPN
В папке «C:\Program Files\OpenVPN\config», создаем текстовой документ server.ovpn — это будет конфиг сервера, вставляем в файл текст:
dev tun # Поднимаем L3-туннель proto udp # Протокол port 12345 # Порт который слушает впн # Ключи и сертификаты: ca ca.crt cert server.crt key server.key dh dh1024.pem topology subnet # Грубо говоря экономим адреса server 10.9.0.0 255.255.255.0 # Пул адресов cipher AES-128-CBC # Метод шифрования comp-lzo # Сжатие mssfix # Немного улучшит пинг keepalive 10 120 # Время жизни клиентов, если не откликнулся — отключает verb 3 # Уровень отладки
Пробуем запустить сервер: Кликаем на рабочем столе по ярлыку OpenVPN Gui или запускаем файл «C:\Program Files\OpenVPN\bin\openvpn-gui.exe».
В панели задач возле к появится серый значок, кликаем по нему дважды, если через 10-20 секунд он загорелся зеленым, значит, все хорошо, если нет, тогда смотрим лог в папке log.
Конфигурация клиента OpenVPN
На компьютере клиента тоже устанавливаем OpenVPN, все галочки можно не отмечать.
Копируем из папки «C:\Program Files\OpenVPN\easy-rsa» на компьютере с сервером файлы:
- ca.crt
- client.crt
- client.key
на компьютер с OpenVPN клиентом в папку C:\Program Files\OpenVPN\config. В этой же папке создаем файл client.ovpn, в котором прописываем:
client dev tun proto udp remote АДРЕС_СЕРВЕРА 12345 # Адрес и порт сервера ca ca.crt cert client.crt key client.key cipher AES-128-CBC nobind comp-lzo persist-key persist-tun verb 3
На клиентском компьютере запускаем OpenVPN Gui или client.ovpn.
Если подключились, пробуем проверить связь: в командной строке набираем ping 10.9.0.1. Если пинг проходит, значит все настроено верно.
На OpenVPN сервере можно настроить автоматический запуск OpenVPN службы:
- переходим в Панель Управления — Администрирование — Службы
- Ищем OpenVPN Service и выставляем тип запуска «Автоматически»
Ошибка «WARNING: can’t open config file: /etc/ssl/openssl.cnf «
Если при попытке создать сертификат для OpenVpn вы видите эту ошибку, то скорее всего вы не запустили перед этим действием bat-файл OpenVPN\easy-rsa\vars.bat.
Installation for Debian and Ubuntu
Follow these steps in order to install OpenVPN 3 Client on Linux for Debian and Ubuntu:
-
Open the Terminal by pressing
-
Type the following command into the Terminal: . This is done to ensure that your apt supports the https transport. Enter the root password as prompted
-
Type the following command into the Terminal: . This will install the OpenVPN repository key used by the OpenVPN 3 Linux packages
-
Type the following command into the Terminal:
-
Type the following command into the Terminal: . This will install the proper repository. Replace $DISTRO with the release name depending on your Debian/Ubuntu distribution (the table of release names for each distribution can be found below). In this case, is chosen since Ubuntu 20.04 is used
-
Type the following command into the Terminal:
-
Type the following command into the Terminal: . This will finally install the OpenVPN 3 package
Distribution | Release | Release name ($DISTRO) |
---|---|---|
Debian | 9 | stretch |
Debian | 10 | buster |
Ubuntu | 16.04 | xenial |
Ubuntu | 18.04 | bionic |
Ubuntu | 19.10 | eoan |
Ubuntu | 20.04 | focal |
Introduction
This guide is meant for users of the OpenVPN Access Server product that wish to connect their macOS computer using the official OpenVPN Connect Client software. In the steps outlined below we’ll take you through the process of obtaining the OpenVPN Connect Client from your Access Server’s web interface, and installing and using it on the macOS operating system. Aside from some minor differences due to different versions of software used this guide should be accurate and easy to follow. Each step can be clicked to show a screenshot for that particular step in the installation process. Each screenshot can be clicked to reveal an image gallery you can follow to go through all the steps.
Stop and Remove System Service
- You can stop the service by entering the following command into the Command Prompt: ovpnconnector.exe stop. A VPN connection will be terminated. Important: Connection will restart automatically after the system reboot unless you remove the service
- Configured paths to VPN profile and the log file can be rolled back to default values using the following commands in the Command Prompt: ovpnconnector.exe unset-config profile and ovpnconnector.exe unset-config log. Important: The service needs to be stopped first to change the configuration. Important: You will be able to use a different OpenVPN session as a system service only after running ovpnconnector.exe unset-config profile, as a System Service will still be present, but it won’t have the Running status in Windows Services since it will have no OpenVPN Profile associated with it. Afterward, to change the OpenVPN Profile of the system service, simply go through the steps in the section Starting System Service with a new OpenVPN profile
- If you want to remove system service run the command: ovpnconnector.exe remove
Несколько конфигурационных файлов
Позволит держать несколько конфигураций для подключения к различным VPN-серверам. Между последними можно переключаться из клиентской программы.
Для Windows:
В каталоге config создаем для каждого сервера свою папку и помещаем в нее рабочие файлы (файл конфигурации, сертификаты и так далее). В каждой папке называем конфигурационные файлы ovpn своими именами (даже если файлы будут находиться в разных папках, но с одинаковыми именами, клиент OpenVPN будет воспринимать их как один конфиг).
Пример каталога config:
Пример файлов в одном из каталогов:
Теперь при подключении клиентом к можно выбрать конкретный VPN-сервер:
Для Linux:
Также как для Windows, создаем для каждого сервера свой каталог, куда скопируем рабочие файлы:
mkdir /etc/openvpn/server1
А в каталоге /etc/openvpn создаем для каждого подключения свой конфиг:
vi /etc/openvpn/client1.conf
* в конфигурационном файле все пути до файлов должны вести в соответствующий каталог (в нашем примере, /etc/openvpn/server1).
Запускаем OpenVPN:
openvpn —config /etc/openvpn/server1/client.conf
Для автоматического запуска мы уже ранее применяли команду:
systemctl enable openvpn@client
… где @client — указатель на использование конфигурационного файла client внутри папки openvpn (/etc/openvpn). Таким образом, если мы создали 2 файла client1.conf и client2.conf, команды для разрешения автозапуска бelen такие:
systemctl enable openvpn@client1
systemctl enable openvpn@client2
Locating the server log files
To diagnose problems with an OpenVPN server or client, it is helpful to look at the log files. The log files are located in specific areas on your computer systems, and the following is a general guide on how to find them and how to get the best information out of them. Log files are the place to check whenever you’re having any problems making a connection with an OpenVPN client program to the OpenVPN Access Server, they the information needed to ascertain what’s going wrong.
On the OpenVPN Access Server there is the server side log:/var/log/openvpnas.log /var/log/openvpnas.node.log (in case of a failover setup)
In the event that you are having problems with starting the Access Server or certain portions of it, for example the web services, then it may be useful to stop the Access Server service, move the log file aside, then start the Access Server service, and stop it again immediately. This creates a new clean log file that contains the startup and shutdown sequence of the Access Server and no other extraneous information. This makes analysis of the log file much easier. To do so use these commands in order:
You can then grab the /var/log/openvpnas.log file for analysis and start the Access Server again:
Connect App Installation
- Go to https://openvpn.net/client-connect-vpn-for-windows/ and click Download OpenVPN Connect V3. Note: If you are using OpenVPN Cloud or OpenVPN Access Server, you may also download OpenVPN Connect with an already existing OpenVPN Profile (needed to connect to VPN) on the portal
- After the download has been completed, click on the setup in the Downloads pop-up bar in your browser
- In the OpenVPN Connect Setup Wizard that has just opened, click Next
- Read the License Agreement and click on the I accept the terms in the License Agreement checkmark (in case you accept the terms)
- Click Next
- In the Driver Selection window, choose a driver and click Next
- Click the Install button in order to begin the installation process
- Finally, click Finish in order to finish the setup process after the installation has been completed
Настройка сервера
Переходим в папку C:\Program Files\OpenVPN\config-auto (или для старой версии C:\Program Files\OpenVPN\config) и создаем файл server.ovpn. Открываем его на редактирование и приводим к следующему виду:
port 443
proto udp
dev tun
dev-node «VPN Server»
dh «C:\\Program Files\\OpenVPN\\ssl\\dh.pem»
ca «C:\\Program Files\\OpenVPN\\ssl\\ca.crt»
cert «C:\\Program Files\\OpenVPN\\ssl\\cert.crt»
key «C:\\Program Files\\OpenVPN\\ssl\\cert.key»
server 172.16.10.0 255.255.255.0
max-clients 32
keepalive 10 120
client-to-client
compress
ncp-disable
fast-io
cipher AES-256-CBC
persist-key
persist-tun
status «C:\\Program Files\\OpenVPN\\log\\status.log»
log «C:\\Program Files\\OpenVPN\\log\\openvpn.log»
verb 4
mute 20
* где port — сетевой порт (443 позволит избежать проблем при использовании Интернета в общественных местах, но может быть любым из свободных, например 1194, занятые порты в Windows можно посмотреть командой netstat -a); dev-node — название сетевого интерфейса; server — подсеть, в которой будут работать как сам сервер, так и подключенные к нему клиенты.
** так как в некоторых путях есть пробелы, параметр заносится в кавычках.
*** при использовании другого порта необходимо проверить, что он открыт в брандмауэре или на время тестирования отключить его.
В сетевых подключениях Windows открываем управление адаптерами — TAP-адаптер переименовываем в «VPN Server» (как у нас указано в конфигурационном файле, разделе dev-node):
Теперь открываем службы Windows и находим «OpenVpnService». Открываем ее, настраиваем на автозапуск и включаем:
Ранее переименованный сетевой интерфейс должен включиться:
VPN-сервер работает. Проверьте, что сетевой адаптер VPN Server получил IP 172.16.10.1. Если он получает что-то, на подобие, 169.254…, выключаем сетевой адаптер — перезапускаем службу OpenVpnService и снова включаем сетевой адаптер.
Locating the client log files
Log file location for the OpenVPN Connect Client for Windows:C:\Program Files (x86)\OpenVPN Technologies\OpenVPN Client\etc\log\openvpn_(unique_name).log
The OpenVPN Connect Client for Mac:/Library/Application Support/OpenVPN/log/openvpn_(unique_name).log
Macintosh may not show you this folder in finder as it only shows you certain things and hides others. So to get to the /Library folder, open Finder and in the menu at the top choose Go followed by Go to folder and then enter the path /Library to get into that directory. You can then go to the correct folder and look up the log file. Please also note that the OpenVPN Connect Client for Macintosh will have permissions set on the log file so that you cannot normally open it. To bypass this, right click the log file and choose the Get info option in the menu. Then at the bottom, under Sharing & Permissions, you will be able to use the yellow padlock icon to unlock the settings and to give everyone read access. Then you will be able to open the log file with a right click and selecting Open with and then choosing something like Text editor to view the contents of the log file.
Finishing configuration and using the product
Once the program is installed it will automatically configure itself with default settings unless it detected a previous installation — then it just keeps those settings from the existing installation. If you install fresh, the installation process will tell you where to find the client web service, which is the web based GUI that you can use to log on and connect to the Access Server, and where to find the admin web service, which is where you can log on as an administrative user and manage the configuration, certificate, users, etcetera, in the web based GUI.
Usually the client UI is at the address of your server, as an example it may be at https://192.168.70.222/.
The admin UI is usually at the /admin/ address, for example https://192.168.70.222/admin/.
Please note that the web services by default actually run on port TCP 943, so using our example IP address, you can add that to the end: https://192.168.70.222:943/. The OpenVPN TCP daemon that runs on TCP port 443 redirects incoming browser requests so that it is easier for users to open the web interface — they won’t have to specify that port number.
Initially a single administrative user is added to the system. But it has no password set and therefore cannot be used yet. To use it a password must be set first:
You can now point your web browser at the admin UI web interface. Because the Access Server comes with a self-signed SSL certificate to begin with, you will receive a warning in the browser like “Invalid certificate» or “Cannot verify identity of the server». You will have to confirm that you wish to continue to the web interface (these warnings may be a little scary but can be resolved later by installing a properly signed web SSL certificate in the Access Server). You will then see the login screen and you can then enter the username openvpn and the password you have just set with the “passwd openvpn» command.
Once you are logged in to the Admin UI you can select which authentication system to use. The available choices are LOCAL, PAM, RADIUS, and LDAP. The default is LOCAL which lets you manage the users directly from the web interface.
You can also use another external system like RADIUS or LDAP server, for example to connect to a Windows Server Active Directory using an LDAP or RADIUS connector. If you do connect to Windows AD, we recommend that you use LDAP for best results.
If you are managing only a limited amount of users and don’t want things to be too complicated you can just stay with LOCAL authentication mode. Almost everything can then be configured purely from the Admin UI, although some advanced options are only available in the command line tools. We recommend that if you choose to use PAM that you look at the command line authentication options documentation specifically to learn how to add/remove users and manage passwords.
Further documentation is available to configure specific functions and configuration options for the OpenVPN Access Server.
User ManualGet Started GuideLinux Video Tutorials
Background
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/releases (expand the tag to see the full text)
Alternative OpenVPN client: tunXten
tunXten is a third-party client created by Eugene Mindrov. tunXten is only available for Windows and is compatible with OpenVPN Access Server. tunXten supports importing connection profiles directly from the Access Server and can also support multiple simultaneous OpenVPN tunnel connections. Just like the open source version, tunXten needs multiple virtual network adapters to do this, but it comes with a GUI tool to achieve this. You can simply keep adding adapters until you have the required number to establish as many connections as you need. It comes with useful logging information and the ability to place custom icons on connections, rename profiles in the GUI, set connections to automatically connect at boot up, remember saved usernames and passwords, and so on.