c89a0e4f879ed37969c7b7c8f4a1af498c24f94f
[ira/wip.git] / docs / docbook / projdoc / ADS-HOWTO.xml
1 <chapter id="ADS">
2
3 <chapterinfo>
4         &author.tridge;
5         &author.jelmer;
6         <pubdate>2002/2003</pubdate>
7 </chapterinfo>
8
9 <title>Samba as a ADS domain member</title>
10
11 <para>
12 This is a rough guide to setting up Samba 3.0 with kerberos authentication against a
13 Windows2000 KDC. 
14 </para> 
15
16 <sect1>
17 <title>Setup your <filename>smb.conf</filename></title>
18
19 <para>You must use at least the following 3 options in smb.conf:</para>
20
21 <para><programlisting>
22         realm = YOUR.KERBEROS.REALM
23         security = ADS
24         encrypt passwords = yes
25 </programlisting></para>
26
27 <para>
28 In case samba can't figure out your ads server using your realm name, use the 
29 <command>ads server</command> option in <filename>smb.conf</filename>:
30 <programlisting>
31         ads server = your.kerberos.server
32 </programlisting>
33 </para>
34
35 <note><para>You do *not* need a smbpasswd file, and older clients will
36   be authenticated as if <command>security = domain</command>,
37   although it won't do any harm
38   and allows you to have local users not in the domain.
39   I expect that the above required options will change soon when we get better
40   active directory integration.</para></note>
41
42 </sect1>
43   
44 <sect1>
45 <title>Setup your <filename>/etc/krb5.conf</filename></title>
46
47 <para>Note: you will need the krb5 workstation, devel, and libs installed</para>
48
49 <para>The minimal configuration for <filename>krb5.conf</filename> is:</para>
50
51 <para><programlisting>
52         [realms]
53             YOUR.KERBEROS.REALM = {
54                 kdc = your.kerberos.server
55             }
56 </programlisting></para>
57
58 <para>Test your config by doing a <userinput>kinit
59 <replaceable>USERNAME</replaceable>@<replaceable>REALM</replaceable></userinput> and
60 making sure that your password is accepted by the Win2000 KDC.
61 </para>
62
63 <note><para>The realm must be uppercase or you will get "Cannot find KDC for requested
64 realm while getting initial credentials" error </para></note>
65
66 <note><para>Time between the two servers must be synchronized.  You will get a
67 "kinit(v5): Clock skew too great while getting initial credentials" if the time
68 difference is more than five minutes. </para></note>
69
70 <para>
71 You also must ensure that you can do a reverse DNS lookup on the IP
72 address of your KDC. Also, the name that this reverse lookup maps to
73 must either be the netbios name of the KDC (ie. the hostname with no
74 domain attached) or it can alternatively be the netbios name
75 followed by the realm. 
76 </para>
77
78 <para>
79 The easiest way to ensure you get this right is to add a 
80 <filename>/etc/hosts</filename> entry mapping the IP address of your KDC to 
81 its netbios name. If you don't get this right then you will get a 
82 "local error" when you try to join the realm.
83 </para>
84
85 <para>
86 If all you want is kerberos support in &smbclient; then you can skip
87 straight to <link linkend="ads-test-smbclient">Test with &smbclient;</link> now. 
88 <link linkend="ads-create-machine-account">Creating a computer account</link> 
89 and <link linkend="ads-test-server">testing your servers</link>
90 is only needed if you want kerberos support for &smbd; and &winbindd;.
91 </para>
92
93 </sect1>
94
95 <sect1 id="ads-create-machine-account">
96 <title>Create the computer account</title>
97
98 <para>
99 As a user that has write permission on the Samba private directory
100 (usually root) run:
101 <programlisting>
102         <userinput>net join -U Administrator%password</userinput>
103 </programlisting>
104 </para>
105
106 <sect2>
107 <title>Possible errors</title>
108
109 <para>
110 <variablelist>
111         <varlistentry><term>"ADS support not compiled in"</term>
112         <listitem><para>Samba must be reconfigured (remove config.cache) and recompiled
113         (make clean all install) after the kerberos libs and headers are installed.
114         </para></listitem></varlistentry>
115
116         <varlistentry><term>net join prompts for user name</term>
117         <listitem><para>You need to login to the domain using <userinput>kinit
118         <replaceable>USERNAME</replaceable>@<replaceable>REALM</replaceable></userinput>.
119         <replaceable>USERNAME</replaceable> must be a user who has rights to add a machine
120         to the domain.  </para></listitem></varlistentry>
121 </variablelist>
122 </para>
123
124 </sect2>
125
126 </sect1>
127
128 <sect1 id="ads-test-server">
129 <title>Test your server setup</title>
130
131 <para>
132 If the join was successful, you will see a new computer account with the
133 NetBIOS name of your Samba server in Active Directory (in the "Computers"
134 folder under Users and Computers.
135 </para>
136
137 <para>
138 On a Windows 2000 client try <userinput>net use * \\server\share</userinput>. You should
139 be logged in with kerberos without needing to know a password. If
140 this fails then run <userinput>klist tickets</userinput>. Did you get a ticket for the
141 server? Does it have an encoding type of DES-CBC-MD5 ? 
142 </para>
143
144 </sect1>
145
146 <sect1 id="ads-test-smbclient">
147 <title>Testing with &smbclient;</title>
148
149 <para>
150 On your Samba server try to login to a Win2000 server or your Samba
151 server using &smbclient; and kerberos. Use &smbclient; as usual, but
152 specify the <parameter>-k</parameter> option to choose kerberos authentication.
153 </para>
154
155 </sect1>
156
157 <sect1>
158 <title>Notes</title>
159
160 <para>You must change administrator password at least once after DC 
161 install, to create the right encoding types</para>
162
163 <para>w2k doesn't seem to create the _kerberos._udp and _ldap._tcp in
164    their defaults DNS setup. Maybe fixed in service packs?</para>
165 </sect1>
166
167 </chapter>