Relocate name lookup info to correct section.
[Samba.git] / docs / Samba-HOWTO-Collection / InterdomainTrusts.xml
blob78e92db5a88aa55b2a4de30cc9d38767812913ea
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4   <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
5   %global_entities;
6 ]>
8 <chapter id="InterdomainTrusts">
9 <chapterinfo>
10         &author.jht;
11         &author.mimir;
12         <author>&person.jelmer;<contrib>drawing</contrib></author>
13         <author>
14                 <firstname>Stephen</firstname><surname>Langasek</surname>
15                 <affiliation>
16                         <address><email>vorlon@netexpress.net</email></address>
17                 </affiliation>
18         </author>
19         <pubdate>April 3, 2003</pubdate>
20 </chapterinfo>
22 <title>Interdomain Trust Relationships</title>
25 <para>
26 <indexterm><primary>Interdomain Trusts</primary></indexterm>
27 Samba-3 supports NT4-style domain trust relationships. This is a feature that many sites
28 will want to use if they migrate to Samba-3 from an NT4-style domain and do not want to
29 adopt Active Directory or an LDAP-based authentication backend. This section explains
30 some background information regarding trust relationships and how to create them. It is now
31 possible for Samba-3 to trust NT4 (and vice versa), as well as to create Samba-to-Samba 
32 trusts.
33 </para>
35 <sect1>
36 <title>Features and Benefits</title>
38 <para>
39 Samba-3 can participate in Samba-to-Samba as well as in Samba-to-MS Windows NT4-style
40 trust relationships. This imparts to Samba similar scalability as with MS Windows NT4.
41 </para>
43 <para>
44 Given that Samba-3 has the capability to function with a scalable backend authentication
45 database such as LDAP, and given its ability to run in Primary as well as Backup Domain Control
46 modes, the administrator would be well advised to consider alternatives to the use of
47 Interdomain trusts simply because by the very nature of how this works it is fragile.
48 That was, after all, a key reason for the development and adoption of Microsoft Active Directory.
49 </para>
51 </sect1>
53 <sect1>
54 <title>Trust Relationship Background</title>
56 <para>
57 MS Windows NT3/4 type security domains employ a non-hierarchical security structure.
58 The limitations of this architecture as it effects the scalability of MS Windows networking
59 in large organizations is well known. Additionally, the flat namespace that results from
60 this design significantly impacts the delegation of administrative responsibilities in
61 large and diverse organizations.
62 </para>
64 <para>
65 Microsoft developed Active Directory Service (ADS), based on Kerberos and LDAP, as a means
66 of circumventing the limitations of the older technologies. Not every organization is ready
67 or willing to embrace ADS. For small companies the older NT4-style domain security paradigm
68 is quite adequate, there remains an entrenched user base for whom there is no direct
69 desire to go through a disruptive change to adopt ADS.
70 </para>
72 <para>
73 With MS Windows NT, Microsoft introduced the ability to allow differing security domains
74 to effect a mechanism so users from one domain may be given access rights and privileges
75 in another domain. The language that describes this capability is couched in terms of
76 <emphasis>Trusts</emphasis>. Specifically, one domain will <emphasis>trust</emphasis> the users
77 from another domain. The domain from which users are available to another security domain is
78 said to be a trusted domain. The domain in which those users have assigned rights and privileges
79 is the trusting domain. With NT3.x/4.0 all trust relationships are always in one direction only,
80 thus if users in both domains are to have privileges and rights in each others' domain, then it is
81 necessary to establish two relationships, one in each direction.
82 </para>
84 <para>
85 In an NT4-style MS security domain, all trusts are non-transitive. This means that if there
86 are three domains (let's call them RED, WHITE and BLUE) where RED and WHITE have a trust
87 relationship, and WHITE and BLUE have a trust relationship, then it holds that there is no
88 implied trust between the RED and BLUE domains. Relationships are explicit and not
89 transitive.
90 </para>
92 <para>
93 New to MS Windows 2000 ADS security contexts is the fact that trust relationships are two-way
94 by default. Also, all inter-ADS domain trusts are transitive. In the case of the RED, WHITE and BLUE
95 domains above, with Windows 2000 and ADS the RED and BLUE domains can trust each other. This is
96 an inherent feature of ADS domains. Samba-3 implements MS Windows NT4-style Interdomain trusts
97 and interoperates with MS Windows 200x ADS security domains in similar manner to MS Windows NT4-style domains.
98 </para>
100 </sect1>
102 <sect1>
103 <title>Native MS Windows NT4 Trusts Configuration</title>
105 <para>
106 There are two steps to creating an interdomain trust relationship. To effect a two-way trust
107 relationship, it is necessary for each domain administrator to create a trust account for the 
108 other domain to use in verifying security credentials.
109 <indexterm><primary>Interdomain Trusts</primary><secondary>creating</secondary></indexterm>
110 </para>
113 <sect2>
114 <title>Creating an NT4 Domain Trust</title>
116 <para>
117 For MS Windows NT4, all domain trust relationships are configured using the 
118 <application>Domain User Manager</application>. This is done from the Domain User Manager Policies
119 entry on the menu bar. From the <guimenu>Policy</guimenu> menu, select
120 <guimenuitem>Trust Relationships</guimenuitem>. Next to the lower box labeled
121 <guilabel>Permitted to Trust this Domain</guilabel> are two buttons, <guibutton>Add</guibutton>
122 and <guibutton>Remove</guibutton>. The <guibutton>Add</guibutton> button will open a panel in which
123 to enter the name of the remote domain that will be able to assign access rights to users in 
124 your domain. You will also need to enter a password for this trust relationship, which the 
125 trusting domain will use when authenticating users from the trusted domain.
126 The password needs to be typed twice (for standard confirmation).
127 </para>
129 </sect2>
132 <sect2>
133 <title>Completing an NT4 Domain Trust</title>
135 <para>
136 <indexterm><primary>Interdomain Trusts</primary><secondary>Completing</secondary></indexterm>
137 A trust relationship will work only when the other (trusting) domain makes the appropriate connections
138 with the trusted domain. To consummate the trust relationship, the administrator will launch the
139 Domain User Manager from the menu select <guilabel>Policies</guilabel>, then select
140 <guilabel>Trust Relationships</guilabel>, click on the <guibutton>Add</guibutton> button
141 next to the box that is labeled <guilabel>Trusted Domains</guilabel>. A panel will open in which
142 must be entered the name of the remote domain as well as the password assigned to that trust.
143 </para>
145 </sect2>
147 <sect2>
148 <title>Inter-Domain Trust Facilities</title>
151 <para>
152 <indexterm><primary>Interdomain Trusts</primary><secondary>Facilities</secondary></indexterm>
153 A two-way trust relationship is created when two one-way trusts are created, one in each direction.
154 Where a one-way trust has been established between two MS Windows NT4 domains (let's call them
155 DomA and DomB), the following facilities are created:
156 </para>
158 <image id="trusts1"><imagefile>trusts1</imagefile><imagedescription>Trusts overview.</imagedescription></image>
160 <itemizedlist>
161         <listitem><para>
162         DomA (completes the trust connection) <parameter>Trusts</parameter> DomB.
163         </para></listitem>
165         <listitem><para>
166         DomA is the <parameter>Trusting</parameter> domain.
167         </para></listitem>
169         <listitem><para>
170         DomB is the <parameter>Trusted</parameter> domain (originates the trust account).
171         </para></listitem>
173         <listitem><para>
174         Users in DomB can access resources in DomA.
175         </para></listitem>
177         <listitem><para>
178         Users in DomA cannot access resources in DomB.
179         </para></listitem>
181         <listitem><para>
182         Global groups from DomB can be used in DomA.
183         </para></listitem>
185         <listitem><para>
186         Global groups from DomA cannot be used in DomB.
187         </para></listitem>
189         <listitem><para>
190         DomB does appear in the logon dialog box on client workstations in DomA.
191         </para></listitem>
193         <listitem><para>
194         DomA does not appear in the logon dialog box on client workstations in DomB.
195         </para></listitem>
196 </itemizedlist>
198 <itemizedlist>
199         <listitem><para>
200         Users/Groups in a trusting domain cannot be granted rights, permissions or access
201         to a trusted domain.
202         </para></listitem>
204         <listitem><para>
205         The trusting domain can access and use accounts (Users/Global Groups) in the
206         trusted domain.
207         </para></listitem>
209         <listitem><para>
210         Administrators of the trusted domain can be granted administrative rights in the 
211         trusting domain.
212         </para></listitem>
214         <listitem><para>
215         Users in a trusted domain can be given rights and privileges in the trusting
216         domain.
217         </para></listitem>
219         <listitem><para>
220         Trusted domain Global Groups can be given rights and permissions in the trusting
221         domain.
222         </para></listitem>
224         <listitem><para>
225         Global Groups from the trusted domain can be made members in Local Groups on
226         MS Windows Domain Member machines.
227         </para></listitem>
228 </itemizedlist>
230 </sect2>
232 </sect1>
234 <sect1>
235 <title>Configuring Samba NT-Style Domain Trusts</title>
237 <para>
238 This description is meant to be a fairly short introduction about how to set up a Samba server so
239 that it can participate in interdomain trust relationships. Trust relationship support in Samba
240 is at an early stage, so do not be surprised if something does not function as it should.
241 </para>
243 <para>
244 Each of the procedures described below assumes the peer domain in the trust relationship is 
245 controlled by a Windows NT4 server. However, the remote end could just as well be another 
246 Samba-3  domain. It can be clearly seen, after reading this document, that combining 
247 Samba-specific parts of what's written below leads to trust between domains in a purely Samba 
248 environment.
249 </para>
251 <sect2 id="samba-trusted-domain">
252 <title>Samba as the Trusted Domain</title>
254 <para>
255 In order to set the Samba PDC to be the trusted party of the relationship, you first need
256 to create a special account for the domain that will be the trusting party. To do that,
257 you can use the <command>smbpasswd</command> utility. Creating the trusted domain account is 
258 similar to creating a trusted machine account. Suppose, your domain is
259 called SAMBA, and the remote domain is called RUMBA. The first step
260 will be to issue this command from your favorite shell:
261 </para>
263 <para>
264 <screen>
265 &rootprompt; <userinput>smbpasswd -a -i rumba</userinput>
266 New SMB password: <userinput>XXXXXXXX</userinput>
267 Retype SMB password: <userinput>XXXXXXXX</userinput>
268 Added user rumba$
269 </screen>
271 where <option>-a</option> means to add a new account into the
272 passdb database and <option>-i</option> means: <quote>create this
273 account with the Inter-Domain trust flag</quote>.
274 </para>
276 <para>
277 The account name will be <quote>rumba$</quote> (the name of the remote domain).
278 If this fails, you should check that the trust account has been added to the system
279 password database (<filename>/etc/passwd</filename>). If it has not been added, you
280 can add it manually and then repeat the step above.
281 </para>
283 <para>
284 After issuing this command, you will be asked to enter the password for
285 the account. You can use any password you want, but be aware that Windows NT will
286 not change this password until seven days following account creation.
287 After the command returns successfully, you can look at the entry for the new account
288 (in the standard way as appropriate for your configuration) and see that accounts name is
289 really RUMBA$ and it has the <quote>I</quote> flag set in the flags field. Now you are ready to confirm
290 the trust by establishing it from Windows NT Server.
291 </para>
294 <para>
295 <indexterm><primary>User Manager</primary></indexterm>
296 Open <application>User Manager for Domains</application> and from the
297 <guimenu>Policies</guimenu> menu, select <guimenuitem>Trust Relationships...</guimenuitem>.
298 Beside the <guilabel>Trusted domains</guilabel> list box click the
299 <guimenu>Add...</guimenu> button. You will be prompted for
300 the trusted domain name and the relationship password. Type in SAMBA, as this is
301 the name of the remote domain and the password used at the time of account creation.
302 Click on <guibutton>OK</guibutton> and, if everything went without incident, you will see 
303 the <computeroutput>Trusted domain relationship successfully 
304 established</computeroutput> message.
305 </para>
307 </sect2>
308 <sect2>
309 <title>Samba as the Trusting Domain</title>
311 <para>
312 This time activities are somewhat reversed. Again, we'll assume that your domain
313 controlled by the Samba PDC is called SAMBA and the NT-controlled domain is called RUMBA.
314 </para>
316 <para>
317 The very first step is to add an account for the SAMBA domain on RUMBA's PDC.
318 </para>
321 <para>
322 <indexterm><primary>User Manager</primary></indexterm>
323 Launch the <application>Domain User Manager</application>, then from the menu select
324 <guimenu>Policies</guimenu>, <guimenuitem>Trust Relationships</guimenuitem>.
325 Now, next to the <guilabel>Trusted Domains</guilabel> box press the <guibutton>Add</guibutton>
326 button and type in the name of the trusted domain (SAMBA) and the password to use in securing
327 the relationship.
328 </para>
330 <para>
331 The password can be arbitrarily chosen. It is easy to change the password
332 from the Samba server whenever you want. After confirming the password your account is
333 ready for use. Now its Samba's turn.
334 </para>
336 <para>
337 Using your favorite shell while being logged in as root, issue this command:
338 </para>
340 <para>
341 &rootprompt;<userinput>net rpc trustdom establish rumba</userinput>
342 </para>
344 <para>
345 You will be prompted for the password you just typed on your Windows NT4 Server box.
346 An error message <errorname>`NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT'</errorname>
347 that may be reported periodically is of no concern and may safely be ignored.
348 It means the password you gave is correct and the NT4 Server says the account is ready for
349 interdomain connection and not for ordinary connection.  After that, be patient;
350 it can take a while (especially in large networks), but eventually you should see
351 the <computeroutput>Success</computeroutput> message. Congratulations! Your trust
352 relationship has just been established.
353 </para>
355 <note><para>
356 You have to run this command as root because you must have write access to
357 the <filename>secrets.tdb</filename> file.
358 </para></note>
360 </sect2>
361 </sect1>
363 <sect1>
364 <title>NT4-Style Domain Trusts with Windows 2000</title>
365 <para>
366 Although <application>Domain User Manager</application> is not present in Windows 2000, it is 
367 also possible to establish an NT4-style trust relationship with a Windows 2000 domain 
368 controller running in mixed mode as the trusting server. It should also be possible for 
369 Samba to trust a Windows 2000 server, however, more testing is still needed in this area.
370 </para>
372 <para>
373 After <link linkend="samba-trusted-domain">creating the interdomain trust account on the 
374 Samba server</link> as described above, open <application>Active Directory Domains and 
375 Trusts</application> on the AD controller of the domain whose resources you wish Samba users 
376 to have access to. Remember that since NT4-style trusts are not transitive, if you want 
377 your users to have access to multiple mixed-mode domains in your AD forest, you will need to 
378 repeat this process for each of those domains. With <application>Active Directory Domains 
379 and Trusts</application> open, right-click on the name of the Active Directory domain that 
380 will trust our Samba domain and choose <guimenuitem>Properties</guimenuitem>, then click on
381 the <guilabel>Trusts</guilabel> tab. In the upper part of the panel, you will see a list box 
382 labeled <guilabel>Domains trusted by this domain:</guilabel>, and an 
383 <guilabel>Add...</guilabel> button next to it. Press this button and just as with NT4, you 
384 will be prompted for the trusted domain name and the relationship password. Press OK and 
385 after a moment, Active Directory will respond with <computeroutput>The trusted domain has 
386 been added and the trust has been verified.</computeroutput>  Your Samba users can now be 
387 granted access to resources in the AD domain.
388 </para>
389 </sect1>
391 <sect1>
392 <title>Common Errors</title>
394 <para>
395 Interdomain trust relationships should not be attempted on networks that are unstable
396 or that suffer regular outages. Network stability and integrity are key concerns with
397 distributed trusted domains.
398 </para>
400 <sect2>
401 <title>Browsing of Trusted Domain Fails</title>
403 <para>
404 Browsing from a machine in a trusted Windows 200x Domain to a Windows 200x member of
405 a trusting samba domain, I get the following error:
406 </para>
408 <formalpara><emphasis>
409 The system detected a possible attempt to compromise security. Please ensure that
410 you can contact the server that authenticated you.</emphasis>
411 </formalpara>
413 <para>
414 The event logs on the box I'm trying to connect to have entries regarding group
415 policy not being applied because it is a member of a down-level domain.
416 </para>
418 <para><emphasis>Answer: </emphasis> If there is a computer account in the Windows
419 200x Domain for the machine in question, and it is disabled, this problem can
420 occur.  If there is no computer account (removed or never existed), or if that 
421 account is still intact (i.e.: you just joined it to another domain) everything 
422 seems to be fine. By default, when you un-join a domain (the Windows 200x 
423 Domain), the computer tries to automatically disable the computer account in 
424 the domain.  If you are running as an account which has privileges to do this 
425 when you un-join the machine, it is done, otherwise it is not done.
426 </para>
428 </sect2>
430 <sect2>
431 <title>Problems With LDAP ldapsam And The smbldap-tools</title>
433 <para>
434 If you use the <command>smbldap-useradd.pl</command> script to create a trust
435 account to set up Interdomain trusts the process of setting up the trust will
436 fail. The account that was created in the LDAP database will have an account
437 flags field that has <constant>[W          ]</constant>, when it must have
438 <constant>[I          ]</constant> for Interdomain trusts to work.
439 </para>
441 <para><emphasis>Answer: </emphasis>Here is a simple solution.
442 Create a machine account as follows:
443 <screen>
444 &rootprompt; smbldap-useradd.pl -w domain_name
445 </screen>
446 Then set the desired trust account password as shown here:
447 <screen>
448 &rootprompt; smbldap-passwd.pl domain_name\$
449 </screen>
450 Using a text editor, create the following file:
451 <screen>
452 dn: uid=domain_name$,ou=People,dc={your-domain},dc={your-top-level-domain}
453 changetype: modify
454 sambaAcctFlags: [I         ]
455 </screen>
456 Then apply the text file to the LDAP database as follows:
457 <screen>
458 &rootprompt; ldapmodify -x -h localhost \
459  -D "cn=Manager,dc={your-domain},dc={your-top-level-domain}" \
460  -W -f /path-to/foobar
461 </screen>
462 Create a single-sided trust under the NT4 Domain User Manager, then execute:
463 <screen>
464 &rootprompt; net rpc trustdom establish domain_name
465 </screen>
466 </para>
468 <para>
469 It works with Samba-3  and NT4 Domains, and also with Samba-3 and Windows 200x ADS in mixed mode.
470 Both DC's, samba and NT, must have the same WINS server otherwise
471 the trust will never work. 
472 </para>
474 </sect2>
476 </sect1>
478 </chapter>