Showing posts with label UNIX groups. Show all posts
Showing posts with label UNIX groups. Show all posts

Monday, September 15, 2014

Business Problems: Leveraging UNIX-enabled AD Groups and Kerberos to Control Unix/Linux/Mac Access to a Windows Share

Background

In the previous post we discussed how to leverage the Kerberized environment provided by Centrify's UNIX/Linux client and the computer's AD account to access a read-only Windows (CIFS) share. By leveraging Kerberos, the mount command (or filesystems table) does not have to use a cleartext password.

Windows (CIFS) shares are all over the Enterprise (for files and printers) and most likely a read-only share is not a very practical example, however, a departmental share that is used by a workgroup to share files is much more common.  This time, we will implement an example.

The Marketing Share

In our mock example we have a share in APP1 set for the Marketing department.  Both Elaine and J.Peterman are members of this department, however they consistently access these shares from OS X, Unix and Windows machines.  Today a Marketing Share Access AD group is used to control access by way of memberships.

Requirements:


  • Marketing users should have the ability to exchange files (read/write)
  • The current heterogeneous environment consists of Windows, Mac OS X and UNIX/Linux stations
  • Users should be able to access the information from any type of platform
  • Controlling access to the Windows share should not deviate from the current process.
  • Users should alingn with the security policy and don't use cleartext passwords when mounting CIFS shares.

Challenges:

  • This would not be an issue in a homogeneous environment
  • Identity is key, UNIX identities should be uniform across platforms (for users and groups)
  • Users should not have access to the root account to use the mount command

The Proposed Solution:

  • Centrify the non-Windows platforms  (Mac OS X, Unix/Linux) - this provides the AD Integration, Kerberos environment and Privilege Elevation
  • Leverage a common UID/GID scheme by leveraging Zones and the Autozone
  • UNIX-enable the Matkeing Share Access AD group.
  • On UNIX Platforms, allow the Marketing users to use the mount command with privileges


Video Labs

Lab Part I - Initial Setup (13.30 min):  https://www.youtube.com/watch?v=flp4L200o4c 
Lab Part II - Verification (11 min):  https://www.youtube.com/watch?v=M-fdtZeYYtk 

Elaine's mount command (CentOS 6.5):
dzdo mount -t cifs //app1.corp.contoso.com/marketing /mnt/share -o sec=krb5,user=elaine.benes,uid=1149240407,gid=99998,group=marketing-share-access,umask=0002,file_mode=0775,dir_mode=0755 --verbose
Share Permissions:
(this can be improved since the rest of the world would get read access given that ACL)
Marketing Share - Permissions.jpg
NTFS Permissions:
Marketing NTFS - Permissions.jpg
Role created for Marketing Users
Marketing - mount command.jpg

We can improve on this by using Automount to access the user's Windows home.

Saturday, January 4, 2014

Basics: Strategies for UNIX Identities with Centrify

Background

In lab 8b, we UNIX-enabled some of the users of our test environment and accessed one of our systems. Here are the session results:


The screenshot above outlines some of the issues that will be encountered when a system is integrated in to Active Directory with Centrify and the users are UNIX-enabled with a proper planning exercise.  For our purposes this is OK, because we need to understand why planning and design exercises should be done.  After all, not everyone is a UNIX/Linux identity management expert.

Duplicated Identities

An identity conflict happens when a key user field (like login or UID) are duplicated.  In the example above the OS (CentOS/RedHat) was designed to be smart enough to warn the user about this, but this is not true of all UNIX and Linux distributions.  This problem has a trickle-down effect in many aspects.  Let's look at the root cause in depth, the culprit is the Name Server Switch (NSS) framework.  Let's look at an excerpt of the file /etc/nsswitch.conf in that system:

passwd:        centrifydc    files
shadow:        centrifydc    files
group:         centrifydc    files


