Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


July 24, 2008

ACL on UNIX

Get granular access control similar to AGDLP
RSS
Subscribe to Windows IT Pro | See More Security Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Executive Summary:

You can get granular access control that mimics AGDLP for UNIX systems by using a package of tools and file systems known as ACL. However, although ACL has been around for years, not every UNIX variant supports it. And even within a supported OS and file system, you must be cautious which file tools you use or you might strip the ACL from a file. Learn how to install and use ACL correctly in this example using Ubuntu, which supports ACL.


      On the Windows platform, security administrators can take advantage of a very robust framework when working with file and folder ACLs and assign access permissions to resources by using a strategy known as AGDLP. The acronym stands for the practice of putting accounts (A) into global (G) groups, which are members of domain local (DL) groups, which are assigned permissions (P) on objects. Using the AGDLP strategy makes adding and removing access to users and groups a snap because you don't need to reapply permissions. Many auditors love the AGDLP model as it means they can largely focus on auditing the centralized database, Active Directory (AD).

      In Linux, however, AGDLP becomes more difficult to enforce because most traditional installations only support very broad access control consisting of three levels: owner, group, and “other.” Using this model, you're limited to only a single group from which to base your permissions (e.g., Read or Write) and then grant those permissions to other groups and users by making them members of that original group. But you can get granular access control that mimics several steps of the AGDLP process for UNIX systems by using a package of tools and file systems known as ACL.

 

ACL on UNIX

ACL has been available to the UNIX community for many years but perhaps isn't well known, especially to Windows admins new to managing UNIX variants. The ACL package is based on POSIX.1.e, which defines various security standards within UNIX systems, including how to handle discrete access control lists. (POSIX is a collection of IEEE standards specifying how software should operate on various UNIX systems.)

      Although ACL has been around for years, not every UNIX variant supports it. Even within a supported OS and file system, you must be cautious which file tools you use or you might strip the ACL from a file. However, if you want to grant fine-grained access controls to a file, ACL provides richness not otherwise available to you.

 

Using ACL

Let’s walk through an example to get a feel for how to use the ACL package. Let's say you're responsible for the centralized firewall logs and you want to grant a series of access permissions to various groups. The firewall logs are stored in the directory /var/log/hosts.

      For your networking team, you decide to provide read-only access; your log file admins who regularly maintain the logs get read/write access. To accomplish this, create two groups: fwlog-reader and fwlog-author. For the fwlog-reader group, you'll assign read-only access. For the fwlog-author group, you'll assign read/write access. To create these groups, run this command:

 

sudo addgroup fwlog-reader

sudo addgroup fwlog-author

 

 

      I'll walk you through installing and configuring the ACL package in a moment, then you'll use the command setfacl to apply unique permissions to the firewall logs for each of these groups. You'll then be free to add or remove individuals from the membership of these groups without having to reset the permissions of the files. (Plus, if your UNIX systems are AD aware and these groups are domain local groups, then your auditing of the membership becomes simpler too as the groups are in one location and stored in AD instead of stored on the individual servers.)

      In this example we’ll walk through the steps of installing and configuring ACL using Ubuntu 7.10 with the 2.6 kernel and an EXT3 file system. Other Linux distributions and UNIX variants support ACL (e.g., XFS, ReiserFS file systems, and more recently EXT2 and EXT3 file systems), but that support varies significantly, so it’s important you review the ACL implementation for your specific platform and also review which tools you want to use with your ACL extended files.

      First, install the ACL package using Ubuntu’s package manager aptitude by running the command

 

sudo aptitude install acl

 

Next, enable ACL for each partition where you want to set the extended file attributes. Do this by editing the file /etc/fstab. This is the critical file-system table. I recommend you make a backup first and be careful when editing. While you're learning about ACL for your variant of UNIX (or UNIX-like system), I recommend testing on a non-critical partition in case something goes awry, so you can recover without losing access to your system. I also recommend testing and learning using a virtual machine (VM) guest that you’ve taken a snapshot of prior to making any changes. If you make a catastrophic change, you can quickly revert to the snapshot.

      The fstab file varies by Linux system but generally contains the name of the device, the mount point, type, options, the archiving schedule, and the order a volume is scanned for errors. To activate ACL support for a specific partition, you need to add the ACL option to its entry. For example, in our test system, the root directory is mounted to the device /dev/sda1. Your installation will vary, but look for the options—in this case, defaults,errors=remount-ro—and add the option acl, which in this case would look like this:

 

/dev/sda1/ ext3acl,defaults,errors=remount-ro 0 1

 

You shouldn't edit anything else in the file, nor should you change other parts of the entry. You're simply adding the option acl. Also, your fstab might look different because recent versions of some Linux variants also now support Universal Unique Identifiers (UUID) instead of the device, so be careful and do some research if the contents of your fstab aren't familiar to you.)

      Next, remount your partition or if you set ACL on an in-use partition, reboot your system.

At this point your partition supports setting of file-level ACLs.

      To set and view the ACLs on a file, run the commands setfacl and getfacl, respectively. Before we set any new ACLs, let's view the current ACLs on our target directory by running this command:

 

jeff@ubuntu:/var/log$ getfacl hosts

 

The command returns the user, group, and other permissions of the traditional UNIX permission model. In this example, only root has access to the directory:

# file: hosts

# owner: root

# group: root

user::rwx

group::r-x

other::r-x

 

      Now, let’s set the ACL for our two new groups by running this command:

 

sudo setfacl -m group:fwlog-reader:r /var/log/hosts

sudo setfacl -m group:fwlog-author:rw /var/log/hosts

 

The parameter -m instructs the program to modify an existing ACL. (You can specify the parameter -x to remove an ACL.) The next triplet of parameters separated by colons specifies whether to modify (or add) a user or group, the name of that user or group, and the permissions you wish to grant—either read (r), write (w), or execute (x). The first command above, for example, instructs the program to add the group named fwlog-reader with read-only access to the directory /var/log/hosts.

      Now, when you rerun getfacl like this

 

jeff@ubuntu:/var/log$ getfacl hosts

 

you can see the new ACLs:

# file: hosts

# owner: root

# group: root

user::rwx

group::r-x

group:fwlog-reader:r--

group:fwlog-author:rw-

mask::rwx

other::r-x

 

      Now, users who are members of either the fwlog-reader or fwlog-author groups have permissions to access files within that folder appropriate to their role. Other features of ACL allow mass processing of many files and folders as well as support to back up and restore your newly-set ACLs. You might want to check out the ACL man (manual) page as well as search the web for other examples of how to configure and use this very useful package.

 

End of Article



Reader Comments

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...

WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...


Related Articles Command-line Tools in Windows Server 2008

Integrate Active Directory and OpenLDAP

6 New Security Features in IIS 7.0

Strengthening Permissions on Hard Links

Security Whitepapers Reducing the Costs and Risks of Branch Office Data Protection

Solving Desktop Management Challenges in Healthcare

Solving Desktop Management Challenges in Education

Related Events Introduction to Identity Lifecycle Manager "2"

Configuration Manager SP1 and R2 Overview

SQL Server Security: How to Secure, Monitor & Audit Your Databases

Check out our list of Free Email Newsletters!

Security eBooks Spam Fighting and Email Security for the 21st Century

Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

Related Security Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement