various: Remove references to about to be deleted thirdparty/dnspython
[bbaumbach/samba-autobuild/.git] / source4 / scripting / bin / samba_upgradedns
1 #!/usr/bin/env python
2 #
3 # Unix SMB/CIFS implementation.
4 # Copyright (C) Amitay Isaacs <amitay@gmail.com> 2012
5 #
6 # Upgrade DNS provision from BIND9_FLATFILE to BIND9_DLZ or SAMBA_INTERNAL
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21 import sys
22 import os
23 import errno
24 import optparse
25 import logging
26 import grp
27 from base64 import b64encode
28 import shlex
29
30 sys.path.insert(0, "bin/python")
31
32 import ldb
33 import samba
34 from samba import param
35 from samba.auth import system_session
36 from samba.ndr import (
37     ndr_pack,
38     ndr_unpack )
39 import samba.getopt as options
40 from samba.upgradehelpers import (
41     get_paths,
42     get_ldbs )
43 from samba.dsdb import DS_DOMAIN_FUNCTION_2003
44 from samba.provision import (
45     find_provision_key_parameters,
46     interface_ips_v4,
47     interface_ips_v6 )
48 from samba.provision.common import (
49     setup_path,
50     setup_add_ldif,
51     FILL_FULL)
52 from samba.provision.sambadns import (
53     ARecord,
54     AAAARecord,
55     CNameRecord,
56     NSRecord,
57     SOARecord,
58     SRVRecord,
59     TXTRecord,
60     get_dnsadmins_sid,
61     add_dns_accounts,
62     create_dns_partitions,
63     fill_dns_data_partitions,
64     create_dns_dir,
65     secretsdb_setup_dns,
66     create_samdb_copy,
67     create_named_conf,
68     create_named_txt )
69 from samba.dcerpc import security
70
71 import dns.zone, dns.rdatatype
72
73 __docformat__ = 'restructuredText'
74
75
76 def find_bind_gid():
77     """Find system group id for bind9
78     """
79     for name in ["bind", "named"]:
80         try:
81             return grp.getgrnam(name)[2]
82         except KeyError:
83             pass
84     return None
85
86
87 def convert_dns_rdata(rdata, serial=1):
88     """Convert resource records in dnsRecord format
89     """
90     if rdata.rdtype == dns.rdatatype.A:
91         rec = ARecord(rdata.address, serial=serial)
92     elif rdata.rdtype == dns.rdatatype.AAAA:
93         rec = AAAARecord(rdata.address, serial=serial)
94     elif rdata.rdtype == dns.rdatatype.CNAME:
95         rec = CNameRecord(rdata.target.to_text(), serial=serial)
96     elif rdata.rdtype == dns.rdatatype.NS:
97         rec = NSRecord(rdata.target.to_text(), serial=serial)
98     elif rdata.rdtype == dns.rdatatype.SRV:
99         rec = SRVRecord(rdata.target.to_text(), int(rdata.port),
100                         priority=int(rdata.priority), weight=int(rdata.weight),
101                         serial=serial)
102     elif rdata.rdtype == dns.rdatatype.TXT:
103         slist = shlex.split(rdata.to_text())
104         rec = TXTRecord(slist, serial=serial)
105     elif rdata.rdtype == dns.rdatatype.SOA:
106         rec = SOARecord(rdata.mname.to_text(), rdata.rname.to_text(),
107                         serial=int(rdata.serial),
108                         refresh=int(rdata.refresh), retry=int(rdata.retry),
109                         expire=int(rdata.expire), minimum=int(rdata.minimum))
110     else:
111         rec = None
112     return rec
113
114
115 def import_zone_data(samdb, logger, zone, serial, domaindn, forestdn,
116                      dnsdomain, dnsforest):
117     """Insert zone data in DNS partitions
118     """
119     labels = dnsdomain.split('.')
120     labels.append('')
121     domain_root = dns.name.Name(labels)
122     domain_prefix = "DC=%s,CN=MicrosoftDNS,DC=DomainDnsZones,%s" % (dnsdomain,
123                                                                     domaindn)
124
125     tmp = "_msdcs.%s" % dnsforest
126     labels = tmp.split('.')
127     labels.append('')
128     forest_root = dns.name.Name(labels)
129     dnsmsdcs = "_msdcs.%s" % dnsforest
130     forest_prefix = "DC=%s,CN=MicrosoftDNS,DC=ForestDnsZones,%s" % (dnsmsdcs,
131                                                                     forestdn)
132
133     # Extract @ record
134     at_record = zone.get_node(domain_root)
135     zone.delete_node(domain_root)
136
137     # SOA record
138     rdset = at_record.get_rdataset(dns.rdataclass.IN, dns.rdatatype.SOA)
139     soa_rec = ndr_pack(convert_dns_rdata(rdset[0]))
140     at_record.delete_rdataset(dns.rdataclass.IN, dns.rdatatype.SOA)
141
142     # NS record
143     rdset = at_record.get_rdataset(dns.rdataclass.IN, dns.rdatatype.NS)
144     ns_rec = ndr_pack(convert_dns_rdata(rdset[0]))
145     at_record.delete_rdataset(dns.rdataclass.IN, dns.rdatatype.NS)
146
147     # A/AAAA records
148     ip_recs = []
149     for rdset in at_record:
150         for r in rdset:
151             rec = convert_dns_rdata(r)
152             ip_recs.append(ndr_pack(rec))
153
154     # Add @ record for domain
155     dns_rec = [soa_rec, ns_rec] + ip_recs
156     msg = ldb.Message(ldb.Dn(samdb, 'DC=@,%s' % domain_prefix))
157     msg["objectClass"] = ["top", "dnsNode"]
158     msg["dnsRecord"] = ldb.MessageElement(dns_rec, ldb.FLAG_MOD_ADD,
159                                           "dnsRecord")
160     try:
161         samdb.add(msg)
162     except Exception:
163         logger.error("Failed to add @ record for domain")
164         raise
165     logger.debug("Added @ record for domain")
166
167     # Add @ record for forest
168     dns_rec = [soa_rec, ns_rec]
169     msg = ldb.Message(ldb.Dn(samdb, 'DC=@,%s' % forest_prefix))
170     msg["objectClass"] = ["top", "dnsNode"]
171     msg["dnsRecord"] = ldb.MessageElement(dns_rec, ldb.FLAG_MOD_ADD,
172                                           "dnsRecord")
173     try:
174         samdb.add(msg)
175     except Exception:
176         logger.error("Failed to add @ record for forest")
177         raise
178     logger.debug("Added @ record for forest")
179
180     # Add remaining records in domain and forest
181     for node in zone.nodes:
182         name = node.relativize(forest_root).to_text()
183         if name == node.to_text():
184             name = node.relativize(domain_root).to_text()
185             dn = "DC=%s,%s" % (name, domain_prefix)
186             fqdn = "%s.%s" % (name, dnsdomain)
187         else:
188             dn = "DC=%s,%s" % (name, forest_prefix)
189             fqdn = "%s.%s" % (name, dnsmsdcs)
190
191         dns_rec = []
192         for rdataset in zone.nodes[node]:
193             for rdata in rdataset:
194                 rec = convert_dns_rdata(rdata, serial)
195                 if not rec:
196                     logger.warn("Unsupported record type (%s) for %s, ignoring" %
197                                 dns.rdatatype.to_text(rdata.rdatatype), name)
198                 else:
199                     dns_rec.append(ndr_pack(rec))
200
201         msg = ldb.Message(ldb.Dn(samdb, dn))
202         msg["objectClass"] = ["top", "dnsNode"]
203         msg["dnsRecord"] = ldb.MessageElement(dns_rec, ldb.FLAG_MOD_ADD,
204                                               "dnsRecord")
205         try:
206             samdb.add(msg)
207         except Exception:
208             logger.error("Failed to add DNS record %s" % (fqdn))
209             raise
210         logger.debug("Added DNS record %s" % (fqdn))
211
212 def cleanup_remove_file(file_path):
213     try:
214         os.remove(file_path)
215     except OSError as e:
216         if e.errno not in [errno.EEXIST, errno.ENOENT]:
217             pass
218         else:
219             logger.debug("Could not remove %s: %s" % (file_path, e.strerror))
220
221 def cleanup_remove_dir(dir_path):
222     try:
223         for root, dirs, files in os.walk(dir_path, topdown=False):
224             for name in files:
225                 os.remove(os.path.join(root, name))
226             for name in dirs:
227                 os.rmdir(os.path.join(root, name))
228         os.rmdir(dir_path)
229     except OSError as e:
230         if e.errno not in [errno.EEXIST, errno.ENOENT]:
231             pass
232         else:
233             logger.debug("Could not delete dir %s: %s" % (dir_path, e.strerror))
234
235 def cleanup_obsolete_dns_files(paths):
236     cleanup_remove_file(os.path.join(paths.private_dir, "named.conf"))
237     cleanup_remove_file(os.path.join(paths.private_dir, "named.conf.update"))
238     cleanup_remove_file(os.path.join(paths.private_dir, "named.txt"))
239
240     cleanup_remove_dir(os.path.join(paths.private_dir, "dns"))
241
242
243 # dnsprovision creates application partitions for AD based DNS mainly if the existing
244 # provision was created using earlier snapshots of samba4 which did not have support
245 # for DNS partitions
246
247 if __name__ == '__main__':
248
249     # Setup command line parser
250     parser = optparse.OptionParser("upgradedns [options]")
251     sambaopts = options.SambaOptions(parser)
252     credopts = options.CredentialsOptions(parser)
253
254     parser.add_option_group(options.VersionOptions(parser))
255     parser.add_option_group(sambaopts)
256     parser.add_option_group(credopts)
257
258     parser.add_option("--dns-backend", type="choice", metavar="<BIND9_DLZ|SAMBA_INTERNAL>",
259                       choices=["SAMBA_INTERNAL", "BIND9_DLZ"], default="SAMBA_INTERNAL",
260                       help="The DNS server backend, default SAMBA_INTERNAL")
261     parser.add_option("--migrate", type="choice", metavar="<yes|no>",
262                       choices=["yes","no"], default="yes",
263                       help="Migrate existing zone data, default yes")
264     parser.add_option("--verbose", help="Be verbose", action="store_true")
265
266     opts = parser.parse_args()[0]
267
268     if opts.dns_backend is None:
269         opts.dns_backend = 'SAMBA_INTERNAL'
270
271     if opts.migrate:
272         autofill = False
273     else:
274         autofill = True
275
276     # Set up logger
277     logger = logging.getLogger("upgradedns")
278     logger.addHandler(logging.StreamHandler(sys.stdout))
279     logger.setLevel(logging.INFO)
280     if opts.verbose:
281         logger.setLevel(logging.DEBUG)
282
283     lp = sambaopts.get_loadparm()
284     lp.load(lp.configfile)
285     creds = credopts.get_credentials(lp)
286
287     logger.info("Reading domain information")
288     paths = get_paths(param, smbconf=lp.configfile)
289     paths.bind_gid = find_bind_gid()
290     ldbs = get_ldbs(paths, creds, system_session(), lp)
291     names = find_provision_key_parameters(ldbs.sam, ldbs.secrets, ldbs.idmap,
292                                            paths, lp.configfile, lp)
293
294     if names.domainlevel < DS_DOMAIN_FUNCTION_2003:
295         logger.error("Cannot create AD based DNS for OS level < 2003")
296         sys.exit(1)
297
298     domaindn = names.domaindn
299     forestdn = names.rootdn
300
301     dnsdomain = names.dnsdomain.lower()
302     dnsforest = dnsdomain
303
304     site = names.sitename
305     hostname = names.hostname
306     dnsname = '%s.%s' % (hostname, dnsdomain)
307
308     domainsid = names.domainsid
309     domainguid = names.domainguid
310     ntdsguid = names.ntdsguid
311
312     # Check for DNS accounts and create them if required
313     try:
314         msg = ldbs.sam.search(base=domaindn, scope=ldb.SCOPE_DEFAULT,
315                               expression='(sAMAccountName=DnsAdmins)',
316                               attrs=['objectSid'])
317         dnsadmins_sid = ndr_unpack(security.dom_sid, msg[0]['objectSid'][0])
318     except IndexError:
319         logger.info("Adding DNS accounts")
320         add_dns_accounts(ldbs.sam, domaindn)
321         dnsadmins_sid = get_dnsadmins_sid(ldbs.sam, domaindn)
322     else:
323         logger.info("DNS accounts already exist")
324
325     # Import dns records from zone file
326     if os.path.exists(paths.dns):
327         logger.info("Reading records from zone file %s" % paths.dns)
328         try:
329             zone = dns.zone.from_file(paths.dns, relativize=False)
330             rrset = zone.get_rdataset("%s." % dnsdomain, dns.rdatatype.SOA)
331             serial = int(rrset[0].serial)
332         except Exception as e:
333             logger.warn("Error parsing DNS data from '%s' (%s)" % (paths.dns, str(e)))
334             logger.warn("DNS records will be automatically created")
335             autofill = True
336     else:
337         logger.info("No zone file %s" % paths.dns)
338         logger.warn("DNS records will be automatically created")
339         autofill = True
340
341     # Create DNS partitions if missing and fill DNS information
342     try:
343         expression = '(|(dnsRoot=DomainDnsZones.%s)(dnsRoot=ForestDnsZones.%s))' % \
344                      (dnsdomain, dnsforest)
345         msg = ldbs.sam.search(base=names.configdn, scope=ldb.SCOPE_DEFAULT,
346                               expression=expression, attrs=['nCName'])
347         ncname = msg[0]['nCName'][0]
348     except IndexError:
349         logger.info("Creating DNS partitions")
350
351         logger.info("Looking up IPv4 addresses")
352         hostip = interface_ips_v4(lp)
353         try:
354             hostip.remove('127.0.0.1')
355         except ValueError:
356             pass
357         if not hostip:
358             logger.error("No IPv4 addresses found")
359             sys.exit(1)
360         else:
361             hostip = hostip[0]
362             logger.debug("IPv4 addresses: %s" % hostip)
363
364         logger.info("Looking up IPv6 addresses")
365         hostip6 = interface_ips_v6(lp)
366         if not hostip6:
367             hostip6 = None
368         else:
369             hostip6 = hostip6[0]
370         logger.debug("IPv6 addresses: %s" % hostip6)
371
372         create_dns_partitions(ldbs.sam, domainsid, names, domaindn, forestdn,
373                               dnsadmins_sid, FILL_FULL)
374
375         logger.info("Populating DNS partitions")
376         fill_dns_data_partitions(ldbs.sam, domainsid, site, domaindn, forestdn,
377                              dnsdomain, dnsforest, hostname, hostip, hostip6,
378                              domainguid, ntdsguid, dnsadmins_sid,
379                              autofill=autofill)
380
381         if not autofill:
382             logger.info("Importing records from zone file")
383             import_zone_data(ldbs.sam, logger, zone, serial, domaindn, forestdn,
384                              dnsdomain, dnsforest)
385     else:
386         logger.info("DNS partitions already exist")
387
388     # Mark that we are hosting DNS partitions
389     try:
390         dns_nclist = [ 'DC=DomainDnsZones,%s' % domaindn,
391                        'DC=ForestDnsZones,%s' % forestdn ]
392
393         msgs = ldbs.sam.search(base=names.serverdn, scope=ldb.SCOPE_DEFAULT,
394                                expression='(objectclass=nTDSDSa)',
395                                attrs=['hasPartialReplicaNCs',
396                                       'msDS-hasMasterNCs'])
397         msg = msgs[0]
398
399         master_nclist = []
400         ncs = msg.get("msDS-hasMasterNCs")
401         if ncs:
402             for nc in ncs:
403                 master_nclist.append(str(nc))
404
405         partial_nclist = []
406         ncs = msg.get("hasPartialReplicaNCs")
407         if ncs:
408             for nc in ncs:
409                 partial_nclist.append(str(nc))
410
411         modified_master = False
412         modified_partial = False
413
414         for nc in dns_nclist:
415             if nc not in master_nclist:
416                 master_nclist.append(nc)
417                 modified_master = True
418             if nc in partial_nclist:
419                 partial_nclist.remove(nc)
420                 modified_partial = True
421
422         if modified_master or modified_partial:
423             logger.debug("Updating msDS-hasMasterNCs and hasPartialReplicaNCs attributes")
424             m = ldb.Message()
425             m.dn = msg.dn
426             if modified_master:
427                 m["msDS-hasMasterNCs"] = ldb.MessageElement(master_nclist,
428                                                             ldb.FLAG_MOD_REPLACE,
429                                                             "msDS-hasMasterNCs")
430             if modified_partial:
431                 if partial_nclist:
432                     m["hasPartialReplicaNCs"] = ldb.MessageElement(partial_nclist,
433                                                                    ldb.FLAG_MOD_REPLACE,
434                                                                    "hasPartialReplicaNCs")
435                 else:
436                     m["hasPartialReplicaNCs"] = ldb.MessageElement(ncs,
437                                                                    ldb.FLAG_MOD_DELETE,
438                                                                    "hasPartialReplicaNCs")
439             ldbs.sam.modify(m)
440     except Exception:
441         raise
442
443     # Special stuff for DLZ backend
444     if opts.dns_backend == "BIND9_DLZ":
445         config_migration = False
446
447         if (paths.private_dir != paths.binddns_dir and
448             os.path.isfile(os.path.join(paths.private_dir, "named.conf"))):
449             config_migration = True
450
451         # Check if dns-HOSTNAME account exists and create it if required
452         secrets_msgs = ldbs.secrets.search(expression='(samAccountName=dns-%s)' % hostname, attrs=['secret'])
453         msg = ldbs.sam.search(base=domaindn, scope=ldb.SCOPE_DEFAULT,
454                               expression='(sAMAccountName=dns-%s)' % (hostname),
455                               attrs=[])
456
457         if len(secrets_msgs) == 0 or len(msg) == 0:
458             logger.info("Adding dns-%s account" % hostname)
459
460             if len(secrets_msgs) == 1:
461                 dn = secrets_msgs[0].dn
462                 ldbs.secrets.delete(dn)
463
464             if len(msg) == 1:
465                 dn = msg[0].dn
466                 ldbs.sam.delete(dn)
467
468             dnspass = samba.generate_random_password(128, 255)
469             setup_add_ldif(ldbs.sam, setup_path("provision_dns_add_samba.ldif"), {
470                     "DNSDOMAIN": dnsdomain,
471                     "DOMAINDN": domaindn,
472                     "DNSPASS_B64": b64encode(dnspass.encode('utf-16-le')).decode('utf8'),
473                     "HOSTNAME" : hostname,
474                     "DNSNAME" : dnsname }
475                            )
476
477             res = ldbs.sam.search(base=domaindn, scope=ldb.SCOPE_DEFAULT,
478                                   expression='(sAMAccountName=dns-%s)' % (hostname),
479                                   attrs=["msDS-KeyVersionNumber"])
480             if "msDS-KeyVersionNumber" in res[0]:
481                 dns_key_version_number = int(res[0]["msDS-KeyVersionNumber"][0])
482             else:
483                 dns_key_version_number = None
484
485             secretsdb_setup_dns(ldbs.secrets, names,
486                                 paths.private_dir, paths.binddns_dir, realm=names.realm,
487                                 dnsdomain=names.dnsdomain,
488                                 dns_keytab_path=paths.dns_keytab, dnspass=dnspass,
489                                 key_version_number=dns_key_version_number)
490
491         else:
492             logger.info("dns-%s account already exists" % hostname)
493
494         private_dns_keytab_path = os.path.join(paths.private_dir, paths.dns_keytab)
495         bind_dns_keytab_path = os.path.join(paths.binddns_dir, paths.dns_keytab)
496
497         if os.path.isfile(private_dns_keytab_path):
498             if os.path.isfile(bind_dns_keytab_path):
499                 try:
500                     os.unlink(bind_dns_keytab_path)
501                 except OSError as e:
502                     logger.error("Failed to remove %s: %s" %
503                                  (bind_dns_keytab_path, e.strerror))
504
505             # link the dns.keytab to the bind-dns directory
506             try:
507                 os.link(private_dns_keytab_path, bind_dns_keytab_path)
508             except OSError as e:
509                 logger.error("Failed to create link %s -> %s: %s" %
510                              (private_dns_keytab_path, bind_dns_keytab_path, e.strerror))
511
512             # chown the dns.keytab in the bind-dns directory
513             if paths.bind_gid is not None:
514                 try:
515                     os.chmod(paths.binddns_dir, 0o770)
516                     os.chown(paths.binddns_dir, -1, paths.bind_gid)
517                 except OSError:
518                     if 'SAMBA_SELFTEST' not in os.environ:
519                         logger.info("Failed to chown %s to bind gid %u",
520                                     paths.binddns_dir, paths.bind_gid)
521                 try:
522                     os.chmod(bind_dns_keytab_path, 0o640)
523                     os.chown(bind_dns_keytab_path, -1, paths.bind_gid)
524                 except OSError:
525                     if 'SAMBA_SELFTEST' not in os.environ:
526                         logger.info("Failed to chown %s to bind gid %u",
527                                     bind_dns_keytab_path, paths.bind_gid)
528
529
530         # This forces a re-creation of dns directory and all the files within
531         # It's an overkill, but it's easier to re-create a samdb copy, rather
532         # than trying to fix a broken copy.
533         create_dns_dir(logger, paths)
534
535         # Setup a copy of SAM for BIND9
536         create_samdb_copy(ldbs.sam, logger, paths, names, domainsid,
537                           domainguid)
538
539         create_named_conf(paths, names.realm, dnsdomain, opts.dns_backend, logger)
540
541         create_named_txt(paths.namedtxt, names.realm, dnsdomain, dnsname,
542                          paths.binddns_dir, paths.dns_keytab)
543
544         cleanup_obsolete_dns_files(paths)
545
546         if config_migration:
547             logger.info("ATTENTION: The BIND configuration and keytab has been moved to: %s",
548                         paths.binddns_dir)
549             logger.info("           Please update your BIND configuration accordingly.")
550         else:
551             logger.info("See %s for an example configuration include file for BIND", paths.namedconf)
552             logger.info("and %s for further documentation required for secure DNS "
553                         "updates", paths.namedtxt)
554
555     elif opts.dns_backend == "SAMBA_INTERNAL":
556         # Make sure to remove everything from the bind-dns directory to avoid
557         # possible security issues with the named group having write access
558         # to all AD partions
559         cleanup_remove_file(os.path.join(paths.binddns_dir, "dns.keytab"))
560         cleanup_remove_file(os.path.join(paths.binddns_dir, "named.conf"))
561         cleanup_remove_file(os.path.join(paths.binddns_dir, "named.conf.update"))
562         cleanup_remove_file(os.path.join(paths.binddns_dir, "named.txt"))
563
564         cleanup_remove_dir(os.path.dirname(paths.dns))
565
566         try:
567             os.chmod(paths.private_dir, 0o700)
568             os.chown(paths.private_dir, -1, 0)
569         except:
570             logger.warn("Failed to restore owner and permissions for %s",
571                         (paths.private_dir))
572
573         # Check if dns-HOSTNAME account exists and delete it if required
574         try:
575             dn_str = 'samAccountName=dns-%s,CN=Principals' % hostname
576             msg = ldbs.secrets.search(expression='(dn=%s)' % dn_str, attrs=[])
577             dn = msg[0].dn
578         except IndexError:
579             dn = None
580
581         if dn is not None:
582             try:
583                 ldbs.secrets.delete(dn)
584             except Exception:
585                 logger.info("Failed to delete %s from secrets.ldb" % dn)
586
587         try:
588             msg = ldbs.sam.search(base=domaindn, scope=ldb.SCOPE_DEFAULT,
589                                   expression='(sAMAccountName=dns-%s)' % (hostname),
590                                   attrs=[])
591             dn = msg[0].dn
592         except IndexError:
593             dn = None
594
595         if dn is not None:
596             try:
597                 ldbs.sam.delete(dn)
598             except Exception:
599                 logger.info("Failed to delete %s from sam.ldb" % dn)
600
601     logger.info("Finished upgrading DNS")
602
603     services = lp.get("server services")
604     for service in services:
605         if service == "dns":
606             if opts.dns_backend.startswith("BIND"):
607                 logger.info("You have switched to using %s as your dns backend,"
608                         " but still have the internal dns starting. Please"
609                         " make sure you add '-dns' to your server services"
610                         " line in your smb.conf." % opts.dns_backend)
611             break
612     else:
613         if opts.dns_backend == "SAMBA_INTERNAL":
614             logger.info("You have switched to using %s as your dns backend,"
615                     " but you still have samba starting looking for a"
616                     " BIND backend. Please remove the -dns from your"
617                     " server services line." % opts.dns_backend)