All this means is that any NSS-enabled program will look first at the centrifydc source (in our case Active Directory) and if there's an identity match (for login in this case) this will be the identity picked.  CentOS was just smart enough to continue checking and letting us know that there was a match in the local /etc/passwd too.  This was verified with the subsequent command (getent) that returned a UNIX-enabled jmatthews with an AD SID-derived UID (1149240406) and the local jmatthews with UID 503.

This is true regarding the different sources that a system may have.  In complex environments you could have local databases, OpenLDAP directories, Network Information System services, etc.  It can be as complex as this:

passwd:        ldap nis  files db

In this case, any NSS-enabled program will check LDAP, then NIS, then local files, and so on for users.
This issue is very broad, because it not only applies to users (passwd), but to groups too and with all NSS-enabled programs like login, passwd, sshd, sudo, etc.

The next problem that happens has to do with file/folder ownership.  Notice that our user was unable to change folders to the home directory, in turn he is unable to read his basic environment settings!!!!  This has direct-impact in the productivity of the user, and most likely people will have to get involved to do a change of ownership of files and folders.  This is extremely inefficient.

A final, but important issue has to do with usability.  The user does not have any visual cues to find out the context of the user that he is working with.  Is this the local or the AD account?  We can finish this with some group policies.

The reasons outlined above are why companies with mature identity practices for their UNIX systems do a rationalization (normalization or flattening) of their namespace.  Users have unique login names and UIDs.  Many solutions in the market require organizations to rationalize their namespace prior to implementing the solution, but with Centrify that is not the case.  This is where Active Directory and Centrify Zones come into play.  The following video illustrates how we resolve this one-off:

Strategies for UNIX User Identities with Centrify

The correct strategy depends a lot on the current environment of the customer, but, the preferred strategy is typically the end-state for the majority of the deployments: a normalized user state. The biggest constraint is that the business must go on and there are impact assessments and change-control windows to work with.

A New World of Flexibility with Centrify

Centrify allows for UNIX user identities to be defined at the Zone level, Child Zone (CZ) level and Server level.  This means that a user that is uniquely known in AD as jmatthews@corp.contoso.com, in UNIX, then can have these identities:

Level/Field
Login
UID
GID
GECOS
Home
Shell
Zone (HQ)
jmatthews
1149240406
1149240406
%{u:displayname}
%{home}/%{user}
%{shell}
CZ (Marketing)
jessie.matthews
(same as above)
(same as above)
(same as above)
(same as above)
(same as above)
Server (SOL1)
jmatthew
101
101
Jessie SysAdmin
/exports/home
/bin/bash

Notice that the user's identity was defined with the basic defaults, the login name overridden at the child zone level, and then the whole identity revamped at the Solaris server level.  Notably a truncated login name, more friendly UID/GID as well as defined Home and Shell fields.  Flexibility can be a two-edge blade because it allows for exceptions at multiple levels, and this is against two important Information Technology principles: standardization and simplicity.

Note:  The following strategies assume that the previous questions about AD-domain design, naming conventions, Zone structure, Computer Groups, Roles and Rights and naming conventions have been discussed.

The Recommended Strategy:  Normalize now and have peace of mind

  1. Perform a table-top exercise to normalize your users and groups.
  2. UNIX-enable (or migrate) all users at the zone level with a unique login and a UID generated from SID
  3. Perform any role assignments at the Zone, Hierarchical Zone and Computer Role levels.
  4. Pre-create all the UNIX computer accounts in Active Directory
  5. Place the computer account in their corresponding Computer Role
  6. Join the UNIX/Linux Systems to Active Directory.
  7. Run the adfixid utility
  8. Run the adrmlocal utility
This strategy works if you have committed to fixing this problem and are thinking about the future.  Maybe there are mergers and acquisitions in the future and the namespace is uncertain.  The drawbacks are that the identity rationalization exercise is lengthy and the implementation requires wide change-control windows.  The biggest benefit is that as new systems come online, there's a clean-slate across the board.

Another option:  Obtain results now and normalize later

