%global_entities; ]> &author.jht; Identity Mapping (IDMAP) THIS IS A WORK IN PROGRESS - it is a preparation for the release of Samba-3.0.8. The Microsoft Windows operating system has a number of features that impose specific challenges to interoperability with operating system on which Samba is implemented. This chapter deals explicitly with the mechanisms Samba-3 (version 3.0.8 and later) uses to overcome one of the key challenges in the integration of Samba servers into an MS Windows networking environment. This chapter deals with IDentity MAPping (IDMAP) of Windows Security IDentifiers (SIDs) to UNIX UIDs and GIDs. To ensure good sufficient coverage each possible Samba deployment type will be discussed. This is followed by an overview of how the IDMAP facility may be implemented. The IDMAP facility is usually of concern where more than one Samba server (or Samba network client) is installed in the one Domain. Where there is a single Samba server do not be too concerned regarding the IDMAP infrastructure - the default behavior of Samba is nearly always sufficient. The use of IDMAP is important where the Samba server will be accessed by workstations or servers from more than one domain, in which case it is important to run winbind so it can handle the resolution (ID mapping) of foreign SIDs to local UNIX UIDs and GIDs. The use of the IDMAP facility requires that the winbindd be executed on Samba start-up. Samba Server Deployment Types There are four (4) basic server deployment types, as documented in the chapter on Server Types and Security Modes. Stand-Alone Samba Server A stand-alone Samba server is an implementation that is not a member of a Windows NT4 Domain, a Windows 200X Active Directory Domain, or of a Samba Domain. By definition, this means that users and groups will be created and controlled locally and the identity of a network user must match a local UNIX/Linux user login. The IDMAP facility is therefore of little to no interest, winbind will not be necessary, and the IDMAP facility will not be relevant or of interest. Domain Member Server or Domain Member Client Samba-3 can act as a Windows NT4 PDC or BDC thereby providing domain control protocols that are compatible with Windows NT4. Samba-3 file and print sharing protocols are compatible with all version of Microsoft Windows products. Windows NT4, as with Microsoft Active Directory, i extensively makes use of Windows security identifiers (SIDs). Samba-3 Domain Member servers and clients must interact correctly with MS Windows SIDs. Incoming Windows SIDs must be translated to local UNIX UIDs and GIDs. Outgoing information from the Samba server must provide to MS Windows clients and servers appropriate SIDs. A Samba member of a Windows networking domain (NT4-style or ADS) can be configured to handle identity mapping in a variety of ways. The mechanism is will use depends on whether or not the winbindd daemon is used, and how the winbind functionality is configured. The configuration options are briefly described here: Winbind is not used, users and groups are local: &smbmdash; Where winbindd is not used Samba (smbd) uses the underlying UNIX/Linux mechanisms to resolve the identity of incoming network traffic. This will be done using the LoginID (account name) in the session setup request and passing it to the getpwnam() system function call. This call is implemented using the name service switch (NSS) mechanism on modern UNIX/Linux systems. By saying users and groups are local we are implying that they are stored only on the local system, in the /etc/passwd and /etc/group respectively. For example, if an incoming SessionSetupAndX request is owned by the user BERYLIUM\WambatW, a system call will be made to look up the user WambatW in the /etc/paswwd file. This configuration may be used with stand-alone Samba servers, Domain Member servers (NT4 or ADS), and may be used for a PDC that uses either an smbpasswd or a tdbsam based Samba passdb backend. Winbind is not used, users and groups resolved via NSS: &smbmdash; In this situation user and group accounts are treated as if they are local accounts, the only way in which this differs from having local accounts is that the accounts are stored in a repository that can be shared. In practice this means that they will reside in either a NIS type database or else in LDAP. This configuration may be used with stand-alone Samba servers, Domain Member servers (NT4 or ADS), and may be used for a PDC that uses either an smbpasswd or a tdbsam based Samba passdb backend. Winbind/NSS with the default local IDMAP table: &smbmdash; There are many sites that require only a simple Samba server, or a single Samba server that is a member of a Windows NT4 Domain or an ADS Domain. A typical example is an appliance like file server on which no local accounts are configured and winbind is used to obtain account credentials from the domain controllers for the domain. The domain control can be provided by Samba-3, MS Windows NT4 or MS Windows Active Directory. Winbind is a great convenience in this situation. All that is needed is a range of UID numbers and GID numbers that can be defined in the &smb.conf; file, the /etc/nsswitch.conf file is configued to use winbind which does all the difficult work of mapping incoming SIDs to appropriate UIDs and GIDs. The SIDs are allocated a UID/GID in the order in which winbind receives them. This configuration is not convenient or practical in sites that have more than one Samba server and that require the same UID or GID for the same user or group across all servers. One of the hazards of this method is that in the event that the winbind IDMAP file may become corrupted or lost, the repaired or rebuilt IDMAP file may allocate UIDs and GIDs to differing users and groups from what was there previously with the result that MS Windows files that are stored on the Samba server may now not belong to to rightful owner. Winbind with an NSS/LDAP backend based IDMAP facility: &smbmdash; In this configuration winbind resolved SIDs to UIDs and GIDs from the idmap uid and idmap gid ranges specified in the &smb.conf; file, but instead of using a local winbind IDMAP table it is stored in an LDAP directory so that all Domain Member machines (clients and servers) can share a common IDMAP table. It is important that all LDAP IDMAP clients use only the master LDAP server as the idmap backend facility in the &smb.conf; file does not correctly handle LDAP redirects. Winbind with NSS to resolve UNIX/Linux user and group IDs: &smbmdash; When Samba is being used as the PDC and BDC the of an LDAP passdb backend is a smart solution, certainly for the domain controllers, but also for Domain Member servers. It is a neat method for assuring that UIDs, GIDs and the matching SIDs will be consistent across all servers. The use of the LDAP based passdb backend requires use of the PADL nss_ldap utility, or an equivalent. In this situation winbind is used to handle foreign SIDs; ie: SIDs from stand-alone Windows clients (i.e.: not a member of our domain) as well as SIDs from another domain. The foreign UID/GID is mapped from allocated ranges (idmap uid and idmap gid) in precisely the same manner as when using winbind with a local IDMAP table. The nss_ldap tool set can be used to access UIDs and GIDs via LDAP as well as via Active Directory. In order to use Active Directory it is necessary to modify the ADS schema by installing either the AD4UNIX schema extension or else use the Microsoft Services for UNIX version 3.5 of later to extend the ADS schema so it maintains UNIX account credentials. Where the ADS schema is extended a Microsoft Management Console (MMC) snap-in in also installed to permit the UNIX credentials to be set and managed from the ADS User and Computer managment tool. Each account must be separately UNIX enabled before the UID and GID data can be used by Samba.` Winbind/NSS uses RID based IDMAP: &smbmdash; The IDMAP_RID facility is new to Samba version 3.0.8. It was added to make life easier for a number of sites that are committed to use of MS ADS, who do not want to apply an ADS schema extension, and who do not wish to install an LDAP directory server just for the purpose of maintaining an IDMAP table. If you have a single ADS domain (not a forest of domains, and not mutiple domain trees) and you want a simple cookie-cutter solution to the IDMAP table problem, then IDMAP_RID is an obvious choice. This facility requires the allocation of the idmap uid and the idmap gid ranges, and within the idmap uid it is possible to allocate a sub-set of this range for automatic mapping of the relative identifier (RID) portion of the SID directly to the base of the UID plus the RID value. For example, if the idmap uid range is 1000-100000000 and the idmap backend = idmap_rid:DOMAIN_NAME=1000-50000000, and a SID is encountered that has the value S-1-5-21-34567898-12529001-32973135-1234, the resulting UID will be 1000 + 1234 = 2234. Primary Domain Controller Microsoft Windows domain security systems generate the user and group security identifier (SID) as part of the process of creation of an account. Windows does not have a concept of a UID or a GID. MS Active Directory Server (ADS) uses a directory schema that can be extended to accommodate additional account attributes such as UIDs and GIDs. Backup Domain Controller IDMAP Backend Usage Default Winbind TDB IDMAP Storage in LDAP using Winbind IDMAP and NSS IDMAP Resolution IDMAP, Active Directory and MS Services for UNIX 3.5 IDMAP, Active Directory and AD4UNIX IDMAP_RID with Winbind