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="ServerType">
10 <title>Server Types and Security Modes</title>
13 <indexterm><primary>migrate</primary></indexterm>
14 <indexterm><primary>security mode</primary></indexterm>
15 This chapter provides information regarding the types of server that Samba may be configured to be. A
16 Microsoft network administrator who wishes to migrate to or use Samba will want to know the meaning, within a
17 Samba context, of terms familiar to the MS Windows administrator. This means that it is essential also to
18 define how critical security modes function before we get into the details of how to configure the server
23 This chapter provides an overview of the security modes of which Samba is capable and how they relate to MS
24 Windows servers and clients.
28 A question often asked is, <quote>Why would I want to use Samba?</quote> Most chapters contain a section that
29 highlights features and benefits. We hope that the information provided will help to answer this question. Be
30 warned though, we want to be fair and reasonable, so not all features are positive toward Samba. The benefit
31 may be on the side of our competition.
35 <title>Features and Benefits</title>
38 Two men were walking down a dusty road, when one suddenly kicked up a small red stone. It
39 hurt his toe and lodged in his sandal. He took the stone out and cursed it with a passion
40 and fury befitting his anguish. The other looked at the stone and said, <quote>This is a garnet.
41 I can turn that into a precious gem and some day it will make a princess very happy!</quote>
45 The moral of this tale: Two men, two very different perspectives regarding the same stone.
46 Like it or not, Samba is like that stone. Treat it the right way and it can bring great
47 pleasure, but if you are forced to use it and have no time for its secrets, then it can be
48 a source of discomfort.
52 <indexterm><primary>UNIX</primary><secondary>server</secondary></indexterm>
53 <indexterm><primary>interoperability</primary></indexterm>
54 Samba started out as a project that sought to provide interoperability for MS Windows 3.x
55 clients with a UNIX server. It has grown up a lot since its humble beginnings and now provides
56 features and functionality fit for large-scale deployment. It also has some warts. In sections
57 like this one, we tell of both.
61 So, what are the benefits of the features mentioned in this chapter?
66 <indexterm><primary>domain</primary><secondary>controller</secondary></indexterm>
67 Samba-3 can replace an MS Windows NT4 domain controller.
71 <indexterm><primary>active directory</primary></indexterm>
72 Samba-3 offers excellent interoperability with MS Windows NT4-style
73 domains as well as natively with Microsoft Active Directory domains.
77 <indexterm><primary>interdomain</primary><secondary>trustrs</secondary></indexterm>
78 Samba-3 permits full NT4-style interdomain trusts.
82 <indexterm><primary>authentication</primary></indexterm>
83 <indexterm><primary>security</primary><secondary>modes</secondary></indexterm>
84 Samba has security modes that permit more flexible authentication
85 than is possible with MS Windows NT4 domain controllers.
89 <indexterm><primary>account</primary><secondary>database</secondary><tertiary>backends</tertiary></indexterm>
90 <indexterm><primary>encrypted</primary></indexterm>
91 Samba-3 permits use of multiple concurrent account database backends.
92 (Encrypted passwords that are stored in the account database are in
93 formats that are unique to Windows networking).
97 <indexterm><primary>replicated</primary></indexterm>
98 The account database backends can be distributed
99 and replicated using multiple methods. This gives Samba-3
100 greater flexibility than MS Windows NT4 and in many cases a
101 significantly higher utility than Active Directory domains
102 with MS Windows 200x.
109 <title>Server Types</title>
113 <indexterm><primary>Server Type</primary></indexterm>
114 Administrators of Microsoft networks often refer to three different types of servers:
118 <listitem><para>Domain Controller</para>
120 <listitem><para>Primary Domain Controller (PDC)</para></listitem>
121 <listitem><para>Backup Domain Controller (BDC)</para></listitem>
122 <listitem><para>ADS Domain Controller</para></listitem>
125 <listitem><para>Domain Member Server</para>
127 <listitem><para>Active Directory Domain Server</para></listitem>
128 <listitem><para>NT4 Style Domain Domain Server</para></listitem>
131 <listitem><para>Standalone Server</para></listitem>
135 <indexterm><primary>domain</primary><secondary>control</secondary></indexterm>
136 <indexterm><primary>domain</primary><secondary>member</secondary></indexterm>
137 <indexterm><primary>domain control</primary><secondary>primary</secondary></indexterm>
138 <indexterm><primary>domain control</primary><secondary>backup</secondary></indexterm>
139 The chapters covering domain control (<link linkend="samba-pdc">Domain Control</link>),
140 backup domain control (<link linkend="samba-bdc">Backup Domain Control</link>), and
141 domain membership (<link linkend="domain-member">Domain Membership</link>) provide
142 pertinent information regarding Samba configuration for each of these server roles.
143 You are strongly encouraged to become intimately familiar with these chapters because
144 they lay the foundation for deployment of Samba domain security.
148 <indexterm><primary>standalone</primary></indexterm>
149 A Standalone server is autonomous in respect of the source of its account backend.
150 Refer to <link linkend="StandAloneServer">Standalone Servers</link> to gain a wider appreciation
151 of what is meant by a server being configured as a <emphasis>standalone</emphasis> server.
157 <title>Samba Security Modes</title>
161 <indexterm><primary>Security Mode</primary></indexterm>
162 <indexterm><primary>security</primary></indexterm>
163 In this section, the function and purpose of Samba's security modes are described. An accurate understanding of
164 how Samba implements each security mode as well as how to configure MS Windows clients for each mode will
165 significantly reduce user complaints and administrator heartache.
169 <indexterm><primary>Server Message Block</primary><see>SMB</see></indexterm>
170 <indexterm><primary>Common Internet Filesystem</primary><see>CIFS</see></indexterm>
171 Microsoft Windows networking uses a protocol that was originally called the Server Message Block (SMB)
172 protocol. Since some time around 1996 the protocol has been better known as the Common Internet Filesystem
177 <indexterm><primary>security levels</primary></indexterm>
178 <indexterm><primary>security modes</primary></indexterm>
179 <indexterm><primary>user-level</primary></indexterm>
180 Samba has three ways of implementing <emphasis>user-level</emphasis> security. Collectively, we call the Samba
181 implementations of the security levels <emphasis>security modes</emphasis>. They are known as
182 <emphasis>user</emphasis>, <emphasis>domain</emphasis> and
183 <emphasis>ADS</emphasis> modes. They are documented in this chapter.
187 The term <literal>client</literal> refers to all agents whether it is a Windows workstation, a Windows server,
188 another Samba server, or any vanilla SMB or CIFS client application (e.g., <command>smbclient</command>) that
189 make use of services provided by an SMB/CIFS server.
193 <title>User Level Security</title>
196 <indexterm><primary>user-level</primary></indexterm>
197 We describe user-level security first because its simpler. In user-level security, the client sends a session
198 setup request directly following protocol negotiation. This request provides a username and password. The
199 server can either accept or reject that username/password combination. At this stage the server has no idea
200 what share the client will eventually try to connect to, so it can't base the
201 <emphasis>accept/reject</emphasis> on anything other than:
205 <listitem><para>the username/password.</para></listitem>
206 <listitem><para>the name of the client machine.</para></listitem>
210 <indexterm><primary>credentials</primary></indexterm>
211 If the server accepts the username/password credentials, the client expects to be able to mount shares (using
212 a <emphasis>tree connection</emphasis>) without further specifying a password. It expects that all access
213 rights will be as the username/password credentials set that was specified in the initial <emphasis>session
218 <indexterm><primary>session setup</primary></indexterm>
219 It is also possible for a client to send multiple <emphasis>session setup</emphasis>
220 requests. When the server responds, it gives the client a <emphasis>uid</emphasis> to use
221 as an authentication tag for that username/password. The client can maintain multiple
222 authentication contexts in this way (WinDD is an example of an application that does this).
226 <indexterm><primary>LanManager</primary></indexterm>
227 <indexterm><primary>case-preserving</primary></indexterm>
228 <indexterm><primary>case-insensitive</primary></indexterm>
229 <indexterm><primary>upper-case</primary></indexterm>
230 <indexterm><primary>lower-case</primary></indexterm>
231 Windows networking user account names are case-insensitive, meaning that upper-case and lower-case characters
232 in the account name are considered equivalent. They are said to be case-preserving, but not case significant.
233 Windows and LanManager systems previous to Windows NT version 3.10 have case-insensitive passwords that were
234 not necessarily case-preserving. All Windows NT family systems treat passwords as case-preserving and
239 <title>Example Configuration</title>
242 The &smb.conf; parameter that sets user-level security is:
246 <smbconfoption name="security">user</smbconfoption>
247 </smbconfblock></para>
250 This is the default setting since Samba-2.2.x.
257 <title>Domain Security Mode (User-Level Security)</title>
260 <indexterm><primary>domain</primary><secondary>controllers</secondary></indexterm>
261 <indexterm><primary>security</primary><secondary>controllers</secondary></indexterm>
262 <indexterm><primary>PDC</primary></indexterm>
263 <indexterm><primary>BDC</primary></indexterm>
264 <indexterm><primary>logon</primary></indexterm>
265 <indexterm><primary>authentication</primary></indexterm>
266 Domain security provides a mechanism for storing all user and group accounts in a central, shared, account
267 repository. The centralized account repository is shared between domain (security) controllers. Servers that
268 act as domain controllers provide authentication and validation services to all machines that participate in
269 the security context for the domain. A primary domain controller (PDC) is a server that is responsible for
270 maintaining the integrity of the security account database. Backup domain controllers (BDCs) provide only domain
271 logon and authentication services. Usually, BDCs will answer network logon requests more responsively than
276 <indexterm><primary>domain member</primary></indexterm>
277 <indexterm><primary>trust account</primary></indexterm>
278 <indexterm><primary>trust</primary><secondary>account</secondary></indexterm>
279 <indexterm><primary>domain</primary><secondary>security</secondary></indexterm>
280 <indexterm><primary>domain</primary><secondary>controller</secondary></indexterm>
281 When Samba is operating in <smbconfoption name="security">domain</smbconfoption> mode, the Samba server has a
282 domain security trust account (a machine account) and causes all authentication requests to be passed through
283 to the domain controllers. In other words, this configuration makes the Samba server a domain member server,
284 even when it is in fact acting as a domain controller. All machines that participate in domain security must
285 have a machine account in the security database.
289 <indexterm><primary>account</primary><secondary>database</secondary></indexterm>
290 <indexterm><primary>machine</primary><secondary>account</secondary></indexterm>
291 <indexterm><primary>NetBIOS</primary><secondary>name</secondary></indexterm>
292 <indexterm><primary>NetBIOS</primary></indexterm>
293 Within the domain security environment, the underlying security architecture uses user-level security. Even
294 machines that are domain members must authenticate on startup. The machine account consists of an account
295 entry in the accounts database, the name of which is the NetBIOS name of the machine and of which the password
296 is randomly generated and known to both the domain controllers and the member machine. If the machine account
297 cannot be validated during startup, users will not be able to log on to the domain using this machine because
298 it cannot be trusted. The machine account is referred to as a machine trust account.
302 There are three possible domain member configurations:
306 <listitem><para>Primary domain controller (PDC) - of which there is one per domain.</para></listitem>
307 <listitem><para>Backup domain controller (BDC) - of which there can be any number per domain.</para></listitem>
308 <listitem><para>Domain member server (DMS) - of which there can be any number per domain.</para></listitem>
312 <indexterm><primary>DMS</primary></indexterm>
313 We will discuss each of these in separate chapters. For now, we are most interested in basic DMS
318 <title>Example Configuration</title>
320 Samba as a Domain Member Server
325 <indexterm><primary>server type</primary><secondary>domain member</secondary></indexterm>
326 This method involves addition of the following parameters in the &smb.conf; file:
328 <smbconfoption name="security">domain</smbconfoption>
329 <smbconfoption name="workgroup">&example.workgroup;</smbconfoption>
334 In order for this method to work, the Samba server needs to join the MS Windows NT
335 security domain. This is done as follows:
336 <indexterm><primary>net</primary><secondary>rpc</secondary></indexterm>
337 <indexterm><primary>Domain Member</primary><secondary>joining</secondary></indexterm>
342 <step><para>On the UNIX/Linux system execute:</para>
344 <para><screen>&rootprompt;<userinput>net rpc join -U administrator%password</userinput></screen></para>
349 <indexterm><primary>invalid shell</primary></indexterm>
350 <indexterm><primary>/etc/passwd</primary></indexterm>
351 <indexterm><primary>/bin/false</primary></indexterm>
352 Use of this mode of authentication requires there to be a standard UNIX account for each user in order to
353 assign a UID once the account has been authenticated by the Windows domain controller. This account can be
354 blocked to prevent logons by clients other than MS Windows through means such as setting an invalid shell in
355 the <filename>/etc/passwd</filename> entry. The best way to allocate an invalid shell to a user account is to
356 set the shell to the file <filename>/bin/false</filename>.
360 <indexterm><primary>PDC</primary></indexterm>
361 <indexterm><primary>BDC</primary></indexterm>
362 Domain controllers can be located anywhere that is convenient. The best advice is to have a BDC on every
363 physical network segment, and if the PDC is on a remote network segment the use of WINS (see <link
364 linkend="NetworkBrowsing">Network Browsing</link> for more information) is almost essential.
368 An alternative to assigning UIDs to Windows users on a Samba member server is presented in <link
369 linkend="winbind">Winbind</link>, <link linkend="winbind">Winbind: Use of Domain Accounts</link>.
373 For more information regarding domain membership, <link linkend="domain-member">Domain Membership</link>.
380 <title>ADS Security Mode (User-Level Security)</title>
383 <indexterm><primary>ADS</primary></indexterm>
384 <indexterm><primary>native mode</primary></indexterm>
385 Samba can join an Active Directory domain using NT4 style RPC based security. This is
386 possible if the domain is run in native mode. Active Directory in native mode perfectly allows NT4-style
387 domain members. This is contrary to popular belief.
391 If you are using Active Directory, starting with Samba-3 you can join as a native AD member. Why would you
392 want to do that? Your security policy might prohibit the use of NT-compatible authentication protocols. All
393 your machines are running Windows 2000 and above and all use Kerberos. In this case, Samba, as an NT4-style
394 domain, would still require NT-compatible authentication data. Samba in AD-member mode can accept Kerberos
399 <indexterm><primary>realm</primary></indexterm>
400 <indexterm><primary>mixed mode</primary></indexterm>
401 Sites that use Microsoft Windows active directory services (ADS) should be aware of the significance of the
402 terms: <literal>native mode</literal> and <literal>mixed mode</literal> ADS operation. The term
403 <literal>realm</literal> is used to describe a Kerberos-based security architecture (such as is used by
408 <title>Example Configuration</title>
411 <smbconfoption name="realm">your.kerberos.REALM</smbconfoption>
412 <smbconfoption name="security">ADS</smbconfoption>
413 </smbconfblock></para>
416 The following parameter may be required:
420 <smbconfoption name="password server">your.kerberos.server</smbconfoption>
421 </smbconfblock></para>
424 Please refer to <link linkend="domain-member">Domain Membership</link>, and <link linkend="ads-member">Samba
425 ADS Domain Membership</link> for more information regarding this configuration option.
434 <title>Password Checking</title>
437 MS Windows clients may use encrypted passwords as part of a challenge/response
438 authentication model (a.k.a. NTLMv1 and NTLMv2) or alone, or clear-text strings for simple
439 password-based authentication. It should be realized that with the SMB protocol,
440 the password is passed over the network either in plaintext or encrypted, but
441 not both in the same authentication request.
445 <indexterm><primary>encrypted passwords</primary></indexterm>
446 <indexterm><primary>encrypted</primary></indexterm>
447 When encrypted passwords are used, a password that has been entered by the user
448 is encrypted in two ways:
452 <listitem><para>An MD4 hash of the unicode of the password
453 string. This is known as the NT hash.
456 <listitem><para>The password is converted to uppercase,
457 and then padded or truncated to 14 bytes. This string is
458 then appended with 5 bytes of NULL characters and split to
459 form two 56-bit DES keys to encrypt a "magic" 8-byte value.
460 The resulting 16 bytes form the LanMan hash.
465 <indexterm><primary>plain-text</primary><secondary>passwords</secondary></indexterm>
466 MS Windows 95 pre-service pack 1 and MS Windows NT versions 3.x and version 4.0 pre-service pack 3 will use
467 either mode of password authentication. All versions of MS Windows that follow these versions no longer
468 support plain-text passwords by default.
472 <indexterm><primary>cached</primary><secondary>password</secondary></indexterm>
473 MS Windows clients have a habit of dropping network mappings that have been idle
474 for 10 minutes or longer. When the user attempts to use the mapped drive
475 connection that has been dropped, the client re-establishes the connection using
476 a cached copy of the password.
480 When Microsoft changed the default password mode, support was dropped for caching
481 of the plaintext password. This means that when the registry parameter is changed
482 to re-enable use of plaintext passwords, it appears to work, but when a dropped
483 service connection mapping attempts to revalidate, this will fail if the remote
484 authentication server does not support encrypted passwords. It is definitely not
485 a good idea to re-enable plaintext password support in such clients.
489 The following parameters can be used to work around the issue of Windows 9x/Me clients
490 uppercasing usernames and passwords before transmitting them to the SMB server
491 when using clear-text authentication:
497 <smbconfoption name="username level"><replaceable>integer</replaceable></smbconfoption>
501 By default Samba will convert to lowercase the username before attempting to lookup the user
502 in the database of local system accounts. Because UNIX usernames conventionally
503 only contain lowercase characters, the <smbconfoption name="username-level"/> parameter
508 <indexterm><primary>clear-text</primary></indexterm>
509 However, passwords on UNIX systems often make use of mixed-case characters. This means that in order for a
510 user on a Windows 9x/Me client to connect to a Samba server using clear-text authentication, the
511 password must be in lower case.
515 The best option to adopt is to enable support for encrypted passwords wherever
516 Samba is used. Most attempts to apply the registry change to re-enable plaintext
517 passwords will eventually lead to user complaints and unhappiness.
523 <title>Common Errors</title>
526 We all make mistakes. It is okay to make mistakes, as long as they are made in the right places
527 and at the right time. A mistake that causes lost productivity is seldom tolerated; however, a mistake
528 made in a developmental test lab is expected.
532 Here we look at common mistakes and misapprehensions that have been the subject of discussions
533 on the Samba mailing lists. Many of these are avoidable by doing your homework before attempting
534 a Samba implementation. Some are the result of a misunderstanding of the English language,
535 which has many phrases that are potentially vague and may be highly confusing
536 to those for whom English is not their native tongue.
540 <title>What Makes Samba a Domain Controller?</title>
543 <indexterm><primary>server-mode</primary></indexterm>
544 The &smb.conf; parameter <smbconfoption name="security">domain</smbconfoption> does not really make Samba behave
545 as a domain controller. This setting means we want Samba to be a domain member. See <link
546 linkend="samba-pdc">Samba as a PDC</link> for more information.
552 <title>What Makes Samba a Domain Member?</title>
555 Guess! So many others do. But whatever you do, do not think that <smbconfoption name="security">user</smbconfoption>
556 makes Samba act as a domain member. Read the manufacturer's manual before the warranty expires. See
557 <link linkend="domain-member">Domain Membership</link>, for more information.