summaryrefslogtreecommitdiff
path: root/docs/docbook/projdoc/ServerType.xml
blob: 8b567ca16f88626a7eafb318782cdee7e5cb69d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
<chapter id="ServerType">
<chapterinfo>
	&author.tridge;
	&author.jelmer;
	&author.jht;
</chapterinfo>

<title>Server Types and Security Modes</title>

<para>
This chapter provides information regarding the types of server that Samba may be
configured to be. A Microsoft network administrator who wishes to migrate to or to
use Samba will want to know what within a Samba context, terms familiar to MS Windows
adminstrator mean. This means that it is essential also to define how critical security
modes function BEFORE we get into the details of how to configure the server itself.
</para>

<para>
The chapter provides an overview of the security modes of which Samba is capable
and how these relate to MS Windows servers and clients.
</para>

<para>
Firstly we should recognise the question so often asked, "Why would I want to use Samba?"
So, in those chapters where the answer may be important you will see a section that highlights
features and benefits. These may be for or against Samba.
</para>

<sect1>
<title>Features and Benefits</title>

<para>
Two men were walking down a dusty road, when one suddenly kicked up a small red stone. It
hurt his toe and lodged in his sandle. He took the stone out and cursed it with a passion
and fury fitting his anguish. The other looked at the stone and said, that is a garnet - I
can turn that into a precious gem and some day it will make a princess very happy!
</para>

<para>
The moral of this tale: Two men, two very different perspectives regarding the same stone.
Like it or not, Samba is like that stone. Treated the right way and it can bring great
pleasure, but if you are forced upon it and have no time for it's secrets then it can be
a source of discomfort.
</para>

<para>
Samba started out as a project that sought to provide interoperability for MS Windows 3.x
clients with a Unix server. It has grown up a lot since it's humble beginnings and now provides
features and functionality fit for large scale deployment. It also has some warts. In sections
like this one we will tell of both.
</para>

<para>
So now, what are the benefits of features mentioned in this chapter?
</para>

<itemizedlist>
	<listitem><para>
	Samba-3 can replace an MS Windows NT4 Domain Controller
	</para></listitem>

	<listitem><para>
	Samba-3 offers excellent interoperability with MS Windows NT4
	style domains as well as natively with Microsoft Active
	Directory domains.
	</para></listitem>

	<listitem><para>
	Samba-3 permits full NT4 style Interdomain Trusts
	</para></listitem>

	<listitem><para>
	Samba has security modes that permit more flexible
	authentication than is possible with MS Windows NT4 Domain Controllers.
	</para></listitem>

	<listitem><para>
	Samba-3 permits use of multiple account database backends
	</para></listitem>

	<listitem><para>
	The account (password) database backends can be distributed
	and replicated using multiple methods. This gives Samba-3
	greater flexibility than MS Windows NT4 and in many cases a
	significantly higher utility than Active Directory domains
	with MS Windows 200x.
	</para></listitem>
</itemizedlist>

</sect1>

<sect1>
<title>Server Types</title>

<para>Adminstrators of Microsoft networks often refer to there being three
different type of servers:</para>

<itemizedlist>
	<listitem><para>Domain Controller</para>
		<itemizedlist>
			<listitem><para>Primary Domain Controller</para></listitem>
			<listitem><para>Backup Domain Controller</para></listitem>
			<listitem><para>ADS Domain Controller</para></listitem>
		</itemizedlist>
	</listitem>
	<listitem><para>Domain Member Server</para>
		<itemizedlist>
			<listitem><para>Active Directory Member Server</para></listitem>
			<listitem><para>NT4 Style Domain Member Server</para></listitem>
		</itemizedlist>
	</listitem>
	<listitem><para>Stand Alone Server</para></listitem>
</itemizedlist>

<para>
The chapters covering Domain Control, Backup Domain Control and Domain Membership provide
pertinent information regarding Samba-3 configuration for each of these server roles.
The reader is strongly encouraged to become intimately familiar with the information 
presented.
</para>

</sect1>

<sect1>
<title>Samba Security Modes</title>

<para>
In this section the function and purpose of Samba's <emphasis>security</emphasis>
modes are described. An acurate understanding of how Samba implements each security
mode as well as how to configure MS Windows clients for each mode will significantly
reduce user complaints and administrator heartache.
</para>