Use this strategy if you are confident in the existing namespace
  1. UNIX-enable all users at the zone level with a unique login and a UID generated from SID
  2. Perform any role assignments at the Zone, Hierarchical Zone and Computer Role levels.
  3. Pre-create all the UNIX computer accounts in Active Directory
  4. Place the computer account in their corresponding Computer Role
  5. Override all user identities at the system level (to their existing login/UID/GID)
  6. Join the UNIX/Linux Systems to Active Directory.
  7. Use the adrmlocal utility
  8. Normalize opportunistically (with adfixid) or as new servers come online.
This strategy is the fastest path to productivity, however it does not solve the identity issues right away.  If you haven't done so, you may be forced to rationalize accounts that are using exported filesystems.  This allows for waves of systems to be normalized if needed.

Status Quo:  Be stubborn and reactive

  1. Perform a user migration from an existing source (NIS, files, etc.) making sure you conserve the existing identity at the Zone
  2. Perform any role assignments at the Zone, Hierarchical Zone and Computer Role levels.
  3. Pre-create all the UNIX computer accounts in Active Directory
  4. Place the computer account in their corresponding Computer Role
  5. Join the UNIX/Linux Systems to Active Directory.
  6. Use the adrmlocal utility to remove local users (if local) or clean your network-based (NIS) files
  7. If inconsistencies are found, perform local-level overrides.
At the user level, a typical inconsistency is that a user may have different identities in different servers. E.g. in our test environment.  jmatthews has UID 503 on cen1, UID 1001 on suse1 and UID 101 on sol1.
Although this is possible, it's highly inefficient and promotes the same disadvantages of local administration:  non-standardization, exceptions and more exposure.  Unfortunately, this administrative model was highly promoted by Classic zones.  Use this model if you are politically defeated.

Thursday, January 2, 2014

Labs: Managing UNIX Groups fom Active Directory using Centrify

    In this lab:

    • We UNIX-enable the System Admin by using Access Manager
    • We UNIX-enable one of the DBAs using Active Directory Users and Computers
    • We UNIX-enable another DBA using adedit
    • We discuss the issues that arise when a UNIX-enabled AD user has a conflicting account in the system.

    Make sure you review the following postings before this lab:

Tuesday, December 31, 2013

Basics: Managing UNIX groups from Active Directory with Centrify

Background

With Centrify, UNIX group membership can be managed from AD Security groups.  There's basically a 1:1 mapping between the AD group and the UNIX group.
Note:  In version 2016 of Server Suite, Centrify has added the ability to manage local UNIX groups. Here's a post on how to test the feature: http://centrifying.blogspot.com/2016/01/labs-testing-local-account-management.html

Planning

UNIX groups may be used for different purposes, may contain different members and can mean different things for different administrative groups.  The most important goal is standardization in management, therefore the system administrators have to get together to answer these questions:

  • What is this group used for? Why?
  • Is this group still relevant?
  • Will this group be deprecated by any of the authorization components?
    This is very important, for example, Netgroups are not needed anymore with Centrify zones and Computer Roles.  The other important note is that Role Assignments eliminate the need to maintain UNIX groups for the purpose of sudo usage.
  • How many groups are uniquely identified?
  • Are there any groups that are defined differently in other systems?
  • Are the group memberships uniform?  Are there groups that have network and local users?
  • Is this a primary group for all  or a set of users?
  • What is the impact of changing the definition?
  • What is the impact of the unavailability of the group?
  • Is the group in AD going to be managed manually or with a tool?
  • Are there any workflow and approvals required?
  • Is the group subject to any attestation exercises?
  • What will be the naming convention for the AD group that corresponds to the UNIX group?
  • What is the scope of the AD group (Domain Local, Domain Global, Universal)?
All these questions need to be answered with a catalog of groups, definitions, members, etc. in a serious table-top exercise.  Because groups are units of identity management, the decisions made here can affect zone design.  
A common issue seen in the field is that a group is part of a legacy infrastructure not understood by the current management team, therefore they decide to keep the status-quo and not compromise on governance, naming or GID to be assigned, this adds complexity rather than understanding the real impact of the group.

