s3:dbwrap_tool: add --persistent switch and mode for non-persistent DBs
[Samba/gebeck_regimport.git] / docs-xml / Samba3-HOWTO / TOSHARG-BDC.xml
blob9b6936861430e488af00dec98171e85bed0deab6
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="samba-bdc">
5 <chapterinfo>
6         &author.jht;
7         &author.vl;
8         <author>&person.gd;<contrib>LDAP updates</contrib></author>
9 </chapterinfo>
11 <title>Backup Domain Control</title>
13 <para>
14 Before you continue reading this section, please make sure that you are comfortable
15 with configuring a Samba domain controller as described in <link linkend="samba-pdc">Domain Control</link>.
16 </para>
18 <sect1>
19 <title>Features and Benefits</title>
21 <para>
22 This is one of the most difficult chapters to summarize. It does not matter what we say here, for someone will
23 still draw conclusions and/or approach the Samba Team with expectations that are either not yet capable of
24 being delivered or that can be achieved far more effectively using a totally different approach. In the event
25 that you should have a persistent concern that is not addressed in this book, please email <ulink
26 url="mailto:jht@samba.org">John H. Terpstra</ulink> clearly setting out your requirements and/or question, and
27 we will do our best to provide a solution.
28 </para>
30 <para>
31 <indexterm><primary>SAM backend</primary><secondary>LDAP</secondary></indexterm>
32 <indexterm><primary>PDC</primary></indexterm>
33 <indexterm><primary>BDC</primary></indexterm>
34 <indexterm><primary>LDAP</primary><secondary>slave</secondary></indexterm>
35 <indexterm><primary>scalability</primary></indexterm>
36 Samba-3 can act as a Backup Domain Controller (BDC) to another Samba Primary Domain Controller (PDC). A
37 Samba-3 PDC can operate with an LDAP account backend. The LDAP backend can be either a common master LDAP
38 server or a slave server. The use of a slave LDAP server has the benefit that when the master is down, clients
39 may still be able to log onto the network.  This effectively gives Samba a high degree of scalability and is
40 an effective solution for large organizations. If you use an LDAP slave server for a PDC, you will need to
41 ensure the master's continued availability &smbmdash; if the slave finds its master down at the wrong time,
42 you will have stability and operational problems.
43 </para>
45 <para>
46 <indexterm><primary>two-way</primary><secondary>propagation</secondary></indexterm>
47 <indexterm><primary>replication</primary><secondary>SAM</secondary></indexterm>
48 <indexterm><primary>non-LDAP</primary><secondary>backend</secondary></indexterm>
49 <indexterm><primary>propagate</primary></indexterm>
50 It is not possible to run a Samba-3 BDC with a non-LDAP backend, as that backend must allow some form of
51 "two-way" propagation of changes from the BDC to the master.  At this time only LDAP delivers the capability
52 to propagate identity database changes from the BDC to the PDC. The BDC can use a slave LDAP server, while it
53 is preferable for the PDC to use as its primary an LDAP master server.
54 </para>
56 </sect1>
58 <sect1>
59 <title>Essential Background Information</title>
61 <para>
62 <indexterm><primary>domain controller</primary></indexterm>
63 <indexterm><primary>logon requests</primary></indexterm>
64 <indexterm><primary>LanMan</primary></indexterm>
65 <indexterm><primary>Netlogon</primary></indexterm>
66 A domain controller is a machine that is able to answer logon requests from network
67 workstations. Microsoft LanManager and IBM LanServer were two early products that
68 provided this capability. The technology has become known as the LanMan Netlogon service.
69 </para>
71 <para>
72 <indexterm><primary>network</primary><secondary>logon</secondary><tertiary>service</tertiary></indexterm>
73 <indexterm><primary>Windows NT3.10</primary></indexterm>
74 When MS Windows NT3.10 was first released, it supported a new style of Domain Control
75 and with it a new form of the network logon service that has extended functionality.
76 This service became known as the NT NetLogon Service. The nature of this service has
77 changed with the evolution of MS Windows NT and today provides a complex array of
78 services that are implemented over an intricate spectrum of technologies.
79 </para>
81 <sect2>
82 <title>MS Windows NT4-style Domain Control</title>
84 <para>
85 <indexterm><primary>domain controller</primary></indexterm>
86 <indexterm><primary>authentication server</primary></indexterm>
87 <indexterm><primary>username</primary></indexterm>
88 <indexterm><primary>password</primary></indexterm>
89 <indexterm><primary>SAM</primary></indexterm>
90 <indexterm><primary>Security Account Manager</primary><see>SAM</see></indexterm>
91 <indexterm><primary>domain control database</primary><see>SAM</see></indexterm>
92 Whenever a user logs into a Windows NT4/200x/XP Professional workstation,
93 the workstation connects to a domain controller (authentication server) to validate that
94 the username and password the user entered are valid. If the information entered
95 does not match account information that has been stored in the domain
96 control database (the SAM, or Security Account Manager database), a set of error
97 codes is returned to the workstation that has made the authentication request.
98 </para>
100 <para>
101 <indexterm><primary>account information</primary></indexterm>
102 <indexterm><primary>machine accounts database</primary></indexterm>
103 <indexterm><primary>profile</primary></indexterm>
104 <indexterm><primary>network access profile</primary></indexterm>
105 <indexterm><primary>desktop profile</primary></indexterm>
106 When the username/password pair has been validated, the domain controller
107 (authentication server) will respond with full enumeration of the account information
108 that has been stored regarding that user in the user and machine accounts database
109 for that domain. This information contains a complete network access profile for
110 the user but excludes any information that is particular to the user's desktop profile,
111 or for that matter it excludes all desktop profiles for groups that the user may
112 belong to. It does include password time limits, password uniqueness controls,
113 network access time limits, account validity information, machine names from which the
114 user may access the network, and much more. All this information was stored in the SAM
115 in all versions of MS Windows NT (3.10, 3.50, 3.51, 4.0).
116 </para>
118 <para>
119 <indexterm><primary>replication</primary><secondary>SAM</secondary></indexterm>
120 <indexterm><primary>%SystemRoot%\System32\config</primary></indexterm>
121 <indexterm><primary>C:\WinNT\System32\config</primary></indexterm>
122 <indexterm><primary>BDC</primary></indexterm>
123 <indexterm><primary>SAM</primary></indexterm>
124 The account information (user and machine) on domain controllers is stored in two files,
125 one containing the security information and the other the SAM. These are stored in files
126 by the same name in the <filename>%SystemRoot%\System32\config</filename> directory. 
127 This normally translates to the path <filename>C:\WinNT\System32\config</filename>. These
128 are the files that are involved in replication of the SAM database where BDCs are present
129 on the network.
130 </para>
132 <para>
133 There are two situations in which it is desirable to install BDCs:
134 </para>
136 <itemizedlist>
137         <listitem><para>
138         <indexterm><primary>PDC</primary></indexterm>
139         <indexterm><primary>BDC</primary></indexterm>
140         On the local network that the PDC is on, if there are many
141         workstations and/or where the PDC is generally very busy. In this case the BDCs
142         will pick up network logon requests and help to add robustness to network services.
143         </para></listitem>
145         <listitem><para>
146         <indexterm><primary>network</primary><secondary>wide-area</secondary></indexterm>
147         At each remote site, to reduce wide-area network traffic and to add stability to
148         remote network operations. The design of the network, and the strategic placement of
149         BDCs, together with an implementation that localizes as much of network to client
150         interchange as possible, will help to minimize wide-area network bandwidth needs
151         (and thus costs).
152         </para></listitem>
153 </itemizedlist>
155 <para>
156 <indexterm><primary>PDC</primary></indexterm>
157 <indexterm><primary>SAM</primary></indexterm>
158 <indexterm><primary>user account database</primary></indexterm>
159 <indexterm><primary>BDC</primary></indexterm>
160 <indexterm><primary>trigger</primary></indexterm>
161 The interoperation of a PDC and its BDCs in a true Windows NT4 environment is worth
162 mentioning here. The PDC contains the master copy of the SAM. In the event that an
163 administrator makes a change to the user account database while physically present
164 on the local network that has the PDC, the change will likely be made directly to
165 the PDC instance of the master copy of the SAM. In the event that this update may
166 be performed in a branch office, the change will likely be stored in a delta file
167 on the local BDC. The BDC will then send a trigger to the PDC to commence the process
168 of SAM synchronization. The PDC will then request the delta from the BDC and apply
169 it to the master SAM. The PDC will then contact all the BDCs in the domain and
170 trigger them to obtain the update and then apply that to their own copy of the SAM.
171 </para>
173 <para>
174 <indexterm><primary>SAM</primary><secondary>replication</secondary></indexterm>
175 <indexterm><primary>SAM</primary><secondary>delta file</secondary></indexterm>
176 <indexterm><primary>PDC</primary></indexterm>
177 <indexterm><primary>BDC</primary></indexterm>
178 Samba-3 cannot participate in true SAM replication and is therefore not able to
179 employ precisely the same protocols used by MS Windows NT4. A Samba-3 BDC will
180 not create SAM update delta files. It will not interoperate with a PDC (NT4 or Samba)
181 to synchronize the SAM from delta files that are held by BDCs.
182 </para>
184 <para>
185 <indexterm><primary>PDC</primary></indexterm>
186 <indexterm><primary>BDC</primary></indexterm>
187 Samba-3 cannot function as a BDC to an MS Windows NT4 PDC, and Samba-3 cannot
188 function correctly as a PDC to an MS Windows NT4 BDC. Both Samba-3 and MS Windows
189 NT4 can function as a BDC to its own type of PDC.
190 </para>
192 <para>
193 <indexterm><primary>SAM</primary></indexterm>
194 <indexterm><primary>BDC</primary></indexterm>
195 <indexterm><primary>domain security</primary></indexterm>
196 The BDC is said to hold a <emphasis>read-only</emphasis> of the SAM from which
197 it is able to process network logon requests and authenticate users. The BDC can
198 continue to provide this service, particularly while, for example, the wide-area
199 network link to the PDC is down. A BDC plays a very important role in both the
200 maintenance of domain security as well as in network integrity.
201 </para>
203 <para>
204 <indexterm><primary>PDC</primary></indexterm>
205 <indexterm><primary>promoted</primary></indexterm>
206 <indexterm><primary>demoted</primary></indexterm>
207 <indexterm><primary>reconfiguration</primary></indexterm>
208 In the event that the NT4 PDC should need to be taken out of service, or if it dies, one of the NT4 BDCs can
209 be promoted to a PDC. If this happens while the original NT4 PDC is online, it is automatically demoted to an
210 NT4 BDC. This is an important aspect of domain controller management. The tool that is used to effect a
211 promotion or a demotion is the Server Manager for Domains. It should be noted that Samba-3 BDCs cannot be
212 promoted in this manner because reconfiguration of Samba requires changes to the &smb.conf; file. It is easy
213 enough to manuall change the &smb.conf; file and then restart relevant Samba network services.
214 </para>
216 <sect3>
217 <title>Example PDC Configuration</title>
219 <para>
220 <indexterm><primary>domain logon</primary></indexterm>
221 <indexterm><primary>PDC</primary></indexterm>
222 Beginning with Version 2.2, Samba officially supports domain logons for all current Windows clients, including
223 Windows NT4, 2003, and XP Professional. For Samba to be enabled as a PDC, some parameters in the
224 <smbconfsection name="[global]"/> section of the &smb.conf; have to be set.  Refer to <link
225 linkend="minimalPDC">the Minimal smb.conf for a PDC in Use with a BDC &smbmdash; LDAP Server on PDC
226 section</link> for an example of the minimum required settings.
227 </para>
229 <example id="minimalPDC">
230 <title>Minimal smb.conf for a PDC in Use with a BDC &smbmdash; LDAP Server on PDC</title>
231 <smbconfblock>
232 <smbconfoption name="workgroup">&example.workgroup;</smbconfoption>
233 <smbconfoption name="passdb backend">ldapsam://localhost:389</smbconfoption>
234 <smbconfoption name="domain master">yes</smbconfoption>
235 <smbconfoption name="domain logons">yes</smbconfoption>
236 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
237 <smbconfoption name="ldap user suffix">ou=Users</smbconfoption>
238 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
239 <smbconfoption name="ldap machine suffix">ou=Computers</smbconfoption>
240 <smbconfoption name="ldap idmap suffix">ou=Idmap</smbconfoption>
241 <smbconfoption name="ldap admin dn">cn=sambadmin,dc=quenya,dc=org</smbconfoption>
242 </smbconfblock>
243 </example>
245 <para>
246 <indexterm><primary>profile path</primary></indexterm>
247 <indexterm><primary>home drive</primary></indexterm>
248 Several other things like a <smbconfsection name="[homes]"/> and a <smbconfsection name="[netlogon]"/> share
249 also need to be set along with settings for the profile path, the user's home drive, and so on. This is not
250 covered in this chapter; for more information please refer to <link linkend="samba-pdc">Domain Control</link>.
251 Refer to <link linkend="samba-pdc">the Domain Control chapter</link> for specific recommendations for PDC
252 configuration. Alternately, fully documented working example network configurations using OpenLDAP and Samba
253 as available in the <ulink url="http://www.samba.org/samba/docs/Samba3-ByExample">book</ulink> <quote>Samba-3
254 by Example</quote> that may be obtained from local and on-line book stores.
255 </para>
257 </sect3>
258 </sect2>
260 <sect2>
261 <title>LDAP Configuration Notes</title>
263 <para>
264 <indexterm><primary>LDAP</primary><secondary>master</secondary></indexterm>
265 <indexterm><primary>LDAP</primary><secondary>slave</secondary></indexterm>
266 <indexterm><primary>BDC</primary></indexterm>
267 When configuring a master and a slave LDAP server, it is advisable to use the master LDAP server
268 for the PDC and slave LDAP servers for the BDCs. It is not essential to use slave LDAP servers; however,
269 many administrators will want to do so in order to provide redundant services. Of course, one or more BDCs
270 may use any slave LDAP server. Then again, it is entirely possible to use a single LDAP server for the
271 entire network.
272 </para>
274 <para>
275 <indexterm><primary>LDAP</primary><secondary>master</secondary></indexterm>
276 <indexterm><primary>LDAP</primary><secondary>server</secondary></indexterm>
277 <indexterm><primary>CN</primary></indexterm>
278 <indexterm><primary>DN</primary></indexterm>
279 <indexterm><primary>RFC2830</primary></indexterm>
280 When configuring a master LDAP server that will have slave LDAP servers, do not forget to configure this in
281 the <filename>/etc/openldap/slapd.conf</filename> file. It must be noted that the DN of a server certificate
282 must use the CN attribute to name the server, and the CN must carry the servers' fully qualified domain name.
283 Additional alias names and wildcards may be present in the subjectAltName certificate extension. More details
284 on server certificate names are in RFC2830.
285 </para>
287 <para>
288 <indexterm><primary>LDAP</primary></indexterm>
289 <indexterm><primary>BDC</primary></indexterm>
290 <indexterm><primary>OpenLDAP</primary></indexterm>
291 <indexterm><primary>transport layer security</primary><see>TLS</see></indexterm>
292 <indexterm><primary>/etc/ssl/certs/slapd.pem</primary></indexterm>
293 <indexterm><primary>slapd.pem</primary></indexterm>
294 <indexterm><primary>Red Hat Linux</primary></indexterm>
295 It does not really fit within the scope of this document, but a working LDAP installation is basic to
296 LDAP-enabled Samba operation. When using an OpenLDAP server with Transport Layer Security (TLS), the machine
297 name in <filename>/etc/ssl/certs/slapd.pem</filename> must be the same as in
298 <filename>/etc/openldap/sldap.conf</filename>. The Red Hat Linux startup script creates the
299 <filename>slapd.pem</filename> file with hostname <quote>localhost.localdomain.</quote> It is impossible to
300 access this LDAP server from a slave LDAP server (i.e., a Samba BDC) unless the certificate is re-created with
301 a correct hostname.
302 </para>
304 <para>
305 <indexterm><primary>PDC</primary></indexterm>
306 <indexterm><primary>OpenLDAP</primary></indexterm>
307 <indexterm><primary>machine account</primary></indexterm>
308 <indexterm><primary>credentials</primary></indexterm>
309 <indexterm><primary>replication</primary></indexterm>
310 <indexterm><primary>duplicate</primary></indexterm>
311 Do not install a Samba PDC so that is uses an LDAP slave server. Joining client machines to the domain
312 will fail in this configuration because the change to the machine account in the LDAP tree must take place on
313 the master LDAP server. This is not replicated rapidly enough to the slave server that the PDC queries. It
314 therefore gives an error message on the client machine about not being able to set up account credentials. The
315 machine account is created on the LDAP server, but the password fields will be empty.  Unfortunately, some
316 sites are unable to avoid such configurations, and these sites should review the <smbconfoption name="ldap
317 replication sleep"/> parameter, intended to slow down Samba sufficiently for the replication to catch up.
318 This is a kludge, and one that the administrator must manually duplicate in any scripts (such as the
319 <smbconfoption name="add machine script"/>) that they use.
320 </para>
322 <para>
323 Possible PDC/BDC plus LDAP configurations include:
324 </para>
326 <itemizedlist>
327         <listitem><para>
328         PDC+BDC -> One Central LDAP Server.
329         </para></listitem>
330         <listitem><para>
331         PDC -> LDAP master server, BDC -> LDAP slave server.
332         </para></listitem>
333         <listitem><para>
334         PDC -> LDAP master, with secondary slave LDAP server.
335         </para><para>
336         BDC -> LDAP master, with secondary slave LDAP server.
337         </para></listitem>
338         <listitem><para>
339         PDC -> LDAP master, with secondary slave LDAP server.
340         </para><para>
341         BDC -> LDAP slave server, with secondary master LDAP server.
342         </para></listitem>
343 </itemizedlist>
345 <para>
346 In order to have a fallback configuration (secondary) LDAP server, you would specify
347 the secondary LDAP server in the &smb.conf; file as shown in <link linkend="mulitldapcfg">the Multiple LDAP
348 Servers in &smb.conf; example</link>.
349 </para>
351 <example id="mulitldapcfg">
352 <title>Multiple LDAP Servers in &smb.conf;</title>
353 <smbconfblock>
354 <smbconfoption name="passdb backend">ldapsam:"ldap://master.quenya.org ldap://slave.quenya.org"</smbconfoption>
355 </smbconfblock>
356 </example>
358 </sect2>
360 <sect2>
361 <title>Active Directory Domain Control</title>
363 <para>
364 <indexterm><primary>MS Windows 2000</primary></indexterm>
365 <indexterm><primary>Active Directory</primary></indexterm>
366 <indexterm><primary>directory</primary></indexterm>
367 <indexterm><primary>replicated</primary></indexterm>
368 <indexterm><primary>BDC</primary></indexterm>
369 <indexterm><primary>domain controller</primary></indexterm>
370 As of the release of MS Windows 2000 and Active Directory, this information is now stored
371 in a directory that can be replicated and for which partial or full administrative control
372 can be delegated. Samba-4.0 is able to be a domain controller within an Active Directory
373 tree, and it can be an Active Directory server.  The details for how
374 this can be done are documented in the <ulink
375 url="https://wiki.samba.org/index.php/Samba4/HOWTO">Samba 4.0 as an
376 AD DC HOWTO</ulink>
378 </para>
380 </sect2>
382 <sect2>
383 <title>What Qualifies a Domain Controller on the Network?</title>
385 <para>
386 <indexterm><primary>DMB</primary></indexterm>
387 <indexterm><primary>PDC</primary></indexterm>
388 <indexterm><primary>WINS</primary></indexterm>
389 <indexterm><primary>NetBIOS</primary></indexterm>
390 Every machine that is a domain controller for the domain MIDEARTH has to register the NetBIOS
391 group name MIDEARTH&lt;1C&gt; with the WINS server and/or by broadcast on the local network.
392 The PDC also registers the unique NetBIOS name MIDEARTH&lt;1B&gt; with the WINS server.
393 The name type &lt;1B&gt; name is normally reserved for the Domain Master Browser (DMB), a role
394 that has nothing to do with anything related to authentication, but the Microsoft domain
395 implementation requires the DMB to be on the same machine as the PDC.
396 </para>
398 <para>
399 <indexterm><primary>broadcast</primary></indexterm>
400 <indexterm><primary>name registration</primary></indexterm>
401 <indexterm><primary>SMB/CIFS</primary></indexterm>
402 Where a WINS server is not used, broadcast name registrations alone must suffice. Refer to
403 <link linkend="NetworkBrowsing">Network Browsing</link>,<link linkend="netdiscuss">Discussion</link>
404 for more information regarding TCP/IP network protocols and how SMB/CIFS names are handled.
405 </para>
407 </sect2>
409 <sect2>
410 <title>How Does a Workstation find its Domain Controller?</title>
412 <para>
413 <indexterm><primary>locate domain controller</primary></indexterm>
414 <indexterm><primary>NetBIOS</primary></indexterm>
415 There are two different mechanisms to locate a domain controller: one method is used when
416 NetBIOS over TCP/IP is enabled and the other when it has been disabled in the TCP/IP
417 network configuration.
418 </para>
420 <para>
421 <indexterm><primary>DNS</primary></indexterm>
422 <indexterm><primary>broadcast messaging</primary></indexterm>
423 Where NetBIOS over TCP/IP is disabled, all name resolution involves the use of DNS, broadcast
424 messaging over UDP, as well as Active Directory communication technologies. In this type of
425 environment all machines require appropriate DNS entries. More information may be found in
426 <link linkend="adsdnstech">DNS and Active Directory</link>.
427 </para>
429 <sect3>
430 <title>NetBIOS Over TCP/IP Enabled</title>
431 <para>
432 <indexterm><primary>Windows NT4/200x/XP</primary></indexterm>
433 <indexterm><primary>domain controller</primary></indexterm>
434 <indexterm><primary>logon requests</primary></indexterm>
435 <indexterm><primary>credentials validation</primary></indexterm>
436 An MS Windows NT4/200x/XP Professional workstation in the domain MIDEARTH that wants a
437 local user to be authenticated has to find the domain controller for MIDEARTH. It does this
438 by doing a NetBIOS name query for the group name MIDEARTH&lt;1C&gt;. It assumes that each
439 of the machines it gets back from the queries is a domain controller and can answer logon
440 requests. To not open security holes, both the workstation and the selected domain controller
441 authenticate each other. After that the workstation sends the user's credentials (name and
442 password) to the local domain controller for validation.
443 </para>
445 </sect3>
447 <sect3>
448 <title>NetBIOS Over TCP/IP Disabled</title>
450 <para>
451 <indexterm><primary>realm</primary></indexterm>
452 <indexterm><primary>logon authentication</primary></indexterm>
453 <indexterm><primary>DNS</primary></indexterm>
454 <indexterm><primary>_ldap._tcp.pdc._msdcs.quenya.org</primary></indexterm>
455 An MS Windows NT4/200x/XP Professional workstation in the realm <constant>quenya.org</constant>
456 that has a need to affect user logon authentication will locate the domain controller by 
457 re-querying DNS servers for the <constant>_ldap._tcp.pdc._msdcs.quenya.org</constant> record.
458 More information regarding this subject may be found in <link linkend="adsdnstech">DNS and Active Directory</link>.
459 </para>
461 </sect3>
462 </sect2>
463 </sect1>
465 <sect1>
466 <title>Backup Domain Controller Configuration</title>
468 <para>
469 <indexterm><primary>BDC</primary></indexterm>
470 The creation of a BDC requires some steps to prepare the Samba server before
471 &smbd; is executed for the first time. These steps are as follows:
472 </para>
474 <itemizedlist>
475         <listitem><para>
476         <indexterm><primary>secrets.tdb</primary></indexterm>
477         <indexterm><primary>smbpasswd</primary></indexterm>
478         <indexterm><primary>LDAP administration password</primary></indexterm>
479         Specification of the <smbconfoption name="ldap admin dn"/> is obligatory.
480         This also requires the LDAP administration password to be set in the <filename>secrets.tdb</filename>
481         using the <command>smbpasswd -w <replaceable>mysecret</replaceable></command>.
482         </para></listitem>
484         <listitem><para>
485         The <smbconfoption name="ldap suffix"/> parameter and the <smbconfoption name="ldap idmap suffix"/>
486         parameter must be specified in the &smb.conf; file.
487         </para></listitem>
489         <listitem><para>
490         <indexterm><primary>replication</primary><secondary>SAM</secondary></indexterm>
491         <indexterm><primary>user database</primary></indexterm>
492         <indexterm><primary>synchronized</primary></indexterm>
493         <indexterm><primary>NIS</primary></indexterm>
494         The UNIX user database has to be synchronized from the PDC to the
495         BDC. This means that both the <filename>/etc/passwd</filename> and
496         <filename>/etc/group</filename> have to be replicated from the PDC
497         to the BDC. This can be done manually whenever changes are made. 
498         Alternately, the PDC is set up as an NIS master server and the BDC as an NIS slave
499         server. To set up the BDC as a mere NIS client would not be enough,
500         as the BDC would not be able to access its user database in case of
501         a PDC failure. NIS is by no means the only method to synchronize
502         passwords. An LDAP solution would also work.
503         </para>
504         </listitem>
506         <listitem><para>
507         <indexterm><primary>password database</primary></indexterm>
508         <indexterm><primary>replicated</primary></indexterm>
509         <indexterm><primary>PDC</primary></indexterm>
510         <indexterm><primary>BDC</primary></indexterm>
511         <indexterm><primary>smbpasswd</primary></indexterm>
512         <indexterm><primary>rsync</primary></indexterm>
513         <indexterm><primary>ssh</primary></indexterm>
514         <indexterm><primary>LDAP</primary></indexterm>
515         The Samba password database must be replicated from the PDC to the BDC.
516         The solution
517         is to set up slave LDAP servers for each BDC and a master LDAP server for the PDC.
518         The use of rsync is inherently flawed by the fact that the data will be replicated
519         at timed intervals. There is no guarantee that the BDC will be operating at all
520         times with correct and current machine and user account information. This means that
521         this method runs the risk of users being inconvenienced by discontinuity of access
522         to network services due to inconsistent security data. It must be born in mind that
523         Windows workstations update (change) the machine trust account password at regular
524         intervals &smbmdash; administrators are not normally aware that this is happening
525         or when it takes place.
526         </para>
528         <para>
529         <indexterm><primary>POSIX</primary></indexterm>
530         <indexterm><primary>LDAP</primary></indexterm>
531         <indexterm><primary>SambaSAMAccount</primary></indexterm>
532         <indexterm><primary>synchronize</primary></indexterm>
533         The use of LDAP for both the POSIX (UNIX user and group) accounts and for the
534         SambaSAMAccount data automatically ensures that all account change information
535         will be written to the shared directory. This eliminates the need for any special
536         action to synchronize account information because LDAP will meet that requirement.
537         </para></listitem>
539         <listitem><para>
540         <indexterm><primary>netlogon share</primary></indexterm>
541         <indexterm><primary>replicate</primary></indexterm>
542         <indexterm><primary>PDC</primary></indexterm>
543         <indexterm><primary>BDC</primary></indexterm>
544         <indexterm><primary>cron</primary></indexterm>
545         <indexterm><primary>rsync</primary></indexterm>
546         The netlogon share has to be replicated from the PDC to the BDC. This can be done manually whenever login
547         scripts are changed, or it can be done automatically using a <command>cron</command> job that will replicate
548         the directory structure in this share using a tool like <command>rsync</command>. The use of
549         <command>rsync</command> for replication of the netlogon data is not critical to network security and is one
550         that can be manually managed given that the administrator will make all changes to the netlogon share as part
551         of a conscious move.
552         </para></listitem>
554 </itemizedlist>
556 <sect2>
557 <title>Example Configuration</title>
559 <para>
560 Finally, the BDC has to be capable of being found by the workstations. This can be done by configuring the
561 Samba &smb.conf; file <smbconfsection name="[global]"/> section as shown in <link linkend="minim-bdc">Minimal
562 Setup for Being a BDC</link>.
563 </para>
565 <example id="minim-bdc">
566 <title>Minimal Setup for Being a BDC</title>
567 <smbconfblock>
568 <smbconfoption name="workgroup">&example.workgroup;</smbconfoption>
569 <smbconfoption name="passdb backend">ldapsam:ldap://slave-ldap.quenya.org</smbconfoption>
570 <smbconfoption name="domain master">no</smbconfoption>
571 <smbconfoption name="domain logons">yes</smbconfoption>
572 <smbconfoption name="ldap suffix">dc=abmas,dc=biz</smbconfoption>
573 <smbconfoption name="ldap user suffix">ou=Users</smbconfoption>
574 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
575 <smbconfoption name="ldap machine suffix">ou=Computers</smbconfoption>
576 <smbconfoption name="ldap idmap suffix">ou=Idmap</smbconfoption>
577 <smbconfoption name="ldap admin dn">cn=sambadmin,dc=quenya,dc=org</smbconfoption>
578 <smbconfoption name="idmap backend">ldap:ldap://master-ldap.quenya.org</smbconfoption>
579 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
580 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
581 </smbconfblock>
582 </example>
584 <para>
585 Fully documented working example network configurations using OpenLDAP and Samba
586 as available in the <ulink url="http://www.samba.org/samba/docs/Samba3-ByExample">book</ulink> <quote>Samba-3
587 by Example</quote> that may be obtained from local and on-line book stores.
588 </para>
590 <para>
591 <indexterm><primary>BDC</primary></indexterm>
592 <indexterm><primary>NetBIOS</primary></indexterm>
593 <indexterm><primary>group</primary></indexterm>
594 <indexterm><primary>PDC</primary></indexterm>
595 This configuration causes the BDC to register only the name MIDEARTH&lt;1C&gt; with the WINS server. This is
596 not a problem, as the name MIDEARTH&lt;1C&gt; is a NetBIOS group name that is meant to be registered by more
597 than one machine. The parameter <smbconfoption name="domain master">no</smbconfoption> forces the BDC not to
598 register MIDEARTH&lt;1B&gt;, which is a unique NetBIOS name that is reserved for the PDC.
599 </para>
601 <para>
602 <indexterm><primary>idmap backend</primary></indexterm>
603 <indexterm><primary>winbindd</primary></indexterm>
604 <indexterm><primary>redirect</primary></indexterm>
605 <indexterm><primary>winbindd</primary></indexterm>
606 <indexterm><primary>LDAP database</primary></indexterm>
607 <indexterm><primary>UID</primary></indexterm>
608 <indexterm><primary>GID</primary></indexterm>
609 <indexterm><primary>SID</primary></indexterm>
610 <indexterm><primary>nss_ldap</primary></indexterm>
611 The <parameter>idmap backend</parameter> will redirect the <command>winbindd</command> utility to use the LDAP
612 database to store all mappings for Windows SIDs to  UIDs and GIDs for UNIX accounts in a repository that is
613 shared. The BDC will however depend on local resolution of UIDs and GIDs via NSS and the
614 <command>nss_ldap</command> utility.
615 </para>
617 <note><para>
618 <indexterm><primary>Server Type</primary><secondary>Domain Member</secondary></indexterm>
619 <indexterm><primary>ID mapping</primary></indexterm>
620 <indexterm><primary>domain member server</primary></indexterm>
621 <indexterm><primary>idmap backend</primary></indexterm>
622 Samba-3 has introduced a new ID mapping facility. One of the features of this facility is that it
623 allows greater flexibility in how user and group IDs are handled in respect to NT domain user and group
624 SIDs. One of the new facilities provides for explicitly ensuring that UNIX/Linux UID and GID values
625 will be consistent on the PDC, all BDCs, and all domain member servers. The parameter that controls this
626 is called <parameter>idmap backend</parameter>. Please refer to the man page for &smb.conf; for more information
627 regarding its behavior.
628 </para></note>
630 <para>
631 <indexterm><primary>BDC</primary></indexterm>
632 <indexterm><primary>winbindd</primary></indexterm>
633 <indexterm><primary>domain member servers</primary></indexterm>
634 The use of the <smbconfoption name="idmap backend">ldap:ldap://master.quenya.org</smbconfoption>
635 option on a BDC only makes sense where ldapsam is used on a PDC. The purpose of an LDAP-based idmap backend is
636 also to allow a domain member (without its own passdb backend) to use winbindd to resolve Windows network users
637 and groups to common UID/GIDs. In other words, this option is generally intended for use on BDCs and on domain
638 member servers.
639 </para>
641 </sect2>
642 </sect1>
644 <sect1>
645 <title>Common Errors</title>
647 <para>
648 <indexterm><primary>domain control</primary></indexterm>
649 Domain control was a new area for Samba, but there are now many examples that we may refer to.
650 Updated information will be published as they become available and may be found in later Samba releases or
651 from the Samba Web <ulink url="http://samba.org">site</ulink>; refer in particular to the
652 <filename>WHATSNEW.txt</filename> in the Samba release tarball. The book, <quote>Samba-3 by Example</quote>
653 documents well tested and proven configuration examples. You can obtain a copy of this
654 <ulink url="http://www.samba.org/samba/docs/Samba3-ByExample.pdf">book</ulink> for the Samba web site.
655 </para>
657 <sect2>
658 <title>Machine Accounts Keep Expiring</title>
660 <para>
661 <indexterm><primary>Machine Trust Accounts</primary></indexterm>
662 <indexterm><primary>passdb</primary></indexterm>
663 <indexterm><primary>SAM</primary></indexterm>
664 <indexterm><primary>Local Machine Trust Account</primary></indexterm>
665 This problem will occur when the passdb (SAM) files are copied  from a central
666 server but the local BDC is acting as a PDC. This results in the application of
667 Local Machine Trust Account password updates to the local SAM. Such updates 
668 are not copied back to the central server. The newer machine account password is then
669 overwritten when the SAM is recopied from the PDC. The result is that the domain member machine
670 on startup will find that its passwords do not match the one now in the database, and
671 since the startup security check will now fail, this machine will not allow logon attempts
672 to proceed and the account expiry error will be reported.
673 </para>
675 <para>
676 The solution is to use a more robust passdb backend, such as the ldapsam backend, setting up
677 a slave LDAP server for each BDC and a master LDAP server for the PDC.
678 </para>
680 </sect2>
682 <sect2>
683 <title>Can Samba Be a Backup Domain Controller to an NT4 PDC?</title>
685 <para>
686 <indexterm><primary>replication</primary><secondary>SAM</secondary></indexterm>
687 <indexterm><primary>SAM</primary></indexterm>
688 No. The native NT4 SAM replication protocols have not yet been fully implemented.
689 </para>
691 <para>
692 <indexterm><primary>BDC</primary></indexterm>
693 <indexterm><primary>PDC</primary></indexterm>
694 <indexterm><primary>logon requests</primary></indexterm>
695 Can I get the benefits of a BDC with Samba?  Yes, but only to a Samba
696 PDC or as a <ulink
697 url="https://wiki.samba.org/index.php/Samba4/HOWTO">Samba 4.0 Active
698 Directory domain controller.</ulink>  The
699 main reason for implementing a BDC is availability. If the PDC is a Samba
700 machine, a second Samba machine can be set up to service logon requests whenever
701 the PDC is down.
702 </para>
704 </sect2>
706 </sect1>
707 </chapter>