Solaris / CIFS
Last edited January 24, 2009
More by lewiz »
Security Descriptor (SD) definition
www.microsoft.com/whdc/driver/security/drvsecure.m...
The security descriptor describes the owner and group SIDs for the object along with its ACLs
Key topics

  • CIFS availability
    • OpenSolaris 2008.11
    • SXDE, SXCE
    • not Solaris 10
  • workgroup mode demo
    • installation on opensolaris
    • updating pam.conf & passwd
    • start service
    • create a new filesystem and share
    • share an existing filesystem
    • show in network places
    • copy files to/from
  • id mapper
    • the need to map IDs
    • how Solaris & Windows handle ids
      • define SID
    • algorithmic mapping
    • static rules
    • ephemeral mappings
      • persistent across service restarts, not reboots
    • uid_t & gid_t changes
    • implicit v explicit permissions
  • filesystem support
    • ZFS changes, FUIDs
      • mandatory v advisory locking
    • changes to VFS for legacy FS
    • NFSv3 implementation
    • NFSv4 implementation
  • workgroup mode
  • domain mode
    • ephemeral mapping in use
  • VSCAN
    • the problem VSCAN is designed to solve (viruses)
    • how VSCAN has been implemented in Solaris
    • brief description of ICAP; specifically how it is used for VSCAN as well as other uses
    • commands and processes involves (vscand & vscanadm)
    • vscanadm syntax
    • demonstration using VirtualBox and EICAR test virus
Questions

Sun should most likely pursue an IETF Internet Standard for SID representation and the current set of valid SID generation and encoding formats, independent of use in any particular operating system, data format, or network protocol. This can be done in parallel with but not gating our use of SIDs in Solaris. Similarly, Sun could pursue standardizing its new APIs through IEEE or POSIX.
did this get done? if so, what is the range?
(d) The ability for kernel code such as FUID-aware filesystems to upcall the
mapping service via a door to convert SIDs to UIDs/GIDs, and some
appropriate caching of the results, as determined by performance analysis.
what does this mean?  FUID-aware FS?  upcall mapping?
(i) The project proposes to store its mappings in a persistent database.
Although such mappings need to be persisted, with ephemeral IDs they only
need to be persisted across service restart, and not reboots, implying that
tmpfs can be used to back the cache. This property may significantly
simplify the design and implementation of the persistence mechanism.
 why do the emphemeral id mappings not need to be persistent across reboots?
sharemgr add lewis
sharemgr add-share -s /export/cifs -r cifs lewis
Using CIFS

Enable SMB sharing for the ZFS file system.


# zfs set sharesmb=on fsname

Note –

The resource name for the share is automatically constructed by the zfs command when the share is created. The resource name is based on the dataset name, unless you specify a resource name. Any characters that are illegal for resource names are replaced by an underscore character (_).


To specify a resource name for the share, specify a name for the sharesmb property, sharesmb=name=resource-name.

