Realm linux ��� ���

Linuxoid

OpenSource forever

Подключаем Linux ПК к Active Directory при помощи realmd

Не смотря на то что Linux и Windows уже не редкость в одной сети, интеграции из коробки до сих пор нет. Как нет и единого решения. Проект realmd упрощает подключение Linux систем к Active Directory.

Что у нас есть на сегодня? Microsoft для Windows Server 2008 R2 — 2012 R2 предлагает Identity Management for UNIX (Служба управления идентификацией UNIX), являющийся частью роли контроллера домена и позволяющий использовать для входа в Unix учетные записи Active Directory. Но в настоящее время он уже объявлен как устаревший. Большие возможности дает Configuration Manager, но и соответственно требует больших вложений. Сторонники Unix ориентируются на связку Samba (winbind) и Kerberos или на решения сторонних компаний (PowerBroker Identity Services, Centrify Server Suite, Quest Authentication Services). Первый бесплатен, рекомендуется многими специалистами как более правильные, но требуют тщательных настроек. Вторые вмешиваются в схему AD и требуют дополнительного лицензирования (PowerBroker имеет и OpenSource версию).
realmd (Realm Discovery, freedesktop.org/software/realmd) сервис D-Bus позволяющий производить настройку сетевой аутентификации и членства в домене (AD или IPA/FreeIPA) без сложных настроек. Информация о домене обнаруживается автоматически. Для аутентификации и проверки учетных записей realmd использует SSSD (через Kerberos и LDAP, fedorahosted.org/sssd) или Winbind. Версия 0.1 была представлена в конце июля 2012, на момент написания этих строк актуальной была 0.16.1. В настоящее время realmd интегрирован в kickstart, Центр управления GNOME и другие инструменты. Покажем подключение к домену example.org при помощи realmd на примере Ubuntu Linux 14.04 LTS, в других дистрибутивах все показанное будет отличаться только особенностями работы менеджера пакетов.
Перед началом настроек, необходимо настроить DNS, лучше всего когда в /etc/resolv.conf прописан сам контролер домена. Все что необходимо уже есть в репозитарии:

При конфигурировании krb5-user будет запрошена область по умолчанию, вводим имя домена в верхнем регистре — EXAMPLE.ORG.

Конфигурирование пакета krb5-user

Конфигурационный файл /etc/realmd.conf не создается и действуют параметры по умолчанию. В результате может возникнуть конфликт имен, что приведет к ошибке при подключении. Чтобы избежать проблем следует его создать, такого содержания:

Файл на самом деле имеет множество полезных опций, но пока этого достаточно.
Сервисы SSSD ( System Security Services Daemon) также требуют настройки. Добавим фильтр учетных записей и количество попыток подключений:

В некоторых ситуациях следует добавить «use_fully_qualified_names = False».
Указываем права доступа:

Пробуем найти доступные домены:

Получаем тикет пользователя имеющего права администратора домена.

Подключаемся (рис.2). Для запуска понадобятся права root иначе получим сообщение «realm: Couldn’t join realm: Not authorized to perform this action».

Подключаемся к Active Directory

Теперь если ввести «sudo realm list» получим полную информацию о домене, а в консоли «Active Directory Users and Computers» появится новый компьютер.
Информация о домене

Вкладка Active Directory Users and Computers
Некоторые действия и информацию можно получить при помощи утилиты adsli.

Также стоит добавить новое правило в /etc/sudoers, чтобы доменный пользователь мог получать права администратора локального компьютера:

Перегружаем систему и регистрируемся как доменный пользователь «пользователь@домен».

Источник

Вики IT-KB

Пошаговые руководства, шпаргалки, полезные ссылки.

Инструменты пользователя

Инструменты сайта

Боковая панель

Содержание

Установка SSSD/realmd и подключение к домену Active Directory в Ubuntu Linux 16.04 LTS