<para>
There are in the SMB/CIFS networking world only two types of security: <emphasis>USER Level</emphasis>
and <emphasis>SHARE Level</emphasis>. We refer to these collectively as <emphasis>security levels</emphasis>. In implementing these two <emphasis>security levels</emphasis> samba provides flexibilities
that are not available with Microsoft Windows NT4 / 200x servers. Samba knows of five (5)
ways that allow the security levels to be implemented. In actual fact, Samba implements
<emphasis>SHARE Level</emphasis> security only one way, but has for ways of implementing
<emphasis>USER Level</emphasis> security. Collectively, we call the samba implementations
<emphasis>Security Modes</emphasis>. These are: <emphasis>SHARE, USER, DOMAIN, ADS, and SERVER</emphasis>
modes. They are documented in this chapter.
</para>

<para>
A SMB server tells the client at startup what <emphasis>security level</emphasis>
it is running. There are two options <emphasis>share level</emphasis> and
<emphasis>user level</emphasis>. Which of these two the client receives affects
the way the client then tries to authenticate itself. It does not directly affect
(to any great extent) the way the Samba server does security. This may sound strange,
but it fits in with the client/server approach of SMB. In SMB everything is initiated
and controlled by the client, and the server can only tell the client what is
available and whether an action is allowed.
</para>

<sect2>
<title>User Level Security</title>

<para>
We will describe<emphasis>user level</emphasis> security first, as its simpler.
In <emphasis>user level</emphasis> security the client will send a
<emphasis>session setup</emphasis> command directly after the protocol negotiation.
This contains a username and password. The server can either accept or reject that
username/password combination. Note that at this stage the server has no idea what
share the client will eventually try to connect to, so it can't base the
<emphasis>accept/reject</emphasis> on anything other than:
</para>

<orderedlist>
<listitem><para>The username/password</para></listitem>
<listitem><para>The name of the client machine</para></listitem>
</orderedlist>

<para>
If the server accepts the username/password then the client expects to be able to
mount shares (using a <emphasis>tree connection</emphasis>) without specifying a
password. It expects that all access rights will be as the username/password
specified in the <emphasis>session setup</emphasis>.
</para>

<para>
It is also possible for a client to send multiple <emphasis>session setup</emphasis>
requests. When the server responds it gives the client a <emphasis>uid</emphasis> to use
as an authentication tag for that username/password. The client can maintain multiple
authentication contexts in this way (WinDD is an example of an application that does this).
</para>

<sect3>
<title>Example Configuration</title>

<para>
The &smb.conf; parameter that sets <emphasis>User Level Security</emphasis> is:
</para>

<para><programlisting>
	security = user
</programlisting></para>

<para>
This is the default setting since samba-2.2.x.
</para>

</sect3>

</sect2>
<sect2>
<title>Share Level Security</title>

<para>
Ok, now for share level security. In share level security the client authenticates
itself separately for each share. It will send a password along with each 
<emphasis>tree connection</emphasis> (share mount). It does not explicitly send a
username with this operation. The client is expecting a password to be associated
with each share, independent of the user. This means that samba has to work out what
username the client probably wants to use. It is never explicitly sent the username.
Some commercial SMB servers such as NT actually associate passwords directly with
shares in share level security, but samba always uses the unix authentication scheme
where it is a username/password pair that is authenticated, not a share/password pair.
</para>

<para>
To gain understanding of the MS Windows networking parallels to this, one should think
in terms of MS Windows 9x/Me where one can create a shared folder that provides read-only
or full access, with or without a password.
</para>

<para>
Many clients send a <emphasis>session setup</emphasis> even if the server is in share
level security. They normally send a valid username but no password. Samba records
this username in a list of <emphasis>possible usernames</emphasis>. When the client
then does a <emphasis>tree connection</emphasis> it also adds to this list the name
of the share they try to connect to (useful for home directories) and any users
listed in the <command>user =</command> &smb.conf; line. The password is then checked
in turn against these <emphasis>possible usernames</emphasis>. If a match is found
then the client is authenticated as that user.
</para>

<sect3>
<title>Example Configuration</title>

