diff --git a/README.md b/README.md index d6aaa2b6..2e67fbdd 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,28 @@ + + [![License](https://img.shields.io/badge/license-view-orange)](https://github.com/MultifactorLab/multifactor-radius-adapter/blob/main/LICENSE.md) -# multifactor-radius-adapter +# Multifactor radius adapter _Also, available in other languages: [Русский](README.ru.md)_ -**multifactor-radius-adapter** is a RADIUS server for Linux. It allows you to quickly add multifactor authentication through RADIUS protocol to your VPN, VDI, RDP, and other resources. +## What is Multifactor radius adapter? +**Multifactor radius adapter** is a RADIUS server for Linux. It allows you to quickly add multifactor authentication through RADIUS protocol to your VPN, VDI, RDP, and other resources. The component is a part of MultiFactor 2FA hybrid solution. * Source code -* Build - -See documentation at for additional guidance on integrating 2FA through RADIUS into your infrastructure. - -Windows version of the component is available in our [MultiFactor.Radius.Adapter](https://github.com/MultifactorLab/MultiFactor.Radius.Adapter) repository. +* Releases ## Table of Contents -* [Background](#background) - * [Component Features](#component-features) -* [Prerequisites](#prerequisites) -* [Installation](#installation) - * [Dependencies Installation](#dependencies-installation) - * [CentOS 7](#centos-7) - * [CentOS 8](#centos-8) - * [Ubuntu 18.04](#ubuntu-1804) - * [Debian 10](#debian-10) - * [Component Installation](#component-installation) -* [Configuration](#configuration) - * [General Parameters](#general-parameters) - * [Active Directory Connection Parameters](#active-directory-connection-parameters) - * [External RADIUS Server Connection](#external-radius-server-connection) - * [Optional RADIUS Attributes](#optional-radius-attributes) - * [Second factor verification parameters](#second-factor-verification-parameters) - * [2FA before 1FA](#second-factor-authentication-before-first-factor-authentication) - * [Customize logging](#logging) - * [Environment variables](#configuring-the-adapter-using-environment-variables) -* [Start-Up](#start-up) -* [Logs](#logs) -* [Limitations of Active Directory Integration](#limitations-of-active-directory-integration) +* [What is Multifactor radius adapter](#what-is-multifactor-radius-adapter) +* [Component Features](#component-features) * [Use Cases](#use-cases) +* [Installation and configuration](#installation-and-configuration) * [License](#license) -## Background - -Remote Authentication Dial-In User Service (RADIUS) — is a networking protocol primarily used for remote user authentication. - -The protocol has been around for a long time and is supported by major network devices and services vendors. - -### Component Features +## Component Features Key features: @@ -65,448 +39,6 @@ Additional features: * Configure RADIUS response attributes based on user's Active Directory group membership; * Proxy Network Policy Server requests and responses. -## Prerequisites - -* Component is installed on a Linux server, tested on CentOS, Ubuntu, Debian; -* Minimum server requirements: 1 CPU, 2 GB RAM, 8 GB HDD (to run the OS and adapter for 100 simultaneous connections — approximately 1500 users); -* Port 1812 (UDP) must be open on the server to receive requests from Radius clients; -* The server with the component installed needs access to ```api.multifactor.ru``` via TCP port 443 (TLS) directly or via HTTP proxy; -* To interact with Active Directory, the component needs access to the domain server via TCP port 389 (LDAP scheme) or 636 (LDAPS scheme); -* To interact with the Network Policy Server, the component needs access to NPS via UDP port 1812. - -## Installation - -### Dependencies Installation - -The component uses the .NET 8 runtime environment, which is free, open-source, developed by Microsoft and the open-source community. The runtime environment does not impose any restrictions on its use. - -To install, run the commands: - -#### CentOS 7 - -```shell -sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm -sudo yum install aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-centos - -#### CentOS 8 - -> ⚠️ **Warning** -> CentOS Linux 8 reached an early End Of Life (EOL) on December 31st, 2021. -> For more information, see the official CentOS Linux EOL page. -> Because of this, .NET isn't supported on CentOS Linux 8. - -For more information see this page. -See also: install the .NET on CentOS Stream. - -#### Ubuntu 18.04 - -```shell -$ wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -$ sudo dpkg -i packages-microsoft-prod.deb - -$ sudo apt-get update; \ - sudo apt-get install -y apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get install -y aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-ubuntu - -#### Debian 10 - -```shell -$ wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -$ sudo dpkg -i packages-microsoft-prod.deb - -$ sudo apt-get update; \ - sudo apt-get install -y apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get install -y aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-debian - -### Component Installation - -Create a folder, download and unzip the current version of the component from GitHub: - -```shell -sudo mkdir /opt/multifactor /opt/multifactor/radius /opt/multifactor/radius/logs -sudo wget https://github.com/MultifactorLab/multifactor-radius-adapter/releases/latest/download/release_linux_x64.zip -sudo unzip release_linux_x64.zip -d /opt/multifactor/radius -``` - -Create a system user mfa and give it rights to the application: - -```shell -sudo useradd -r mfa -sudo chown -R mfa: /opt/multifactor/radius/ -sudo chmod -R 700 /opt/multifactor/radius/ -``` - -Create a service - -```shell -sudo vi /etc/systemd/system/multifactor-radius.service -``` - -```shell -[Unit] -Description=Multifactor Radius Adapter - -[Service] -WorkingDirectory=/opt/multifactor/radius/ -ExecStart=/usr/bin/dotnet /opt/multifactor/radius/multifactor-radius-adapter.dll -Restart=always -# Restart service after 10 seconds if the service crashes: -RestartSec=10 -KillSignal=SIGINT -SyslogIdentifier=multifactor-radius -User=mfa -Environment=ASPNETCORE_ENVIRONMENT=Production -Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false - -# How many seconds to wait for the app to shut down after it receives the initial interrupt signal. -# If the app doesn't shut down in this period, SIGKILL is issued to terminate the app. -# The default timeout for most distributions is 90 seconds. -TimeoutStopSec=30 - -[Install] -WantedBy=multi-user.target -``` - -Enable autorun: - -```shell -sudo systemctl enable multifactor-radius -``` - -## Configuration - -The component's parameters are stored in ```/opt/multifactor/radius/multifactor-radius-adapter.dll.config``` in XML format. - -### General Parameters - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -### Active Directory Connection Parameters - -To check the first factor in the Active Directory domain, the following parameters apply: - -```xml - - - - - - - - - - - - -``` - -When the ```use-active-directory-user-phone``` option is enabled, the component will use the phone recorded in the General tab. The format of the phone can be anything. - -AD phone - -When the ```use-active-directory-mobile-user-phone``` option is enabled, the component will use the phone recorded in the Telephones tab in the Mobile field. The format of the phone can also be any format. - -AD mobile phone - -### External RADIUS Server Connection - -To check the first factor in RADIUS, for example in Network Policy Server, the following parameters are applicable: - -```xml - - - - - - -``` - -### Optional RADIUS Attributes - -You can specify attributes the component will pass further upon successful authentication, including verification that the user is a member of a security group. - -```xml - - - - - - - - -``` - -### Second factor verification parameters - -The following parameters will help you set up access to the MULTIFACTOR API when checking the second factor: - -```xml - - - - - - - - - - -``` - -### Second Factor Authentication before First Factor Authentication - -The Adapter now supports new mode: Second Factor Authentication before First Factor Authentication. -If this mode is enabled, the user will have to confirm the second factor before he can proceed to confirm the first (login/password). -All current features such as BYPASS and INLINE ENROLLMENT are available in the new mode as well. - -> Note: The Second Factor Authentication before First Factor Authentication mode is not available for **Winlogon** and **RDGW** resources. - -All available methods - push, telegram, otp - specifies the preferred method for the current user during the authentication session on the Multifactor Cloud side. This means that the specified method will be preferred. But if this method is not available, the next one will be used according to priority. - -In **otp** mode, the user must enter the OTP code in the `User-Password` attribute along with the password. If no password is required, the user only needs to enter the OTP code. -Examples of `User-Password` attribute content: - -- password + otp: mypassword123456 -- otp only: 123456 - -#### Configuration - -You can activate this mode by adding the following option to the client config: -`` -Allowed **METHOD** values: none (by default), push, telegram, otp. - -If the mode is enabled (push, telegram, otp) it is necessary to add invalid credential delay settings in root or client level config: -`` -The minimal value of **DELAY** must be 2. - -#### Configuration examples - -```xml - - - - - - - - - - - - - - - - - -``` - -### Logging - -There are such options to customize logging: - -```xml - - - - - - -``` - -As ```outputTemplate``` also acts text template which shows the logging system how the message should be formatted. For example - - ```sh -[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception} -[{Timestamp:HH:mm:ss} {Level:u3}] {CorrelationId} {Message:lj}{NewLine}{Exception} -``` - -For more information [see this page.](https://github.com/serilog/serilog/wiki/Formatting-Output) - -Moreover, logging can be provided in json: - -```xml - - - -``` - -Keep in mind that ```console-log-output-template``` and ```file-log-output-template``` settings are not applicable for the JSON log format, but it's possible to choose from predefined formats. Here are possible values of the ```format``` parametr (register is not case-sensitive). - -* ```Json``` or ```JsonUtc```. Compact logging, times in UTC. - - ```json - {"@t":"2016-06-07T03:44:57.8532799Z","@m":"Hello, \"nblumhardt\"","@i":"7a8b9c0d","User":"nblumhardt"} - ``` - -* ```JsonTz```. Compact logging, differs from ```JsonUtc``` by the time format. In this kind of format the local time with time zone is indicated. - - ```Json - {"@t":"2023-11-23 17:16:29.919 +03:00","@m":"Hello, \"nblumhardt\"","@i":"7a8b9c0d","User":"nblumhardt"} - ``` - -* ```Ecs```. Ecs formats logs according to elastic common schema. - - ```json - { - "@timestamp": "2019-11-22T14:59:02.5903135+11:00", - "log.level": "Information", - "message": "Log message", - "ecs": { - "version": "1.4.0" - }, - "event": { - "severity": 0, - "timezone": "AUS Eastern Standard Time", - "created": "2019-11-22T14:59:02.5903135+11:00" - }, - "log": { - "logger": "Elastic.CommonSchema.Serilog" - }, - "process": { - "thread": { - "id": 1 - }, - "executable": "System.Threading.ExecutionContext" - } - } - ``` -### Configuring the Adapter using Environment Variables - -There is another way to configure the Adapter - by setting environment variables. -This approach has a number of advantages: -- independence from configuration files: solves the problem of possible overwriting of files; -- easier containerization: just set a set of environment variables inside the container; -- increased security: sensitive data can be transferred via variables without using the file system. - -When launched, the Adapter reads the configuration from the `multifactor-radius-adapter.dll.config` file, as well as from the `*.config` files located in the **/clients** folder. -After this, the adapter receives values from the environment and "overlays" them on top of the settings read from the settings files. -Thus, it turns out that values from environment variables overload values from settings files. -By the way, you don’t have to use settings files at all (leave them with default values or delete the files): any settings can be described through environment variables. - -##### Examples - -Syntax: -```shell -# Linux -export VAR=VALUE - -# Windows (PowerShell) -$Env:VAR = VALUE -``` -**VAR** - environment variable name, **VALUE** - variable value. -The `export` directive is needed to set the specified variable not only for the current shell, but also for all processes launched from this shell. - -To pass settings to the adapter via environment variables, you must specify the name correctly. -To transfer the setting to the main config (multifactor-radius-adapter.dll.config), the variable name should look like this: -```shell -export RAD_APPSETTINGS__FirstFactorAuthenticationSource=ActiveDirectory -``` -**RAD_** - prefix. -**APPSETTINGS** - section inside the configuration file. -**FirstFactorAuthenticationSource** - name of a setting. -**__** - nesting separator. -Case of variable name is **not important**. - -> Note: if the name of the configuration file contains whitespace characters, when forming the name for the environment variable, these spaces must be ignored: `my rad` -> `myrad`. - -Alternative way: -```xml - - - -``` - -More complex example: -```shell -export RAD_RADIUSREPLY__ATTRIBUTES__ADD__0__NAME=Class -export RAD_RADIUSREPLY__ATTRIBUTES__ADD__0__VALUE=users1 -``` -0 - an index (number) of element. - -Alternative way: -```xml - - - - - -``` - -If you need to pass setting to the client configuration, you must just insert configuration name after **RAD_** prefix. For example, for the configuration that is in the `my-rad.config` file, the variable name would look like this: -```shell -export RAD_my-rad_APPSETTINGS__FirstFactorAuthenticationSource=ActiveDirectory -``` - - -## Start-Up - -After configuring the configuration, run the component: - -```shell -sudo systemctl start multifactor-radius -``` - -You can check the status with the command: - -```shell -sudo systemctl status multifactor-radius -``` - -## Logs - -The logs of the component are located in the ``/opt/multifactor/radius/logs`` folder as well as in the system log. - -## Limitations of Active Directory Integration - -* The Linux version of the Adapter _can't yet_ handle multiple domains with trust established between them; -* A simple user's password authentication is used with Active Directory. We strongly recommend using the LDAPS scheme to encrypt traffic between the adapter and the domain (AD server must have a certificate installed, including a self-signed one). - ## Use Cases Use Radius Adapter Component to implement 2FA in one of the following scenarios: @@ -521,6 +53,9 @@ Use Radius Adapter Component to implement 2FA in one of the following scenarios: and many more... +## Installation and configuration +See knowledge base for information about configuration, launch and an additional guidance. + ## License -Please note, the license does not entitle you to modify the source code of the Component or create derivative products based on it. The source code is provided as-is for evaluation purposes. +Please note, the license does not entitle you to modify the source code of the Component or create derivative products based on it. The source code is provided as-is for evaluation purposes. \ No newline at end of file diff --git a/README.ru.md b/README.ru.md index 981ad8cf..eb452c87 100644 --- a/README.ru.md +++ b/README.ru.md @@ -1,54 +1,25 @@ + [![License](https://img.shields.io/badge/license-view-orange)](https://github.com/MultifactorLab/multifactor-radius-adapter/blob/main/LICENSE.md) -# multifactor-radius-adapter +# Multifactor radius adapter _Also available in other languages: [English](README.md)_ +## Что такое Multifactor radius adapter? MultiFactor Radius Adapter — программный компонент, RADIUS сервер для Linux. Компонент является частью гибридного 2FA решения сервиса MultiFactor. * Исходный код -* Сборка - -Дополнительные инструкции по интеграции 2FA через RADIUS в вашу инфраструктуру см. в документации по адресу . - -Windows-версия компонента также доступна в репозитории [MultiFactor.Radius.Adapter](https://github.com/MultifactorLab/MultiFactor.Radius.Adapter). +* Релизы ## Содержание - -* [Общие сведения](#общие-сведения) - * [Функции компонента](#функции-компонента) -* [Требования для установки компонента](#требования-для-установки-компонента) -* [Установка](#установка) - * [Установка зависимостей](#установка-зависимостей) - * [CentOS 7](#centos-7) - * [CentOS 8](#centos-8) - * [Ubuntu 18.04](#ubuntu-1804) - * [Debian 10](#debian-10) - * [Установка компонента](#установка-компонента) -* [Конфигурация](#конфигурация) - * [Общие параметры](#общие-параметры) - * [Параметры подключения к Active Directory](#параметры-подключения-к-active-directory) - * [Параметры подключения к внешнему RADIUS серверу](#параметры-подключения-к-внешнему-radius-серверу) - * [Дополнительные RADIUS атрибуты](#дополнительные-radius-атрибуты) - * [Параметры проверки второго фактора](#параметры-проверки-второго-фактора) - * [Второй фактор перед первым](#второй-фактор-перед-первым) - * [Настройка журналирования](#журналирование) - * [Переменные окружения](#использование-переменных-окружения) -* [Запуск компонента](#запуск-компонента) -* [Журналы](#журналы) -* [Ограничения работы с Active Directory](#ограничения-работы-с-active-directory) +* [Что такое Что такое Multifactor radius adapter?](#что-такое-multifactor-radius-adapter?) +* [Функции компонента](#функции-компонента) * [Сценарии использования](#сценарии-использования) +* [Установка и конфигурация](#установка-и-конфигурация) * [Лицензия](#лицензия) -## Общие сведения - -Что такое RADIUS? - -Remote Authentication Dial-In User Service (RADIUS) — сетевой протокол для удаленной аутентификации пользователей в единой базе данных доступа. - -Протокол создан достаточно давно и поэтому поддерживается множеством сетевых устройств и сервисов. ### Функции компонента @@ -67,444 +38,6 @@ Remote Authentication Dial-In User Service (RADIUS) — сетевой пр * настройка атрибутов ответа RADIUS на основе принадлежности пользователя к группе Active Directory; * проксирование запросов и ответов Network Policy Server; -## Требования для установки компонента - -* Компонент устанавливается на Linux сервер, протестирован на CentOS, Ubuntu, Debian, Astra Linux; -* Минимальные требования для сервера: 1 CPU, 2 GB RAM, 8 GB HDD (обеспечивают работу ОС и адаптера для 100 одновременных подключений — примерно 1500 пользователей); -* На сервере должен быть открыт порт 1812 (UDP) для приема запросов от Radius клиентов; -* Серверу с установленным компонентом необходим доступ к хосту api.multifactor.ru по TCP порту 443 (TLS) напрямую или через HTTP proxy; -* Для взаимодействия с Active Directory, компоненту нужен доступ к серверу домена по TCP порту 389 (схема LDAP) или 636 (схема LDAPS); -* Для взаимодействия с Network Policy Server, компоненту нужен доступ к NPS по UDP порту 1812. - -## Установка - -### Установка зависимостей - -Компонент использует среду выполнения .NET 8 runtime, которая является бесплатной, открытой, разрабатывается компанией Microsoft и Open-Source сообществом. Среда выполнения не накладывает никаких ограничений на использование. - -Для установки выполните команды: - -#### CentOS 7 - -```shell -sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm -sudo yum install aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-centos - -#### CentOS 8 - -> ⚠️ **Warning** -> CentOS Linux 8 достигла раннего окончания жизни (EOL) 31 декабря 2021 года. -> Дополнительные сведения см. на официальной странице EOL Для CentOS Linux. -> Из-за этого .NET не поддерживается в CentOS Linux 8. - -Дополнительную информацию см. на странице. -См. также: установка .NET на CentOS Stream. - -#### Ubuntu 18.04 - -```shell -$ wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -$ sudo dpkg -i packages-microsoft-prod.deb - -$ sudo apt-get update; \ - sudo apt-get install -y apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get install -y aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-ubuntu - -#### Debian 10 - -```shell -$ wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -$ sudo dpkg -i packages-microsoft-prod.deb - -$ sudo apt-get update; \ - sudo apt-get install -y apt-transport-https && \ - sudo apt-get update && \ - sudo apt-get install -y aspnetcore-runtime-8.0 -``` - -https://docs.microsoft.com/ru-ru/dotnet/core/install/linux-debian - -### Установка компонента - -Создайте папку, скачайте и распакуйте актуальную версию компонента из GitHub: - -```shell -sudo mkdir /opt/multifactor /opt/multifactor/radius /opt/multifactor/radius/logs -sudo wget https://github.com/MultifactorLab/multifactor-radius-adapter/releases/latest/download/release_linux_x64.zip -sudo unzip release_linux_x64.zip -d /opt/multifactor/radius -``` - -Создайте системного пользователя mfa и дайте ему права на приложение: - -```shell -sudo useradd -r mfa -sudo chown -R mfa: /opt/multifactor/radius/ -sudo chmod -R 700 /opt/multifactor/radius/ -``` - -Создайте службу - -```shell -sudo vi /etc/systemd/system/multifactor-radius.service -``` - -```shell -[Unit] -Description=Multifactor Radius Adapter - -[Service] -WorkingDirectory=/opt/multifactor/radius/ -ExecStart=/usr/bin/dotnet /opt/multifactor/radius/multifactor-radius-adapter.dll -Restart=always -# Restart service after 10 seconds if the service crashes: -RestartSec=10 -KillSignal=SIGINT -SyslogIdentifier=multifactor-radius -User=mfa -Environment=ASPNETCORE_ENVIRONMENT=Production -Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false - -# How many seconds to wait for the app to shut down after it receives the initial interrupt signal. -# If the app doesn't shut down in this period, SIGKILL is issued to terminate the app. -# The default timeout for most distributions is 90 seconds. -TimeoutStopSec=30 - -[Install] -WantedBy=multi-user.target -``` - -Включите автозапуск: - -```shell -sudo systemctl enable multifactor-radius -``` - -## Конфигурация - -Параметры работы компонента хранятся в файле ```/opt/multifactor/radius/multifactor-radius-adapter.dll.config``` в формате XML. - -### Общие параметры - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -### Параметры подключения к Active Directory - -Для проверки первого фактора в домене применимы следующие параметры: - -```xml - - - - - - - - - - - - -``` - -При включении параметра ```use-active-directory-user-phone``` компонент будет использовать телефон, записанный на вкладке General. Формат телефона может быть любым. - -ra-ad-phone-source - -При включении параметра ```use-active-directory-mobile-user-phone``` компонент будет использовать телефон, записанный на вкладке Telephones в поле Mobile. Формат телефона также может быть любым. - -ra-ad-mobile-phone-source - -### Параметры подключения к внешнему RADIUS серверу - -Для проверки первого фактора в RADIUS, например, в Network Policy Server применимы следующие параметры: - -```xml - - - - - - -``` - -### Дополнительные RADIUS атрибуты - -Можно указать, какие атрибуты будет передавать компонент при успешной аутентификации, в том числе с проверкой вхождения пользователя в группу безопасности - -```xml - - - - - - - - -``` - -### Параметры проверки второго фактора - -Следующие параметры помогут настроить обращение в API МУЛЬТИФАКТОР при проверке второго фактора: - -```xml - - - - - - - - - - -``` - -### Второй фактор перед первым - -В режиме "Второй фактор перед первым" пользователь должен подтверждать второй фактор перед тем, как перейти к подтверждению первого (логин/пароль). При этом стандартный функционал (пропуск без подтверждения, самостоятельная настройка фактора) работает в штатном режиме. -All current features such as BYPASS and INLINE ENROLLMENT are available in the new mode as well. - -> Важно: Режим проверки второго фактора перед первым недоступен для ресурсов **Winlogon** и **RDGW**. - -Поддерживаемые методы - push, telegram, otp - задают предпочитаемый метод на стороне Мультифактора для текущего пользователя в рамках сессии аутентификации. Если предпочитаемый метод недоступен, будет использован следующий по приоритету метод согласно стандартному поведению на стороне Мультифактора. - -Если указан метод **otp**, пользователь должен указать OTP в атрибуте `User-Password` вместе с паролем. Если пароль не требуется, достаточно указать только OTP. -Примеры содержимого атрибута `User-Password`: - -- пароль + otp: mypassword123456 -- только otp: 123456 - -#### Настройка режима проверки второго фактора перед первым - -Вы можете активировать режим проверки второго фактора перед первым, добавив эту настройку в клиентский конфиг: -`` -Доступные значения **METHOD**: none (по умолчанию), push, telegram, otp. - -Если режим активен (указаны методы push, telegram или otp), необходимо также указать задержку ответа в случае провала аутентификации или авторизации. Это можно сделать в общем или клиентском конфиге: -`` -Значение **DELAY** не должно быть меньше 2. - -#### Примеры настроек - -```xml - - - - - - - - - - - - - - - - - -``` - -### Журналирование - -Существуют следующие параметры для настройки журналирования: - -```xml - - - - - - -``` - -В качестве ```outputTemplate``` выступает текстовый шаблон, который показывает системе ведения логов, как следует отформатировать сообщение. Например: - - ```sh -[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception} -[{Timestamp:HH:mm:ss} {Level:u3}] {CorrelationId} {Message:lj}{NewLine}{Exception} -``` - -Подробнее про шаблоны можно прочитать [по ссылке.](https://github.com/serilog/serilog/wiki/Formatting-Output) - -Также журналирование может вестись в формате json: - -```xml - -``` - -Для этого формата не применим текстовый шаблон, но можно выбрать один из следующих предустановленных форматтеров. Далее приведены возможные значения параметра ```format``` (регистр не важен): - -* ```Json``` или ```JsonUtc```. Компактное представление логов, время в UTC. - - ```json - {"@t":"2016-06-07T03:44:57.8532799Z","@m":"Hello, \"nblumhardt\"","@i":"7a8b9c0d","User":"nblumhardt"} - ``` - -* ```JsonTz```. Компактное представление логов, отличается от ```JsonUtc``` форматом времени. В данном форматтере указано локальное время с часовым поясом. - - ```Json - {"@t":"2023-11-23 17:16:29.919 +03:00","@m":"Hello, \"nblumhardt\"","@i":"7a8b9c0d","User":"nblumhardt"} - ``` - -* ```Ecs```. Форматирует логи в соответствии с Elastic Common Schema. - - ```json - { - "@timestamp": "2019-11-22T14:59:02.5903135+11:00", - "log.level": "Information", - "message": "Log message", - "ecs": { - "version": "1.4.0" - }, - "event": { - "severity": 0, - "timezone": "AUS Eastern Standard Time", - "created": "2019-11-22T14:59:02.5903135+11:00" - }, - "log": { - "logger": "Elastic.CommonSchema.Serilog" - }, - "process": { - "thread": { - "id": 1 - }, - "executable": "System.Threading.ExecutionContext" - } - } - ``` - -### Использование переменных окружения - -Есть еще один способ конфигурации адаптера - с помощью установки переменных окружения. -У такого подхода есть преимущества: -- независимость от файлов настройки: решает проблему возможного затирания файлов; -- более легкий процесс контейнеризации: достаточно установить набор переменных окружения внутри контейнера; -- повышенная безопасность: чувствительные данные можно проставлять через переменные, не использую файловую систему. - -При старте адаптер считывает конфигурацию из файла `multifactor-radius-adapter.dll.config`, а также из файлов `*.config`, находящихся в папке **/clients**. -После этого адаптер получает переменные из окружения и "накладывает" их поверх настроек, считанных из файлов: значения из переменных окружения перегружают значения из файлов настроек. -К слову, можно вообще не использовать файлы настроек (оставить их со значениями по умолчанию или вовсе удалить): любые настройки можно описать через переменные окружения. - -##### Примеры - -Базовый синтаксис: -```shell -# Linux -export VAR=VALUE - -# Windows (PowerShell) -$Env:VAR = VALUE -``` -**VAR** - имя переменной окружения, а **VALUE** - значение. -Директива `export` нужна, чтобы установить указанную переменную не только для текущей оболочки, но и для всех процессов, запускаемых из этой оболочки. - -Чтобы передать в адаптер настройку через переменные окружения, нужно правильно указать имя. -Для передачи настройки в основной конфиг (multifactor-radius-adapter.dll.config) имя переменной должно выглядеть так: -```shell -export RAD_APPSETTINGS__FirstFactorAuthenticationSource=ActiveDirectory -``` -**RAD_** - префикс. -**APPSETTINGS** - секция в файле настроек. -**FirstFactorAuthenticationSource** - имя настройки. -**__** - разделитель уровней вложенности. -Регистр **не важен**. - -> Важно: если название файла конфигурации содержит пробелы, при формировании имени для переменной окружения эти пробелы надо игнорировать: `my rad` -> `myrad`. - -Альтернатива: -```xml - - - -``` - -Более сложный пример: -```shell -export RAD_RADIUSREPLY__ATTRIBUTES__ADD__0__NAME=Class -export RAD_RADIUSREPLY__ATTRIBUTES__ADD__0__VALUE=users1 -``` -0 - это индекс (номер) элемента. - -Альтернатива: -```xml - - - - - -``` - -Чтобы передать настройку в клиентскую конфигурацию, нужно добавить имя конфигурации сразу после префикса _**RAD**. Например, для конфигурации, которая находится в файле `my-rad.config` имя переменной будет выглядеть так: -```shell -export RAD_my-rad_APPSETTINGS__FirstFactorAuthenticationSource=ActiveDirectory -``` - -## Запуск компонента - -После настройки конфигурации запустите компонент: - -```shell -sudo systemctl start multifactor-radius -``` - -Статус можно проверить командой: - -```shell -sudo systemctl status multifactor-radius -``` - -## Журналы - -Журналы работы компонента находятся в папке ```/opt/multifactor/radius/logs```, а также в системном журнале. - -## Ограничения работы с Active Directory - -* Linux версия адаптера **пока** не умеет работать с несколькими доменами, между которыми установлено доверие. -* Для работы с Active Directory используется простая проверка подлинности пароля пользователя. Настоятельно рекомендуем использовать схему LDAPS для шифрования трафика между адаптером и доменом (на сервере AD должен быть установлен сертификат, в т.ч. самоподписанный). - ## Сценарии использования С помощью компонента можно реализовать следующие сценарии: @@ -519,6 +52,9 @@ sudo systemctl status multifactor-radius и многие другие... +## Установка и конфигурация +Информацию о настройке, запуске и дополнительные рекомендации смотрите в [документации](https://multifactor.ru/docs/radius-adapter/linux/). + ## Лицензия -Обратите внимание на лицензию. Она не дает вам право вносить изменения в исходный код Компонента и создавать производные продукты на его основе. Исходный код предоставляется в ознакомительных целях. +Обратите внимание на лицензию. Она не дает вам право вносить изменения в исходный код Компонента и создавать производные продукты на его основе. Исходный код предоставляется в ознакомительных целях. \ No newline at end of file