<?Pub UDT _bookmark _target?><?Pub EntList bsol dash hellip gt lt minus?><?Pub CX solbook(book(title()bookinfo()part(6)part(title()partintro()chapter()?><chapter id="audittask-1"><?Pub Tag atict:info tracking="on" ref="0"?><?Pub Tag atict:user user="sharonr" fullname="Sharon Veach"?><title>Managing
Solaris Auditing (Tasks)</title><highlights><itemizedlist><para>This chapter presents procedures to help you set up and manage a Solaris
system that is audited. This chapter also includes instructions for administering
the audit trail. The following is a list of the information in this chapter.</para><listitem><para><olink targetptr="audittask-3" remap="internal">Solaris Auditing (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="audittask-15" remap="internal">Configuring Audit Files (Task
Map)</olink></para>
</listitem><listitem><para><olink targetptr="audittask-4" remap="internal">Configuring and Enabling the
Auditing Service (Task Map)</olink></para>
</listitem><listitem><para><olink targetptr="audittask-91" remap="internal">Managing Audit Records (Task
Map)</olink></para>
</listitem>
</itemizedlist><para>For an overview of the auditing service, see <olink targetptr="auditov-1" remap="internal">Chapter&nbsp;28,
Solaris Auditing (Overview)</olink>. For planning suggestions, see <olink targetptr="auditplan-1" remap="internal">Chapter&nbsp;29, Planning for Solaris Auditing</olink>.
For reference information, see <olink targetptr="auditref-1" remap="internal">Chapter&nbsp;31,
Solaris Auditing (Reference)</olink>.</para>
</highlights><sect1 id="audittask-3"><title>Solaris Auditing (Task Map)</title><para><indexterm><primary>audit daemon</primary><see><command>auditd</command> daemon</see></indexterm><indexterm><primary>task maps</primary><secondary>auditing</secondary></indexterm><indexterm><primary>managing</primary><secondary>auditing</secondary></indexterm><indexterm><primary>administering</primary><secondary>auditing</secondary><tertiary>task map</tertiary></indexterm><indexterm><primary>Solaris auditing task map</primary></indexterm>The following task map points to the major tasks
that are required to manage auditing. The tasks are ordered.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colname="colspec1" colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. Plan for auditing</para>
</entry><entry><para>Contains configuration issues to decide before you configure the auditing
service.</para>
</entry><entry><para><olink targetptr="auditplan-11" remap="internal">Planning Solaris Auditing (Task Map)</olink></para>
</entry>
</row><row><entry><para>2. Configure audit files</para>
</entry><entry><para>Defines which events, classes, and users require auditing.</para>
</entry><entry><para><olink targetptr="audittask-15" remap="internal">Configuring Audit Files (Task Map)</olink></para>
</entry>
</row><row><entry morerows="1" rowsep="1"><para>3. Configure and enable auditing</para>
</entry><entry><para>Configures each host for disk space and other auditing service requirements.
Then, starts the auditing service.</para>
</entry><entry><para><olink targetptr="audittask-4" remap="internal">Configuring and Enabling the Auditing
Service (Task Map)</olink></para>
</entry>
</row><row><entry><para>On a host that has installed non-global zones, configure one auditing
service for the system, or one auditing service per zone.</para>
</entry><entry><para><olink targetptr="audittask-26" remap="internal">Configuring the Auditing Service in
Zones (Tasks)</olink></para>
</entry>
</row><row><entry><para>4. Manage audit records</para>
</entry><entry><para>Collects and analyzes the audit data.</para>
</entry><entry><para><olink targetptr="audittask-91" remap="internal">Managing Audit Records (Task Map)</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="audittask-15"><title>Configuring Audit Files (Task Map)</title><indexterm><primary>task maps</primary><secondary>configuring audit files</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>audit files task map</secondary>
</indexterm><para>The following task map points to the procedures for configuring files
to customize auditing at your site. Most of the tasks are optional.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec2" colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colname="colspec3" colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Select audit classes, and customize <filename>audit_control</filename> settings</para>
</entry><entry><para>Involves:</para><itemizedlist><listitem><para>Preselecting system-wide audit classes</para>
</listitem><listitem><para>Specifying the audit directories for each system</para>
</listitem><listitem><para>Setting disk space limits on audit file systems</para>
</listitem>
</itemizedlist>
</entry><entry><para><olink targetptr="audittask-45" remap="internal">How to Modify the audit_control File</olink></para>
</entry>
</row><row><entry><para>(Optional) Log audit events in two modes</para>
</entry><entry><para>Enables you to monitor audit events in real time, in addition to storing
audit records in binary format.</para>
</entry><entry><para><olink targetptr="audittask-11" remap="internal">How to Configure syslog Audit Logs</olink></para>
</entry>
</row><row><entry><para>(Optional) Change audit characteristics for users</para>
</entry><entry><para>Sets user-specific exceptions to the system-wide preselected audit classes.</para>
</entry><entry><para><olink targetptr="audittask-53" remap="internal">How to Change a User's Audit Characteristics</olink></para>
</entry>
</row><row><entry><para>(Optional) Add audit classes</para>
</entry><entry><para>Reduces the number of audit records by creating a new audit class to
hold events.</para>
</entry><entry><para><olink targetptr="audittask-58" remap="internal">How to Add an Audit Class</olink></para>
</entry>
</row><row><entry><para>(Optional) Change event-to-class mappings</para>
</entry><entry><para>Reduces the number of audit records by changing the event-class mapping.</para>
</entry><entry><para><olink targetptr="audittask-59" remap="internal">How to Change an Audit Event's Class
Membership</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="audittask-44"><title>Configuring Audit Files (Tasks)</title><indexterm><primary>configuring</primary><secondary>audit files</secondary>
</indexterm><indexterm><primary>audit files</primary><secondary>configuring</secondary>
</indexterm><para>Before you enable auditing on your network, you can customize the audit
configuration files for your site auditing requirements. You can also restart
the auditing service or reboot the local system to read changed configuration
files after the auditing service has been enabled. However, the recommended
practice is to customize your audit configuration as much as possible before
you start the auditing service.</para><para>If you have implemented zones, you can choose to audit all zones from
the global zone. To differentiate between zones in the audit output, you can
set the <literal>zonename</literal> policy option. Alternatively, to audit
 non-global zones individually, you can set the <literal>perzone</literal> policy
in the global zone and customize the audit configuration files in the non-global
zones. For an overview, see <olink targetptr="auditref-28" remap="internal">Auditing and Solaris
Zones</olink>. For planning, see <olink targetptr="auditplan-10" remap="internal">How to Plan
Auditing in Zones</olink>.</para><task id="audittask-45"><title>How to Modify the <filename>audit_control</filename> File</title><indexterm><primary>changing</primary><secondary><filename>audit_control</filename> file</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary><filename>audit_control</filename> file</secondary>
</indexterm><indexterm><primary><filename>audit_control</filename> file</primary><secondary>configuring</secondary>
</indexterm><indexterm><primary>configuration files</primary><secondary><filename>audit_control</filename> file</secondary>
</indexterm><indexterm><primary>selecting</primary><secondary>audit classes</secondary>
</indexterm><indexterm><primary>preselecting</primary><secondary>audit classes</secondary>
</indexterm><indexterm><primary>audit classes</primary><secondary>preselecting</secondary>
</indexterm><tasksummary><para>The <filename>/etc/security/audit_control</filename> file configures
system-wide auditing. The file determines which events are audited, when audit
warnings are issued, and the location of the audit files.</para>
</tasksummary><procedure>&rolePAstep;<step performance="optional" id="audittask-stepopt-3"><para>Save a backup
copy of the <filename>audit_control</filename> file.</para><screen># <userinput>cp /etc/security/audit_control /etc/security/audit_control.orig</userinput></screen>
</step><step><para>Modify the <filename>audit_control</filename> file for your site.</para><para>Each entry has the following format:</para><screen><replaceable>keyword</replaceable>:<replaceable>value</replaceable></screen><variablelist><varlistentry><term><replaceable>keyword</replaceable></term><listitem><para>Defines the type of line. The types are <literal>dir</literal>, <literal>flags</literal>, <literal>minfree</literal>, <literal>naflags</literal>, and <literal>plugin</literal>. The <literal>dir</literal> line can be repeated.</para><para>For explanations of the keywords, see the following examples. For an
example of a <literal>plugin</literal> entry, see <olink targetptr="audittask-11" remap="internal">How to Configure syslog Audit Logs</olink></para>
</listitem>
</varlistentry><varlistentry><term><replaceable>value</replaceable></term><listitem><para>Specifies data that is associated with the line type.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="audittask-71"><title>Preselecting Audit Classes for All Users</title><para>The <literal>flags</literal> line in the <filename>audit_control</filename> file
defines which classes of attributable events are audited for all users on
the system. The classes are separated by commas. White space is allowed. In
this example, the events in the <literal>lo</literal> class are audited for
all users.</para><screen># audit_control file
dir:/var/audit
<userinput>flags:lo</userinput>
minfree:20
naflags:lo</screen><para>To see which events are in the <literal>lo</literal> class, read the <filename>audit_event</filename> file. You can also use the <command>bsmrecord</command> command,
as shown in <olink targetptr="audittask-33" remap="internal">Example&nbsp;30&ndash;25</olink>.</para>
</example><example id="audittask-70"><title>Preselecting Nonattributable Events</title><para>In this example, all events in the <literal>na</literal> class, and
all <literal>login</literal> events that are not attributable, are audited.</para><screen># audit_control file
dir:/var/audit
flags:lo
minfree:20
<userinput>naflags:lo,na</userinput></screen>
</example><example id="audittask-50"><title>Specifying the Location of Binary Audit Data</title><para><indexterm><primary>naming conventions</primary><secondary>audit directories</secondary></indexterm>The <literal>dir</literal> lines in the <filename>audit_control</filename> file list which audit file systems to use for binary audit data.
In this example, three locations for binary audit data are defined.</para><screen># audit_control file
#
# Primary audit directory - NFS-mounted from audit server
<userinput>dir:/var/audit/egret.1/files</userinput>
#
# Secondary audit directory - NFS-mounted from audit server
<userinput>dir:/var/audit/egret.2/files</userinput>
#
# Directory of last resort local directory
<userinput>dir:/var/audit</userinput>
flags:lo
minfree:20
naflags:lo,na
plugin:</screen><para>To set up file systems to hold audit binary audit data, see <olink targetptr="audittask-8" remap="internal">How to Create Partitions for Audit Files</olink>.</para>
</example><example id="audittask-49"><title>Changing the Soft Limit for Warnings</title><para>In this example, the minimum free-space level for all audit file systems
is set so that a warning is issued when only 10 percent of the file system
is available.</para><screen># audit_control file
#
dir:/var/audit/examplehost.1/files
dir:/var/audit/examplehost.2/files
dir:/var/audit/localhost/files
flags:lo
<userinput>minfree:10</userinput>
naflags:lo,na</screen><para>The <literal>audit_warn</literal> alias receives the warning. To set
up the alias, see <olink targetptr="audittask-16" remap="internal">How to Configure the audit_warn
Email Alias</olink>.</para>
</example>
</task><task id="audittask-11"><title>How to Configure <command>syslog</command> Audit
Logs</title><indexterm><primary>configuring</primary><secondary>textual audit logs</secondary>
</indexterm><indexterm><primary>log files</primary><secondary>configuring for auditing service</secondary>
</indexterm><indexterm><primary>audit logs</primary><secondary>configuring textual audit logs</secondary>
</indexterm><tasksummary><para>You can instruct the auditing service to collect only binary audit data,
or you can instruct the auditing service to collect binary data and text data.
In the following procedure, you collect binary audit data and text audit data.
The collected text audit data is a subset of the binary data.</para>
</tasksummary><taskprerequisites><para>Preselected audit classes must be specified on the <literal>flags</literal> line
or the <literal>naflags</literal> line of the <filename>audit_control</filename> file.
The text data is a subset of the preselected binary data.</para>
</taskprerequisites><procedure>&rolePAstep;<step performance="optional"><para>Save a backup copy of the <filename>audit_control</filename> file.</para><screen># <userinput>cp /etc/security/audit_control /etc/security/audit_control.save</userinput></screen>
</step><step><para>Add a <literal>plugin</literal> entry.</para><para><indexterm><primary>plugins</primary><secondary>in auditing service</secondary></indexterm>Plugins
in the auditing service implement binary output and <command>syslog</command> output
of audit data. The binary plugin is not specified. The <command>syslog</command> plugin
must be specified. For more information, see <olink targetptr="auditref-14" remap="internal">auditd
Daemon</olink>.</para><para>A <literal>plugin</literal> entry has the following format:</para><screen>plugin:name=<replaceable>value</replaceable>; p_flags=<replaceable>classes</replaceable></screen><variablelist><varlistentry><term><replaceable>value</replaceable></term><listitem><para>Lists the name of the plugin to use. Currently, the only valid
value is the <filename>audit_syslog.so.1</filename> plugin.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>classes</replaceable></term><listitem><para><indexterm><primary><literal>flags</literal> line</primary><secondary><literal>plugin</literal> line and</secondary></indexterm><indexterm><primary><literal>naflags</literal> line</primary><secondary><literal>plugin</literal> line and</secondary></indexterm><indexterm><primary><literal>plugin</literal> line</primary><secondary><literal>flags</literal> line and</secondary></indexterm>Lists
a subset of the audit classes that are specified in the <literal>flags</literal> line
and the <literal>naflags</literal> line.</para>
</listitem>
</varlistentry>
</variablelist><para>For more information about the <literal>plugin</literal> value, see
the <olink targetdoc="group-refman" targetptr="audit-syslog-5" remap="external"><citerefentry><refentrytitle>audit_syslog</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> man page.</para>
</step><step><para><indexterm><primary><filename>/etc/syslog.conf</filename> file</primary><secondary>auditing and</secondary></indexterm><indexterm><primary><filename>syslog.conf</filename> file</primary><secondary><literal>audit.notice</literal> level</secondary></indexterm><indexterm><primary><literal>audit.notice</literal> entry</primary><secondary><filename>syslog.conf</filename> file</secondary></indexterm><indexterm><primary><filename>/var/adm/auditlog</filename> file</primary><secondary>text audit records</secondary></indexterm><indexterm><primary><filename>auditlog</filename> file</primary><secondary>text audit records</secondary></indexterm><indexterm><primary>audit records</primary><secondary><filename>/var/adm/auditlog</filename> file</secondary></indexterm>Add an <literal>audit.notice</literal> entry to the <filename>syslog.conf</filename> file.</para><para>The entry includes the location of
the log file.</para><screen># <userinput>cat /etc/syslog.conf</userinput>
&hellip;
audit.notice       /var/adm/auditlog</screen><para>Text logs should not be stored where the binary audit files are stored.
The <command>auditreduce</command> command assumes that all files in an audit
partition are binary audit files.</para>
</step><step><para>Create the log file.</para><screen># <userinput>touch /var/adm/auditlog</userinput></screen>
</step><step><para><indexterm><primary><command>svcadm</command> command</primary><secondary>restarting <command>syslog</command> daemon</secondary></indexterm>Refresh
the configuration information for the <command>syslog</command> service.</para><screen># <userinput>svcadm refresh system/system-log</userinput></screen>
</step><step><para>Regularly archive the <command>syslog</command> log files.</para><para>The auditing service can generate extensive output. To manage the logs,
see the <olink targetdoc="group-refman" targetptr="logadm-1m" remap="external"><citerefentry><refentrytitle>logadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</step>
</procedure><example id="audittask-63"><title>Specifying Audit Classes for <literal>syslog</literal> Output</title><para>In the following example, the <literal>syslog</literal> utility collects
a subset of the preselected audit classes.</para><screen># audit_control file
dir:/var/audit/host.1/files
dir:/var/audit/host.2/files
dir:/var/audit/localhost/files
flags:lo,ss
minfree:10
naflags:lo,na
<userinput>plugin:name=audit_syslog.so.1; p_flags=-lo,-na,-ss</userinput></screen><para>The <literal>flags</literal> and <literal>naflags</literal> entries
instruct the system to collect all login/logout, nonattributable, and change
of system state audit records in binary format. The <literal>plugin</literal> entry
instructs the <filename>syslog</filename> utility to collect only failed logins,
failed nonattributable events, and failed changes of system state.</para>
</example><example id="audittask-73"><title>Putting <command>syslog</command> Audit Records on a Remote System</title><para>You can change the <literal>audit.notice</literal> entry in the <filename>syslog.conf</filename> file to point to a remote system. In this example, the name of
the local system is <literal>example1</literal>. The remote system is <literal>remote1</literal>.</para><screen>example1 # <userinput>cat /etc/syslog.conf</userinput>
&hellip;
audit.notice       @remote1</screen><para>The <literal>audit.notice</literal> entry in the <filename>syslog.conf</filename> file
on the <literal>remote1</literal> system points to the log file.</para><screen>remote1 # <userinput>cat /etc/syslog.conf</userinput>
&hellip;
audit.notice       /var/adm/auditlog</screen>
</example>
</task><task id="audittask-53"><title>How to Change a User's Audit Characteristics</title><indexterm><primary>configuring</primary><secondary><filename>audit_user</filename> database</secondary>
</indexterm><indexterm><primary><filename>audit_user</filename> database</primary><secondary>specifying user exceptions</secondary>
</indexterm><indexterm><primary>users</primary><secondary>modifying audit preselection mask of</secondary>
</indexterm><indexterm><primary>audit preselection mask</primary><secondary>modifying for individual users</secondary>
</indexterm><tasksummary><para>Definitions for each user are stored in the <filename>audit_user</filename> database.
These definitions modify, for the specified user, the preselected classes
in the <filename>audit_control</filename> file. The <filename>nsswitch.conf</filename> file
determines if a local file or if a name service database is used. To calculate
the user's final audit preselection mask, see <olink targetptr="auditref-55" remap="internal">Process
Audit Characteristics</olink>.</para>
</tasksummary><procedure>&rolePAstep;<step performance="optional" id="audittask-stepopt-4"><para>Save a backup
copy of the <filename>audit_user</filename> database.</para><screen># <userinput>cp /etc/security/audit_user /etc/security/audit_user.orig</userinput></screen>
</step><step><para>Add new entries to the <filename>audit_user</filename> database.</para><para>In the local database, each entry has the following format:</para><screen><replaceable>username</replaceable>:<replaceable>always-audit</replaceable>:<replaceable>never-audit</replaceable></screen><variablelist><varlistentry><term><replaceable>username</replaceable></term><listitem><para>Selects the name of the user to be audited.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>always-audit</replaceable></term><listitem><para>Selects the list of audit classes that should always be audited
for the specified user.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>never-audit</replaceable></term><listitem><para>Selects the list of audit classes that should never be audited
for the specified user.</para>
</listitem>
</varlistentry>
</variablelist><para>You can specify multiple classes by separating the audit classes with
commas.</para><para>The <filename>audit_user</filename> entries are in effect at the user's
next login.</para>
</step>
</procedure><example id="audittask-75"><title>Changing Which Events Are Audited for One User</title><para>In this example, the <filename>audit_control</filename> file contains
the preselected audit classes for the system:</para><screen># audit_control file
&hellip;
flags:lo,ss
minfree:10
naflags:lo,na</screen><para>The <filename>audit_user</filename> file shows an exception. When the
user <literal>jdoe</literal> uses a profile shell, that use is audited:</para><screen># audit_user file
jdoe:pf</screen><para>The audit preselection mask for <literal>jdoe</literal> is a combination
of the <filename>audit_user</filename> settings with the <filename>audit_control</filename> settings.
The <command>auditconfig -getaudit</command> command shows the preselection
mask for <literal>jdoe</literal>:</para><screen># <userinput>auditconfig -getaudit</userinput>
audit id = jdoe(1234567)
process preselection mask = ss,pf,lo(0x13000,0x13000)
terminal id (maj,min,host) = 242,511,example1(192.168.160.171)
audit session id = 2138517656</screen>
</example><example id="audittask-35"><title>Auditing Users Only, Not the System</title><para>In this example, the login and role activities of four users only are
audited on this system. The <filename>audit_control</filename> file does not
preselect audit classes for the system:</para><screen># audit_control file
&hellip;
flags:
minfree:10
naflags:</screen><para>The <filename>audit_user</filename> file preselects two audit classes
for four users:</para><screen># audit_user file
jdoe:lo,pf
kdoe:lo,pf
pdoe:lo,pf
sdoe:lo,pf</screen><para>The following <literal>audit_control</literal> file protects the system
from unwarranted intrusion. In combination with the <filename>audit_user</filename> file,
this file protects the system more than the first <filename>audit_control</filename> file
in this example.</para><screen># audit_control file
&hellip;
flags:
minfree:10
naflags:lo</screen>
</example>
</task><task id="audittask-58"><title>How to Add an Audit Class</title><indexterm><primary>changing</primary><secondary><filename>audit_class</filename> file</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>audit classes</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary><filename>audit_class</filename> file</secondary>
</indexterm><indexterm><primary><filename>audit_class</filename> file</primary><secondary>adding a class</secondary>
</indexterm><indexterm><primary>audit classes</primary><secondary>modifying default</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>audit classes</secondary>
</indexterm><indexterm><primary>audit classes</primary><secondary>adding</secondary>
</indexterm><tasksummary><para>When you create your own audit class, you can place into it just those
audit events that you want to audit for your site. When you add the class
on one system, you should copy the change to all systems that are being audited.</para>
</tasksummary><procedure>&rolePAstep;<step performance="optional" id="audittask-stepopt-5"><para>Save a backup
copy of the <filename>audit_class</filename> file.</para><screen># <userinput>cp /etc/security/audit_class /etc/security/audit_class.orig</userinput></screen>
</step><step id="audittask-addclass-1"><para>Add new entries to the <filename>audit_class</filename> file.</para><para>Each entry has the following format:</para><screen>0x<replaceable>number</replaceable>:<replaceable>name</replaceable>:<replaceable>description</replaceable></screen><variablelist><varlistentry><term>0x</term><listitem><para>Identifies <replaceable>number</replaceable> as hexadecimal.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>number</replaceable></term><listitem><para>Defines the unique audit class mask.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>name</replaceable></term><listitem><para>Defines the letter name of the audit class.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>description</replaceable></term><listitem><para>Defines the descriptive name of the audit class.</para>
</listitem>
</varlistentry>
</variablelist><para>The entry must be unique in the file. Do not use existing audit class
masks.</para>
</step>
</procedure><example id="audittask-51"><title>Creating a New Audit Class</title><para>This example creates a class to hold a small set of audit events. The
added entry to the <filename>audit_class</filename> file is as follows:</para><screen>0x01000000:pf:profile command</screen><para>The entry creates a new audit class that is called <literal>pf</literal>. <olink targetptr="audittask-43" remap="internal">Example&nbsp;30&ndash;10</olink> populates the new
audit class.</para>
</example><taskrelated role="troubleshooting"><para>If you have customized the <filename>audit_class</filename> database,
make sure that any modifications to <filename>audit_user</filename> are consistent
with the new audit classes. Errors occur when the audit classes in <filename>audit_user</filename> are not a subset of the <filename>audit_class</filename> database.</para>
</taskrelated>
</task><task id="audittask-59"><title>How to Change an Audit Event's Class
Membership</title><indexterm><primary>configuring</primary><secondary><filename>audit_event</filename> file</secondary>
</indexterm><indexterm><primary>changing</primary><secondary><filename>audit_event</filename> file</secondary>
</indexterm><indexterm><primary><filename>audit_event</filename> file</primary><secondary>changing class membership</secondary>
</indexterm><indexterm><primary>audit events</primary><secondary>changing class membership</secondary>
</indexterm><tasksummary><para>You might want to change an audit event's class membership to reduce
the size of an existing audit class, or to place the event in a class of its
own. When you reconfigure audit event-class mappings on one system, you should
copy the change to all systems that are being audited.</para>
</tasksummary><procedure>&rolePAstep;<step performance="optional" id="audittask-stepopt-1"><para>Save a backup
copy of the <filename>audit_event</filename> file.</para><screen># <userinput>cp /etc/security/audit_event /etc/security/audit_event.orig</userinput></screen>
</step><step><para>Change the class to which particular events belong by changing
the <replaceable>class-list</replaceable> of the events.</para><para>Each
entry has the following format:</para><screen><replaceable>number</replaceable>:<replaceable>name</replaceable>:<replaceable>description</replaceable>:<replaceable>class-list</replaceable></screen><variablelist><varlistentry><term><replaceable>number</replaceable></term><listitem><para>Is the audit event ID.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>name</replaceable></term><listitem><para>Is the name of the audit event.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>description</replaceable></term><listitem><para>Typically, the system call or executable that triggers the
creation of an audit record.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>class-list</replaceable></term><listitem><para>Is a comma-separated list of audit classes.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="audittask-43"><title>Mapping Existing Audit Events to a New Class</title><para>This example maps an existing audit event to the new class that was
created in <olink targetptr="audittask-51" remap="internal">Example&nbsp;30&ndash;9</olink>.
In the <filename>audit_control</filename> file, the binary audit record captures
successes and failures of events in the <literal>pf</literal> class. The <filename>syslog</filename> audit log contains only failures of events in the <literal>pf</literal> class.</para><screen># <userinput>grep pf | /etc/security/audit_class</userinput>
0x01000000:pf:profile command
# <userinput>vi /etc/security/audit_event</userinput>
6180:AUE_prof_cmd:profile command:ua,as<userinput>,pf</userinput>
# <userinput>vi audit_control</userinput>
...
flags:lo<userinput>,pf</userinput>
plugin:name=audit_syslog.so.1; p_flags=-lo<userinput>,-pf</userinput></screen>
</example><example id="audittask-74"><title>Auditing the Use of <command>setuid</command> Programs</title><para>This example creates a class to hold events that monitor calls to the <command>setuid</command> and <command>setgid</command> programs. The <filename>audit_control</filename> entries audit all successful invocations of the events in the <literal>st</literal> class.</para><screen># <userinput>vi /etc/security/audit_class</userinput>
0x00000800:st:setuid class
# <userinput>vi /etc/security/audit_event</userinput>
26:AUE_SETGROUPS:setgroups(2):<userinput>st</userinput>
27:AUE_SETPGRP:setpgrp(2):<userinput>st</userinput>
40:AUE_SETREUID:setreuid(2):<userinput>st</userinput>
41:AUE_SETREGID:setregid(2):<userinput>st</userinput>
214:AUE_SETEGID:setegid(2):<userinput>st</userinput>
215:AUE_SETEUID:seteuid(2):<userinput>st</userinput>
# <userinput>vi audit_control</userinput>
...
flags:lo<userinput>,+st</userinput>
plugin:name=audit_syslog.so.1; p_flags=-lo<userinput>,+st</userinput></screen>
</example>
</task>
</sect1><sect1 id="audittask-4"><title>Configuring and Enabling the Auditing Service
(Task Map)</title><indexterm><primary>task maps</primary><secondary>configuring auditing service</secondary>
</indexterm><indexterm><primary>task maps</primary><secondary>enabling auditing service</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>auditing service task map</secondary>
</indexterm><indexterm><primary>enabling</primary><secondary>auditing service task map</secondary>
</indexterm><para>The following task map points to procedures for configuring and enabling
the auditing service. The tasks are ordered.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colname="colspec1" colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. (Optional) Change the audit configuration files</para>
</entry><entry><para>Selects which events, classes, and users require auditing.</para>
</entry><entry><para><olink targetptr="audittask-15" remap="internal">Configuring Audit Files (Task Map)</olink></para>
</entry>
</row><row><entry><para>2. Create audit partitions</para>
</entry><entry><para>Creates disk space for the audit files, and protects them with file
permissions.</para>
</entry><entry><para><olink targetptr="audittask-8" remap="internal">How to Create Partitions for Audit Files</olink></para>
</entry>
</row><row><entry><para>3. Create the <literal>audit_warn</literal> alias</para>
</entry><entry><para>Defines who should get email warnings when the auditing service needs
attention.</para>
</entry><entry><para><olink targetptr="audittask-16" remap="internal">How to Configure the audit_warn Email
Alias</olink></para>
</entry>
</row><row><entry><para>4. (Optional) Change audit policy</para>
</entry><entry><para>Defines additional audit data that your site requires.</para>
</entry><entry><para><olink targetptr="audittask-18" remap="internal">How to Configure Audit Policy</olink></para>
</entry>
</row><row><entry><para>5. Configure auditing in non-global zones</para>
</entry><entry><para>Enable non-global zones to collect auditing records</para>
</entry><entry><para><olink targetptr="audittask-26" remap="internal">Configuring the Auditing Service in
Zones (Tasks)</olink></para>
</entry>
</row><row><entry morerows="1" rowsep="1"><para>6. Enable auditing</para>
</entry><entry><para>Turns on the auditing service.</para>
</entry><entry><para><olink targetptr="audittask-62" remap="internal">How to Enable the Auditing Service</olink></para>
</entry>
</row><row><entry><para>When <literal>perzone</literal> auditing is turned on, enables auditing
in a non-global zone.</para>
</entry><entry><para><olink targetptr="audittask-85" remap="internal">Example&nbsp;30&ndash;18</olink></para>
</entry>
</row><row><entry morerows="1" rowsep="1"><para>7. (Optional) Disable auditing</para>
</entry><entry><para>Turns off the auditing service.</para>
</entry><entry><para><olink targetptr="audittask-31" remap="internal">How to Disable the Auditing Service</olink></para>
</entry>
</row><row><entry><para>When <literal>perzone</literal> auditing is turned on, disables auditing
in a non-global zone.</para>
</entry><entry><para><olink targetptr="audittask-81" remap="internal">Example&nbsp;30&ndash;23</olink></para>
</entry>
</row><row><entry><para>8. (Optional) Reread auditing configuration changes</para>
</entry><entry><para>Reads audit configuration changes into the kernel while the <command>auditd</command> daemon is running.</para>
</entry><entry><para><olink targetptr="audittask-30" remap="internal">How to Update the Auditing Service</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="audittask-28"><title>Configuring and Enabling the Auditing Service
(Tasks)</title><para>After the configuration files have been set up for your site,
you need to set up disk space for your audit files. You also need to set up
other attributes of the auditing service, and then enable the service. This
section also contains procedures to refresh the auditing service when you
change configuration settings.</para><para>When a non-global zone is installed, you can choose to audit the zone
exactly as the global zone is being audited. Alternatively, to audit the non-global
zone individually, you can modify the audit configuration files in the non-global
zone. To customize audit configuration files, see <olink targetptr="audittask-15" remap="internal">Configuring Audit Files (Task Map)</olink>.</para><task id="audittask-8"><title>How to Create Partitions for Audit
Files</title><indexterm><primary>creating</primary><secondary>partitions for binary audit files</secondary>
</indexterm><indexterm><primary>audit directory</primary><secondary>partitioning for</secondary>
</indexterm><indexterm><primary>audit files</primary><secondary>partitioning disk for</secondary>
</indexterm><indexterm><primary>disk partitioning</primary><secondary>for binary audit files</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>audit directories</secondary>
</indexterm><indexterm><primary>storing</primary><secondary>audit files</secondary>
</indexterm><tasksummary><para>The following procedure shows how to create partitions for audit files,
as well as the corresponding file systems and directories. Skip steps as necessary,
depending on if you already have an empty partition, or if you have already
mounted an empty file system.</para>
</tasksummary><procedure>&rolePAstep;<step><para>Determine the amount of disk space that is required.</para><para>Assign
at least 200 Mbytes of disk space per host. However, how much auditing you
require dictates the disk space requirements. So, your disk space requirements
might be far greater than this figure. Remember to include a local partition
for a directory of last resort.</para>
</step><step><para>Create dedicated audit partitions, as needed.</para><para>This
step is most easily done during server installation. You can also create the
partitions on disks that have not yet been mounted on the server. For complete
instructions on how to create the partitions, see <olink targetdoc="group-sa" targetptr="disksprep-31030" remap="external">Chapter 11, <citetitle remap="chapter">Administering Disks (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Devices and File Systems</citetitle></olink>.</para><screen># newfs /dev/rdsk/c<replaceable>w</replaceable>t<replaceable>x</replaceable>d<replaceable>y</replaceable>s<replaceable>z</replaceable></screen><para>where <literal>/dev/rdsk/c</literal><replaceable>w</replaceable><literal>t</literal><replaceable>x</replaceable><literal>d</literal><replaceable>y</replaceable><literal>s</literal><replaceable>z</replaceable> is the raw device name for the partition.</para><para>If the local host is to be audited, also create an audit directory of
last resort for the local host.</para>
</step><step><para>Create mount points for each new partition.</para><screen># mkdir /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable></screen><para>where <replaceable>server-name</replaceable>.<replaceable>n</replaceable> is
the name of the server plus a number that identifies each partition. The number
is optional, but the number is useful when there are many audit directories.</para>
</step><step><para>Add entries to automatically mount the new partitions.</para><para>Add
a line to the <filename>/etc/vfstab</filename> file that resembles the following:</para><screen>/dev/dsk/c<replaceable>w</replaceable>t<replaceable>x</replaceable>d<replaceable>y</replaceable>s<replaceable>z</replaceable> /dev/rdsk/c<replaceable>w</replaceable>t<replaceable>x</replaceable>d<replaceable>y</replaceable>s<replaceable>z</replaceable> /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable>   ufs  2  yes</screen>
</step><step performance="optional" id="audittask-stepopt-2"><para>Remove the minimum
free space threshold on each partition.</para><para>If you use the default
configuration, a warning is generated when the directory is 80 percent full.
The warning removes the reason to reserve free space on the partition.</para><screen># tunefs -m 0 /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable></screen>
</step><step><para>Mount the new audit partitions.</para><screen># mount /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable></screen>
</step><step><para>Create audit directories on the new partitions.</para><screen># mkdir /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable>/files</screen>
</step><step><para>Correct the permissions on the mount points and new directories.</para><screen># chmod -R 750 /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable>/files</screen>
</step><step id="audittask-stepopt-7"><para>On a file server, define the file systems
to be made available to other hosts.</para><para>Often, disk farms are installed
to store the audit records. If an audit directory is to be used by several
systems, then the directory must be shared through the NFS service. Add an
entry that resembles the following for each directory to the <filename>/etc/dfs/dfstab</filename> file:</para><screen>share -F nfs /var/audit/<replaceable>server-name</replaceable>.<replaceable>n</replaceable>/files</screen>
</step><step id="audittask-stepopt-8"><para>On a file server, restart the NFS service.</para><para><indexterm><primary><command>svcadm</command> command</primary><secondary>restarting NFS server</secondary></indexterm>If this command is the first <command>share</command> command
or set of <command>share</command> commands that you have initiated, the NFS
daemons might not be running.</para><stepalternatives><step><para>If the NFS service is offline, enable the service.</para><screen>% <userinput>svcs \*nfs\*</userinput>
disabled       Nov_02   svc:/network/nfs/rquota:default
offline        Nov_02   svc:/network/nfs/server:default
# <userinput>svcadm enable network/nfs/server</userinput></screen>
</step><step><para>If the NFS service is running, restart the service.</para><screen>% <userinput>svcs \*nfs\*</userinput>
online         Nov_02   svc:/network/nfs/client:default
online         Nov_02   svc:/network/nfs/server:default
# <userinput>svcadm restart network/nfs/server</userinput></screen>
</step>
</stepalternatives><para>For more information about the NFS service, refer to <olink targetdoc="group-sa" targetptr="rfsadmin-68" remap="external"><citetitle remap="section">Setting Up NFS Services</citetitle> in <citetitle remap="book">System Administration Guide: Network Services</citetitle></olink>. For information on managing persistent
services, see <olink targetdoc="group-sa" targetptr="hbrunlevels-25516" remap="external">Chapter 15, <citetitle remap="chapter">Managing Services (Overview),</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink> and
the <olink targetdoc="group-refman" targetptr="smf-5" remap="external"><citerefentry><refentrytitle>smf</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> man
page.</para>
</step>
</procedure><example id="audittask-76"><title>Creating an Audit Directory of Last Resort</title><indexterm><primary>audit directory</primary><secondary>creating</secondary>
</indexterm><para>All systems that run the auditing service should have a local file system
that can be used if no other file system is available. In this example, a
file system is being added to a system that is named <literal>egret</literal>.
Because this file system is only used locally, none of the steps for a file
server are necessary.</para><screen># <userinput>newfs /dev/rdsk/c0t2d0</userinput>
# <userinput>mkdir /var/audit/egret</userinput>
# <userinput>grep egret /etc/vfstab</userinput>
/dev/dsk/c0t2d0s1  /dev/rdsk/c0t2d0s1  /var/audit/egret ufs  2  yes  -
# <userinput>tunefs -m 0 /var/audit/egret</userinput>
# <userinput>mount /var/audit/egret</userinput>
# <userinput>mkdir /var/audit/egret/files</userinput>
# <userinput>chmod -R 750 /var/audit/egret/files</userinput></screen>
</example><example id="audittask-77"><title>Creating New Audit Partitions</title><para>In this example, a new file system is created on two new disks that
are to be used by other systems in the network.</para><screen># <userinput>newfs /dev/rdsk/c0t2d0</userinput>
# <userinput>newfs /dev/rdsk/c0t2d1</userinput>
# <userinput>mkdir /var/audit/egret.1</userinput>
# <userinput>mkdir /var/audit/egret.2</userinput>
# <userinput>grep egret /etc/vfstab</userinput>
/dev/dsk/c0t2d0s1  /dev/rdsk/c0t2d0s1  /var/audit/egret.1 ufs  2  yes  -
/dev/dsk/c0t2d1s1  /dev/rdsk/c0t2d1s1  /var/audit/egret.2 ufs  2  yes  -
# <userinput>tunefs -m 0 /var/audit/egret.1</userinput>
# <userinput>tunefs -m 0 /var/audit/egret.2</userinput>
# <userinput>mount /var/audit/egret.1</userinput>
# <userinput>mount /var/audit/egret.2</userinput>
# <userinput>mkdir /var/audit/egret.1/files</userinput>
# <userinput>mkdir /var/audit/egret.2/files</userinput>
# <userinput>chmod -R 750 /var/audit/egret.1/files /var/audit/egret.2/files</userinput>
# <userinput>grep egret /etc/dfs/dfstab</userinput>
 share -F nfs /var/audit/egret.1/files
 share -F nfs /var/audit/egret.2/files
# <userinput>svcadm enable network/nfs/server</userinput></screen>
</example>
</task><task id="audittask-16"><title>How to Configure the <literal>audit_warn</literal> Email Alias</title><indexterm><primary>configuring</primary><secondary><literal>audit_warn</literal> script</secondary>
</indexterm><indexterm><primary><filename>audit_warn</filename> script</primary><secondary>configuring</secondary>
</indexterm><tasksummary><para>The <filename>audit_warn</filename> script generates mail to an email
alias that is called <literal>audit_warn</literal>. To send this mail to a
valid email address, you can follow one of the options that are described
in <olink targetptr="audittask-step-6" remap="internal">Step&nbsp;2</olink>:</para>
</tasksummary><procedure>&rolePAstep;<step id="audittask-step-6"><para>Configure the <literal>audit_warn</literal> email
alias.</para><itemizedlist><para>Choose one of the following options:</para><listitem><para><emphasis role="strong">OPTION 1 &ndash;</emphasis> Replace
the <literal>audit_warn</literal> email alias with another email account in
the <filename>audit_warn</filename> script.</para><para>Change the email alias
in the following line of the script:</para><screen>ADDRESS=<userinput>audit_warn</userinput>            # standard alias for audit alerts</screen>
</listitem><listitem><para><emphasis role="strong">OPTION 2 &ndash;</emphasis> Redirect
the <literal>audit_warn</literal> email to another mail account.</para><para>In
this case, you would add the <literal>audit_warn</literal> email alias to
the appropriate mail aliases file. You could add the alias to the local <filename>/etc/mail/aliases</filename> file or to the <literal>mail_aliases</literal> database
in the name space. The new entry would resemble the following if the <literal>root</literal> mail account was made a member of the <literal>audit_warn</literal> email
alias:</para><screen>audit_warn: root</screen>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="audittask-18"><title>How to Configure Audit Policy</title><indexterm><primary>configuring</primary><secondary><command>audit_startup</command> script</secondary>
</indexterm><indexterm><primary><command>audit_startup</command> script</primary><secondary>configuring</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>audit policy</secondary>
</indexterm><indexterm><primary>audit policy</primary><secondary>setting</secondary>
</indexterm><indexterm><primary>disabling</primary><secondary>audit policy</secondary>
</indexterm><indexterm><primary>setting</primary><secondary>audit policy</secondary>
</indexterm><tasksummary><para>Audit policy determines the characteristics of the audit records for
the local host. When auditing is enabled, the contents of the <filename>/etc/security/audit_startup</filename> file determine the audit policy.</para><para>You can inspect, enable, or disable the current audit policy options
with the the <command>auditconfig</command> command. You can also modify the
policy options to the <command>auditconfig</command> command in the <filename>audit_startup</filename> script to make permanent audit policy changes.</para>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Control profile, or become
superuser.</para><para>To create a role that includes the Audit Control profile
and to assign the role to a user, see <olink targetptr="rbactask-15" remap="internal">Configuring
RBAC (Task Map)</olink>.</para>
</step><step id="audittask-stepopt-10"><para><indexterm><primary>displaying</primary><secondary>audit policies</secondary></indexterm>Review the audit policy.</para><para>Before auditing is enabled, the contents of the <filename>audit_startup</filename> file
determine the audit policy:</para><screen>#! /bin/sh
...
/usr/bin/echo "Starting BSM services."
/usr/sbin/auditconfig -setpolicy +cnt <lineannotation>Counts rather than drops records</lineannotation>
/usr/sbin/auditconfig -conf  <lineannotation>Configures event-class mappings</lineannotation>
/usr/sbin/auditconfig -aconf <lineannotation>Configures nonattributable events</lineannotation></screen>
</step><step id="audittask-step-policy-1"><para>View the available policy options.</para><screen>$ <userinput>auditconfig -lspolicy</userinput></screen><note><para>The <literal>perzone</literal> and <literal>ahlt</literal> policy
options can be set only in the global zone.</para>
</note>
</step><step><para>Enable or disable selected audit policy options.</para><screen># <userinput>auditconfig -setpolicy <replaceable>prefix</replaceable><replaceable>policy</replaceable></userinput></screen><variablelist><varlistentry><term><replaceable>prefix</replaceable></term><listitem><para>A <replaceable>prefix</replaceable> value of <literal>+</literal> enables
the policy option. A <replaceable>prefix</replaceable> value of <literal>-</literal> disables
the policy option.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>policy</replaceable></term><listitem><para>Selects the policy to be enabled or to be disabled.</para>
</listitem>
</varlistentry>
</variablelist><para>The policy is in effect until the next boot, or until the policy is
modified by the <command>auditconfig -setpolicy</command> command.</para><para>For a description of each policy option, see <olink targetptr="auditplan-5" remap="internal">Determining Audit Policy</olink>.</para>
</step>
</procedure><example id="audittask-90"><title>Setting the <literal>cnt</literal> and <literal>ahlt</literal> Audit
Policy Options</title><indexterm><primary>auditing</primary><secondary>configuring in global zone</secondary>
</indexterm><indexterm><primary>zones</primary><secondary>configuring auditing in global zone</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary><literal>ahlt</literal> audit policy</secondary>
</indexterm><indexterm><primary><literal>ahlt</literal> audit policy</primary><secondary>setting</secondary>
</indexterm><indexterm><primary>audit policy</primary><secondary>setting <literal>ahlt</literal></secondary>
</indexterm><para>In this example, the <literal>cnt</literal> policy is disabled and the <literal>ahlt</literal> policy is enabled. With these settings, system use is halted
when the audit partitions are full. These settings are appropriate when security
is more important than availability. For restrictions on setting this policy,
see <olink targetptr="audittask-step-policy-1" remap="internal">Step&nbsp;3</olink>.</para><para>The following <filename>audit_startup</filename> entries disable the <literal>cnt</literal> policy option and enable the <literal>ahlt</literal> policy
option across reboots:</para><screen># <userinput>cat /etc/security/audit_startup</userinput>
#!/bin/sh
/usr/bin/echo "Starting BSM services."
/usr/sbin/deallocate -Is
/usr/sbin/auditconfig -conf
/usr/sbin/auditconfig -aconf
/usr/sbin/auditconfig -setpolicy -cnt	
/usr/sbin/auditconfig -setpolicy +ahlt</screen>
</example><example id="audittask-93"><title>Setting the <literal>seq</literal> Audit Policy Temporarily</title><indexterm><primary>configuring</primary><secondary>audit policy temporarily</secondary>
</indexterm><indexterm><primary><command>auditconfig</command> command</primary><secondary>setting audit policy</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>audit policy</secondary>
</indexterm><para>In this example, the <command>auditd</command> daemon is running and
the <literal>ahlt</literal> audit policy has been set. The <literal>seq</literal> audit
policy is added to the current policy. The <literal>seq</literal> policy adds
a <literal>sequence</literal> token to every audit record. This is useful
for debugging the auditing service when audit records are corrupted, or when
records are being dropped.</para><para>The <literal>+</literal> prefix adds the <literal>seq</literal> option
to the audit policy, rather than replaces the current audit policy with <literal>seq</literal>. The <command>auditconfig</command> command puts the policy
in effect until the next invocation of the command, or until the next boot.</para><screen>$ <userinput>auditconfig -setpolicy +seq</userinput>
$ <userinput>auditconfig -getpolicy</userinput>
audit policies = ahlt,seq	</screen>
</example><example id="audittask-32"><title>Setting the <literal>perzone</literal> Audit Policy</title><indexterm><primary>configuring</primary><secondary><literal>perzone</literal> audit policy</secondary>
</indexterm><indexterm><primary><literal>perzone</literal> audit policy</primary><secondary>setting</secondary>
</indexterm><indexterm><primary>audit policy</primary><secondary>setting <literal>perzone</literal></secondary>
</indexterm><para>In this example, the <literal>perzone</literal> audit policy is set
in the <filename>audit_startup</filename> script in the global zone. When
a zone boots, the non-global  zone collects audit records according to the
audit configuration settings in its zone.</para><screen>$ <userinput>cat /etc/security/audit_startup</userinput>
#!/bin/sh
/usr/bin/echo "Starting BSM services."
/usr/sbin/deallocate -Is
/usr/sbin/auditconfig -conf
/usr/sbin/auditconfig -aconf
/usr/sbin/auditconfig -setpolicy +perzone
/usr/sbin/auditconfig -setpolicy +cnt</screen>
</example><example id="audittask-78"><title>Changing an Audit Policy</title><para>In this example, the audit daemon is running and audit policy has been
set. The <command>auditconfig</command> command changes the <literal>ahlt</literal> and <literal>cnt</literal> policies for the duration of the session. With these settings,
audit records are dropped, but counted, when the audit file system is full.
For restrictions on setting the <literal>ahlt</literal> policy, see <olink targetptr="audittask-step-policy-1" remap="internal">Step&nbsp;3</olink>.</para><screen>$ <userinput>auditconfig -setpolicy +cnt</userinput>
$ <userinput>auditconfig -setpolicy -ahlt</userinput>
$ <userinput>auditconfig -getpolicy</userinput>
audit policies = cnt,seq</screen><para>When the changes are put in the <filename>audit_startup</filename> file,
the policies are permanently in effect:</para><screen>$ <userinput>cat /etc/security/audit_startup</userinput>
#!/bin/sh
/usr/bin/echo "Starting BSM services."
/usr/sbin/deallocate -Is
/usr/sbin/auditconfig -conf
/usr/sbin/auditconfig -aconf
/usr/sbin/auditconfig -setpolicy +cnt</screen><para>The <option>ahlt</option> option does not have to be specified in the
file, because the <literal>ahlt</literal> policy option is disabled by default.
This setting is appropriate when availability is more important than the security
that audit records provide.</para>
</example>
</task><task id="audittask-62"><title>How to Enable the Auditing Service</title><indexterm><primary>enabling</primary><secondary>auditing service</secondary>
</indexterm><indexterm><primary><command>bsmconv</command> script</primary><secondary>enabling auditing service</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>enabling</secondary>
</indexterm><indexterm><primary>scripts</primary><secondary><command>bsmconv</command> to enable auditing</secondary>
</indexterm><indexterm><primary>enabling</primary><secondary>auditing</secondary>
</indexterm><indexterm><primary>starting</primary><secondary>auditing</secondary>
</indexterm><tasksummary><para>This procedure enables the auditing service for all zones. To start
the audit daemon in a non-global zone, see <olink targetptr="audittask-85" remap="internal">Example&nbsp;30&ndash;18</olink>.</para><para>When auditing is configured securely, the system is in single-user mode
until auditing is enabled. You can also enable auditing in multiuser mode.</para>
</tasksummary><taskprerequisites><itemizedlist><para>You should perform this procedure as superuser after completing the
following tasks:</para><listitem><para>Planning &ndash; <olink targetptr="auditplan-11" remap="internal">Planning
Solaris Auditing (Task Map)</olink></para>
</listitem><listitem><para>Customizing audit files &ndash; <olink targetptr="audittask-15" remap="internal">Configuring
Audit Files (Task Map)</olink></para>
</listitem><listitem><para>Setting up audit partitions &ndash; <olink targetptr="audittask-8" remap="internal">How to Create Partitions for Audit Files</olink></para>
</listitem><listitem><para>Setting up audit warning messages &ndash; <olink targetptr="audittask-16" remap="internal">How to Configure the audit_warn Email Alias</olink></para>
</listitem><listitem><para>Setting audit policy &ndash; <olink targetptr="audittask-18" remap="internal">How
to Configure Audit Policy</olink></para>
</listitem>
</itemizedlist>
</taskprerequisites><procedure><step><para>Run the script that enables the auditing service.</para><para>Go
to the <filename>/etc/security</filename> directory, and execute the <command>bsmconv</command> script there.</para><screen># <userinput>cd /etc/security</userinput>
# <userinput>./bsmconv</userinput>
This script is used to enable the Basic Security Module (BSM).
Shall we continue with the conversion now? [y/n] <userinput>y</userinput>
bsmconv: INFO: checking startup file.
bsmconv: INFO: turning on audit module.
bsmconv: INFO: initializing device allocation.

The Basic Security Module is ready.
If there were any errors, please fix them now.
Configure BSM by editing files located in /etc/security.
Reboot this system now to come up with BSM enabled.</screen><para>For the effects of the script, see the <olink targetdoc="group-refman" targetptr="bsmconv-1m" remap="external"><citerefentry><refentrytitle>bsmconv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Reboot the system.</para><screen># <userinput>reboot</userinput></screen><para>The startup file <filename>/etc/security/audit_startup</filename> causes
the <command>auditd</command> daemon to run automatically when the system
enters multiuser mode.</para><para>Another effect of the script is to turn on device allocation. To configure
device allocation, see <olink targetptr="devtask-3" remap="internal">Managing Device Allocation
(Task Map)</olink>.</para>
</step>
</procedure><example id="audittask-85"><title>Enabling Auditing in a Non-Global Zone</title><para>In the following example, the global zone administrator turned on <literal>perzone</literal> policy after auditing was enabled in the global zone and
after the non-global zone had booted. The zone administrator of the non-global
zone has configured the audit files for the zone, and then starts the audit
daemon in the zone.</para><screen>zone1# <userinput>svcadm enable svc:/system/auditd</userinput></screen>
</example>
</task><task id="audittask-31"><title>How to Disable the Auditing Service</title><indexterm><primary>disabling</primary><secondary>auditing service</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>disabling</secondary>
</indexterm><indexterm><primary><command>bsmunconv</command> script</primary><secondary>disabling auditing service</secondary>
</indexterm><tasksummary><para>If the auditing service is no longer required at some point, this procedure
returns the system to the system state before auditing was enabled. If non-global
zones are being audited, their auditing service is also disabled.</para><caution><para><indexterm><primary>disabling</primary><secondary>device allocation</secondary></indexterm><indexterm><primary>device allocation</primary><secondary>disabling</secondary></indexterm>This command also disables device
allocation. Do not run this command if you want to be able to allocate devices.
To disable auditing and retain device allocation, see <olink targetptr="audittask-67" remap="internal">Example&nbsp;30&ndash;19</olink>.</para>
</caution>
</tasksummary><procedure><step><para>Become superuser and bring the system into single-user mode.</para><screen>% <userinput>su</userinput>
Password: <lineannotation>&lt;Type root password&gt;</lineannotation>
# <userinput>init S</userinput></screen><para>For more information, see the <olink targetdoc="group-refman" targetptr="init-1m" remap="external"><citerefentry><refentrytitle>init</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step><step><para>Run the script to disable auditing.</para><para>Change to the <filename class="directory">/etc/security</filename> directory, and execute the <command>bsmunconv</command> script.</para><screen># <userinput>cd /etc/security</userinput>
# <userinput>./bsmunconv</userinput></screen><para>Another effect of the script is to disable device allocation.</para><para>For information on the full effect of the <command>bsmunconv</command> script,
see the <olink targetdoc="group-refman" targetptr="bsmconv-1m" remap="external"><citerefentry><refentrytitle>bsmconv</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</step><step><para>Bring the system into multiuser mode.</para><screen># <userinput>init 6</userinput></screen>
</step>
</procedure><example id="audittask-67"><title>Disabling Auditing and Keeping Device Allocation</title><para>In this example, the auditing service stops collecting records, but
device allocation continues to work. All values from the <literal>flags</literal>, <literal>naflags</literal>, and <literal>plugin</literal> entries in the <filename>audit_control</filename> file are removed, as are all user entries in the <filename>audit_user</filename> file. </para><screen># audit_control file
&hellip;
flags:
minfree:10
naflags:
plugin:

# audit_user file</screen><para>The <command>auditd</command> daemon runs, but no audit records are
kept.</para>
</example><example id="audittask-87"><title>Disabling Auditing on a Per-Zone Basis</title><para>In this example, the auditing service stops running in the zone where
the auditing service is disabled. Device allocation continues to work. When
this command is run in the global zone, and the <literal>perzone</literal> audit
policy is not set, auditing is disabled for all zones, not just the global
zone.</para><screen># svcadm disable svc:/system/auditd</screen>
</example>
</task><task id="audittask-30"><title>How to Update the Auditing Service</title><indexterm><primary>updating</primary><secondary>auditing service</secondary>
</indexterm><indexterm><primary><command>audit</command> command</primary><secondary>updating auditing service</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>updating information</secondary>
</indexterm><tasksummary><para><indexterm><primary>restarting</primary><secondary>audit daemon</secondary></indexterm><indexterm><primary><command>auditd</command> daemon</primary><secondary>rereading information for the kernel</secondary></indexterm>This
procedure restarts the <command>auditd</command> daemon when you have made
changes to audit configuration files after the daemon has been running.</para>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Control
rights profile, or become superuser.</para><para>To create a role that includes
the Audit Control rights profile and assign the role to a user, see <olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink>.</para>
</step><step><para>Choose the appropriate command.</para><stepalternatives><step><para><indexterm><primary><filename>audit_control</filename> file</primary><secondary>changing kernel mask for nonattributable events</secondary></indexterm>If you modify the <literal>naflags</literal> line in the <filename>audit_control</filename> file, change the kernel mask for nonattributable events.</para><screen>$ <userinput>/usr/sbin/auditconfig -aconf</userinput></screen><para>You can also reboot.</para>
</step><step><para><indexterm><primary><command>audit</command> command</primary><secondary>preselection mask for existing processes (<option>s</option> option)</secondary></indexterm><indexterm><primary><command>auditd</command> daemon</primary><secondary>rereading the <filename>audit_control</filename> file</secondary></indexterm><indexterm><primary><filename>audit_control</filename> file</primary><secondary>audit daemon rereading after editing</secondary></indexterm><indexterm><primary><command>auditd</command> daemon</primary><secondary>rereading the <filename>audit_control</filename> file</secondary></indexterm>If you modify other lines
in the <filename>audit_control</filename> file, reread the <filename>audit_control</filename> file.</para><para>The audit daemon stores information from the <filename>audit_control</filename> file internally. To use the new information, either
reboot the system or instruct the audit daemon to read the modified file.</para><screen>$ <userinput>/usr/sbin/audit -s</userinput></screen><note><para>Audit records are generated based on the audit preselection mask
that is associated with each process. Executing <command>audit -s</command> does <emphasis>not</emphasis> change the masks in existing processes. To change the preselection
mask for an existing process, you must restart the process. You can also reboot.</para>
</note><para>The <command>audit -s</command> command causes the audit daemon to re-read
the <literal>directory</literal> and <literal>minfree</literal> values from
the <filename>audit_control</filename> file. The command changes the generation
of the preselection mask for processes spawned by subsequent logins.</para>
</step><step><para>If you modify the <filename>audit_event</filename> file or the <filename>audit_class</filename> file while the audit daemon is running, refresh the
auditing service.</para><para>Read the modified event-class mappings into
the system, and ensure that each user who uses the machine is correctly audited.</para><screen>$ <userinput>auditconfig -conf</userinput>
$ <userinput>auditconfig -setumask</userinput> <replaceable>auid classes</replaceable></screen><variablelist><varlistentry><term><replaceable>auid</replaceable></term><listitem><para>Is the user ID.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>classes</replaceable></term><listitem><para>Are the preselected audit classes.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>To change audit policy on a running system, see <olink targetptr="audittask-93" remap="internal">Example&nbsp;30&ndash;15</olink>.</para>
</step>
</stepalternatives>
</step>
</procedure><example id="audittask-52"><title>Restarting the Audit Daemon</title><para><indexterm><primary>starting</primary><secondary>audit daemon</secondary></indexterm>In this example, the system is brought down to single-user mode,
then back up to multiuser mode. When the system is brought into multiuser
mode, modified audit configuration files are read into the system.</para><screen># <userinput>init S</userinput>
# <userinput>init 6</userinput></screen>
</example>
</task>
</sect1><sect1 id="audittask-26"><title>Configuring the Auditing Service in Zones
(Tasks)</title><para>The auditing service audits the entire system, including audit events
in zones. A system that has installed non-global zones can audit all zones
identically, or can control auditing per zone. For background, see <olink targetptr="auditov-8" remap="internal">Auditing on a System With Zones</olink>. To plan, see <olink targetptr="auditplan-10" remap="internal">How to Plan Auditing in Zones</olink>.</para><task id="audittask-34"><title>How to Configure All Zones Identically for
Auditing</title><indexterm><primary>configuring</primary><secondary>identical auditing for non-global zones</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>configuring identically for all zones</secondary>
</indexterm><tasksummary><para>This procedure enables audits every zone identically. This method requires
the least computer overhead and administrative resources.</para>
</tasksummary><procedure><step><para>Configure the global zone for auditing.</para><substeps><step><para>Complete the tasks in <olink targetptr="audittask-15" remap="internal">Configuring
Audit Files (Task Map)</olink>.</para>
</step><step><para>Complete the tasks in <olink targetptr="audittask-4" remap="internal">Configuring
and Enabling the Auditing Service (Task Map)</olink>, with the following exceptions.</para><itemizedlist><listitem><para>Do not enable <literal>perzone</literal> audit policy.</para>
</listitem><listitem><para>Do not enable the auditing service. You enable the auditing
service after you have configured the non-global zones for auditing.</para>
</listitem>
</itemizedlist>
</step>
</substeps>
</step><step><para>Copy the audit configuration files from the global zone to every
non-global zone.</para><para>Copy any of the following files that you have
edited: <filename>audit_class</filename>, <filename>audit_control</filename>, <filename>audit_event</filename>, <filename>audit_user</filename>. Do not copy <filename>audit_startup</filename> or <filename>audit_warn</filename>. You do not have to copy files
that you have not edited.</para><para>You have two options. As superuser, you can copy the files, or loopback
mount the files. The non-global zone must be running.</para><stepalternatives><step><para>Copy the files.</para><substeps><step><para>From the global zone, list the <filename class="directory">/etc/security</filename> directory in the non-global zone.</para><screen># ls /zone/<replaceable>zonename</replaceable>/etc/security/</screen>
</step><step><para>Copy the audit configuration files to the zone's  <filename class="directory">/etc/security</filename> directory.</para><screen># cp /etc/security/<replaceable>audit-file</replaceable> /zone/<replaceable>zonename</replaceable>/etc/security/<replaceable>audit-file</replaceable></screen><para>Later, if you modify an audit configuration file in the global zone,
you re-copy the file to the non-global zones.</para>
</step>
</substeps>
</step><step><para>Loopback mount the configuration files.</para><substeps><step><para>From the global zone, halt the non-global zone. </para><screen># zoneadm -z <replaceable>non-global-zone</replaceable> halt</screen>
</step><step><para>Create a read-only loopback mount for every audit configuration
file that you modified in the global zone.</para><screen># zonecfg -z <replaceable>non-global-zone</replaceable>
 add filesystem
    set special=/etc/security/<replaceable>audit-file</replaceable>
    set directory=/etc/security/<replaceable>audit-file</replaceable>
    set type=lofs
    add options [ro,nodevices,nosetuid]
    end
 exit</screen>
</step>
</substeps>
</step>
</stepalternatives>
</step>
</procedure><example id="audittask-89"><title>Loopback Mounting Audit Configuration Files</title><para>In this example, the system administrator has modified the <filename>audit_class</filename>, <filename>audit_event</filename>, <filename>audit_control</filename>, <filename>audit_user</filename>, <filename>audit_startup</filename>, and <filename>audit_warn</filename> files.</para><para>The <filename>audit_startup</filename> and <filename>audit_warn</filename> files
are read in the global zone only, so do not have to be loopback mounted into
the non-global zones.</para><para>On this system, <literal>machine1</literal>, the administrator has created
two non-global zones, <literal>machine1&ndash;webserver</literal> and <literal>machine1&ndash;appserver</literal>.</para><screen># <userinput>zoneadm -z machine1-webserver halt</userinput>
# <userinput>zoneadm -z machine1-appserver halt</userinput>
# <userinput>zonecfg -z machine1-webserver</userinput> 
 <userinput>add filesystem</userinput>
    <userinput>set special=/etc/security/audit_class</userinput>
    <userinput>set directory=/etc/security/audit_class</userinput>
    <userinput>set type=lofs</userinput>
    <userinput>add options [ro,nodevices,nosetuid]</userinput>
    <userinput>end</userinput>
 <userinput>add filesystem</userinput>
    <userinput>set special=/etc/security/audit_event</userinput>
    <userinput>set directory=/etc/security/audit_event</userinput>
    <userinput>set type=lofs</userinput>
    <userinput>add options [ro,nodevices,nosetuid]</userinput>
    <userinput>end</userinput>
 <userinput>add filesystem</userinput>
    <userinput>set special=/etc/security/audit_control</userinput>
    <userinput>set directory=/etc/security/audit_control</userinput>
    <userinput>set type=lofs</userinput>
    <userinput>add options [ro,nodevices,nosetuid]</userinput>
    <userinput>end</userinput> 
<userinput>add filesystem</userinput>
    <userinput>set special=/etc/security/audit_user</userinput>
    <userinput>set directory=/etc/security/audit_user</userinput>
    <userinput>set type=lofs</userinput>
    <userinput>add options [ro,nodevices,nosetuid]</userinput>
    <userinput>end</userinput>
 <userinput>exit</userinput>
# <userinput>zonecfg -z machine1-appserver</userinput> 
 <userinput>add filesystem</userinput>
    <userinput>set special=/etc/security/audit_class</userinput>
    <userinput>set directory=/etc/security/audit_class</userinput>
    <userinput>set type=lofs</userinput>
    <userinput>add options [ro,nodevices,nosetuid]</userinput>
    <userinput>end</userinput>
...
 <userinput>exit</userinput></screen><para>When the zones are rebooted, the audit configuration files are read-only
in the zones. When the global administrator modifies the files in the global
zone, the changes are immediately effective in the non-global zones.</para>
</example>
</task><task id="audittask-36"><title>How to Configure Per-Zone Auditing</title><indexterm><primary>configuring</primary><secondary>per-zone auditing</secondary>
</indexterm><indexterm><primary>auditing</primary><secondary>configuring per-zone</secondary>
</indexterm><indexterm><primary><literal>perzone</literal> audit policy</primary><secondary>using</secondary>
</indexterm><tasksummary><para>This procedure enables separate zone administrators to control the auditing
service in their zone. For the complete list of policy options, see the <olink targetdoc="group-refman" targetptr="auditconfig-1m" remap="external"><citerefentry><refentrytitle>auditconfig</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</tasksummary><procedure><step><para>In the global zone, configure auditing, but do not enable the
auditing service.</para><substeps><step><para>Complete the tasks in <olink targetptr="audittask-15" remap="internal">Configuring
Audit Files (Task Map)</olink>.</para>
</step><step><para>Complete the tasks in <olink targetptr="audittask-4" remap="internal">Configuring
and Enabling the Auditing Service (Task Map)</olink>, with the following exceptions.</para><itemizedlist><listitem><para>Add the <literal>perzone</literal> audit policy. For an example,
see <olink targetptr="audittask-32" remap="internal">Example&nbsp;30&ndash;16</olink>.</para>
</listitem><listitem><para>Do not enable the auditing service. You enable the auditing
service after the non-global zones are configured for auditing.</para>
</listitem>
</itemizedlist>
</step>
</substeps>
</step><step><para>In each non-global zone, configure the audit files.</para><note><para>If you are planning to disable auditing in the non-global zone,
you can skip this step. To disable auditing, see <olink targetptr="audittask-81" remap="internal">Example&nbsp;30&ndash;23</olink>.</para>
</note><substeps><step><para>Complete the tasks in <olink targetptr="audittask-15" remap="internal">Configuring
Audit Files (Task Map)</olink>.</para>
</step><step><para>Follow the procedures that are described in <olink targetptr="audittask-4" remap="internal">Configuring and Enabling the Auditing Service (Task
Map)</olink>.</para>
</step><step><para>Do not configure system-wide audit settings.</para><para>Specifically,
do not add the <literal>perzone</literal> or <literal>ahlt</literal> to the
non-global zone's <filename>audit_startup</filename> file. And do not run
the <command>bsmconv</command> command from the non-global zone.</para>
</step><step><para>Enable auditing in your zone.</para><para>When the global zone
reboots after auditing is configured, auditing is automatically enabled in
your zone.</para><para>If the global zone administrator activates the <literal>perzone</literal> audit
policy after the system is booted, individual zone administrators must enable
auditing. For details, see <olink targetptr="audittask-85" remap="internal">Example&nbsp;30&ndash;18</olink>.</para>
</step>
</substeps>
</step><step><para>In the global zone, enable the auditing service.</para><para>For
the procedure, see <olink targetptr="audittask-62" remap="internal">How to Enable the Auditing
Service</olink>.</para>
</step>
</procedure><example id="audittask-81"><title>Disabling Auditing in a Non-Global Zone</title><para>This example works if the global zone has set the <literal>perzone</literal> audit
policy. The zone administrator of the <literal>noaudit</literal> zone disables
auditing for that zone. Because the administrator planned to disable auditing,
she did not edit the audit configuration files.</para><screen>noauditzone # <userinput>svcadm disable svc:/system/auditd</userinput></screen>
</example>
</task>
</sect1><sect1 id="audittask-91"><title>Managing Audit Records (Task Map)</title><indexterm><primary>task maps</primary><secondary>managing audit records</secondary>
</indexterm><indexterm><primary>managing</primary><secondary> audit records task map</secondary>
</indexterm><para>The following task map points to procedures for selecting, analyzing,
and managing audit records.</para><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colname="colspec0" colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colname="colspec1" colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Display the formats of audit records</para>
</entry><entry><para>Shows the kind of information that is collected for an audit event,
and the order in which the information is presented.</para>
</entry><entry><para><olink targetptr="audittask-10" remap="internal">How to Display Audit Record Formats</olink></para>
</entry>
</row><row><entry><para>Merge audit records</para>
</entry><entry><para>Combines audit files from several machines into one audit trail.</para>
</entry><entry><para><olink targetptr="audittask-20" remap="internal">How to Merge Audit Files From the Audit
Trail</olink></para>
</entry>
</row><row><entry><para>Select records to examine</para>
</entry><entry><para>Selects particular events for study.</para>
</entry><entry><para><olink targetptr="audittask-24" remap="internal">How to Select Audit Events From the
Audit Trail</olink></para>
</entry>
</row><row><entry><para>Display audit records</para>
</entry><entry><para>Enables you to view binary audit records.</para>
</entry><entry><para><olink targetptr="audittask-22" remap="internal">How to View the Contents of Binary Audit
Files</olink></para>
</entry>
</row><row><entry><para>Clean up incorrectly named audit files</para>
</entry><entry><para>Provides an end timestamp to audit files that were inadvertently left
open by the auditing service.</para>
</entry><entry><para><olink targetptr="audittask-12" remap="internal">How to Clean Up a not_terminated Audit
File</olink></para>
</entry>
</row><row><entry><para>Prevent audit trail overflow</para>
</entry><entry><para>Prevents the audit file systems from becoming full.</para>
</entry><entry><para><olink targetptr="audittask-83" remap="internal">How to Prevent Audit Trail Overflow</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="audittask-21"><title>Managing Audit Records</title><para>By managing the audit trail, you can monitor the actions of users on
your network. Auditing can generate large amounts of data. The following tasks
show you how to work with all this data.</para><task id="audittask-10"><title>How to Display Audit Record Formats</title><indexterm><primary>displaying</primary><secondary>audit record formats</secondary>
</indexterm><indexterm><primary>viewing</primary><secondary>audit record formats</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>displaying formats of</secondary><tertiary>procedure</tertiary>
</indexterm><indexterm><primary><command>bsmrecord</command> command</primary><secondary>displaying audit record formats</secondary>
</indexterm><indexterm><primary>displaying</primary><secondary>format of audit records</secondary>
</indexterm><indexterm><primary><command>bsmrecord</command> command</primary><secondary>displaying audit record formats</secondary>
</indexterm><tasksummary><para>To write scripts that can find the audit data that you want, you need
to know the order of tokens in an audit event. The <command>bsmrecord</command> command
displays the audit event number, audit class, selection mask, and record format
of an audit event.</para>
</tasksummary><procedure remap="single-step"><step><para><indexterm><primary><option>a</option> option</primary><secondary><command>bsmrecord</command> command</secondary></indexterm><indexterm><primary><command>bsmrecord</command> command</primary><secondary>listing all formats</secondary></indexterm>Put the format of all audit event records in an HTML file.</para><para>The <option>a</option> option lists all audit event record formats.
The <option>h</option> option puts the list in HTML format that can be displayed
in a browser.</para><screen>% <userinput>bsmrecord -a -h &gt; audit.events.html</userinput></screen><para>When you display the <filename>*html</filename> file in a browser, use
the browser's Find tool to find specific records.</para><para><indexterm><primary><command>bsmrecord</command> command</primary><secondary>example</secondary></indexterm><indexterm><primary><option>h</option> option</primary><secondary><command>bsmrecord</command> command</secondary></indexterm><indexterm><primary>format of audit records</primary><secondary><command>bsmrecord</command> command</secondary></indexterm><indexterm><primary>audit records</primary><secondary>formatting example</secondary></indexterm>For
more information, see the <olink targetdoc="group-refman" targetptr="bsmrecord-1m" remap="external"><citerefentry><refentrytitle>bsmrecord</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</step>
</procedure><example id="audittask-79"><title>Displaying the Audit Record Formats of a Program</title><indexterm><primary>audit records</primary><secondary>displaying formats of a program</secondary>
</indexterm><indexterm><primary><option>p</option> option</primary><secondary><command>bsmrecord</command> command</secondary>
</indexterm><indexterm><primary><command>bsmrecord</command> command</primary><secondary>listing formats of program</secondary>
</indexterm><para>In this example, the format of all audit records that are generated
by the <command>login</command> program are displayed. The login programs
include <command>rlogin</command>, <command>telnet</command>, <command>newgrp</command>,
role login to the Solaris Management Console, and Solaris Secure Shell.</para><screen>% <userinput>bsmrecord -p login</userinput>
terminal login
  program     /usr/sbin/login      See login(1)
              /usr/dt/bin/dtlogin  See dtlogin
  event ID    6152                 AUE_login
  class       lo                   (0x00001000)
      header
      subject
      text                         error message or "successful login"
      return

login: logout
  program     various              See login(1)
  event ID    6153                 AUE_logout
&hellip;

newgrp
  program     newgrp               See newgrp login
  event ID    6212                 AUE_newgrp_login
&hellip;

rlogin
  program     /usr/sbin/login      See login(1) - rlogin
  event ID    6155                 AUE_rlogin
&hellip;

SMC: role login
  program     SMC server           See role login
  event ID    6173                 AUE_role_login
&hellip;

/usr/lib/ssh/sshd
  program     /usr/lib/ssh/sshd    See login - ssh
  event ID    6172                 AUE_ssh
&hellip;

telnet login
  program     /usr/sbin/login      See login(1) - telnet
  event ID    6154                 AUE_telnet
  &hellip;</screen>
</example><example id="audittask-33"><title>Displaying the Audit Record Formats of an Audit Class</title><indexterm><primary>audit records</primary><secondary>displaying formats of an audit class</secondary>
</indexterm><indexterm><primary><option>c</option> option</primary><secondary><command>bsmrecord</command> command</secondary>
</indexterm><indexterm><primary><command>bsmrecord</command> command</primary><secondary>listing formats of class</secondary>
</indexterm><para>In this example, the format of all audit records in the <command>fd</command> class
are displayed.</para><screen>% <userinput>bsmrecord -c fd</userinput>

rmdir
  system call rmdir                See rmdir(2)
  event ID    48                   AUE_RMDIR
  class       fd                   (0x00000020)
      header
      path
      [attribute]
      subject
      [use_of_privilege]
      return

unlink
  system call unlink               See unlink(2)
  event ID    6                    AUE_UNLINK
  &hellip;

unlinkat
  system call unlinkat             See openat(2)
  event ID    286                  AUE_UNLINKAT
  &hellip;</screen>
</example>
</task><task id="audittask-20"><title>How to Merge Audit Files From the
Audit Trail</title><indexterm><primary>merging</primary><secondary>binary audit records</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>merging</secondary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary>merging audit records</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>auditing</secondary><tertiary><command>auditreduce</command> command</tertiary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary>examples</secondary>
</indexterm><indexterm><primary>audit files</primary><secondary>combining</secondary>
</indexterm><indexterm><primary>audit files</primary><secondary>reducing</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>reducing audit files</secondary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary><option>O</option> option</secondary>
</indexterm><indexterm><primary>combining audit files</primary><secondary><command>auditreduce</command> command</secondary>
</indexterm><indexterm><primary sortas="o1"><option>O</option> option</primary><secondary><command>auditreduce</command> command</secondary>
</indexterm><indexterm><primary>reducing</primary><secondary>audit files</secondary>
</indexterm><indexterm><primary>size of audit files</primary><secondary>reducing</secondary>
</indexterm><indexterm><primary>managing</primary><secondary>audit files</secondary>
</indexterm><indexterm><primary>displaying</primary><secondary>selected audit records</secondary>
</indexterm><tasksummary><para><indexterm><primary>deleting</primary><secondary>audit files</secondary></indexterm>By merging all audit files in all the audit directories, you can
analyze the contents of the entire audit trail. The <command>auditreduce</command> command
merges all the records from its input files into a single output file. The
input files can then be deleted. When the output file is placed in a directory
that is named <filename class="directory">/etc/security/audit</filename><replaceable>server-name</replaceable><filename>/files</filename>, the <command>auditreduce</command> command
can find the output file without your specifying the full path.</para><note><para>This procedure applies only to binary audit records.</para>
</note>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Review profile, or become
superuser.</para><para>The System Administrator role includes the Audit Review
profile. You can also create a separate role that includes the Audit Review
profile. To create a role and assign the role to a user, see <olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink>.</para>
</step><step><para>Create a directory for storing merged audit files.</para><screen># mkdir <replaceable>audit-trail-directory</replaceable></screen>
</step><step><para>Limit access to the directory.</para><screen># chmod 700 <replaceable>audit-trail-directory</replaceable>
# ls -la <replaceable>audit-trail-directory</replaceable>
drwx------   3 root     sys          512 May 12 11:47 .
drwxr-xr-x   4 root     sys         1024 May 12 12:47 ..</screen>
</step><step><para>Merge the audit records in the audit trail.</para><para>Change
directories to the <replaceable>audit-trail-directory</replaceable> and merge
the audit records into a file with a named suffix. All directories that are
listed in the <literal>dir</literal> lines of the <filename>audit_control</filename> file
on the local system are merged.</para><screen># cd <replaceable>audit-trail-directory</replaceable>
# auditreduce -<replaceable>Uppercase-option</replaceable> -O <replaceable>suffix</replaceable></screen><para><indexterm><primary><command>auditreduce</command> command</primary><secondary>using uppercase options</secondary></indexterm>The uppercase options
to the <command>auditreduce</command> command manipulate files in the audit
trail. The uppercase options include the following:</para><variablelist><varlistentry><term><option>A</option></term><listitem><para>Selects all of the files in the audit trail.</para>
</listitem>
</varlistentry><varlistentry><term><option>C</option></term><listitem><para>Selects complete files only. This option ignores files with
the suffix <literal>not_terminated</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><option>M</option></term><listitem><para>Selects files with a particular suffix. The suffix can be
a machine name, or it can be a suffix that you have specified for a summary
file.</para>
</listitem>
</varlistentry><varlistentry><term><option>O</option></term><listitem><para>Creates an audit file with 14-character timestamps for both
the start time and the end time, with the suffix <replaceable>suffix</replaceable> in
the current directory.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="audittask-54"><title>Copying Audit Files to a Summary File</title><para><indexterm><primary sortas="a1"><option>A</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>In
the following example, the System Administrator role, <literal>sysadmin</literal>,
copies all files from the audit trail into a merged file.</para><screen>$ <userinput>whoami</userinput>
sysadmin
$ <userinput>mkdir /var/audit/audit_summary.dir</userinput>
$ <userinput>chmod 700 /var/audit/audit_summary.dir</userinput>
$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -A -O All</userinput>
$ <userinput>ls *All</userinput>
20030827183214.20030827215318.All</screen><para><indexterm><primary sortas="c1"><option>C</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>In
the following example, only complete files are copied from the audit trail
into a merged file.</para><screen>$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -C -O Complete</userinput>
$ <userinput>ls *Complete</userinput>
20030827183214.20030827214217.Complete</screen><para><indexterm><primary sortas="m1"><option>M</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>In
the following example, only complete files are copied from the <literal>example1</literal> machine
into a merged file.</para><screen>$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -M example1 -O example1summ</userinput>
$ <userinput>ls *summ</userinput>
20030827183214.20030827214217.example1summ</screen>
</example><example id="audittask-56"><title>Moving Audit Files to a Summary File</title><para><indexterm><primary sortas="d option1"><option>D</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>The <option>D</option> option to the <command>auditreduce</command> command deletes an
audit file when you copy it to another location. In the following example,
the complete audit files from one system are copied to the summary directory
for later examination.</para><screen>$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -C -O daily_example1 -D example1</userinput>
$ <userinput>ls *example1</userinput>
20030827183214.20030827214217.daily_example1</screen><para>The audit files from the <literal>example1</literal> system that were
the input to the <literal>*daily_example1</literal> file are removed when
this command successfully completes.</para>
</example>
</task><task id="audittask-24"><title>How to Select Audit Events From the
Audit Trail</title><indexterm><primary>selecting</primary><secondary>events from audit trail</secondary>
</indexterm><indexterm><primary>audit events</primary><secondary>selecting from audit trail</secondary>
</indexterm><indexterm><primary>audit trail</primary><secondary>selecting events from</secondary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary>selecting audit records</secondary>
</indexterm><indexterm><primary>selecting</primary><secondary>audit records</secondary>
</indexterm><tasksummary><para><indexterm><primary><command>auditreduce</command> command</primary><secondary>using lowercase options</secondary></indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary>filtering options</secondary></indexterm>You can filter audit records for examination. For the complete
list of filtering options, see the <olink targetdoc="group-refman" targetptr="auditreduce-1m" remap="external"><citerefentry><refentrytitle>auditreduce</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man page.</para>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Review profile, or become
superuser.</para><para>The System Administrator role includes the Audit Review
profile. You can also create a separate role that includes the Audit Review
profile. To create a role and assign the role to a user, see <olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink>.</para>
</step><step><para>Select the kinds of records that you want from the audit trail,
or from a specified audit file.</para><screen>auditreduce -<replaceable>lowercase-option</replaceable> <replaceable>argument</replaceable> [<replaceable>optional-file</replaceable>]</screen><variablelist><varlistentry><term><replaceable>argument</replaceable></term><listitem><para>Specific argument that a lowercase option requires. For example,
the <option>c</option> option requires an <replaceable>argument</replaceable> of
an audit class, such as <literal>ua</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option></term><listitem><para>Selects all of the events on a particular date. The date format
for <replaceable>argument</replaceable> is <replaceable>yyymmdd</replaceable>.
Other date options, <option>b</option> and <option>a</option>, select events
before and after a particular date.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option></term><listitem><para>Selects all of the events attributable to a particular user.
The <replaceable>argument</replaceable> is a user name. Another user option, <option>e</option>, selects all of the events attributable to an effective user ID.</para>
</listitem>
</varlistentry><varlistentry><term><option>c</option></term><listitem><para>Selects all of the events in a preselected audit class. The <replaceable>argument</replaceable> is an audit class name.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Selects all of the instances of a particular audit event.
The <replaceable>argument</replaceable> is an audit event.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>optional-file</replaceable></term><listitem><para>Is the name of an audit file.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="audittask-72"><title>Combining and Reducing Audit Files</title><para><indexterm><primary><option>b</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>The <command>auditreduce</command> command
can eliminate the less interesting records as it combines the input files.
For example, you might use the <command>auditreduce</command> command to retain
only the login and logout records in audit files that are over a month old.
If you need to retrieve the complete audit trail, you could recover the trail
from backup media.</para><screen># <userinput>cd /var/audit/audit_summary.dir</userinput>
# <userinput>auditreduce -O lo.summary -b 20030827 -c lo; compress *lo.summary</userinput></screen>
</example><example id="audittask-55"><title>Copying <literal>na</literal> Audit Records to a Summary File</title><para><indexterm><primary><option>c</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>In this example, all
the records of nonattributable audit events in the audit trail are collected
into one file.</para><screen>$ <userinput>whoami</userinput>
sysadmin
$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -c na -O nasumm</userinput>
$ <userinput>ls *nasumm</userinput>
20030827183214.20030827215318.nasumm</screen><para>The merged <literal>nasumm</literal> audit file is time stamped with
the beginning and ending date of the <literal>na</literal> records.</para>
</example><example id="audittask-57"><title>Finding Audit Events in a Specified Audit File</title><para>You can select audit files manually to search just the named set of
files. For example, you can further process the <literal>*nasumm</literal> file
in the previous example to find system boot events. To do so, you would specify
the file name as the final argument to the <command>auditreduce</command> command.</para><screen>$ <userinput>auditreduce -m 113 -O systemboot 20030827183214.20030827215318.nasumm</userinput>
20030827183214.20030827183214.systemboot</screen><para>The <filename>20030827183214.20030827183214.systemboot</filename> file
contains only system boot audit events.</para>
</example><example id="audittask-41"><title>Copying One User's Audit Records to a Summary File</title><para><indexterm><primary><option>e</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>In this example, the
records in the audit trail that contain the name of a particular user are
merged. The <option>e</option> option finds the effective user. The <option>u</option> option
finds the audit user.</para><screen>$ <userinput>cd /var/audit/audit_summary.dir</userinput>
$ <userinput>auditreduce -e tamiko -O tamiko</userinput></screen><para><indexterm><primary><option>d</option> option</primary><secondary><command>auditreduce</command> command</secondary></indexterm>You can look for specific
events in this file. In the following example, what time the user logged in
and out on Sept 7, 2003, your time, is checked. Only those files with the
user's name as the file suffix are checked. The short form of the date is <replaceable>yyyymmdd</replaceable>.</para><screen># <userinput>auditreduce -M tamiko -O tamikolo -d 20030907 -u tamiko -c lo</userinput></screen>
</example><example id="audittask-88"><title>Copying Selected Records to a Single File</title><indexterm><primary>audit files</primary><secondary>copying messages to single file</secondary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary><option>c</option> option</secondary>
</indexterm><indexterm><primary>copying audit messages to single file</primary>
</indexterm><indexterm><primary>audit messages</primary><secondary>copying to single file</secondary>
</indexterm><indexterm><primary><option>c</option> option</primary><secondary><command>auditreduce</command> command</secondary>
</indexterm><para>In this example, login and logout messages for a particular day are
selected from the audit trail. The messages are merged into a target file.
The target file is written in a directory other than the normal audit root
directory.</para><screen># <userinput>auditreduce -c lo -d 20030827 -O /var/audit/audit_summary.dir/logins</userinput>
# <userinput>ls /var/audit/audit_summary.dir/*logins</userinput>
/var/audit/audit_summary.dir/20030827183936.20030827232326.logins</screen>
</example>
</task><task id="audittask-22"><title>How to View the Contents of Binary
Audit Files</title><indexterm><primary>viewing</primary><secondary>binary audit files</secondary>
</indexterm><indexterm><primary>audit events</primary><secondary>viewing from binary files</secondary>
</indexterm><indexterm><primary>audit trail</primary><secondary>viewing events from</secondary>
</indexterm><indexterm><primary><command>praudit</command> command</primary><secondary>viewing audit records</secondary>
</indexterm><indexterm><primary>displaying</primary><secondary>audit records</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>displaying</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>auditing</secondary><tertiary>audit files</tertiary>
</indexterm><tasksummary><para>The <command>praudit</command> command enables you to view the contents
of binary audit files. You can pipe the output from the <command>auditreduce</command> command,
or you can read a particular audit file. The <option>x</option> option is
useful for further processing.</para>
</tasksummary><procedure><step><para>Assume a role that includes the Audit Review profile, or become
superuser.</para><para>The System Administrator role includes the Audit Review
profile. You can also create a separate role that includes the Audit Review
profile. To create a role and assign the role to a user, see <olink targetptr="rbactask-15" remap="internal">Configuring RBAC (Task Map)</olink>.</para>
</step><step><para>Use one of the following <command>praudit</command> commands to
produce the output that is best for your purposes.</para><para>The following
examples show <command>praudit</command> output from the same audit event.
Audit policy has been set to include the <literal>sequence</literal> and <literal>trailer</literal> tokens.</para><itemizedlist><listitem><para>The <command>praudit -s</command> command displays audit records
in a short format, one token per line. Use the <option>l</option> option to
place each record on one line.</para><screen>$ <userinput>auditreduce -c lo | praudit -s</userinput>
header,101,2,AUE_rlogin,,example1,2003-10-13 11:23:31.050 -07:00
subject,jdoe,jdoe,staff,jdoe,staff,749,749,195 1234 server1
text,successful login 
return,success,0 
sequence,1298</screen>
</listitem><listitem><para>The <command>praudit -r</command> command displays audit records
in their raw format, one token per line. Use the <option>l</option> option
to place each record on one line.</para><screen>$ <userinput>auditreduce -c lo | praudit -r</userinput>
21,101,2,6155,0x0000,192.168.60.83,1062021202,64408258
36,2026700,2026700,10,2026700,10,749,749,195 1234 192.168.60.17
40,successful login
39,0,0
47,1298</screen>
</listitem><listitem><para><indexterm><primary>new features</primary><secondary>commands</secondary><tertiary><command>praudit -x</command></tertiary></indexterm><indexterm><primary>viewing</primary><secondary>XML audit records</secondary></indexterm>The <command>praudit -x</command> command displays audit records in XML format, one token
per line. Use the <option>l</option> option to place the XML output for one
record on one line.</para><screen>$ <userinput>auditreduce -c lo | praudit -x</userinput>
&lt;record version="2" event="login - rlogin" host="example1" 
time="Wed Aug 27 14:53:22 PDT 2003" msec="64"&gt;
&lt;subject audit-uid="jdoe" uid="jdoe" gid="staff" ruid="jdoe" 
rgid="staff" pid="749" sid="749" tid="195 1234 server1"/&gt;
&lt;text&gt;successful login&lt;/text&gt;
&lt;return errval="success" retval="0"/&gt;
&lt;sequence seq-num="1298"/&gt;

&lt;/record&gt;</screen>
</listitem>
</itemizedlist>
</step>
</procedure><example id="audittask-40"><title>Printing the Entire Audit Trail</title><indexterm><primary>audit files</primary><secondary>printing</secondary>
</indexterm><indexterm><primary>printing</primary><secondary>audit log</secondary>
</indexterm><indexterm><primary><command>praudit</command> command</primary><secondary>piping <command>auditreduce</command> output to</secondary>
</indexterm><para>With a pipe to the <command>lp</command> command, the output for the
entire audit trail goes to the printer. The printer should have limited access.</para><screen># <userinput>auditreduce | praudit | lp -d example.protected.printer</userinput></screen>
</example><example id="audittask-42"><title>Viewing a Specific Audit File</title><indexterm><primary>log files</primary><secondary>audit records</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>converting to readable format</secondary>
</indexterm><indexterm><primary>converting</primary><secondary> audit records to readable format</secondary>
</indexterm><indexterm><primary>readable audit record format</primary><secondary>converting audit records to</secondary>
</indexterm><indexterm><primary><command>praudit</command> command</primary><secondary>converting audit records to readable format</secondary>
</indexterm><para>In this example, a summary login file is examined in a terminal window.</para><screen># <userinput>cd /var/audit/audit_summary.dir/logins</userinput>
# <userinput>praudit 20030827183936.20030827232326.logins | more</userinput></screen>
</example><example id="audittask-46"><title>Putting Audit Records in XML Format</title><indexterm><primary>displaying</primary><secondary>audit records in XML format</secondary>
</indexterm><indexterm><primary>audit records</primary><secondary>displaying in XML format</secondary>
</indexterm><indexterm><primary><command>praudit</command> command</primary><secondary>XML format</secondary>
</indexterm><indexterm><primary>XML format</primary><secondary>audit records</secondary>
</indexterm><para>In this example, the audit records are converted to XML format.</para><screen># <userinput>praudit -x 20030827183214.20030827215318.logins &gt; 20030827.logins.xml</userinput></screen><para>The <filename>*xml</filename> file can be displayed in a browser. The
contents of the file can be operated on by a script to extract the relevant
information.</para>
</example>
</task><task id="audittask-12"><title>How to Clean Up a <command>not_terminated</command> Audit File</title><indexterm><primary>cleaning up</primary><secondary>binary audit files</secondary>
</indexterm><indexterm><primary>audit trail</primary><secondary>cleaning up not terminated files</secondary>
</indexterm><indexterm><primary><command>auditreduce</command> command</primary><secondary>cleaning up audit files</secondary>
</indexterm><indexterm><primary>deleting</primary><secondary><command>not_terminated</command> audit files</secondary>
</indexterm><tasksummary><para>Occasionally, an audit daemon exits while its audit file is still open.
Or, a server becomes inaccessible and forces the machine to switch to a new
server. In such instances, an audit file remains with the string <command>not_terminated</command> as the end timestamp, even though the file is no longer used for
audit records. Use the <command>auditreduce -O</command> command to give the
file the correct timestamp.</para>
</tasksummary><procedure><step><para>List the files with the <literal>not_terminated</literal> string
on your audit file system in order of creation.</para><screen># ls -R1t <replaceable>audit-directory</replaceable>*/files/* | grep not_terminated</screen><variablelist><varlistentry><term><option>R</option></term><listitem><para>Lists files in subdirectories.</para>
</listitem>
</varlistentry><varlistentry><term><option>t</option></term><listitem><para>Lists files from most recent to oldest.</para>
</listitem>
</varlistentry><varlistentry><term><option>1</option></term><listitem><para>Lists the files in one column.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step><para>Clean up the old <literal>not_terminated</literal> file.</para><para>Specify the name of the old file to the <command>auditreduce -O</command> command.</para><screen># auditreduce -O <replaceable>system-name old-not-terminated-file</replaceable></screen>
</step><step><para>Remove the old <literal>not_terminated</literal> file.</para><screen># rm <replaceable>system-name old-not-terminated-file</replaceable></screen>
</step>
</procedure><example id="audittask-47"><title>Cleaning Up Closed <literal>not_terminated</literal> Audit Files</title><para>In the following example, <literal>not_terminated</literal> files are
found, renamed, then the originals are removed.</para><screen><userinput>ls -R1t */files/* | grep not_terminated</userinput>
&hellip;/egret.1/20030908162220.not_terminated.egret
&hellip;/egret.1/20030827215359.not_terminated.egret
# <userinput>cd */files/egret.1</userinput>
# <userinput>auditreduce -O egret 20030908162220.not_terminated.egret</userinput>
# <userinput>ls -1t</userinput>
20030908162220.not_terminated.egret <lineannotation>Current audit file</lineannotation>
20030827230920.20030830000909.egret <lineannotation>Input (old) audit file</lineannotation>
20030827215359.not_terminated.egret
# <userinput>rm 20030827215359.not_terminated.egret</userinput>
# <userinput>ls -1t</userinput>
20030908162220.not_terminated.egret <lineannotation>Current audit file</lineannotation>
20030827230920.20030830000909.egret <lineannotation>Cleaned up audit file</lineannotation></screen><para>The start timestamp on the new file reflects the time of the first audit
event in the <literal>not_terminated</literal> file. The end timestamp reflects
the time of the last audit event in the file.</para>
</example>
</task><task id="audittask-83"><title>How to Prevent Audit Trail Overflow</title><indexterm><primary>preventing</primary><secondary>audit trail overflow</secondary>
</indexterm><indexterm><primary>audit trail</primary><secondary>preventing overflow</secondary>
</indexterm><indexterm><primary>audit files</primary><secondary>managing</secondary>
</indexterm><indexterm><primary>managing</primary><secondary>audit files</secondary>
</indexterm><indexterm><primary>archiving</primary><secondary>audit files</secondary>
</indexterm><indexterm><primary>administering</primary><secondary>auditing</secondary><tertiary>audit trail overflow prevention</tertiary>
</indexterm><indexterm><primary>managing</primary><secondary>audit trail overflow</secondary>
</indexterm><indexterm><primary>configuring</primary><secondary>audit trail overflow prevention</secondary>
</indexterm><indexterm><primary>overflow prevention</primary><secondary>audit trail</secondary>
</indexterm><indexterm><primary>storage overflow prevention</primary><secondary>audit trail</secondary>
</indexterm><tasksummary><para>If your security policy requires that all audit data be saved, do the
following:</para>
</tasksummary><procedure><step><para>Set up a schedule to regularly archive audit files.</para><para>Archive
audit files by backing up the files to offline media. You can also move the
files to an archive file system.</para><para><indexterm><primary><command>logadm</command> command</primary><secondary>archiving textual audit files</secondary></indexterm>If you are collecting text audit
logs with the <command>syslog</command> utility, archive the text logs. For
more information, see the <olink targetdoc="group-refman" targetptr="logadm-1m" remap="external"><citerefentry><refentrytitle>logadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink> man
page.</para>
</step><step><para><indexterm><primary>deleting</primary><secondary>archived audit files</secondary></indexterm>Set up a schedule to delete the archived audit
files from the audit file system.</para>
</step><step><para>Save and store auxiliary information.</para><para>Archive information
that is necessary to interpret audit records along with the audit trail.</para>
</step><step><para>Keep records of which audit files have been archived.</para>
</step><step><para>Store the archived media appropriately.</para>
</step><step><para>Reduce the volume of audit data that you store by creating summary
files.</para><para>You can extract summary files from the audit trail by using
options to the <command>auditreduce</command> command. The summary files contain
only records for specified types of audit events. To extract summary files,
see <olink targetptr="audittask-72" remap="internal">Example&nbsp;30&ndash;28</olink> and <olink targetptr="audittask-88" remap="internal">Example&nbsp;30&ndash;32</olink>.</para>
</step>
</procedure>
</task>
</sect1>
</chapter><?Pub *0000117363 0?>