<para>
The &smb.conf; parameter that sets <emphasis>Share Level Security</emphasis> is:
</para>

<para><programlisting>
	security = share
</programlisting></para>

<para>
Plese note that there are reports that recent MS Widows clients do not like to work
with share mode security servers. You are strongly discouraged from use of this parameter.
</para>

</sect3>
</sect2>

<sect2>
<title>Domain Security Mode (User Level Security)</title>

<para>
When samba is operating in <emphasis>security = domain</emphasis> mode this means that
the Samba server has a domain security trust account (a machine account) and will cause
all authentication requests to be passed through to the domain controllers.
</para>

<sect3>
<title>Example Configuration</title>
<para><emphasis>
Samba as a Domain Member Server
</emphasis></para>

<para>
This method involves addition of the following parameters in the &smb.conf; file:
</para>

<para><programlisting>
        encrypt passwords = Yes
        security = domain
        workgroup = "name_of_NT_domain"
        password server = *
</programlisting></para>

<para>
The use of the "*" argument to <command>password server</command> will cause samba to locate the
domain controller in a way analogous to the way this is done within MS Windows NT.
This is the default behaviour.
</para>

<para>
In order for this method to work the Samba server needs to join the MS Windows NT
security domain. This is done as follows:
</para>

<itemizedlist>
        <listitem><para>On the MS Windows NT domain controller using
        the Server Manager add a machine account for the Samba server.
        </para></listitem>

        <listitem><para>Next, on the Unix/Linux system execute:</para>
	<para><programlisting>
        <command>smbpasswd -r PDC_NAME -j DOMAIN_NAME</command> (samba 2.x)

        <command>net join -U administrator%password</command>   (samba-3)
	</programlisting>
        </para>
	</listitem>
</itemizedlist>

<note><para>
As of Samba-2.2.4 the Samba 2.2.x series can auto-join a Windows NT4 style Domain just
by executing:
<programlisting>
	smbpasswd -j DOMAIN_NAME -r PDC_NAME -U Administrator%password
</programlisting>

As of Samba-3 the same can be done by executing:
<programlisting>
	net join -U Administrator%password
</programlisting>
It is not necessary with Samba-3 to specify the DOMAIN_NAME or the PDC_NAME as it figures this
out from the smb.conf file settings.
</para></note>

<para>
Use of this mode of authentication does require there to be a standard Unix account
for the user in order to assign a uid once the account has been authenticated by
the remote Windows DC.  This account can be blocked to prevent logons by clients other than
MS Windows through things such as setting an invalid shell in the
<filename>/etc/passwd</filename> entry.
</para>

<para>
An alternative to assigning UIDs to Windows users on a Samba member server is
presented in the <link linkend="winbind">Winbind Overview</link> chapter
in this HOWTO collection.
</para>

</sect3>
</sect2>

<sect2>
<title>ADS Security Mode (User Level Security)</title>

<para>
Samba-2.2.x could join and Active Directory domain so long as the Active Directory domain
controller is configured for mixed mode operation, and is running NetBIOS over TCP/IP. MS
Windows 2000 and later can be configured to run without NetBIOS over TCP/IP, instead it
can run SMB natively over TCP/IP.
</para>

<para>
The ability to natively join an Active Directory domain requires the use of Kerberos
based authentication. The Kerberos protocols have been extended by Microsoft so that
a plain MIT Kerberos, or a Heimdal client is not sufficient. Samba-3 now has the ability
to be a native Active Directory member server.
</para>

<sect3>
<title>Example Configuration</title>

<para>
<programlisting>
	realm = your.kerberos.REALM
	security = ADS
	encrypt passwords = Yes

The following parameter may be required:

	ads server = your.kerberos.server
</programlisting>
</para>

<para>
Please refer to the Domain Membership section, Active Directory Membership for more information
regarding this configuration option.
</para>

</sect3>
</sect2>

<sect2>
<title>Server Security (User Level Security)</title>

<para>
Server level security is a left over from the time when Samba was not capable of acting
as a domain member server. It is highly recommended NOT to use this feature. Server level
security has many draw backs. The draw backs include:
</para>