В целом процедура подключения компьютера под управлением ОС Ubuntu GNU/Linux 16.04.2 LTS (Xenial Xerus) к домену Active Directory с помощью SSSD и realmd схожа с ранее описанной в статье Подключение Debian GNU/Linux 8.6 к домену Active Directory с помощью SSSD и realmd, но с некоторыми исключениями и оговорками.

Читайте также:  Красивый календарь для windows 10

Предварительные требования

Настраиваем и проверяем синхронизацию времени с контроллерами домена.

В файле меняем строчки указывающие на NTP-сервер. В качестве источника времени указываем контроллеры домена AD:

Перезапускаем службу ntp и проверяем статус синхронизации времени:

Установка SSSD/realmd и проблема присоединения к домену Active Directory

Устанавливаем необходимые пакеты из официальных репозиториев Ubuntu Xenial:

При необходимости опционально правим realmd.conf. Подробности в онлайн-справке

Пробуем подключить компьютер к домену Active Directory:

Однако, несмотря на то, что предварительно мы установили все нужные пакеты, в Ubuntu 16.04 можем получить ошибку, говорящую о том, что необходимые пакеты не установлены:

Решить эту проблему можно, воспользовавшись обходным решением предложенным здесь, а именно добавить к команде realm join дополнительный параметр –install=/

Проверяем результат работы realm join, а также проверяем доступ к пользователям и группам Active Directory согласно ранее упомянутой статьи.

Проблема авторизации из-за ошибки механизма кеширования GPO

На этапе проверки доменной авторизации в Ubuntu 16.04 можем обнаружить ещё одну проблему.При попытке войти в систему, аутентификация пользователя проходит успешно, а попытка последующей авторизации завершается ошибкой типа:

Чтобы понять корень проблемы, останавливаем службу sssd, затем запускаем sssd в интерактивном режиме с включённой опцией отладки следующей командой:

Пробуем воспроизвести проблему — выполнить процедуру авторизации, и если на консоли видим ошибки типа:

Значит мы столкнулись с багом, имеющимся в версии sssd, которая на данный момент доступна в официальных репозиториях Ubuntu Xenial (версия 1.13.4). Подробнее об этой проблеме здесь. В качестве решения этой проблемы предлагается создать каталог кеша доменных групповых политик, если его ещё нет. Если этот каталог существует, то установить на него права:

Если это не помогло, можно вообще выключить попытки обработки доменных политик в конфигурации /etc/sssd/sssd.conf в секции, описывающей домен:

В остальном настройка системы аналогична ранее упомянутой статьи.

Приведённые здесь решения также проверены и на Ubuntu GNU/Linux 14.04 LTS (Trusty Tahr).

Автор первичной редакции:
Алексей Максимов
Время публикации: 11.03.2017 16:56

Обсуждение

Спасибо работает ,только дописал
ad_gpo_access_control = disabled
enumerate = True
dyndns_update = true
dynd ns_refresh_interval = 43200
dyndns_ttl = 1200

krb5_renewable_lifetime = 7d
krb5_renew_interval = 1h
иначе на следующий день билет TGT не продлялся.
вот только диалог смены просроченного пароля пользователя хотелось бы на русском.Войдя в систему и сделав su — username, сообщение что пароль просрочен по русски. А вот в DM или по shh или если через консоль входить в систему все по английски. системы ubuntu 16.04, debian 9.2 stretch. В /etc/environment и /etc/default/local как надо.

Источник

Add Linux to Windows Domain using realm (CentOS/RHEL 7/8)

Table of Contents

Microsoft has its Identity Management suite to build around the Active Directory, and Red Hat has its identity management directory server. In this article I will share the steps to add Linux to Windows Active Directory Domain. The steps are validated by adding RHEL/CentOS 7 and 8 Linux to Windows Active Directory configured on Windows Server 2012 R2.

