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.

If the assignment is successful, the AssignProcessToJobObject( )returns TRUE; otherwise,<br />

it returns FALSE, and the reason for the failure can be determined by calling<br />

GetLastError( ). Note that when a process exceeds one of the set limits, it is terminated<br />

immediately without being given the opportunity to perform any cleanup.<br />

13.11 Following Best Practices for Audit Logging<br />

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

You want to record activity and/or errors in your program for later review.<br />

Solution<br />

On Unix systems, syslog is the system audit logging facility. Windows also has its<br />

own built-in facility for audit logging that differs significantly from syslog on Unix.<br />

Discussion<br />

734 | Chapter 13: Other Topics<br />

The syslog( ) function is susceptible to a format string attack if used<br />

improperly. See Recipe 3.2 for more information.<br />

We cannot overstate the importance of audit logging for security and, more importantly,<br />

for forensics. Unfortunately, most existing logging infrastructures severely<br />

lack any kind of security. It is generally trivial for attackers to cover their tracks by<br />

modifying or deleting any logs that would betray their presence or indicate how they<br />

managed to infiltrate your system. A number of things can be done to raise the bar,<br />

making it much more difficult for the would-be attacker to invalidate your logs. (We<br />

acknowledge, however, that no solution is perfect.)<br />

Network logging<br />

One such possibility involves logging to a network server that is dedicated to storing<br />

the logs of other machines on the network. The Unix syslog utility provides a simple<br />

interface for configuring logging to a network server instead of writing the log files<br />

on the local system, but the system administrator must do the configuration. Configuration<br />

cannot be done programmatically by individual programs using the service to<br />

make log entries.<br />

If the server that is responsible for audit logging is configured properly, it can make<br />

an attacker’s job of scrubbing your logs considerably more difficult, but it doesn’t<br />

provide any real guarantees that your log files will not be altered or deleted by an<br />

attacker. Your audit log server should be configured to accept remote logging connections<br />

and nothing else. Any other access to the log files should require physical<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!