HowTo: Migrate Samba 4 DNS data from the legacy to the default partition

HowTo:

Migrate Samba 4 DNS data from the legacy to the default partition

Please take into account that during the migration DNS is not fully available

Step 1:

Check if you have legacy DNS Zones:

root@ucs:~# univention-s4search -b CN=MicrosoftDNS,CN=System,$(ucr get samba4/ldap/base) --cross-ncs |grep dn: |grep -vi root
dn: DC=_msdcs,DC=multi.ucs,CN=MicrosoftDNS,CN=System,DC=multi,DC=ucs
[...]

→ Migration is necessary

There should NOT be anything below the CN=MicrosoftDNS,CN=System container. You should only get the DN itself:

root@ucs:~# univention-s4search -b CN=MicrosoftDNS,CN=System,$(ucr get samba4/ldap/base) --cross-ncs |grep dn: |grep -vi root
dn: CN=MicrosoftDNS,CN=System,DC=multi,DC=ucs

→ Migration not necessary

Check if the connector uses legacy

ucr get connector/s4/mapping/dns/position

→ legacy → you should consider the migration.

Step 2

On the master (or @school-slave) migrate the existing zone info to the new location with the script migrate_legacy_dns_zones attached to
the Bug 43692 - Migrate Samba 4 DNS data from the legacy to the default partition . It is also essential that the unmodified script is used, please avoid Copy&Paste and rather use wget or similar methods.

Step 3

Now make sure the S4 connector does not sync to legacy branches:

ucr unset connector/s4/mapping/dns/position
systemctl restart univention-s4-connector

Step 4

Make sure you do not find entries in your /var/log/daemon.log regarding duplicate zones like

Mar 12 13:26:20 slave named[18248]: samba_dlz: Ignoring duplicate zone 'multi.ucs' from 'DC=@,DC=multi.ucs,CN=MicrosoftDNS,DC=DomainDnsZones,DC=multi,DC=ucs'
Mar 12 13:26:20 slave named[18248]: samba_dlz: Ignoring dnsZone _msdcs.multi.ucs

If this is so start over with step 2.
Remove the duplicate entry:

ldbdel -H /var/lib/samba/private/sam.ldb DC=_msdcs,DC=multi.ucs,CN=MicrosoftDNS,CN=System,DC=multi,DC=ucs
systemctl restart bind9

Tags:
legacy, dns , CN=MicrosoftDNS,CN=System , connector/s4/mapping/dns/position, migrate_legacy_dns_zones