Some more articles on similar topic:

  • How to join Linux client to Windows AD Domain using realmd with SSSD (CentOS/RHEL 7/8)
  • How to join Linux client to Windows AD Domain using adcli with SSSD (CentOS/RHEL 7/8)
  • How to join Linux client to Windows AD Domain using winbind (CentOS/RHEL 7/8)

1. Overview on realmd tool

RealmD is a tool that will easily configure network authentication and domain membership. With RHEL/CentOS 7, RealmD is fully supported and can be used to join IdM, AD, or Kerberos realms. The main advantage of using realmd is the ability to provide a simple one-line command to enroll into a domain as well as configure network authentication.

For example, realmd can easily configure:

The realmd system supports the following domain types:

  • Microsoft Active Directory
  • Red Hat Enterprise Linux Identity Management

The following domain clients are supported by realmd:

  • SSSD for both RHEL/CentOS Identity Management and Microsoft Active Directory
  • Winbind for Microsoft Active Directory

Following table lists some of the most used realm commands:

Command Description
realm discover Run a discovery scan for domains on the network.
realm join Add the system to the specified domain.
realm leave Remove the system from the specified domain.
realm list List all configured domains for the system or all discovered and configured domains.
realm permit Enable access for specified users or for all users within a configured domain to access the local system
realm deny Restrict access for specified users or for all users within a configured domain to access the local system

2. Lab Environment

For demonstrations in this article to add Linux to Windows AD Domain on RHEL/CentOS 7/8, we will use two virtual machines running in an Oracle VirtualBox installed on my Linux Server virtualization environment.

We have a Microsoft Server 2012R2 Active Directory Domain Controller with the IP address 192.168.0.107 and the CentOS 8 host with the IP address 192.168.0.117 . In this article I will only cover the part to add Linux to Windows AD Domain on the client side. So this article to add Linux to Windows AD Domain requires a pre-configured Windows Active Directory.

3. Pre-requisites to add Linux to Windows AD Domain

3.1 Update /etc/resolv.conf

Make sure RHEL/CentOS client machine is able to resolve Active Directory servers. To do this update your /etc/resolv.conf with the IP address of your Domain Controller on your RHEL / CentOS 7/8 client host.

3.2 Verify Domain Name Resolution

Verify if the client is able to resolve the domain name:

Verify the configuration for name resolution. In particular, verify the DNS SRV records.

3.3 Install packages (RHEL/CentOS 7)

For minimal install servers, you need to install krb5-workstation package , which provides klist command. Install adcli package along with sssd :

  • sssd: The System Security Services daemon can be used to divert client authentication as required
  • adcli: These are the tools for joining and managing AD domains

3.4 Install packages (RHEL/CentOS 8)

Following list of packages are required for integrating Linux client to Windows domain using realm. We need oddjob oddjob-mkhomedir to make sure the home directory is automatically created for domain users.

4. Using realm to join Linux to Windows Domain

With all the packages installed, we can use the realm command to add Linux to Windows AD Domain and manage our enrolments. This command is part of the realmd package that we added.

4.1 List configured domains

We can use the list subcommand to ensure that we are not currently part of a domain:

The output should be blank.

4.2 Discover available domains in the network

Now, we are ready to proceed with the next step i.e. to add Linux to Windows AD Domain. With a simple environment, you will know the domain that you want to join; at least we certainly hope that you do . In our case, we do know it and this is golinuxcloud.com .

The realm discover command returns complete domain configuration and a list of packages that must be installed for the system to be enrolled in the domain.

4.3 Join Linux client to Windows domain

The realm join command then sets up the local machine for use with a specified domain by configuring both the local system services and the entries in the identity domain. The process run by realm join follows these steps:

  • Running a discovery scan for the specified domain.
  • Automatic installation of the packages required to join the system to the domain.
  • Joining the domain by creating an account entry for the system in the directory.
  • Creating the /etc/krb5.keytab host keytab file.
  • Configuring the domain in SSSD and restarting the service.
  • Enabling domain users for the system services in PAM configuration and the /etc/nsswitch.conf file.