<itemizedlist>
	<listitem><para>Potential Account Lockout on MS Windows NT4/200x password servers</para></listitem>
	<listitem><para>Lack of assurance that the password server is the one specified</para></listitem>
	<listitem><para>Does not work with Winbind, particularly needed when storing profiles remotely</para></listitem>
	<listitem><para>This mode may open connections to the password server, and keep them open for extended periods.</para></listitem>
	<listitem><para>Security on the samba server breaks badly when the remote password server suddenly shuts down</para></listitem>
	<listitem><para>With this mode there is NO security account in the domain that the password server belongs to for the samba server.</para></listitem>
</itemizedlist>

<para>
In server level security the samba server reports to the client that it is in user level
security. The client then does a <emphasis>session setup</emphasis> as described earlier.
The samba server takes the username/password that the client sends and attempts to login to the
<emphasis>password server</emphasis> by sending exactly the same username/password that
it got from the client. If that server is in user level security and accepts the password
then samba accepts the clients connection. This allows the samba server to use another SMB
server as the <emphasis>password server</emphasis>.
</para>

<para>
You should also note that at the very start of all this, where the server tells the client
what security level it is in, it also tells the client if it supports encryption. If it
does then it supplies the client with a random cryptkey. The client will then send all
passwords in encrypted form. Samba supports this type of encryption by default.
</para>

<para>
The parameter <emphasis>security = server</emphasis> means that Samba reports to clients that
it is running in <emphasis>user mode</emphasis> but actually passes off all authentication
requests to another <emphasis>user mode</emphasis> server. This requires an additional
parameter <emphasis>password server</emphasis> that points to the real authentication server.
That real authentication server can be another Samba server or can be a Windows NT server,
the later natively capable of encrypted password support.
</para>

<note><para>
When Samba is running in <emphasis>server level</emphasis> security it is essential that
the parameter <emphasis>password server</emphasis> is set to the precise netbios machine
name of the target authentication server. Samba can NOT determine this from NetBIOS name
lookups because the choice of the target authentication server arbitrary and can not
be determined from a domain name. In essence a samba server that is in
<emphasis>server level</emphasis> security is operating in what used to be known as
workgroup mode.
</para></note>

<note><para>
<emphasis>Server level</emphasis> security is incompatible with the newer security features
in recent MS Windows networking protocols. In particular it is incompatible with NTLMv2.
Server Mode security also breaks Sign and Seal interoperability because only a domain member
can sign packets in the manner in which it is currently implemented in Samba-3. 
If you chose to use Server Mode security this means it is necessary to disable Sign and Seal
on all workstations.
</para></note>

<sect3>
<title>Example Configuration</title>
<para><emphasis>
Using MS Windows NT as an authentication server
</emphasis></para>

<para>
This method involves the additions of the following parameters in the &smb.conf; file:
</para>

<para><programlisting>
        encrypt passwords = Yes
        security = server
        password server = "NetBIOS_name_of_a_DC"
</programlisting></para>


<para>
There are two ways of identifying whether or not a username and password pair was valid
or not. One uses the reply information provided as part of the authentication messaging
process, the other uses just an error code.
</para>

<para>
The down-side of this mode of configuration is the fact that for security reasons Samba
will send the password server a bogus username and a bogus password and if the remote
server fails to reject the username and password pair then an alternative mode of
identification of validation is used. Where a site uses password lock out after a
certain number of failed authentication attempts this will result in user lockouts.
</para>

<para>
Use of this mode of authentication does require there to be a standard Unix account
for the user, this account can be blocked to prevent logons by other than MS Windows clients.
</para>

</sect3>
</sect2>

</sect1>

<sect1>
<title>Seamless Windows Network Integration</title>

<para>
MS Windows clients may use encrypted passwords as part of a challenege/response
authentication model (a.k.a. NTLMv1 and NTLMv2) or alone, or clear text strings for simple
password based authentication. It should be realized that with the SMB protocol
the password is passed over the network either in plain text or encrypted, but
not both in the same authentication request.
</para>

<para>
When encrypted passwords are used a password that has been entered by the user
is encrypted in two ways:
</para>

