21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter CHAPTER 2 2<br />

Access Control<br />

Access control is a major issue for application developers. An application must<br />

always be sure to protect its resources from unauthorized access. This requires properly<br />

setting permissions on created files, allowing only authorized hosts to connect to<br />

any network ports, and properly handling privilege elevation and surrendering.<br />

Applications must also defend against race conditions that may occur when opening<br />

files—for example, the Time of Check, Time of Use (TOCTOU) condition. The<br />

proper approach to access control is a consistent, careful use of all APIs that access<br />

external resources. You must minimize the time a program runs with privileges and<br />

perform only the bare minimum of operations at a privileged level. When sensitive<br />

data is involved, it is your application’s duty to protect the user’s data from unauthorized<br />

access; keep this in mind during all stages of development.<br />

2.1 Understanding the Unix Access Control<br />

Model<br />

<strong>Problem</strong><br />

You want to understand how access control works on Unix systems.<br />

Solution<br />

Unix traditionally uses a user ID–based access control system. Some newer variants<br />

implement additional access control mechanisms, such as Linux’s implementation of<br />

POSIX capabilities. Because additional access control mechanisms vary greatly from<br />

system to system, we will discuss only the basic user ID system in this recipe.<br />

Discussion<br />

Every process running on a Unix system has a user ID assigned to it. In reality, every<br />

process actually has three user IDs assigned to it: an effective user ID, a real user ID,<br />

38<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!