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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
<chapter id="ServerType">
<chapterinfo>
&author.tridge;
&author.jelmer;
&author.jht;
</chapterinfo>
<title>Server Types and Security Modes</title>
<para>
<indexterm><primary>migrate</primary></indexterm>
<indexterm><primary>security mode</primary></indexterm>
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 use Samba will want to know the meaning, within a
Samba context, of terms familiar to the MS Windows administrator. 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>
This chapter provides an overview of the security modes of which Samba is capable and how they relate to MS
Windows servers and clients.
</para>
<para>
A question often asked is, <quote>Why would I want to use Samba?</quote> Most chapters contain a section that
highlights features and benefits. We hope that the information provided will help to answer this question. Be
warned though, we want to be fair and reasonable, so not all features are positive toward Samba. The benefit
may be on the side of our competition.
</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 sandal. He took the stone out and cursed it with a passion
and fury befitting his anguish. The other looked at the stone and said, <quote>This is a garnet.
I can turn that into a precious gem and some day it will make a princess very happy!</quote>
</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. Treat it the right way and it can bring great
pleasure, but if you are forced to use it and have no time for its secrets, then it can be
a source of discomfort.
</para>
<para>
<indexterm><primary>UNIX</primary><secondary>server</secondary></indexterm>
<indexterm><primary>interoperability</primary></indexterm>
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 its humble beginnings and now provides
features and functionality fit for large-scale deployment. It also has some warts. In sections
like this one, we tell of both.
</para>
<para>
So, what are the benefits of the features mentioned in this chapter?
</para>
<itemizedlist>
<listitem><para>
<indexterm><primary>domain</primary><secondary>controller</secondary></indexterm>
Samba can replace an MS Windows NT4 domain controller.
</para></listitem>
<listitem><para>
<indexterm><primary>active directory</primary></indexterm>
Samba offers excellent interoperability with MS Windows NT4-style
domains as well as natively with Microsoft Active Directory domains.
</para></listitem>
<listitem><para>
<indexterm><primary>interdomain</primary><secondary>trustrs</secondary></indexterm>
Samba permits full NT4-style interdomain trusts.
</para></listitem>
<listitem><para>
<indexterm><primary>authentication</primary></indexterm>
<indexterm><primary>security</primary><secondary>modes</secondary></indexterm>
Samba has security modes that permit more flexible authentication
than is possible with MS Windows NT4 domain controllers.
</para></listitem>
<listitem><para>
<indexterm><primary>account</primary><secondary>database</secondary><tertiary>backends</tertiary></indexterm>
<indexterm><primary>encrypted</primary></indexterm>
Samba permits use of multiple account database backends.
(Encrypted passwords that are stored in the account database are in
formats that are unique to Windows networking).
</para></listitem>
<listitem><para>
<indexterm><primary>replicated</primary></indexterm>
The account database backends can be distributed
and replicated using multiple methods. This gives Samba
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>
<indexterm><primary>Server Type</primary></indexterm>
Administrators of Microsoft networks often refer to three different types of servers:
</para>
<itemizedlist>
<listitem><para>Domain Controller</para>
<itemizedlist>
<listitem><para>Primary Domain Controller (PDC)</para></listitem>
<listitem><para>Backup Domain Controller (BDC)</para></listitem>
<listitem><para>ADS Domain Controller</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>Domain Member Server</para>
<itemizedlist>
<listitem><para>Active Directory Domain Server</para></listitem>
<listitem><para>NT4 Style Domain Domain Server</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>Standalone Server</para></listitem>
</itemizedlist>
<para>
<indexterm><primary>domain</primary><secondary>control</secondary></indexterm>
<indexterm><primary>domain</primary><secondary>member</secondary></indexterm>
<indexterm><primary>domain control</primary><secondary>primary</secondary></indexterm>
<indexterm><primary>domain control</primary><secondary>backup</secondary></indexterm>
The chapters covering domain control (<link linkend="samba-pdc">Domain Control</link>),
backup domain control (<link linkend="samba-bdc">Backup Domain Control</link>), and
domain membership (<link linkend="domain-member">Domain Membership</link>) provide
pertinent information regarding Samba configuration for each of these server roles.
You are strongly encouraged to become intimately familiar with these chapters because
they lay the foundation for deployment of Samba domain security.
</para>
<para>
<indexterm><primary>standalone</primary></indexterm>
A Standalone server is autonomous in respect of the source of its account backend.
Refer to <link linkend="StandAloneServer">Standalone Servers</link> to gain a wider appreciation
of what is meant by a server being configured as a <emphasis>standalone</emphasis> server.
</para>
</sect1>
<sect1>
<title>Samba Security Modes</title>
<para>
<indexterm><primary>Security Mode</primary></indexterm>
<indexterm><primary>security</primary></indexterm>
In this section, the function and purpose of Samba's security modes are described. An accurate 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>
<indexterm><primary>Server Message Block</primary><see>SMB</see></indexterm>
<indexterm><primary>Common Internet Filesystem</primary><see>CIFS</see></indexterm>
Microsoft Windows networking uses a protocol that was originally called the Server Message Block (SMB)
protocol. Since some time around 1996 the protocol has been better known as the Common Internet Filesystem
(CIFS) protocol.
</para>
<para>
<indexterm><primary>security levels</primary></indexterm>
<indexterm><primary>security modes</primary></indexterm>
<indexterm><primary>user-level</primary></indexterm>
Samba has three ways of implementing <emphasis>user-level</emphasis> security. Collectively, we call the Samba
implementations of the security levels <emphasis>security modes</emphasis>. They are known as
<emphasis>user</emphasis>, <emphasis>domain</emphasis> and
<emphasis>ADS</emphasis> modes. They are documented in this chapter.
</para>
<para>
The term <literal>client</literal> refers to all agents whether it is a Windows workstation, a Windows server,
another Samba server, or any vanilla SMB or CIFS client application (e.g., <command>smbclient</command>) that
make use of services provided by an SMB/CIFS server.
</para>
<sect2>
<title>User Level Security</title>
<para>
<indexterm><primary>user-level</primary></indexterm>
We describe user-level security first because its simpler. In user-level security, the client sends a session
setup request directly following protocol negotiation. This request provides a username and password. The
server can either accept or reject that username/password combination. 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>
<indexterm><primary>credentials</primary></indexterm>
If the server accepts the username/password credentials, the client expects to be able to mount shares (using
a <emphasis>tree connection</emphasis>) without further specifying a password. It expects that all access
rights will be as the username/password credentials set that was specified in the initial <emphasis>session
setup</emphasis>.
</para>
<para>
<indexterm><primary>session setup</primary></indexterm>
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>
<para>
<indexterm><primary>LanManager</primary></indexterm>
<indexterm><primary>case-preserving</primary></indexterm>
<indexterm><primary>case-insensitive</primary></indexterm>
<indexterm><primary>upper-case</primary></indexterm>
<indexterm><primary>lower-case</primary></indexterm>
Windows networking user account names are case-insensitive, meaning that upper-case and lower-case characters
in the account name are considered equivalent. They are said to be case-preserving, but not case significant.
Windows and LanManager systems previous to Windows NT version 3.10 have case-insensitive passwords that were
not necessarily case-preserving. All Windows NT family systems treat passwords as case-preserving and
case-sensitive.
</para>
<sect3>
<title>Example Configuration</title>
<para>
The &smb.conf; parameter that sets user-level security is:
</para>
<para><smbconfblock>
<smbconfoption name="security">user</smbconfoption>
</smbconfblock></para>
<para>
This is the default setting since Samba-2.2.x.
</para>
</sect3>
</sect2>
<sect2>
<title>Domain Security Mode (User-Level Security)</title>
<para>
<indexterm><primary>domain</primary><secondary>controllers</secondary></indexterm>
<indexterm><primary>security</primary><secondary>controllers</secondary></indexterm>
<indexterm><primary>PDC</primary></indexterm>
<indexterm><primary>BDC</primary></indexterm>
<indexterm><primary>logon</primary></indexterm>
<indexterm><primary>authentication</primary></indexterm>
Domain security provides a mechanism for storing all user and group accounts in a central, shared, account
repository. The centralized account repository is shared between domain (security) controllers. Servers that
act as domain controllers provide authentication and validation services to all machines that participate in
the security context for the domain. A primary domain controller (PDC) is a server that is responsible for
maintaining the integrity of the security account database. Backup domain controllers (BDCs) provide only domain
logon and authentication services. Usually, BDCs will answer network logon requests more responsively than
will a PDC.
</para>
<para>
<indexterm><primary>domain member</primary></indexterm>
<indexterm><primary>trust account</primary></indexterm>
<indexterm><primary>trust</primary><secondary>account</secondary></indexterm>
<indexterm><primary>domain</primary><secondary>security</secondary></indexterm>
<indexterm><primary>domain</primary><secondary>controller</secondary></indexterm>
When Samba is operating in <smbconfoption name="security">domain</smbconfoption> mode, the Samba server has a
domain security trust account (a machine account) and causes all authentication requests to be passed through
to the domain controllers. In other words, this configuration makes the Samba server a domain member server,
even when it is in fact acting as a domain controller. All machines that participate in domain security must
have a machine account in the security database.
</para>
<para>
<indexterm><primary>account</primary><secondary>database</secondary></indexterm>
<indexterm><primary>machine</primary><secondary>account</secondary></indexterm>
<indexterm><primary>NetBIOS</primary><secondary>name</secondary></indexterm>
<indexterm><primary>NetBIOS</primary></indexterm>
Within the domain security environment, the underlying security architecture uses user-level security. Even
machines that are domain members must authenticate on startup. The machine account consists of an account
entry in the accounts database, the name of which is the NetBIOS name of the machine and of which the password
is randomly generated and known to both the domain controllers and the member machine. If the machine account
cannot be validated during startup, users will not be able to log on to the domain using this machine because
it cannot be trusted. The machine account is referred to as a machine trust account.
</para>
<para>
There are three possible domain member configurations:
</para>
<orderedlist>
<listitem><para>Primary domain controller (PDC) - of which there is one per domain.</para></listitem>
<listitem><para>Backup domain controller (BDC) - of which there can be any number per domain.</para></listitem>
<listitem><para>Domain member server (DMS) - of which there can be any number per domain.</para></listitem>
</orderedlist>
<para>
<indexterm><primary>DMS</primary></indexterm>
We will discuss each of these in separate chapters. For now, we are most interested in basic DMS
configuration.
</para>
<sect3>
<title>Example Configuration</title>
<para><emphasis>
Samba as a Domain Member Server
</emphasis></para>
<para>
<indexterm><primary>server type</primary><secondary>domain member</secondary></indexterm>
This method involves addition of the following parameters in the &smb.conf; file:
<smbconfblock>
<smbconfoption name="security">domain</smbconfoption>
<smbconfoption name="workgroup">&example.workgroup;</smbconfoption>
</smbconfblock>
</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:
<indexterm><primary>net</primary><secondary>rpc</secondary></indexterm>
<indexterm><primary>Domain Member</primary><secondary>joining</secondary></indexterm>
</para>
<procedure>
<step><para>On the UNIX/Linux system execute:</para>
<para><screen>&rootprompt;<userinput>net rpc join -U administrator%password</userinput></screen></para>
</step>
</procedure>
<para>
<indexterm><primary>invalid shell</primary></indexterm>
<indexterm><primary>/etc/passwd</primary></indexterm>
<indexterm><primary>/bin/false</primary></indexterm>
Use of this mode of authentication requires there to be a standard UNIX account for each user in order to
assign a UID once the account has been authenticated by the Windows domain controller. This account can be
blocked to prevent logons by clients other than MS Windows through means such as setting an invalid shell in
the <filename>/etc/passwd</filename> entry. The best way to allocate an invalid shell to a user account is to
set the shell to the file <filename>/bin/false</filename>.
</para>
<para>
<indexterm><primary>PDC</primary></indexterm>
<indexterm><primary>BDC</primary></indexterm>
Domain controllers can be located anywhere that is convenient. The best advice is to have a BDC on every
physical network segment, and if the PDC is on a remote network segment the use of WINS (see <link
linkend="NetworkBrowsing">Network Browsing</link> for more information) is almost essential.
</para>
<para>
An alternative to assigning UIDs to Windows users on a Samba member server is presented in <link
linkend="winbind">Winbind</link>, <link linkend="winbind">Winbind: Use of Domain Accounts</link>.
</para>
<para>
For more information regarding domain membership, <link linkend="domain-member">Domain Membership</link>.
</para>
</sect3>
</sect2>
<sect2>
<title>ADS Security Mode (User-Level Security)</title>
<para>
<indexterm><primary>ADS</primary></indexterm>
<indexterm><primary>native mode</primary></indexterm>
Samba can join an Active Directory domain using NT4 style RPC based security. This is
possible if the domain is run in native mode. Active Directory in native mode perfectly allows NT4-style
domain members. This is contrary to popular belief.
</para>
<para>
If you are using Active Directory, starting with Samba you can join as a native AD member. Why would you
want to do that? Your security policy might prohibit the use of NT-compatible authentication protocols. All
your machines are running Windows 2000 and above and all use Kerberos. In this case, Samba, as an NT4-style
domain, would still require NT-compatible authentication data. Samba in AD-member mode can accept Kerberos
tickets.
</para>
<para>
<indexterm><primary>realm</primary></indexterm>
<indexterm><primary>mixed mode</primary></indexterm>
Sites that use Microsoft Windows active directory services (ADS) should be aware of the significance of the
terms: <literal>native mode</literal> and <literal>mixed mode</literal> ADS operation. The term
<literal>realm</literal> is used to describe a Kerberos-based security architecture (such as is used by
Microsoft ADS).
</para>
<sect3>
<title>Example Configuration</title>
<para><smbconfblock>
<smbconfoption name="realm">your.kerberos.REALM</smbconfoption>
<smbconfoption name="security">ADS</smbconfoption>
</smbconfblock></para>
<para>
The following parameter may be required:
</para>
<para><smbconfblock>
<smbconfoption name="password server">your.kerberos.server</smbconfoption>
</smbconfblock></para>
<para>
Please refer to <link linkend="domain-member">Domain Membership</link>, and <link linkend="ads-member">Samba
ADS Domain Membership</link> for more information regarding this configuration option.
</para>
</sect3>
</sect2>
</sect1>
<sect1>
<title>Password Checking</title>
<para>
MS Windows clients may use encrypted passwords as part of a challenge/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 plaintext or encrypted, but
not both in the same authentication request.
</para>
<para>
<indexterm><primary>encrypted passwords</primary></indexterm>
<indexterm><primary>encrypted</primary></indexterm>
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 uppercase,
and then padded or truncated 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 form the LanMan hash.
</para></listitem>
</itemizedlist>
<para>
<indexterm><primary>plain-text</primary><secondary>passwords</secondary></indexterm>
MS Windows 95 pre-service pack 1 and 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>
<indexterm><primary>cached</primary><secondary>password</secondary></indexterm>
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 plaintext password. This means that when the registry parameter is changed
to re-enable use of plaintext passwords, it appears to work, but when a dropped
service connection mapping attempts to revalidate, this will fail if the remote
authentication server does not support encrypted passwords. It is definitely not
a good idea to re-enable plaintext password support in such clients.
</para>
<para>
The following parameters can be used to work around the issue of Windows 9x/Me clients
uppercasing usernames and passwords before transmitting them to the SMB server
when using clear-text authentication:
</para>
<?latex \newpage ?>
<smbconfblock>
<smbconfoption name="username level"><replaceable>integer</replaceable></smbconfoption>
</smbconfblock>
<para>
By default Samba will convert to lowercase the username before attempting to lookup the user
in the database of local system accounts. Because UNIX usernames conventionally
only contain lowercase characters, the <smbconfoption name="username-level"/> parameter
is rarely needed.
</para>
<para>
<indexterm><primary>clear-text</primary></indexterm>
However, passwords on UNIX systems often make use of mixed-case characters. This means that in order for a
user on a Windows 9x/Me client to connect to a Samba server using clear-text authentication, the
password must be in lower case.
</para>
<para>
The best option to adopt is to enable support for encrypted passwords wherever
Samba is used. Most attempts to apply the registry change to re-enable plaintext
passwords will eventually lead to user complaints and unhappiness.
</para>
</sect1>
<sect1>
<title>Common Errors</title>
<para>
We all make mistakes. It is okay to make mistakes, as long as they are made in the right places
and at the right time. A mistake that causes lost productivity is seldom tolerated; however, 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 your homework before attempting
a Samba implementation. Some are the result of a misunderstanding of the English language,
which has many phrases 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 Domain Controller?</title>
<para>
<indexterm><primary>server-mode</primary></indexterm>
The &smb.conf; parameter <smbconfoption name="security">domain</smbconfoption> does not really make Samba behave
as a domain controller. This setting means we want Samba to be a domain member. See <link
linkend="samba-pdc">Samba as a PDC</link> for more information.
</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 <smbconfoption name="security">user</smbconfoption>
makes Samba act as a domain member. Read the manufacturer's manual before the warranty expires. See
<link linkend="domain-member">Domain Membership</link>, for more information.
</para>
</sect2>
</sect1>
</chapter>
|