Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit b04baff · 11 days ago

Import substitution, part 2: migrating Active Directory to Samba AD, FreeIPA, or ALD Pro

🌐 Machine-translated from Russian. Show original

How to migrate a domain from Active Directory to a domestic or public directory service: three paths, trust relationships, steps, user and group migration, policies, and what usually breaks.

🔒 Since 17.11.2026, the source code of the AD Tools series is provided upon request: leave a request. The showcase of the series is github.com/WorkTime-kz/ad-tools.

In this part:

Three migration paths#

The WayHow theWorks ProsCons
Samba AD in the same domainSamba DC joins AD as another controller, roles are transferred, Windows DC outputsnames, SIDs, and passwords are saved; Windows clients do not noticeSYSVOL does not replicate itself; GPO for Linux needs to be resolved separately
New domain + trustFreeIPA or ALD Pro is a separate forest, between it and ADLinux trust lives in its "own" domain, the transition is gradualtwo directories per transition, more complicated than DNS
New domain + account migrationa new domain is created, users and groups are exported and recreateda clean directory without a "legacy"new SIDs, machine re-entry, reset, or password synchronization

Alt Domain is a commercial product on Samba DC (first path). ALD Pro is based on FreeIPA, capable of trusting, synchronizing, and migrating accounts with password synchronization (second and third paths).

Preparation: what to do before any changes#

  1. Catalog inventory: number of users, groups, computers, OUs, service accounts. Export to CSV:
Get-ADUser -Filter * -Properties mail,department,memberOf,Enabled |
  Select SamAccountName,Name,mail,department,Enabled |
  Export-Csv users.csv -NoTypeInformation -Encoding UTF8
Get-ADGroup -Filter * | Select Name,GroupScope,GroupCategory | Export-Csv groups.csv -NoTypeInformation -Encoding UTF8
  1. List of GPOs and what each does: Get-GPOReport -All -ReportType Html -Path gpo.html. Most Windows policies are not ported to Linux — they will have to be rewritten.
  2. AD dependencies: Exchange, ADFS, ADCS (certification authority), RADIUS/NPS, VPN, Wi-Fi 802.1X, 1C with domain authentication, LDAP applications.
  3. Domain and forest functionality level.
  4. Domain health: dcdiag, repadmin /replsummary. Migrating a domain with replication errors is not allowed.

💡 Rehearse the migration on the booth. The test domain on Samba AD for such experiments is ad-testlab from the AD Tools series (source code is available upon request).

Path 1: Samba AD as a controller in an existing domain#

Samba supports functionality levels up to 2008 R2 from version 4.0, 2012 and 2012 R2 from 4.19, 2016 from 4.20. Check the Samba version in your distribution before starting work.

Procedure:

  1. Linux server, static IP, exact time (Kerberos does not tolerate discrepancies).
  2. The /etc/resolv.conf is the DNS of the active Windows DC.
  3. In /etc/krb5.conf: default_realm, dns_lookup_realm = false, dns_lookup_kdc = true.
  4. Connection:
sudo samba-tool domain join corp.example.ru DC -U"CORP\administrator" \
  --dns-backend=SAMBA_INTERNAL --option="dns forwarder=10.0.0.1"
sudo systemctl enable --now samba
samba-tool drs showrepl   # проверка репликации
  1. Transfer FSMO roles (samba-tool fsmo transfer), switch to DNS clients, then correctly output Windows DC.

What you need to know:

  • SYSVOL does not replicate automatically between Samba DCs. You need your own schema: rsync, Unison, osync, or robocopy.
  • The file is idmap.ldb copied from the DC with the PDC Emulator role to the others; otherwise, user IDs on different DCs will differ.

Path 2: Trust between AD and FreeIPA / ALD Pro#

FreeIPA builds trust between forests with AD using Samba components. AD views the IPA domain as a separate forest. The IPA domain must be in a DNS zone that does not overlap with AD zones, such as ipa.corp.example.ru or a separate zone.

Transition scheme:

  1. Deploy FreeIPA or ALD Pro in a separate zone.
  2. Configure conditional forwarding of DNS in both directions.
  3. You establish trust. AD users gain access to Linux resources, and Linux machines are introduced into the new domain.
  4. Gradually move users and groups; in the end, you remove trust.

ALD Pro includes a synchronization module and scripts for this: migrating workstations with user retention to MS AD or full migration of accounts and services with password synchronization. Details are in the vendor's documentation.

Path 3: Migrating users and groups to the new domain#

If trust is not required, the transfer is done by uploading and uploading. Example for FreeIPA from CSV exported above:

kinit admin
while IFS=, read -r login first last mail; do
  ipa user-add "$login" --first="$first" --last="$last" --email="$mail" --random
done < users.csv
ipa group-add buh --desc="Бухгалтерия"
ipa group-add-member buh --users=ivanov --users=petrova

What to consider:

  • Passwords are not transferred by upload. Options: temporary password with change upon login, product synchronization (ALD Pro), or self-service.
  • SIDs change — rights on file servers will have to be reissued by groups.
  • Keep your logins the same, otherwise your profiles, email, and 1C will suffer.
  • Don't transfer disconnected and "dead" accounts — it's a good time to put things in order.

Group Policies: What to Replace#

GPO problemLinux-equivalent
Windows client policiesremain in Samba AD — edited via RSAT
Linux desktop settingsALT: gpupdate + ADMC/GPUI; ALD Pro: policies on SaltStack
Who can enter the machineFreeIPA/ALD Pro: HBAC rules; sssd: simple_allow_groups
Sudo rightssudo rules FreeIPA/ALD Pro
Passwords, locks,password policies of the
Scripts, packages, filesAnsible, SaltStack, or product policies

Details about stations — Import substitution, part 3: workstations running Astra Linux and RED OS in the domain — input, policies, printers, folders,**, and auto-request of certificates for Wi-Fi, VPN, smart cards.
5. LDAP applications with a hardcoded DN of the OU=...,DC=...type: in FreeIPA, the structure is different (cn=users,cn=accounts,dc=...).
6. Nested groups and groups with spaces and Cyrillic in names.
7. SYSVOL on Samba without configured synchronization.

Sources#

i️ Terms are changing. Prices, tariffs, and features are as of November 2026. Before purchasing or implementing, please check the official websites: reestr.digital.gov.ru.

Comments 00 участников · 0 гостей🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.