Last set of syntax fixes
[Samba/gebeck_regimport.git] / docs / docbook / projdoc / Samba-BDC-HOWTO.xml
blobb1ce4660be68b33c5c088b2944c608e2f1fce88a
1 <chapter id="samba-bdc">
3 <chapterinfo>
4         &author.jht;
5         &author.vl;
6 </chapterinfo>
8 <title>Backup Domain Control</title>
10 <para>
11 Before you continue reading in this section, please make sure that you are comfortable
12 with configuring a Samba Domain Controller as described in <link linkend="samba-pdc"></link>.
13 </para>
15 <sect1>
16 <title>Features And Benefits</title>
18 <para>
19 This is one of the most difficult chapters to summarise. It does not matter what we say here
20 for someone will still draw conclusions and / or approach the Samba-Team with expectations
21 that are either not yet capable of being delivered, or that can be achieved far more
22 effectively using a totally different approach. In the event that you should have a persistent
23 concern that is not addressed in this book then please email
24 <ulink url="mailto:jht@samba.org">John H Terpstra</ulink> clearly setting out your requirements
25 and / or question and we will do our best to provide a solution.
26 </para>
28 <para>
29 Samba-3 is capable of acting as a Backup Domain Controller to another Samba Primary Domain
30 Controller. A Samba-3 PDC can operate with an LDAP Account backend. The LDAP backend can be
31 either a common master LDAP server, or a slave server. The use of a slave LDAP server has the
32 benefit that when the master is down clients may still be able to log onto the network.
33 This effectively gives samba a high degree of scalability iand is a very sweet (nice) solution
34 for large organisations.
35 </para>
37 <para>
38 While it is possible to run a Samba-3 BDC with non-LDAP backend, the administrator will
39 need to figure out precisely what is the best way to replicate (copy / distribute) the
40 user and machine Accounts backend.
41 </para>
43 <para>
44 The use of a non-LDAP backend SAM database is particularly problematic because Domain member
45 servers and workstations periodically change the machine trust account password. The new
46 password is then stored only locally. This means that in the absence of a centrally stored
47 accounts database (such as that provided with an LDAP based solution) if Samba-3 is running
48 as a BDC, the BDC instance of the Domain member trust account password will not reach the
49 PDC (master) copy of the SAM. If the PDC SAM is then replicated to BDCs this results in 
50 overwriting of the SAM that contains the updated (changed) trust account password with resulting
51 breakage of the domain trust.
52 </para>
54 <para>
55 Considering the number of comments and questions raised concerning how to configure a BDC
56 lets consider each possible option and look at the pro's and con's for each theoretical solution:
57 </para>
59 <itemizedlist>
60 <title>Backup Domain Backend Account Distribution Options</title>
61         <listitem><para>
62         Solution: Passwd Backend is LDAP based, BDCs use a slave LDAP server
63         </para>
64         
65         <para>
66         Arguments For: This is a neat and manageable solution. The LDAP based SAM (ldapsam)
67         is constantly kept up to date.
68         </para>
70         <para>
71         Arguments Against: Complexity
72         </para>
73         </listitem>
74                 
75         <listitem><para>
76         Passdb Backend is tdbsam based, BDCs use cron based <emphasis>net rpc vampire</emphasis> to
77         obtain the Accounts database from the PDC and place them into the Samba SAM.
78         <emphasis>net rpc vampire</emphasis> is a Samba function of the "net" command.
79         </para>
81         <para>
82         Arguments For: It would be a nice solution
83         </para>
85         <para>
86         Arguments Against: It does not work because Samba-3 does not support the required
87         protocols. This may become a later feature but is not available today.
88         </para>
89         </listitem>
90                 
91         <listitem><para>
92         Make use of rsync to replicate (pull down) copies of the essential account files
93         </para>
95         <para>
96         Arguments For: It is a simple solution, easy to set up as a scheduled job
97         </para>
99         <para>
100         Arguments Against: This will over-write the locally changed machine trust account
101         passwords. This is a broken and flawed solution. Do NOT do this.
102         </para>
103         </listitem>
104                 
105         <listitem><para>
106         Operate with an entirely local accounts database (not recommended)
107         </para>
108         
109         <para>
110         Arguments For: Simple, easy to maintain
111         </para>
113         <para>
114         Arguments Against: All machine trust accounts and user accounts will be locally
115         maintained. Domain users will NOT be able to roam from office to office. This is
116         a broken and flawed solution. Do NOT do this.
117         </para>
119         </listitem>
120 </itemizedlist>
122 </sect1>
124 <sect1>
125 <title>Essential Background Information</title>
127 <para>
128 A Domain Controller is a machine that is able to answer logon requests from network
129 workstations. Microsoft LanManager and IBM LanServer were two early products that
130 provided this capability. The technology has become known as the LanMan Netlogon service.
131 </para>
133 <para>
134 When MS Windows NT3.10 was first released, it supported an new style of Domain Control
135 and with it a new form of the network logon service that has extended functionality.
136 This service became known as the NT NetLogon Service. The nature of this service has
137 changed with the evolution of MS Windows NT and today provides a very complex array of
138 services that are implemented over a complex spectrum of technologies.
139 </para>
141 <sect2>
142 <title>MS Windows NT4 Style Domain Control</title>
144 <para>
145 Whenever a user logs into a Windows NT4 / 200x / XP Professional Workstation,
146 the workstation connects to a Domain Controller (authentication server) to validate
147 the username and password that the user entered are valid. If the information entered
148 does not validate against the account information that has been stored in the Domain
149 Control database (the SAM, or Security Account Manager database) then a set of error
150 codes is returned to the workstation that has made the authentication request.
151 </para>
153 <para>
154 When the username / password pair has been validated, the Domain Controller
155 (authentication server) will respond with full enumeration of the account information
156 that has been stored regarding that user in the User and Machine Accounts database
157 for that Domain. This information contains a complete network access profile for
158 the user but excludes any information that is particular to the user's desktop profile,
159 or for that matter it excludes all desktop profiles for groups that the user may
160 belong to. It does include password time limits, password uniqueness controls,
161 network access time limits, account validity information, machine names from which the
162 user may access the network, and much more. All this information was stored in the SAM
163 in all versions of MS Windows NT (3.10, 3.50, 3.51, 4.0).
164 </para>
166 <para>
167 The account information (user and machine) on Domain Controllers is stored in two files,
168 one containing the Security information and the other the SAM. These are stored in files
169 by the same name in the <filename>C:\WinNT\System32\config</filename> directory. These
170 are the files that are involved in replication of the SAM database where Backup Domain
171 Controllers are present on the network.
172 </para>
174 <para>
175 There are two situations in which it is desirable to install Backup Domain Controllers:
176 </para>
178 <itemizedlist>
179         <listitem><para>
180         On the local network that the Primary Domain Controller is on, if there are many
181         workstations and/or where the PDC is generally very busy. In this case the BDCs
182         will pick up network logon requests and help to add robustness to network services.
183         </para></listitem>
185         <listitem><para>
186         At each remote site, to reduce wide area network traffic and to add stability to
187         remote network operations. The design of the network, the strategic placement of
188         Backup Domain Controllers, together with an implementation that localises as much
189         of network to client interchange as possible will help to minimise wide area network
190         bandwidth needs (and thus costs).
191         </para></listitem>
192 </itemizedlist>
194 <para>
195 The PDC contains the master copy of the SAM. In the event that an administrator makes a
196 change to the user account database while physically present on the local network that
197 has the PDC, the change will likely be made directly to the PDC instance of the master
198 copy of the SAM. In the event that this update may be performed in a branch office the
199 change will likely be stored in a delta file on the local BDC. The BDC will then send
200 a trigger to the PDC to commence the process of SAM synchronisation. The PDC will then
201 request the delta from the BDC and apply it to the master SAM. The PDC will then contact
202 all the BDCs in the Domain and trigger them to obtain the update and then apply that to
203 their own copy of the SAM.
204 </para>
206 <para>
207 Thus the BDC is said to hold a <emphasis>read-only</emphasis> of the SAM from which
208 it is able to process network logon requests and to authenticate users. The BDC can
209 continue to provide this service, particularly while, for example, the wide area
210 network link to the PDC is down. Thus a BDC plays a very important role in both
211 maintenance of Domain security as well as in network integrity.
212 </para>
214 <para>
215 In the event that the PDC should need to be taken out of service, or if it dies, then
216 one of the BDCs can be promoted to a PDC. If this happens while the original PDC is on
217 line then it is automatically demoted to a BDC. This is an important aspect of Domain
218 Controller management. The tool that is used to affect a promotion or a demotion is the
219 Server Manager for Domains.
220 </para>
222 <sect3>
223 <title>Example PDC Configuration</title>
225 <para>
226 Since version 2.2 Samba officially supports domain logons for all current Windows Clients,
227 including Windows NT4, 2003 and XP Professional. For samba to be enabled as a PDC some
228 parameters in the <smbconfsection>[global]</smbconfsection>-section of the &smb.conf; have to be set:
229 </para>
231 <para><smbconfexample>
232 <title>Minimal smb.conf for being a PDC</title>
233 <smbconfoption><name>workgroup</name><value>&example.workgroup;</value></smbconfoption>
234 <smbconfoption><name>domain master</name><value>yes</value></smbconfoption>
235 <smbconfoption><name>domain logons</name><value>yes</value></smbconfoption>
236 </smbconfexample></para>
238 <para>
239 Several other things like a <smbconfsection>[homes]</smbconfsection> and a
240 <smbconfsection>[netlogon]</smbconfsection> share also need to be set along with
241 settings for the profile path, the users home drive, etc.. This will not be covered in this
242 chapter, for more information please refer to <link linkend="samba-pdc"></link>.
243 </para>
245 </sect3>
246 </sect2>
248 <sect2>
249 <title>Active Directory Domain Control</title>
251 <para>
252 As of the release of MS Windows 2000 and Active Directory, this information is now stored
253 in a directory that can be replicated and for which partial or full administrative control
254 can be delegated. Samba-3 is NOT able to be a Domain Controller within an Active Directory
255 tree, and it can not be an Active Directory server. This means that Samba-3 also can NOT
256 act as a Backup Domain Controller to an Active Directory Domain Controller.
257 </para>
259 </sect2>
261 <sect2>
262 <title>What qualifies a Domain Controller on the network?</title>
264 <para>
265 Every machine that is a Domain Controller for the domain SAMBA has to register the NetBIOS
266 group name SAMBA&lt;#1c&gt; with the WINS server and/or by broadcast on the local network.
267 The PDC also registers the unique NetBIOS name SAMBA&lt;#1b&gt; with the WINS server.
268 The name type &lt;#1b&gt; name is normally reserved for the Domain Master Browser, a role
269 that has nothing to do with anything related to authentication, but the Microsoft Domain
270 implementation requires the domain master browser to be on the same machine as the PDC.
271 </para>
273 </sect2>
275 <sect2>
276 <title>How does a Workstation find its domain controller?</title>
278 <para>
279 An MS Windows NT4 / 200x / XP Professional workstation in the domain SAMBA that wants a
280 local user to be authenticated has to find the domain controller for SAMBA. It does this
281 by doing a NetBIOS name query for the group name SAMBA&lt;#1c&gt;. It assumes that each
282 of the machines it gets back from the queries is a domain controller and can answer logon
283 requests. To not open security holes both the workstation and the selected domain controller
284 authenticate each other. After that the workstation sends the user's credentials (name and
285 password) to the local Domain Controller, for validation.
286 </para>
288 </sect2>
290 </sect1>
292 <sect1>
293 <title>Backup Domain Controller Configuration</title>
295 <para>
296 Several things have to be done:
297 </para>
299 <itemizedlist>
300 <listitem><para>
301         The domain SID has to be the same on the PDC and the BDC. This used to
302         be stored in the file private/MACHINE.SID. This file is not created
303         since Samba 2.2.5. Nowadays the domain SID is stored in the file
304         private/secrets.tdb. Simply copying the secrets.tdb
305         from the PDC to the BDC does not work, as the BDC would
306         generate a new SID for itself and override the domain SID with this
307         new BDC SID.</para>
309         <para>
310         To retrieve the domain SID from the PDC or an existing BDC and store it in the
311         secrets.tdb, execute:
312         </para>
313 <screen>
314 &rootprompt;<userinput>net rpc getsid</userinput>
315 </screen>
316         </listitem>
318         <listitem><para>
319         The UNIX user database has to be synchronized from the PDC to the
320         BDC. This means that both the /etc/passwd and /etc/group have to be
321         replicated from the PDC to the BDC. This can be done manually
322         whenever changes are made, or the PDC is set up as a NIS master
323         server and the BDC as a NIS slave server. To set up the BDC as a
324         mere NIS client would not be enough, as the BDC would not be able to
325         access its user database in case of a PDC failure. NIS is by no means
326         the only method to synchronize passwords. An LDAP solution would work
327         as well.
328         </para>
329         </listitem>
331         <listitem><para>
332         The Samba password database has to be replicated from the PDC to the BDC.
333         As said above, though possible to synchronise the <filename>smbpasswd</filename>
334         file with rsync and ssh, this method is broken and flawed, and is 
335         therefore not recommended. A better solution is to set up slave LDAP
336         servers for each BDC and a master LDAP server for the PDC.
337         </para></listitem>
339         <listitem><para>
340         Any netlogon share has to be replicated from the PDC to the
341         BDC. This can be done manually whenever login scripts are changed,
342         or it can be done automatically together with the smbpasswd
343         synchronization.
344         </para></listitem>
346 </itemizedlist>
348 <sect2>
349 <title>Example Configuration</title>
351 <para>
352 Finally, the BDC has to be found by the workstations. This can be done by setting:
353 </para>
355 <para><smbconfexample>
356 <title>Minimal setup for being a BDC</title>
357 <smbconfoption><name>workgroup</name><value>&example.workgroup;</value></smbconfoption>
358 <smbconfoption><name>domain master</name><value>no</value></smbconfoption>
359 <smbconfoption><name>domain logons</name><value>yes</value></smbconfoption>
360 <smbconfoption><name>idmap backend</name><value>ldapsam://slave-ldap.quenya.org</value></smbconfoption>
361 </smbconfexample></para>
363 <para>
364 In the <smbconfsection>[global]</smbconfsection>-section of the &smb.conf; of the BDC. This makes the BDC
365 only register the name SAMBA&lt;#1c&gt; with the WINS server. This is no
366 problem as the name SAMBA&lt;#1c&gt; is a NetBIOS group name that is meant to
367 be registered by more than one machine. The parameter
368 <smbconfoption><name>domain master</name><value>no</value></smbconfoption>
369 forces the BDC not to register SAMBA&lt;#1b&gt; which as a unique NetBIOS
370 name is reserved for the Primary Domain Controller.
371 </para>
373 <para>
374 The <parameter>idmap backend</parameter> will redirect the <command>winbindd</command> utility to
375 use the LDAP database to resolve all UIDs and GIDs for UNIX accounts.
376 </para>
378 <note><para>
379 Samba-3 has introduced a new ID mapping facility. One of the features of this facility is that it
380 allows greater flexibility in how user and group IDs are handled in respect of NT Domain User and Group
381 SIDs. One of the new facilities provides for explicitly ensuring that UNIX / Linux UID and GID values
382 will be consistent on the PDC, all BDCs and all Domain Member servers. The parameter that controls this
383 is called <parameter>idmap backend</parameter>. Please refer to the man page for &smb.conf; for more information
384 regarding it's behaviour. Do NOT set this parameter except where an LDAP backend (ldapsam) is in use.
385 </para></note>
387 </sect2>
388 </sect1>
390 <sect1>
391 <title>Common Errors</title>
393 <para>
394 As this is a rather new area for Samba there are not many examples that we may refer to. Keep
395 watching for updates to this section.
396 </para>
398 <sect2>
399 <title>Machine Accounts keep expiring, what can I do?</title>
401 <para>
402 This problem will occur when occur when the passdb (SAM) files are copied  from a central
403 server but the local Backup Domain Controllers.  Local machine trust account password updates
404 are not copied back to the central server. The newer machine account password is then over
405 written when the SAM is copied from the PDC. The result is that the Domain member machine
406 on start up will find that it's passwords does not match the one now in the database and
407 since the startup security check will now fail, this machine will not allow logon attempts
408 to proceed and the account expiry error will be reported.
409 </para>
411 <para>
412 The solution: use a more robust passdb backend, such as the ldapsam backend, setting up
413 an slave LDAP server for each BDC, and a master LDAP server for the PDC.
414 </para>
416 </sect2>
418 <sect2>
419 <title>Can Samba be a Backup Domain Controller to an NT4 PDC?</title>
421 <para>
422 With version 2.2, no. The native NT4 SAM replication protocols have not yet been fully
423 implemented. The Samba Team is working on understanding and implementing the protocols,
424 but this work has not been finished for Samba-3.
425 </para>
427 <para>
428 Can I get the benefits of a BDC with Samba?  Yes, but only to a Samba PDC. The main reason for implementing a
429 BDC is availability. If the PDC is a Samba machine, a second Samba machine can be set up to
430 service logon requests whenever the PDC is down.
431 </para>
433 </sect2>
435 <sect2>
436 <title>How do I replicate the smbpasswd file?</title>
438 <para>
439 Replication of the smbpasswd file is sensitive. It has to be done whenever changes
440 to the SAM are made. Every user's password change is done in the smbpasswd file and
441 has to be replicated to the BDC. So replicating the smbpasswd file very often is necessary.
442 </para>
444 <para>
445 As the smbpasswd file contains plain text password equivalents, it must not be
446 sent unencrypted over the wire. The best way to set up smbpasswd replication from
447 the PDC to the BDC is to use the utility rsync. rsync can use ssh as a transport.
448 Ssh itself can be set up to accept <emphasis>only</emphasis> rsync transfer without requiring the user
449 to type a password.
450 </para>
452 <para>
453 As said a few times before, use of this method is broken and flawed. Machine trust 
454 accounts will go out of sync, resulting in a very broken domain. This method is
455 <emphasis>not</emphasis> recommended. Try using LDAP instead.
456 </para>
458 </sect2>
460 <sect2>
461 <title>Can I do this all with LDAP?</title>
463 <para>
464 The simple answer is YES.  Samba's pdb_ldap code supports binding to a replica
465 LDAP server, and will also follow referrals and rebind to the master if it ever
466 needs to make a modification to the database. (Normally BDCs are read only, so
467 this will not occur often).
468 </para>
470 </sect2>
471 </sect1>
472 </chapter>