Initially I was getting following error while trying to join my Linux client to Windows domain using realm:

In the journalctl logs I could find the following logs:

4.4 How to fix «KDC has no support for encryption type»?

Method-1
With RHEL/CentOS 8, rc4 is not in the DEFAULT crypto policy anymore, see man crypto-policies for details. Unfortunately it is still the common fallback in AD.

So we can add rc4-hmac in /etc/krb5.conf.d/crypto-policies as permitted_enctypes as shown below.

Now you can re-try to join Linux client to windows domain using realm:

Method-2
Here also we add rc4 encryption policy but instead of using /etc/krb5.conf.d/crypto-policies , we will add following content in a new file under / etc/krb5.conf.d/

Now you can try to join Linux client to the windows domain using realm:

Method-3
You can allow weak encryption by defining the following under [libdefaults] in /etc/krb5.conf file:

Now you can try to join Linux client to the windows domain using realm:

5. Verify if Linux client is integrated to windows domain

As a standard user, you can then list the domain you have joined using the realm list command again. We should note that the output at first may seem similar to the realm discover golinuxcloud.com command that we ran earlier; however, on closer examination, we will see that we are now a member server, as shown by configured: kerberos-member in the following command:

6. Configure NSS for SSSD service

Next we need to configure NSS to authenticate the users in the Linux client and create home directories for AD users:

6.1 On RHEL/CentOS 7

You can use authconfig on RHEL/CentOS 7 server to configure PAM and make sure the home directories of AD users are automatically created:

Next enable and start/restart oddjobd.service

6.2 On RHEL/CentOS 8

We will use authselect which is the new version of authconfig in RHEL/CentOS 8 for configuring PAM files and making sure that home directories of AD users are automatically created when they login to the Linux client:

Next enable and start/restart oddjobd.service

7. Login as Active Directory User on Linux Client

Let us try to login to our Linux client using Windows AD user and verify if the home directory is automatically created. But first we need to check if our Linux client is able to get the user details of AD users:

So our Administrator user from the AD is detected by the Linux client, so let’ try to switch user to Administrator:

As expected the home directory for our AD user was automatically created.

8. Leaving Active Directory domain

There will be occurrences where the Linux server needs to be removed from active directory domain. Often, this is the case where it is removed from one active directory domain before being added to another active directory domain. Should this be required, the realm command makes the process easy.

The additional option: —remove will ensure that the computer account is also deleted from the domain; otherwise, it should be deleted separately.

Summary

In this article we learned how we can join a Linux client (CentOS/RHEL 7/8) to Windows AD Domain using realmd tool. The realmd system provides a clear and simple way to discover and join identity domains. It does not connect to the domain itself but configures underlying Linux system services, such as SSSD or Winbind, to connect to the domain.

It can run a discovery search to identify available AD and Identity Management domains and then join the system to the domain, as well as set up the required client services used to connect to the given identity domain and manage user access. Additionally, because SSSD as an underlying service supports multiple domains, realmd can discover and support multiple domains as well.

Further Reading

You can go through the following articles to learn more about integrating Linux client to Windows domain using realmd
Using realmd to Connect to an Active Directory Domain
man page of krb5.conf [libdefaults]

Related Searches: linux login with active directory, join linux server to active directory, add linux server to windows domain, linux active directory authentication, how to add a linux system to a windows domain, linux windows domain authentication, linux ad integration

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

4 thoughts on “Add Linux to Windows Domain using realm (CentOS/RHEL 7/8)”

Is there any way to do this without revrting to the CLI?

You mean using any GUI based tool?

Hi, after doing above steps, I was able to do a domain join but I was unable to SSH to the linux server with AD user id.. any advise?

Источник

Читайте также:  Служба операционная система microsoft windows
Оцените статью