Showing posts with label SMB. Show all posts
Showing posts with label SMB. Show all posts

Friday, March 25, 2016

W2K & NFSv4 ACL mapping

This post is a development of another post, SMB & NFSv4 ACL mapping. It's specific to the Windows 2000 (and later) family systems. If necessary, please, check back the aforementioned "parent" post.

My discussion will be based on the following minimal scenario:
(box-01 is a Solaris 11.3 acting as a Windows 2000 Server)
 


























The graphical interface of the (directory and files) unified ACL editor (Properties | Security) seems good to manage basic settings such as: List Folder Contents, Read & Execute, Modify and Full Control. But it is impossible to get the big picture at once, it may be confusing for handling inheritance and it mixes in more complex permissions sets. The point is: it should allow us to see the permissions for all names at once, it shouldn't have the confusing Read and Write options and it should have a more objective approach (other than the confusing dimmed or grayed out checkboxes alongside the Allow inheritable... checkbox) on the inheritance status. And on top of all this, by clicking on the checkboxes on a certain order (check Modify then clear Write, you would expect to be left with Read & Execute but you don't!) it's possible to mistakenly generate unwanted special permissions.
 




























Unfortunately, the design of the Advanced option, entitled Access Control Settings is also bad because it adopts horizontal scrolling (which is terrible; they don't even persist the tedious adjustments of the listview columns that someone does in order to better see all the information without scrolling) instead of more concise graphical elements and filtering, or even a resize-able dialog, in order to really help an administrator do its job. Bottom line is it's also cumbersome as the basic one. Again, unfortunately, especially because Windows is so centric on ergonomics and GUI design. It's like this area has been greatly overlooked or treated with laziness (many out there could do a lot better than that...).
 




























Still similarly to what I have done for Windows NT 4.0 (and before) let's initially focus just on the permissions sets that are displayed on the basic (Properties | Security) dialog.

The first thing to note is that the legacy permission flags (R, W, X, D, P and O) have all gone. They were replaced by other 13 (frequently even more confusing) flags which have no compact names but just descriptions and are only accessible after yet another click and more scrolling and a bunch more clicks. As you can see, a nightmare (I'm still not sure if they really wanted to discourage people or hide their mess, perhaps both, but there would be better ways, but, that's Windows!). In order to help put things in order we have the following 1-1 mapping between the each NFSv4 and Windows permission flag:
 
















To help even more here is a mapping for the Windows 2000 basic permission sets dialog together with each flag setting, bor for the unnamed Windows flags and the UNIX NFSv4 ACLs (for simplicity here I'm intentionally omitting the name of the associated user or group that should be prefixed to each UNIX ACL and I'm also representing the 13 Windows flags as an ordered row resulting from a counter-clockwise rotation of 90°): 




Full Control

+Modify   +Read & Execute   +List Folder Contents   +Read   +Write

      
                
rwxpdDaARWcCos:fd-----:allow



Modify

+Read & Execute   +List Folder Contents   +Read   +Write

              
          rwx
pd-aARWc--s:fd-----:allow



Read & Execute

+List Folder Contents   +Read

           
             r-x---a-R-c--
s:fd-----:allow



List Folder Contents


                        r-x---a-R-c--s:-d-----:allow



Read


                        r-----a-R-c--s:fd-----:allow



Write


                        -w-p---A-W---s:fd-----:allow

NOTE
The preceding series of ACLs is formatted in terms of directory permissions but the same translation applies to file permissions (except, of course, List Folder Contents) if you disregard the respective ACL inheritance flags (between both colons in my listing) which contains an f and/or d. For instance, the Full Control for a file is depicted by rwxpdDaARWcCos:-------:allow, but depending on the inheritance it may show a trailing I inheritance flag.

NOTE
If needed, the Add & Read permission set from Windows NT 4.0 (and before)  must be manually created from the scratch by adding the following two permission sets to the desired user and directory:

r-x---a-R-c--s:f-i----:allow
rwxp--aARWc--s:-d-----:allow

Which, in other words, basically means:

Read & Execute for files and
Read, Write & Execute for directories (not their contents).

NOTE
As a variation of the Add & Read permission set above it could be interesting to have the possibility to add a folder just to a certain subtree root (or share) while all other permissions are inherited (as for giving read access to a group and so on). In that case, it's assumed (of course) that amongst the inherited permissions is the Full Control for the CREATOR OWNER identity. The permission that has to be added to the desired subtree root is:

r-xp--a-R-c--s:-------:allow

Well, beyond all the above, who knows, maybe someone can devise some useful and unanticipated sort of special access, but in general what's been seen is pretty much all about that.

With the knowledge of this post, it's not necessary to resort to a Windows box in order to set meaningful permissions according to Windows by using its GUI editors. You can do it from a Solaris 11.3 shell by using chmod(1).
   

Thursday, March 24, 2016

NT4 & NFSv4 ACL mapping

This post is a development of another post, SMB & NFSv4 ACL mapping. It's specific to the Windows NT 4.0 (and before) family systems. If necessary, please, check back the aforementioned "parent" post.

The graphical interface of the ACL editors (Directory Permissions and File Permissions) are powerful yet reasonably nice, simple, concise and straightforward. And I mostly like it.























Let's focus just on the permissions sets which are listed on the "second colon" of the listboxes labeled Name for each user or group to which the ACL is to be enforced.

The first thing to note is that Directories Permissions have two pairs of parenthesis while Files Permissions just have one. On the former, the first pair of parenthesis refers to the permissions that apply just to the directory (not the files in it), while the second pair of parenthesis refers to the permissions of the (current or new) files in the directory (depending on the setting of the checkbox which text is Replace Permissions on Existing Files).

The second thing to note is that most of the permissions sets that are list on the dropdown-listbox labeled Type of Access are the "standard" ones (according to Windows). Whatever deviates from these is considered a Special Access case and treated accordingly in the interface.

The third thing to note is that on this world, exactly 6 permission flags (independent among each other) are recognized and they are as follows (but there are a few caveats around their names and effective meanings as it shall become more clear on the permissions sets below):

       Permission Flag
    R  Read 
    W  Write 
    X  Execute 
    D  Delete 
    P  Change Permissions 
    O  Take Ownership

The fourth thing to note is that from the Windows GUI ACL editors there's no direct way of telling if an ACL is being inherited or not. The rule is that if you override any ACL for a file system object than then what's previously inherited is copied alongside what's been changed.

Still solely from the Windows perspective let's summarize the ("standard", except for the Special Access) permissions sets as they are recognized by the system:

For directories:
                        Permission Set 
   (None  )   (None  )  No Access
   (R_X___)   (None  )  List
   (R_X___)   (R_X___)  Read
   (_WX___)   (None  )  Add
   (RWX___)   (R_X___)  Add & Read 
   (RWXD__)   (RWXD__)  Change
   (All   )   (All   )  Full Control
   (Other )   (Other )  Special Access


For files:
                        Permission Set 
              (None  )  No Access
              (R_X___)  Read 
              (RWXD__)  Change 
              (All   )  Full Control
              (Other )  Special Access
 

Now from the UNIX NFSv4 ACLs perspective each of the above permission set (interestingly) translates into the following (for simplicity here I'm intentionally omitting the name of the associated user or group that should be prefixed to each ACL):

No Access

 (None)(None)           rwxpdDaARWcCos:f-i----:deny
                        rwxpdDaARWcCos:-d-----:deny 
List

 (RX)(Not Specified)    r-x---a-R-c--s:-d-----:allow
Read

 (RX)(RX)               r-x---a-R-c--s:f-i----:allow
                        r-x---a-R-c--s:-d-----:allow
Add

 (WX)(Not Specified)    -wxp--aA-Wc--s:-d-----:allow
Add & Read

 (RWX)(RX)              r-x---a-R-c--s:f-i----:allow
                        rwxp--aARWc--s:-d-----:allow
Change

 (RWXD)(RWXD)           rwxpd-aARWc--s:f-i----:allow
                        rwxpd-aARWc--s:-d-----:allow
Full Control

 (All)(All)             rwxpdDaARWcCos:f-i----:allow
                        rwxpdDaARWcCos:-d-----:allow

NOTE
The preceding series of ACLs is formatted in terms of directory permissions but the same translation applies to file permissions if you consider just the second pair of parenthesis and the respective ACL inheritance flags (between both colons in my listing) which contain an f but removing both the f and i. For instance, the Full Control for a file is depicted by the ACL rwxpdDaARWcCos:-------:allow

So, as one can see, for directories, except when (Not Specified) is involved, each pair of parenthesis actually translates into 2 NFSv4 ACLs, one for the directory (which contains the d flag) and another (which contains the f flag) for files (for being implictly inherited by new files or overriden in existing files within the directory, this last case depending on the checkbox which text is Replace Permissions on Existing Files).

For attempting the ultimate fine-grained ACL mapping between NT4 and UNIX I'll put the following (hopefully) final listing of this (long) post:
 
 (Special Access)(R)    r-----a-R-c--s:-------:allow
 (Special Access)(W)    -w-p---A-Wc--s:-------:allow
 (Special Access)(X)    --x---a---c--s:-------:allow
 (Special Access)(D)    ----d--------s:-------:allow
 (Special Access)(P)    -----------C-s:-------:allow
 (Special Access)(O)    ------------os:-------:allow

Well, beyond all the above, who knows, maybe someone can devise some useful and unanticipated sort of special access, but in general what's been seen is pretty much all about that.

With the knowledge of this post, it's not necessary to resort to a Windows box in order to set meaningful permissions according to Windows by using its GUI editors. You can do it from a Solaris 11.3 shell by using chmod(1).
    

SMB & NFSv4 ACL mapping

Let's take a quick look at how Windows and UNIX NFSv4 ACLs can kind of co-exist. The purpose of this post is to clear out the inevitable hurdles on mapping permissions between these two systems when a UNIX system shares something to Windows via the SMB/CIFS protocol. To be honest, much of the trouble comes from the cumbersome permission flags (or its unexpected combinations and side-effects) from Windows which may in part reveal how clumsy Windows internals are (and why it's not surprising the vast amount of bugs/flaws per month that have to be patched; a nightmare).

To focus on what matters the scenario assumes no Active Directory, Kerberos, LDAP, and so on..., just plain WORKGROUP operational mode (which implies just the weak NTLM or NTLMv2 authentication mechanisms).

First I'll take at the legacy Windows NT family, then at the next-generation Windows NT family. With the former I cover the legacy and with the later I cover the more recent releases. I think Windows had a good chance by the time of these two mentioned releases, but then it seems to have lost its path amongst a vast amount of crap that was kicked into its code base. But that's not the topic of this post!
 
Windows NT 4.0 (and before - the legacy family)
Please check the details on the post NT4 & NFSv4 ACL mapping.

Windows 2000 (and later - the next-generation family)
Please check the details on the post W2K & NFSv4 ACL mapping.
 
And by the way, what's the point of this post?

Well, Windows is "viral" (sorry, just joking, forgive me) or at least it used to be a decade ago or so and it's still inevitable to interact with it at some point in time. Worse than that, it has spread it's SMB/CIFS protocol throughout the industry and there are many platforms out there which supports it, ranging from Mac laptops to high-end storage systems. And that's why Solaris 11.3 better than ever supports SMB/CIFS protocol, specially on the server side with its SMB version 2.1 implementation which, at least for file-sharing purposes, ranks Solaris 11.3 as a fast Windows 2000 Server (or Windows NT 5.0 Server) amongst other Windows boxes, which is more than enough for most purposes on this area. One silent advantage of SMB 2.1 is it's better operation over WAN, that is, links with moderate-to-high latency. On the client side, Solaris 11.3 stays as a SMB 1.0 client, but frankly, who cares?

root@box-01:/export/project# share
IPC$                      smb   -   Remote IPC
c$       /var/smb/cvol    smb   -   Default Share
Project  /export/project  smb   -
  
 

Friday, June 22, 2012

NFSv4 ACL permissions sets

With respect to NFSv4 ACL permissions,
Solaris offers the following predefined permissions sets:

                                   attr xattr acl own 
                                   ---- ----- --- --- 
         full_set = rwx   p   dD   aA   RW    cC  o   s
       modify_set = rwx   p   dD   aA   RW    c_  _   s
         read_set = r__   _   __   a_   R_    c_  _   s
        write_set = _w_   p   __   _A   _W    __  _   s  
Thus:
       modify_set = read_set | write_set | (x dD)
or yet:
       modify_set = full_set & ~(C o)
   
Note the following resemblance between the trivial-ACL (UNIX standard rwx flags) and the NFSv4 predefined permissions sets (owner implies C o):

      UNIX                NFSv4
      ----      -------------------------
      r    --->  read_set   =  r      ...
       w   ---> write_set   =   w  p  ...
        x  --->                  x  
      r-x  --->  read_set   |    x     
      rwx  --->  modify_set

Again, these are the predefined permissions sets according to Solaris.
It may be useful to contrast to Windows (SMB/CIFS) permission sets
  

NFSv4 ACL summary

Solaris extends UNIX file system permissions through more granular NFSv4-like ACLs. 
The standard UNIX file system permissions are now simply called trivial-ACLs.
For plenty of information on ACLs, refer to acl(5).
 
Each ACL has many ordered allowing and/or denying ACEs combining the following permission and inheritance flags associated to a certain account.

The following is a list of just the permission flags:
(theoretically the most difficult part of an ACL)

 flag   file                    directory (not its contents) 

  r     read_data               list_directory  (ls) 
  w     write_data              add_file        (+modify, +delete) 
  x     execute                 execute         (=search, =enter)     

  p     append_data             add_subdirectory
  D                             delete_child

  d     delete                  delete

  a     read_attributes  (ls -l) 
  A     write_attributes

  R     read_xattr 
  W     write_xattr

  c     read_acl
  C     write_acl

  o     write_owner

  s     synchronize (not supported)


At least in Solaris, the compact form of an ACE comprises 4 parts delimited by colons and which are displayed with the -V option of ls(1). As a minimal example, the following ACL has just a single ACE:

prime@box-01:/export/project# ll -V Europe/Memo-01.txt
-rwx------+  1 prime  staff ... Europe/Memo-01.txt
             user:prime:rwxpdDaARWcCos:-------:allow


Briefly, these 4 parts are:
  1. The account (sometimes called principal or identity).
    It can be one of the following:
     
    • owner@          - for the Current Owner (prime)
    • group@          - for the Current Group (staff)
    • everyone@       - for the rest of the world
    • user:<account>  - for any other user account
    • group:<account> - for any other group account
     
  2. The permission flags already described.
     
  3. The inheritance flags:
    (it's advisable not to mix f and d on a single ACE)
    (only the last 2 seem more reasonable applicable to files)
     
       f-i----  
    - Only applies to new files
       f--n---
     
    - Also inherit just one level down to new files
       -d-----
      - Also inherit to new subdirectories
       -di----
      - Only applies to new subdirectories
       -d-n---
      - Also inherit just one level down to new subdirectories
       ------- 
    - No inheritance; all permissions are local only
       ------I
     
    - The permissions have been inherited
     
  4. The type of the ACE.
    Solaris 11.3 supports just 2 types: allow or deny.
    The deny type supports reasoning in terms of complements.
    (for instance: No Access could be thought as deny Full Control)
NOTE
The n flag in the inheritance flags (part 3 above) is a kind of general idiom when some sort of inheritance or hierarchy is involved. It's sort of a practical way of referring to the immediate (first generation) children of a parent.
As seen above, more options were added to the ls (the v|V options) and chmod (the A option) commands in order to allow managing these extended permissions. In addition, zfs(1M) properties (such as aclmode / aclinherit) affects the overall behavior as well.
  
To help start understanding the big picture of these complex extended permissions, it can be useful take a look at how are they generally gathered together in permissions sets as well as a few examples.

As extension to the topic in may be interesting to find out about mapping NFSv4 permissions to Windows environments or more generally to any platform that talks the SMB/CIFS protocol where permissions have to be dealt with.