&author.tridge; &author.jelmer; &author.jht; Server Types and Security Modes migrate security mode 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. This chapter provides an overview of the security modes of which Samba is capable and how they relate to MS Windows servers and clients. A question often asked is, Why would I want to use Samba? 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. Features and Benefits 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, This is a garnet. I can turn that into a precious gem and some day it will make a princess very happy! 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. UNIXserver interoperability 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. So, what are the benefits of the features mentioned in this chapter? domaincontroller Samba-3 can replace an MS Windows NT4 domain controller. active directory Samba-3 offers excellent interoperability with MS Windows NT4-style domains as well as natively with Microsoft Active Directory domains. interdomaintrustrs Samba-3 permits full NT4-style interdomain trusts. authentication securitymodes Samba has security modes that permit more flexible authentication than is possible with MS Windows NT4 domain controllers. accountdatabasebackends encrypted Samba-3 permits use of multiple concurrent account database backends. (Encrypted passwords that are stored in the account database are in formats that are unique to Windows networking). replicated The account 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. Server Types Server Type Administrators of Microsoft networks often refer to three different types of servers: Domain Controller Primary Domain Controller (PDC) Backup Domain Controller (BDC) ADS Domain Controller Domain Member Server Active Directory Domain Server NT4 Style Domain Domain Server Standalone Server domaincontrol domainmember domain controlprimary domain controlbackup The chapters covering domain control (Domain Control), backup domain control (Backup Domain Control), and domain membership (Domain Membership) 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. standalone A Standalone server is autonomous in respect of the source of its account backend. Refer to Standalone Servers to gain a wider appreciation of what is meant by a server being configured as a standalone server. Samba Security Modes Security Mode security 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. Server Message BlockSMB Common Internet FilesystemCIFS 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. security levels security modes user-level Samba has three ways of implementing user-level security. Collectively, we call the Samba implementations of the security levels security modes. They are known as user, domain and ADS modes. They are documented in this chapter. The term client 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., smbclient) that make use of services provided by an SMB/CIFS server. User Level Security user-level 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 accept/reject on anything other than: the username/password. the name of the client machine. credentials If the server accepts the username/password credentials, the client expects to be able to mount shares (using a tree connection) 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 session setup. session setup It is also possible for a client to send multiple session setup requests. When the server responds, it gives the client a uid 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). LanManager case-preserving case-insensitive upper-case lower-case 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. Example Configuration The &smb.conf; parameter that sets user-level security is: user This is the default setting since Samba-2.2.x. Domain Security Mode (User-Level Security) domaincontrollers securitycontrollers PDC BDC logon authentication 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. domain member trust account trustaccount domainsecurity domaincontroller When Samba is operating in domain 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. accountdatabase machineaccount NetBIOSname NetBIOS 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. There are three possible domain member configurations: Primary domain controller (PDC) - of which there is one per domain. Backup domain controller (BDC) - of which there can be any number per domain. Domain member server (DMS) - of which there can be any number per domain. DMS We will discuss each of these in separate chapters. For now, we are most interested in basic DMS configuration. Example Configuration Samba as a Domain Member Server server typedomain member This method involves addition of the following parameters in the &smb.conf; file: domain &example.workgroup; In order for this method to work, the Samba server needs to join the MS Windows NT security domain. This is done as follows: netrpc Domain Memberjoining On the UNIX/Linux system execute: &rootprompt;net rpc join -U administrator%password invalid shell /etc/passwd /bin/false 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 /etc/passwd entry. The best way to allocate an invalid shell to a user account is to set the shell to the file /bin/false. PDC BDC 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 Network Browsing for more information) is almost essential. An alternative to assigning UIDs to Windows users on a Samba member server is presented in Winbind, Winbind: Use of Domain Accounts. For more information regarding domain membership, Domain Membership. ADS Security Mode (User-Level Security) ADS native mode 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. If you are using Active Directory, starting with Samba-3 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. realm mixed mode Sites that use Microsoft Windows active directory services (ADS) should be aware of the significance of the terms: native mode and mixed mode ADS operation. The term realm is used to describe a Kerberos-based security architecture (such as is used by Microsoft ADS). Example Configuration your.kerberos.REALM ADS The following parameter may be required: your.kerberos.server Please refer to Domain Membership, and Samba ADS Domain Membership for more information regarding this configuration option. Password Checking 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. encrypted passwords encrypted When encrypted passwords are used, a password that has been entered by the user is encrypted in two ways: An MD4 hash of the unicode of the password string. This is known as the NT hash. 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. plain-textpasswords 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. cachedpassword 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. 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. 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: integer 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 parameter is rarely needed. clear-text 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. 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. Common Errors 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. 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. What Makes Samba a Domain Controller? server-mode The &smb.conf; parameter domain does not really make Samba behave as a domain controller. This setting means we want Samba to be a domain member. See Samba as a PDC for more information. What Makes Samba a Domain Member? Guess! So many others do. But whatever you do, do not think that user makes Samba act as a domain member. Read the manufacturer's manual before the warranty expires. See Domain Membership, for more information.