Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
citrix:netscaler_two_factor_authentication_solutions [2019/02/07 12:23] – [Native NetScaler OneTimePassword] admin | citrix:netscaler_two_factor_authentication_solutions [2019/02/11 09:13] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Задача ====== | ||
+ | В наличии имеется работающий **Citrix Netscaler 11.1** и ферма **XenDesktop 7.15**. \\ | ||
+ | Нужно сделать двухфакторную аутентификацию с **Google Authenticator**. \\ | ||
+ | При входе пользователь должен вводить свои доменные учетные данные и, в случае, | ||
+ | ======= Решение ======= | ||
+ | ====== Установка и конфигурирование FreeRadius и Google Authenticator ====== | ||
+ | **FreeRadius** я буду устанавливать на **Ubuntu 18.04**. \\ | ||
+ | Для начала загоним систему в домен - [[linux_faq: | ||
+ | sudo apt-get update && sudo apt-get upgrade -y | ||
+ | Установим необходимые компоненты: | ||
+ | sudo apt-get install freeradius libpam-google-authenticator | ||
+ | ===== / | ||
+ | Для начала нужно дать побольше прав сервису **freeradius**. Для этого, откроем файлик **/ | ||
+ | user = freerad | ||
+ | group = freerad | ||
+ | В результате, | ||
+ | В противном случае - при попытке аутентификации в логе **/ | ||
+ | radiusd(pam_google_authenticator)[....]: | ||
+ | ===== / | ||
+ | Дальше - отредактируем файлик **/ | ||
+ | sudo nano / | ||
+ | В конец файла добавим: | ||
+ | DEFAULT Auth-Type :=PAM | ||
+ | ===== / | ||
+ | Теперь отредактируем файлик **/ | ||
+ | sudo nano / | ||
+ | В разделе **Authentication -> Pluggable Authentication Modules** раскомментируем строку: | ||
+ | pam | ||
+ | Добавим модуль **pam** в список включенных: | ||
+ | sudo ln -s / | ||
+ | ===== / | ||
+ | Отредактируем файл **/ | ||
+ | < | ||
+ | #auth [success=1 default=ignore] pam_winbind.so krb5_auth krb5_ccache_type=FILE cached_login use_first_pass | ||
+ | #auth required pam_unix.so use_first_pass | ||
+ | </ | ||
+ | Две последние строки необходимы только для локального тестирования. Для реальной работы их надо закомментировать!. | ||
+ | ===== / | ||
+ | Сделаем бекап файла **clients.conf**: | ||
+ | sudo mv / | ||
+ | и создадим новый файл: | ||
+ | sudo nano / | ||
+ | В него пропишем в качестве клиентов все **NSIP** адреса **netscaler' | ||
+ | < | ||
+ | secret = mysecret | ||
+ | shortname = NS | ||
+ | }</ | ||
+ | или подсеть: | ||
+ | < | ||
+ | secret = mysecret | ||
+ | shortname = NS_Subnet | ||
+ | } | ||
+ | </ | ||
+ | и **localhost** для тестирования: | ||
+ | < | ||
+ | client 127.0.0.1 { | ||
+ | secret = testing123 | ||
+ | shortname = TEST | ||
+ | } | ||
+ | </ | ||
+ | ===== Тестирование Google Authenticator ===== | ||
+ | Для тестирования нужно создать локального пользователя (или доменного) и залогиниться под ним. \\ | ||
+ | В моем случае это будет **testuser** | ||
+ | |||
+ | ==== Получение токена Google Authenticator ==== | ||
+ | Для получения токена от имени тестового пользователя нужно выполнить команду | ||
+ | google-authenticator | ||
+ | и ответить не несколько простых вопросов: | ||
+ | < | ||
+ | |||
+ | Do you want authentication tokens to be time-based (y/n) y | ||
+ | Warning: pasting the following URL into your browser exposes the OTP secret to Google: | ||
+ | https:// | ||
+ | |||
+ | Your new secret key is: ASOFVIZNKRE... | ||
+ | Your verification code is 245107 | ||
+ | Your emergency scratch codes are: | ||
+ | 40986613 | ||
+ | 75840190 | ||
+ | 36494819 | ||
+ | 18860443 | ||
+ | 79617944 | ||
+ | |||
+ | Do you want me to update your "/ | ||
+ | |||
+ | Do you want to disallow multiple uses of the same authentication | ||
+ | token? This restricts you to one login about every 30s, but it increases | ||
+ | your chances to notice or even prevent man-in-the-middle attacks (y/n) y | ||
+ | |||
+ | By default, a new token is generated every 30 seconds by the mobile app. | ||
+ | In order to compensate for possible time-skew between the client and the server, | ||
+ | we allow an extra token before and after the current time. This allows for a | ||
+ | time skew of up to 30 seconds between authentication server and client. If you | ||
+ | experience problems with poor time synchronization, | ||
+ | from its default size of 3 permitted codes (one previous code, the current | ||
+ | code, the next code) to 17 permitted codes (the 8 previous codes, the current | ||
+ | code, and the 8 next codes). This will permit for a time skew of up to 4 minutes | ||
+ | between client and server. | ||
+ | Do you want to do so? (y/n) y | ||
+ | |||
+ | If the computer that you are logging into isn't hardened against brute-force | ||
+ | login attempts, you can enable rate-limiting for the authentication module. | ||
+ | By default, this limits attackers to no more than 3 login attempts every 30s. | ||
+ | Do you want to enable rate-limiting? | ||
+ | </ | ||
+ | В результате в консоли появится вся необходимая для импорта токена информация. Импортируем его в приложение на смартфоне. | ||
+ | |||
+ | ==== Проверка работоспособности токена ==== | ||
+ | Проверить, | ||
+ | Команда для проверки будет такой: | ||
+ | radtest _username_ _userpassword_+_token_ _hostname_ 1812 testing123 | ||
+ | |||
+ | * **_username_** - логин пользователя | ||
+ | * **_userpassword_+_token_** - пароль и цифры с токена в одну строку без пробела | ||
+ | * **_hostname_** - это адрес **RADIUS** сервера | ||
+ | * **1812** - порт на котором работает сервис | ||
+ | * **testing123** - это **RADIUS secret**, прописанный для клиента **127.0.0.1** в файле **/ | ||
+ | |||
+ | ====== Конфигурирование NetScaler 11 ====== | ||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | ===== Настройка политик двухфакторной аутентификации ===== | ||
+ | Можно создать **Primary** и **Secondary** политики. При этом, пользователь должен будет успешно аутентифицироваться в соответствии с обоими политиками. | ||
+ | |||
+ | |||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | |||
+ | | ||
+ | ===== Сборка google-authenticator-libpam ===== | ||
+ | |||
+ | Установим необходимые компоненты: | ||
+ | sudo apt-get install ntp build-essential libpam0g-dev freeradius git libqrencode3 autoconf | ||
+ | Получаем исходники **google authenticator libpam** | ||
+ | git clone https:// | ||
+ | собираем и ставим | ||
+ | ./ | ||
+ | ./configure | ||
+ | make | ||
+ | sudo make install | ||
+ | ====== Варианты решения ====== | ||
+ | Как настроить двухфактоную аутентификацию с **Netscaler** написано много где. Мне понравился такой вот мануал: | ||
+ | https:// | ||
+ | \\ | ||
+ | Однако, | ||
+ | Вот тут: https:// | ||
+ | И предлагают: | ||
+ | А вот тут написано что делать: | ||
+ | https:// | ||
+ | |||
+ | |||
+ | ===== How to Configure NetScaler Gateway to use RADIUS and LDAP Authentication with Mobile/ | ||
+ | https:// | ||
+ | |||
+ | ===== SMS2 ===== | ||
+ | http:// | ||
+ | Free \\ | ||
+ | SMS or pregenerated password list | ||
+ | Allows passwordless login, using only SMS. | ||
+ | |||
+ | ===== Token2 TOTPRadius ===== | ||
+ | https:// | ||
+ | 5 users free, 2-3 EUR per user. Perpetual \\ | ||
+ | Hardware tokens, Software Tokens \\ | ||
+ | Simple maintenance due to self-enroll feature. \\ | ||
+ | High availability cluster. | ||
+ | |||
+ | ===== Duo Trusted Access ===== | ||
+ | https:// | ||
+ | 10 users - free. $3-9 per user, per month \\ | ||
+ | Hardware tokens, Software Tokens, SMS, Voice Calls, etc... \\ | ||
+ | |||
+ | ===== Native NetScaler OneTimePassword ===== | ||
+ | https:// | ||
+ | Integrated **OTP** in **NetScaler 12 Feature Pack 1** \\ | ||
+ | https:// | ||
+ | https:// | ||
+ | https:// | ||
+ | https:// | ||
+ | https:// | ||
+ | https:// | ||
+ | https:// | ||
+ | ===== Google Authenticator ===== | ||
+ | https:// | ||
+ | Free | ||
+ | https:// | ||
+ | \\ | ||
+ | https:// | ||
+ | |||
+ | https:// | ||
+ | ===== Mobile-OTP ===== | ||
+ | strong, two-factor authentication with mobile phones. Настраивается RADIUS сервер и к нему подключается этот аутентификатор \\ | ||
+ | http:// | ||
+ | http:// |