<itemizedlist>
        <listitem><para>An MD4 hash of the UNICODE of the password
        string.  This is known as the NT hash.
        </para></listitem>

        <listitem><para>The password is converted to upper case,
        and then padded or trucated to 14 bytes.  This string is
        then appended with 5 bytes of NULL characters and split to
        form two 56 bit DES keys to encrypt a "magic" 8 byte value.
        The resulting 16 bytes for the LanMan hash.
        </para></listitem>
</itemizedlist>

<para>
MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x and version 4.0
pre-service pack 3 will use either mode of password authentication. All
versions of MS Windows that follow these versions no longer support plain
text passwords by default.
</para>

<para>
MS Windows clients have a habit of dropping network mappings that have been idle
for 10 minutes or longer. When the user attempts to use the mapped drive
connection that has been dropped, the client re-establishes the connection using
a cached copy of the password.
</para>

<para>
When Microsoft changed the default password mode, support was dropped for caching
of the plain text password. This means that when the registry parameter is changed
to re-enable use of plain text passwords it appears to work, but when a dropped
service connection mapping attempts to revalidate it will fail if the remote
authentication server does not support encrypted passwords.  This means that it
is definitely not a good idea to re-enable plain text password support in such clients.
</para>

<para>
The following parameters can be used to work around the issue of Windows 9x client
upper casing usernames and password before transmitting them to the SMB server
when using clear text authentication.
</para>

<para><programlisting>
        <ulink url="smb.conf.5.html#PASSWORDLEVEL">passsword level</ulink> = <replaceable>integer</replaceable>
        <ulink url="smb.conf.5.html#USERNAMELEVEL">username level</ulink> = <replaceable>integer</replaceable>
</programlisting></para>

<para>
By default Samba will lower case the username before attempting to lookup the user
in the database of local system accounts.  Because UNIX usernames conventionally
only contain lower case character, the <parameter>username level</parameter> parameter
is rarely needed.
</para>

<para>
However, passwords on UNIX systems often make use of mixed case characters.
This means that in order for a user on a Windows 9x client to connect to a Samba
server using clear text authentication, the <parameter>password level</parameter>
must be set to the maximum number of upper case letter which <emphasis>could</emphasis>
appear is a password.  Note that the server OS uses the traditional DES version
of crypt(), a <parameter>password level</parameter> of 8 will result in case
insensitive passwords as seen from Windows users.  This will also result in longer
login times as Samba has to compute the permutations of the password string and
try them one by one until a match is located (or all combinations fail).
</para>

<para>
The best option to adopt is to enable support for encrypted passwords where ever
Samba is used. Most attempts to apply the registry change to re-enable plain text
passwords will eventually lead to user complaints and unhappiness.
</para>

</sect1>

<sect1>
<title>Common Errors</title>

<para>
We all make mistakes. It is Ok to make mistakes, so long as they are made in the right places
and at the right time. A mistake that causes lost productivity is seldom tollerated. A mistake
made in a developmental test lab is expected.
</para>

<para>
Here we look at common mistakes and misapprehensions that have been the subject of discussions
on the samba mailing lists. Many of these are avoidable by doing you homework before attempting
a Samba implementation. Some are the result of misundertanding of the English language. The
English language has many terms of phrase that are potentially vague and may be highly confusing
to those for whom English is not their native tongue.
</para>

<sect2>
<title>What makes Samba a SERVER?</title>

<para>
To some the nature of the samba <emphasis>security</emphasis> mode is very obvious, but entirely
wrong all the same. It is assumed that <emphasis>security = server</emphasis> means that Samba
will act as a server. Not so! See above - this setting means that samba will <emphasis>try</emphasis>
to use another SMB server as it's source of user authentication alone.
</para>

</sect2>

<sect2>
<title>What makes Samba a Domain Controller?</title>

<para>
The &smb.conf; parameter <emphasis>security = domain</emphasis> does NOT really make Samba behave
as a Domain Controller! This setting means we want samba to be a domain member!
</para>

</sect2>

<sect2>
<title>What makes Samba a Domain Member?</title>

<para>
Guess! So many others do. But whatever you do, do NOT think that <emphasis>security = user</emphasis>
makes Samba act as a domain member. Read the manufacturers manual before the warranty expires!
</para>

</sect2>

</sect1>

</chapter>