For example:
UNIX Group:  db2-dba
UID: 1001
Group Membership:  Includes local account db2inst.
Note: This means that the agent has to be configured to merge NSS group memberships.
Purpose: Used to identify the db2 Database Admins.
Any different definitions:  No
Managed:  Manually
Attestation:  Yes
AD Standards:
                        AD Group Scope:  Domain Local
                        AD Container: UNIX Groups,
                        AD Naming Convention: UNIX-<Zone Name>-Unix Name.   UNIX-HQ-DB2 DBA

Creating the Group Mapping (Do)

Creating the UNIX Group
  1. In Access Manager, go to the Zone/UNIX Data and right click Groups and select Create UNIX Group
  2. In the Find window, find the corresponding UNIX group (e.g. UNIX-HQ-Wheel), select it and press OK
  3. Set the UNIX name (preferable  8 characters depending on platform(s) to be supported) and set the GID.

Populating the Group
  1. From ADUC, find and open the group, go to the members tab, click add and add any user principal that has been UNIX-enabled.
  2. From Access Manager, right click the UNIX group, select AD properties and follow the steps outlined above.
  3. From UNIX using adedit:
    a) Log in to UNIX/Linux with an account that can modify the group (or use kinit) and open adedit.
    b) bind to the domain
    >bind corp.contoso.com
    c) add the ade_lib library
    >package require ade_lib
    c) use the add_user_to_group function
    >add_user_to_group "jessie.matthews@corp.contoso.com" "UNIX-HQ-DB2 DBAs@corp.contoso.com"
Note:  Remember that you can use an Identity Management tool, a script (VB, PS) to populate an AD Group.

Process Reuse:  Now your organization can reuse the existing process and tools to manage the memberships to UNIX systems.

Verifying the Membership (Check)

You can always get a snapshot of the Members tab of the AD Group, however, here are some alternatives.

On UNIX with the getent command
  1. Log on to a system in the zone that the UNIX group was created.
  2. Use the getent command.  E.g. (for db2dba)
    $ getent group db2dba
    db2dba:x:1001:jessie.matthews
On UNIX with the adquery command
This report is great because it can mix the AD and local users if the agent was configured to merge them.
  1. Log on to a system in the zone that the UNIX group was created.
  2. Use the adquery group command.  E.g. (for db2dba)
    $ adquery group db2dba
    db2dba:x:1001:jessie.matthews
On UNIX with adedit
Log on to a system in the domain.
  1. Log in to UNIX/Linux with an account that can modify the group (or use kinit) and open adedit.
  2. bind to the domain
    >bind corp.contoso.com
  3. Set the object distinguished name
    >set obj_dn [principal_to_dn "UNIX-HQ-DB2 DBAs@corp.contoso.com"]
  4. select the object just retrieved
    >select_object $obj_dn
  5. Query the group members
    >get_object_field member{CN=Jessie Matthews,OU=Staff,DC=corp,DC=contoso,DC=com}

On Windows from the Command Line
  1. On a computer with the AD DS tools installed, open the command prompt
  2. Run the dsget command  (eg. for the UNIX-HQ-DB2 DBAs group)
    dsget group "CN=UNIX-HQ-DB2 DBAs,OU=UNIX Groups,OU=UNIX,DC=corp,DC=contoso,DC=com" -members
    CN=Jessie Matthews,OU=Staff,DC=corp,DC=contoso,DC=com"
On Windows with Access Manager Reporting
  1. On a computer with Access Manager installed, go to the Reports node.
  2. Create your own report or reuse the Groups Report (pre-created)

(Adjust)ing the Group 

Some of the events that may require an adjustment are:
  • Merging local users in the result:   This is needed in situations in which a local group (existing in the /etc/group) that contains a local user needs to be merged with the AD-managed group.   This is documented in the centrifydc.conf file:
    adclient.local.group.merge  (by default false) - use with caution.
  • Adjusting the GID:  This may be required if redefining the group's unique identifier. It can be facilitated by tools like adfixid.