zfs set sharesmb=on FSNAME
zfs set sharesmb=name=LEWISVIDEO FSNAME
we want to support CIFS as a first-class citizen in Solaris
OpenSolaris CIFS server heritage
blogs.sun.com/mws/resource/uid.txt
the Sun Software organization is working to integrate support for CIFS, based on the stack acquired from Procom, into Solaris. The Procom CIFS stack previously ran on Procom's operating system, code-named Montana, currently the basis of the Sun StorageTek 5310 and 5320 NAS products
Solaris CIFS supports advisory (default) and mandatory locking
docs.sun.com/app/docs/doc/820-2429/smbservertasks?...
The CIFS protocol assumes mandatory locking, but UNIX traditionally uses advisory locking. The Solaris OS can be configured to use mandatory locking on a per mount basis by using the non-blocking mandatory locking (nbmand) mount option.
"zfs create -o nbmand=on fsname" to create a ZFS with mandatory locking
Unsharing a parent FS unshares the children
docs.sun.com/app/docs/doc/820-2429/smbservertasks?...
If you disable SMB sharing for sandbox/fs2, that file system and its children are affected.
Solaris CIFS supports files & directories only
docs.sun.com/app/docs/doc/820-2429/smboverview?a=v...
The Solaris CIFS client does not include the ability to print by means of CIFS or the ability to access CIFS resources other than files and directories. The Solaris CIFS client enables an unprivileged user to mount and unmount shares on directories he owns.
CIFS in kernel land; non-file I/O requests passed to userland smbd
docs.sun.com/app/docs/doc/820-2429/smboverview?a=v...
Similar to the NFS kernel service, the SMB kernel module provides SMB file I/O services directly between the network interface and the virtual file system (VFS) within the kernel. Whenever a non-file I/O request is received, such as a user authentication or an MS-RPC named pipe request, it is passed to smbd for processing in user space
Windows-style ACL support in ZFS and NFSv4
docs.sun.com/app/docs/doc/820-2429/idmappingtasks?...
The Solaris CIFS service is designed to reside in a multiprotocol environment and provide an integrated model for sharing data between Windows and Solaris systems. Although files can be accessed simultaneously from both Windows and Solaris systems, no industry-standard mechanism is used to define a user in both Windows and Solaris environments. Objects can be created in either environment, but traditionally the access control semantics for each environment are vastly different. The Solaris OS is adopting the Windows model of access control lists (ACLs) by introducing ACLs in NFSv4 and the ZFS file system, and by providing the idmapd identity mapping service.
Workgroup mode

  • Enable the Solaris CIFS service.


    # svcadm enable -r smb/server
    

    This command enables the Solaris CIFS service and any service on which it depends, such as the idmap service.

  • (Optional) Change the Solaris CIFS service to operate in a different workgroup.

    By default, the Solaris CIFS service operates in a workgroup called WORKGROUP.


    # smbadm join -w workgroup-name
    
  • Edit the /etc/pam.conf file to support creation of an encrypted version of the user's password for CIFS.

    Add the following line to the end of the file:


    other	password required	pam_smb_passwd.so.1	nowarn

    See the pam_smb_passwd(5) man page.

  • Specify the password for existing local users.

    The Solaris CIFS service cannot use the Solaris encrypted version of the local user's password for authentication. Therefore, you must generate an encrypted version of the local user's password for the Solaris CIFS service to use. When the SMB PAM module is installed, the passwd command generates such an encrypted version of the password.


    # passwd username
  • Domain mode

    Solaris CIFS supports workgroup & domain (= AD auth)
    docs.sun.com/app/docs/doc/820-2429/smboverview?a=v...
    The Solaris CIFS service can operate in either workgroup mode or in domain mode. In workgroup mode, the Solaris CIFS service is responsible for authenticating users locally when access is requested to shared resources. This authentication process is referred to as local login. In domain mode, the Solaris CIFS service uses pass-through authentication, in which user authentication is delegated to a domain controller.
    Example 3–1 Configuring the Solaris CIFS Service in Domain Mode

    This example shows the steps taken to configure the Solaris CIFS service in domain mode. User dana has Domain Administrator privileges. The name of the domain being joined is westsales.example.com.


    # svcadm enable -r smb/server
    # smbadm join -u dana westsales.example.com
    Enter domain password:
    Joining 'westsales.example.com' ... this may take a minute ...
    Successfully joined domain 'westsales.example.com'
    svcadm enable -r enables all services which smb/server depends upon
    Configuring domain & workgroup mode CIFS
    docs.sun.com/app/docs/doc/820-2429/smbservertasks?...

    Configuring the Solaris CIFS Service Operation Mode (Task Map)

    The following table points to the tasks that you can use to configure the operation mode of the Solaris CIFS server.

    Task

    Description

    For Instructions

    Configure the Solaris CIFS service in domain mode.

    Use the smbadm join -u username domain-name command to join the domain.

    How to Configure the Solaris CIFS Service in Domain Mode

    Configure the Solaris CIFS service in workgroup mode.

    Use the smbadm join -w workgroup-name command to join the workgroup.

    How to Configure the Solaris CIFS Service in Workgroup Mode

    Getting Started With the Solaris CIFS Service - Genunix
    www.genunix2.org/wiki/index.php/Getting_Started_Wi...

    Solaris CIFS services can operate in two modes: domain and workgroup. These modes are mutually exclusive. Choose one or the other based on your environment and authentication needs.

    • If you have an Active Directory (AD) domain and want to give domain users access to the Solaris CIFS service, choose domain mode by joining that domain.

    • If you have no AD domains or have no need to support domain users, and you want to use local Solaris users to access the CIFS service, choose workgroup mode by joining the workgroup.

    Implementation details

    The solution proposed for Solaris is fundamentally to do the following:

    (a) Modify ZFS to support SIDs directly in the filesystem, using an encoding
    that can be generalized to other forms of SIDs, generalized to other on-
    disk filesystems should that be required, and efficiently encode POSIX IDs.

    (b) Modify the kernel to support SIDs as part of credentials (cred_t, ucred_t)
    so that the new Solaris CIFS server can establish such credentials in a
    generic fashion and have them be passed through the VOP layer to ZFS.

    (c) Deliver an ID mapping service to perform POSIX ID <-> SID mapping, and
    make this available to both user and kernel clients (i.e. via door upcall).
    This service is the Winchester project, with some minor modifications.

    (d) Change Solaris uid_t and gid_t to be unsigned 32-bit types, and partition
    the ID space into half reserved for standard POSIX identifiers (the current
    range supported by Solaris, 0-0x7fffffff), and half reserved for ephemeral
    mappings associated with SIDs (the new range 0x80000000-0xfffffffe).
    No need to change existing backup software for ZFS; 'extensible attributes'
    opensolaris.org/os/community/arc/caselog/2007/064/...
    17. Backup Formats

    Since ephemeral IDs only exist on the system when CIFS is deployed without POSIX name mapping equivalence, and such IDs cannot be stored in existing filesystems anyway, there is no incompatibility with existing backup software. The only backup issues arise when trying to backup ZFS with SIDs. ZFS already provides its own archival format by virtue of zfs(1M) send/recv; this format would be extended to support the ZFS FUID representation as part of this work.
    SIDs

    Windows SID (PSARC (pre-Winchester))
    opensolaris.org/os/community/arc/caselog/2007/064/...
    A Windows SID typically looks something like this:

    S-1-5-12-7623811015-3361044348-030300820-1013

    and decomposes into the following pieces:

    S - The string is a SID
    1 - The revision level (1 is the only value in present use)
    5 - 48-bit identifier authority value (5 refers to "Windows NT")
    12-7623811015-3361044348-030300820 - Identifier for domain or local computer
    1013 - 32-bit Relative ID (RID) within the previously described domain

    In other words, an SID is a universally unique identifier for a user
    or group.
    SID is equivalent of user@FQDN
    Security Identifier - Wikipedia, the free encyclopedia
    en.wikipedia.org/wiki/Security_Identifier

    Windows grants or denies access and privileges to resources based on access control lists (ACLs), which use SIDs to uniquely identify users and their group memberships. When a user logs into a computer, an access token is generated that contains user and group SIDs and user privilege level. When a user requests access to a resource, the access token is checked by the ACL to permit or deny particular action on a particular object.

    SIDs are useful for troubleshooting issues with security audits, Windows server and domain migrations.

    SID has format as follows: S-1-5-21-7623811015-3361044348-030300820-1013

    S - The string is a SID.
    1 - The revision level.
    5 - The identifier authority value.
    21-7623811015-3361044348-030300820 - domain or local computer identifier
    1013 – a Relative ID (RID). Any group or user that is not created by default will have a Relative ID of 1000 or greater.

    Possible identifier authority values are:

    • 0 - Null Authority
    • 1 - World Authority
    • 2 - Local Authority
    • 3 - Creator Authority
    • 4 - Non-unique Authority
    • 5 - NT Authority
    idmap

    On Windows and Solaris systems, files have an owner attribute and a group attribute. A Solaris file owner attribute must be a UID, and the group attribute must be a GID. Unlike the Solaris OS, Windows has no such restrictions. Windows permits either a user SID or a group SID to be a file owner or a file group. In fact, Windows uses the Administrator Group as a file owner in many instances, and any Windows application can set the file owner and group attributes to any SID.

    The Solaris system cannot interchange UIDs and GIDs like Windows can. Therefore, the Solaris system must be able to perform the following types of mappings:

    • Map a group SID to a UID when the group SID occurs in an owner field

    • Map a user SID to a GID when the user SID occurs in group field

    These are called diagonal mappings, which use naming rules to set up the mappings.

    18. Zones Integration

    Solaris Zones provide a lightweight virtualization environment that includes virtualization of the Solaris name service switch configuration. That is, a local zone may have its own nsswitch.conf(4) settings indicating an entirely different name server, name service, or name service prioritization. As such it is already the case that POSIX identifiers do not necessarily hold the same meaning across disparate Zones in that one zone might assign a given uid_t value one identity in its own passwd(4) file and another zone might see a different identity for that uid_t based upon a NIS or LDAP directory. As such Solaris will need to evaluate identity mapping rules for non-POSIX identities differently in each zone, and therefore the mapping of an SID to a POSIX uid_t or ephemeral uid_t will vary across zones. Finally, a Zone can use the BrandX technology to provide an entirely different identity service for another OS personality. Therefore, each Solaris Zone should have its own instance of the id mapping service, and maintain its own notion of ephemeral uid_t and gid_t's.
    Winchester is a pluggable id mapper
    opensolaris.org/os/community/arc/caselog/2007/064/...
    As specified, Winchester resembles the Samba ID mapping component, in that
    it offers an ID mapping service with pluggable mapping models, independent
    of any underlying capability of the operating system to support SIDs.
    Winchester proposes to implement features beyond (a-c), including:

    - Algorithmic Mapping from Section 3b, similar to Samba
    - A plug-in interface for other mapping schemes, e.g. Apple Open Directory
    chown(2) and similar calls using ephemeral IDs, the system call will determine by use of the ID mapper or a cache if the ID is claimed; if so, the call will succeed, otherwise it will fail and return EINVAL as it does today
    Labels: chown, idmap, winchester
    With uid_t and gid_t now extended to 32-bit unsigned types, we now propose to
    partition the ID space in half, reserving the upper 2 billion values for so-
    called ephemeral IDs. These ID values would be reserved for transient mappings
    of SIDs introduced into the system for which no name-based mapping rule between
    the SID and a POSIX ID in the existing range [0, INT_MAX] applies. A central
    mapping service (the Winchester project, discussed further in Section 11),
    will establish the reservation of an ephemeral ID and its connection to an SID,
    and will hold the reservation until a Solaris instance reboots. That is, when
    the forthcoming SMB server for CIFS establishes a session, it will take the SID
    over the wire, look up the Windows AD name, and contact the ID mapper to see if
    a name-based mapping applies; if so, a POSIX ID in the existing range will be
    assigned to the credential in addition to storing the SID there. If not, an
    ephemeral ID above INT_MAX will be assigned. In either case, every credential
    will always contain both uid_t/gid_t values and an SID simultaneously.
    Labels: idmap, winchester
    wildcard idmap rule matches only otherwise-unmatched rules
    docs.sun.com/app/docs/doc/820-2429/idmappingtasks?...
    If username uses the wildcard (*), it matches all user names that are not matched by other mappings. Similarly, if username is the wildcard Windows name (*@*), it matches all user names in all domains that are not matched by other mappings.
    Algorithmic Mapping (PSARC (Winchester))
    opensolaris.org/os/community/arc/caselog/2007/064/...
    (b) Algorithmic Mapping

    Administrators can manually partition the POSIX UID space by creating a set of
    algorithmic mapping rules for SIDs (based on the encoded RID) to a portion of
    the POSIX UID space. For example, an administrator can configure:

    idmap backend = idmap_rid:SUN=70000-80000

    indicating that the "SUN" domain should be mapped to UIDs [70,000-80,000].
    When Samba encounters the SID S-1-5-21-34567898-12529001-32973135-1234 from
    this domain, the resulting POSIX UID will be 70000 + 1234 = 71234.
  • We changed the type of uid_t and gid_t in Solaris from 32-bit signed to 32-bit unsigned. This really should have been done a long time ago, and brings us (in my opinion) into better alignment with other UNIX variants.
  • We reserved the UID and GID values 0x80000000 - 0xFFFFFFFE to be used for what I call ephemeral mappings to foreign identifiers, represented by a generic form of an SID. These mappings are done by the new identity mapping service in OpenSolaris, called Winchester. (Winchester also can perform mappings of user names between POSIX and Windows name services: see the Winchester project page for all of the details.
  • We created a way for Solaris filesystems to store persistent identifiers in the filesystem on-disk that can represent arbitrary identifiers including both POSIX IDs and SIDs and convert those back to credentials in the kernel.
  • We extended the Solaris ucred mechanism so that these more complex credentials can be expressed back to userland processes for services that need them.
  • idmap rules can be wildcard based (per-server)
    docs.sun.com/app/docs/doc/820-2429/idmappingtasks?...
    Rule-based mappings. Are easy to configure and can be configured with a single wildcard rule. However, the mapping rules are only stored on a particular computer rather than being global. This method is more suitable if only one CIFS server is being used in your environment.
    Ephemeral mappings

    Unlike NFSv3, NFSv4 does not send UIDs and GIDs over the wire for attributes. Instead, nfsmapid(1M) is used to map the values to utf8 strings containing the user and group name suffixed by the NFSv4 mapping domain (either the DNS domain or a domain name manually configured using the NFSMAPID_DOMAIN property).

    If an ephemeral ID for an SID has no mapping, then the POSIX name service lookup should fail and return *ID_NOBODY to the kernel, which NFSv4 already has defined as a clear semantic, and it sends "nobody" back over the wire.
    Ephemeral IDs get mapped to 'nobody' on legacy FSes
    opensolaris.org/os/community/arc/caselog/2007/064/...
    Other than NFSv3, historic Solaris filesystems such as UFS will not be changed to use FUIDs. Instead, the VOP layer should be modified to transparently convert ephemeral IDs to *ID_NOBODY as they are passed to historic filesystems.

    The consequence of this approach is that any credential that is associated with an ephemeral ID cannot be stored in a historic filesystem unless POSIX name mapping equivalence is established
    SIDs stored in ZFS ACLs allow ownership for non-local users to persist across reboots
    blogs.sun.com/nico/entry/dealing_with_windows_sids...
    First and foremost: ephemeral IDs must not be persistently stored anywhere, including in filesystem objects. Because that is far too restrictive the Solaris VFS and one filesystem, ZFS, have been modified to support storing SIDs instead of ephemeral IDs (the other filesystems simply reject any attempt to store an ephemeral ID). You read that right: ZFS can now use SIDs in ACL entries! Most applications will already do the Right Thing -- either reject or pass through ephemeral IDs -- and those core Solaris apps that needed modification have been modified
    SIDs are stored in ZFS ACLs so if ephemeral mappings are lost (reboot) the ACL's SID is used to allow access
    13. NFSv3 Implementation

    Thus NFSv3 would map any ephemeral IDs that have no POSIX equivalent
    to *ID_NOBODY.
    Troubleshooting

    Modify Default Security Policies on Windows Server 2008-Based Domain Controllers
    technet.microsoft.com/en-us/library/cc731654.aspx
    To disable SMB packet signing enforcement on Windows Server 2008–based domain controllers
    1. To open GPMC, click Start, click Run, type gpmc.msc, and then click OK.

    2. In the console tree, right-click Default Domain Controllers Policy in Domains\Current Domain Name\Group Policy objects\Default Domain Controllers Policy, and then click Edit.

    3. In the Group Policy Management Editor window, in the console tree, go to Computer Configuration/Policies/Windows Settings/Security Settings/Local Policies/Security Options.

    4. In the details pane, double-click Microsoft network server: Digitally sign communications (always).

    5. Verify that the Define this policy setting check box is selected, click Disabled to prevent SMB packet signing from being required, and then click OK.

      To apply the Group Policy change immediately, either restart the domain controller or open a command prompt, type the following command, and then press ENTER:

      gpupdate /force

    The following error message only appears if you supply the wrong password for the administrative user:

    failed to join domain-name (LOGON_FAILURE)

    This error message might also appear if packet signing is enabled on the domain controller. So, you must disable packet signing on the domain controller before you can successfully join a domain.

    Labels: packetsigning
    failed to join domain FOO.COM (INVALID_PARAMETER) (smbadm join)
    dlc.sun.com/osol/docs/content/SSMBAG/smbservertrou...

    Missing DNS domain. Ensure that the fully qualified AD domain name has been added to the search list or as the local domain in /etc/resolv.conf.

    If your configuration is incorrect, you might see the failed to join domain domain-name (INVALID_PARAMETER) error when attempting to join the domain.

    Labels: INVALID_PARAMETER
    CIFS Service Troubleshooting - Genunix
    www.genunix2.org/wiki/index.php/CIFS_Service_Troub...

    Joining a Windows 2008 Domain

    To join a Windows 2008 domain, your Solaris system must be running at least SXCE Build 94.

    NTLMv2 authentication is mandatory only when LMCompatibilityLevel is set to 5 on your Windows 2008 domain controller. A value of 0-4 for LMCompatibilityLevel means that NTLMv2 authentication is not mandatory. By default, LMCompatibilityLevel is set to 3.

    Depending on whether NTLMv2 authentication is mandatory on your Windows 2008 domain controller, do one of the following:

    • If NTLMv2 authentication is mandatory on your Windows 2008 domain controller, install the following Microsoft hot fix:

      http://support.microsoft.com/kb/957441/

      Also, set the new AllowLegacySrvCall registry key to 1 because the Solaris CIFS service does not yet support extended security.

    • If NTLMv2 authentication is not mandatory on your Windows 2008 domain controller, you can do one of the following:

      • Install the Microsoft hot fix.

      • Set the LAN manager authentication level on your Solaris system as follows prior to joining the domain:

        # sharectl set -p lmauth_level=2 smb
    The content on this page is provided by a Google Notebook user, and Google assumes no responsibility for this content.